-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
54 changed files
with
573 additions
and
424 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
45 changes: 44 additions & 1 deletion
45
coc-clan/src/main/java/me/shufork/biz/converter/ClanBasicInfoDtoConverter.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 |
---|---|---|
@@ -1,4 +1,47 @@ | ||
package me.shufork.biz.converter; | ||
|
||
public class ClanBasicInfoDtoConverter { | ||
import me.shufork.biz.domain.CocClan; | ||
import me.shufork.common.dto.supercell.coc.ClanBadgeUrlsDto; | ||
import me.shufork.common.dto.supercell.coc.ClanBasicInfoDto; | ||
import org.modelmapper.Converter; | ||
import org.modelmapper.spi.MappingContext; | ||
|
||
public abstract class ClanBasicInfoDtoConverter { | ||
public static class ToCocClan implements Converter<ClanBasicInfoDto,CocClan>{ | ||
|
||
@Override | ||
public CocClan convert(MappingContext<ClanBasicInfoDto, CocClan> mappingContext) { | ||
ClanBasicInfoDto source = mappingContext.getSource(); | ||
CocClan target = new CocClan(); | ||
|
||
target.setTag(source.getTag()); | ||
target.setName(source.getName()); | ||
target.setClanLevel(source.getClanLevel()); | ||
target.setBadgeSmall(source.getBadgeUrls().getSmall()); | ||
target.setBadgeMedium(source.getBadgeUrls().getMedium()); | ||
target.setBadgeLarge(source.getBadgeUrls().getLarge()); | ||
|
||
return target; | ||
} | ||
} | ||
|
||
public static class FromCocClan implements Converter<CocClan,ClanBasicInfoDto>{ | ||
|
||
@Override | ||
public ClanBasicInfoDto convert(MappingContext<CocClan, ClanBasicInfoDto> mappingContext) { | ||
CocClan source = mappingContext.getSource(); | ||
ClanBasicInfoDto target = new ClanBasicInfoDto(); | ||
|
||
target.setTag(source.getTag()); | ||
target.setName(source.getName()); | ||
target.setClanLevel(source.getClanLevel()); | ||
|
||
ClanBadgeUrlsDto clanBadgeUrlsDto = new ClanBadgeUrlsDto(); | ||
clanBadgeUrlsDto.setLarge(source.getBadgeLarge()); | ||
clanBadgeUrlsDto.setMedium(source.getBadgeMedium()); | ||
clanBadgeUrlsDto.setSmall(source.getBadgeSmall()); | ||
target.setBadgeUrls(clanBadgeUrlsDto); | ||
return target; | ||
} | ||
} | ||
} |
59 changes: 58 additions & 1 deletion
59
coc-clan/src/main/java/me/shufork/biz/converter/ClanDetailedInfoDtoConverter.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 |
---|---|---|
@@ -1,4 +1,61 @@ | ||
package me.shufork.biz.converter; | ||
|
||
public class ClanDetailedInfoDtoConverter { | ||
import me.shufork.biz.domain.CocClanDetails; | ||
import me.shufork.common.constants.CocConstants; | ||
import me.shufork.common.dto.supercell.coc.ClanDetailedInfoDto; | ||
import org.modelmapper.Converter; | ||
import org.modelmapper.spi.MappingContext; | ||
|
||
public abstract class ClanDetailedInfoDtoConverter { | ||
public static class ToCocClanDetails implements Converter<ClanDetailedInfoDto,CocClanDetails> { | ||
|
||
@Override | ||
public CocClanDetails convert(MappingContext<ClanDetailedInfoDto, CocClanDetails> mappingContext) { | ||
ClanDetailedInfoDto source = mappingContext.getSource(); | ||
CocClanDetails target = new CocClanDetails(); | ||
target.setTag(source.getTag()); | ||
target.setType(source.getType()); | ||
target.setDescription(source.getDescription()); | ||
target.setLocation(source.getLocation()==null? CocConstants.LOCATION_ID_INVALID:source.getLocation().getId()); | ||
target.setClanPoints(source.getClanPoints()); | ||
target.setClanVersusPoints(source.getClanVersusPoints()); | ||
target.setRequiredTrophies(source.getRequiredTrophies()); | ||
target.setWarFrequency(source.getWarFrequency()); | ||
target.setWarWinStreak(source.getWarWinStreak()); | ||
target.setWarWins(source.getWarWins()); | ||
target.setWarTies(source.getWarTies()); | ||
target.setWarLosses(source.getWarLosses()); | ||
target.setWarLogPublic(source.isWarLogPublic()); | ||
target.setTotalMembers(source.getTotalMembers()); | ||
|
||
//clan member ignored | ||
return target; | ||
} | ||
} | ||
public static class FromCocClanDetails implements Converter<CocClanDetails,ClanDetailedInfoDto> { | ||
|
||
@Override | ||
public ClanDetailedInfoDto convert(MappingContext<CocClanDetails, ClanDetailedInfoDto> mappingContext) { | ||
CocClanDetails source = mappingContext.getSource(); | ||
ClanDetailedInfoDto target = new ClanDetailedInfoDto(); | ||
target.setTag(source.getTag()); | ||
target.setType(source.getType()); | ||
target.setDescription(source.getDescription()); | ||
// TODO : location | ||
target.setLocation(null); | ||
target.setClanPoints(source.getClanPoints()); | ||
target.setClanVersusPoints(source.getClanVersusPoints()); | ||
target.setRequiredTrophies(source.getRequiredTrophies()); | ||
target.setWarFrequency(source.getWarFrequency()); | ||
target.setWarWinStreak(source.getWarWinStreak()); | ||
target.setWarWins(source.getWarWins()); | ||
target.setWarTies(source.getWarTies()); | ||
target.setWarLosses(source.getWarLosses()); | ||
target.setWarLogPublic(source.isWarLogPublic()); | ||
target.setTotalMembers(source.getTotalMembers()); | ||
|
||
//clan member ignored | ||
return target; | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
coc-clan/src/main/java/me/shufork/biz/converter/WarLogEntryClanVoConverter.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,62 @@ | ||
package me.shufork.biz.converter; | ||
|
||
import me.shufork.biz.domain.CocWarTeam; | ||
import me.shufork.biz.vo.WarLogEntryClanVo; | ||
import me.shufork.common.dto.supercell.coc.ClanBadgeUrlsDto; | ||
import org.modelmapper.Converter; | ||
import org.modelmapper.spi.MappingContext; | ||
|
||
public abstract class WarLogEntryClanVoConverter { | ||
public static class ToCocWarTeam implements Converter<WarLogEntryClanVo,CocWarTeam>{ | ||
|
||
@Override | ||
public CocWarTeam convert(MappingContext<WarLogEntryClanVo, CocWarTeam> mappingContext) { | ||
WarLogEntryClanVo source = mappingContext.getSource(); | ||
CocWarTeam target = new CocWarTeam(); | ||
|
||
target.setOpponent(source.getOpponent()); | ||
target.setWarTime(source.getWarTime()); | ||
target.setClan(source.getTag()); | ||
target.setName(source.getName()); | ||
target.setBadgeSmall(source.getBadgeUrls().getSmall()); | ||
target.setBadgeMedium(source.getBadgeUrls().getMedium()); | ||
target.setBadgeLarge(source.getBadgeUrls().getLarge()); | ||
target.setClanLevel(source.getClanLevel()); | ||
target.setAttacks(source.getAttacks()); | ||
target.setStars(source.getStars()); | ||
target.setDestructionPercentage(source.getDestructionPercentage()); | ||
target.setExpEarned(source.getExpEarned()); | ||
|
||
return target; | ||
} | ||
} | ||
|
||
public static class FromCocWarTeam implements Converter<CocWarTeam,WarLogEntryClanVo>{ | ||
|
||
@Override | ||
public WarLogEntryClanVo convert(MappingContext<CocWarTeam, WarLogEntryClanVo> mappingContext) { | ||
CocWarTeam source = mappingContext.getSource(); | ||
WarLogEntryClanVo target = new WarLogEntryClanVo(); | ||
|
||
target.setOpponent(source.getOpponent()); | ||
target.setWarTime(source.getWarTime()); | ||
target.setTag(source.getClan()); | ||
target.setName(source.getName()); | ||
|
||
ClanBadgeUrlsDto clanBadgeUrlsDto = new ClanBadgeUrlsDto(); | ||
clanBadgeUrlsDto.setLarge(source.getBadgeLarge()); | ||
clanBadgeUrlsDto.setMedium(source.getBadgeMedium()); | ||
clanBadgeUrlsDto.setSmall(source.getBadgeSmall()); | ||
target.setBadgeUrls(clanBadgeUrlsDto); | ||
|
||
target.setClanLevel(source.getClanLevel()); | ||
target.setAttacks(source.getAttacks()); | ||
target.setStars(source.getStars()); | ||
target.setDestructionPercentage(source.getDestructionPercentage()); | ||
target.setExpEarned(source.getExpEarned()); | ||
|
||
return target; | ||
} | ||
} | ||
|
||
} |
22 changes: 21 additions & 1 deletion
22
coc-clan/src/main/java/me/shufork/biz/converter/WarLogEntryVoConverter.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 |
---|---|---|
@@ -1,4 +1,24 @@ | ||
package me.shufork.biz.converter; | ||
|
||
public class WarLogEntryVoConverter { | ||
import me.shufork.biz.domain.CocWarLog; | ||
import me.shufork.biz.vo.WarLogEntryVo; | ||
import me.shufork.common.utils.CocDateTimeUtil; | ||
import org.modelmapper.Converter; | ||
import org.modelmapper.spi.MappingContext; | ||
|
||
public abstract class WarLogEntryVoConverter { | ||
public static class FromCocWarLog implements Converter<CocWarLog,WarLogEntryVo>{ | ||
|
||
@Override | ||
public WarLogEntryVo convert(MappingContext<CocWarLog, WarLogEntryVo> mappingContext) { | ||
CocWarLog source = mappingContext.getSource(); | ||
WarLogEntryVo target = new WarLogEntryVo(); | ||
target.setResult(source.getResult()); | ||
target.setEndTime(CocDateTimeUtil.format(source.getEndTime())); | ||
target.setTeamSize(source.getTeamSize()); | ||
target.setHomeTeam(source.getHomeTeam()); | ||
target.setAwayTeam(source.getAwayTeam()); | ||
return target; | ||
} | ||
} | ||
} |
Oops, something went wrong.