-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84b8817
commit c1ab4e5
Showing
10 changed files
with
148 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
backend/src/main/java/com/egor/rssaggregator/mapper/input/FeedInputMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.egor.rssaggregator.mapper.input; | ||
|
||
import com.egor.rssaggregator.dto.input.AddFeedDto; | ||
import com.egor.rssaggregator.entity.Feed; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface FeedInputMapper { | ||
Feed toEntity(AddFeedDto addFeedDto); | ||
} |
10 changes: 10 additions & 0 deletions
10
backend/src/main/java/com/egor/rssaggregator/mapper/output/FeedOutputMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.egor.rssaggregator.mapper.output; | ||
|
||
import com.egor.rssaggregator.dto.output.GetFeedDto; | ||
import com.egor.rssaggregator.entity.Feed; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface FeedOutputMapper { | ||
GetFeedDto toDto(Feed feed); | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/com/egor/rssaggregator/mapper/output/NewsEntryOutputDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.egor.rssaggregator.mapper.output; | ||
|
||
import com.egor.rssaggregator.dto.output.MainNewsEntryDto; | ||
import com.egor.rssaggregator.dto.output.MoreTextNewsEntryDto; | ||
import com.egor.rssaggregator.entity.News; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring", uses = FeedOutputMapper.class) | ||
public interface NewsEntryOutputDto { | ||
MainNewsEntryDto toMainDto(News news); | ||
MoreTextNewsEntryDto toMoreDto(News news); | ||
} |
29 changes: 29 additions & 0 deletions
29
...enerated-sources/annotations/com/egor/rssaggregator/mapper/input/FeedInputMapperImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.egor.rssaggregator.mapper.input; | ||
|
||
import com.egor.rssaggregator.dto.input.AddFeedDto; | ||
import com.egor.rssaggregator.entity.Feed; | ||
import javax.annotation.processing.Generated; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Generated( | ||
value = "org.mapstruct.ap.MappingProcessor", | ||
date = "2024-02-27T21:12:19+0300", | ||
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.9 (Red Hat, Inc.)" | ||
) | ||
@Component | ||
public class FeedInputMapperImpl implements FeedInputMapper { | ||
|
||
@Override | ||
public Feed toEntity(AddFeedDto addFeedDto) { | ||
if ( addFeedDto == null ) { | ||
return null; | ||
} | ||
|
||
Feed.FeedBuilder feed = Feed.builder(); | ||
|
||
feed.name( addFeedDto.getName() ); | ||
feed.url( addFeedDto.getUrl() ); | ||
|
||
return feed.build(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...erated-sources/annotations/com/egor/rssaggregator/mapper/output/FeedOutputMapperImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.egor.rssaggregator.mapper.output; | ||
|
||
import com.egor.rssaggregator.dto.output.GetFeedDto; | ||
import com.egor.rssaggregator.entity.Feed; | ||
import javax.annotation.processing.Generated; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Generated( | ||
value = "org.mapstruct.ap.MappingProcessor", | ||
date = "2024-02-27T21:12:19+0300", | ||
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.9 (Red Hat, Inc.)" | ||
) | ||
@Component | ||
public class FeedOutputMapperImpl implements FeedOutputMapper { | ||
|
||
@Override | ||
public GetFeedDto toDto(Feed feed) { | ||
if ( feed == null ) { | ||
return null; | ||
} | ||
|
||
GetFeedDto.GetFeedDtoBuilder getFeedDto = GetFeedDto.builder(); | ||
|
||
getFeedDto.name( feed.getName() ); | ||
getFeedDto.url( feed.getUrl() ); | ||
|
||
return getFeedDto.build(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...ated-sources/annotations/com/egor/rssaggregator/mapper/output/NewsEntryOutputDtoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.egor.rssaggregator.mapper.output; | ||
|
||
import com.egor.rssaggregator.dto.output.MainNewsEntryDto; | ||
import com.egor.rssaggregator.dto.output.MoreTextNewsEntryDto; | ||
import com.egor.rssaggregator.entity.News; | ||
import javax.annotation.processing.Generated; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Generated( | ||
value = "org.mapstruct.ap.MappingProcessor", | ||
date = "2024-02-27T21:12:18+0300", | ||
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.9 (Red Hat, Inc.)" | ||
) | ||
@Component | ||
public class NewsEntryOutputDtoImpl implements NewsEntryOutputDto { | ||
|
||
@Autowired | ||
private FeedOutputMapper feedOutputMapper; | ||
|
||
@Override | ||
public MainNewsEntryDto toMainDto(News news) { | ||
if ( news == null ) { | ||
return null; | ||
} | ||
|
||
MainNewsEntryDto.MainNewsEntryDtoBuilder mainNewsEntryDto = MainNewsEntryDto.builder(); | ||
|
||
mainNewsEntryDto.newsHead( news.getNewsHead() ); | ||
mainNewsEntryDto.newsDate( news.getNewsDate() ); | ||
mainNewsEntryDto.source( feedOutputMapper.toDto( news.getSource() ) ); | ||
|
||
return mainNewsEntryDto.build(); | ||
} | ||
|
||
@Override | ||
public MoreTextNewsEntryDto toMoreDto(News news) { | ||
if ( news == null ) { | ||
return null; | ||
} | ||
|
||
MoreTextNewsEntryDto.MoreTextNewsEntryDtoBuilder moreTextNewsEntryDto = MoreTextNewsEntryDto.builder(); | ||
|
||
moreTextNewsEntryDto.newsHead( news.getNewsHead() ); | ||
moreTextNewsEntryDto.newsDate( news.getNewsDate() ); | ||
moreTextNewsEntryDto.newsText( news.getNewsText() ); | ||
moreTextNewsEntryDto.source( feedOutputMapper.toDto( news.getSource() ) ); | ||
|
||
return moreTextNewsEntryDto.build(); | ||
} | ||
} |