diff --git a/matcher/src/main/java/com/profile/matcher/service/CampaignService.java b/matcher/src/main/java/com/profile/matcher/service/CampaignService.java index fd4e76f..37984d5 100644 --- a/matcher/src/main/java/com/profile/matcher/service/CampaignService.java +++ b/matcher/src/main/java/com/profile/matcher/service/CampaignService.java @@ -26,8 +26,11 @@ public class CampaignService extends BaseService { @Autowired private CampaignRepository campaignRepository; + /** - * @return + * Method to retrieve the current campaign from external API + * + * @return CampaignDto */ public List getCurrentCampaignsRealService() { writeLog("CampaignService.getCurrentCampaignsRealService() IN"); @@ -56,7 +59,9 @@ public List getCurrentCampaignsRealService() { } /** - * @return + * Method to retrieve a mocked response for current campaign + * + * @return CampaignDto */ public List getCurrentCampaignsMockedService() { writeLog("CampaignService.getCurrentCampaignsMockedService() IN"); @@ -96,9 +101,11 @@ public List getCurrentCampaignsMockedService() { } /** + * Method used to create a campaign entity + * * @param campaignDto * @param player - * @return + * @return Optional of campaign */ public Optional createCampaignEntity(CampaignDto campaignDto, Player player) { if (null != campaignDto) { diff --git a/matcher/src/main/java/com/profile/matcher/service/PlayerService.java b/matcher/src/main/java/com/profile/matcher/service/PlayerService.java index 171c5a7..6bbcabc 100644 --- a/matcher/src/main/java/com/profile/matcher/service/PlayerService.java +++ b/matcher/src/main/java/com/profile/matcher/service/PlayerService.java @@ -33,8 +33,10 @@ public class PlayerService extends BaseService { private PlayerRepository playerRepository; /** + * Method to retrieve a player with id from database + * * @param idPlayer - * @return + * @return Optional of player */ @Transactional(rollbackFor = {Exception.class, UpdatePlayerDetailsException.class}, propagation = Propagation.REQUIRED) public Optional getPlayerDetails(String idPlayer) { @@ -81,9 +83,11 @@ public Optional getPlayerDetails(String idPlayer) { } /** + * Method to check if a player is already in the campaign + * * @param player * @param campaignDto - * @return + * @return boolean */ public static boolean checkNewCampaignForPlayer(Player player, CampaignDto campaignDto) { if (!CollectionUtils.isEmpty(player.getCampaigns())) { @@ -95,6 +99,8 @@ public static boolean checkNewCampaignForPlayer(Player player, CampaignDto campa } /** + * Method to check if a player can be in a campaign + * * @param player * @param campaign * @return @@ -112,7 +118,8 @@ public static boolean matchCurrentCampaign(Player player, CampaignDto campaign) } /** - * + * Implementation of the method test() from functional interface BiPredicate + * This predicate check if the user match with his level in the campaign */ private static final BiPredicate matchLevel = (player, campaign) -> { if (null != player.getLevel()) { @@ -129,7 +136,8 @@ public static boolean matchCurrentCampaign(Player player, CampaignDto campaign) }; /** - * + * Implementation of the method test() from functional interface BiPredicate + * This predicate check if the user match with his country in the campaign */ private static final BiPredicate matchCountry = (player, campaign) -> { if (null != player.getCountry()) { @@ -143,7 +151,8 @@ public static boolean matchCurrentCampaign(Player player, CampaignDto campaign) }; /** - * + * Implementation of the method test() from functional interface BiPredicate + * This predicate check if the user has the respective items from campaign */ private static final BiPredicate matchItems = (player, campaign) -> { if (null != player.getInventory() && !CollectionUtils.isEmpty(player.getInventory().getItems())) { @@ -157,7 +166,8 @@ public static boolean matchCurrentCampaign(Player player, CampaignDto campaign) }; /** - * + * Implementation of the method test() from functional interface BiPredicate + * This predicate check if the user has not the respective items from campaign */ private static final BiPredicate matchDoesNotHaveItems = (player, campaign) -> { if (null != player.getInventory() && !CollectionUtils.isEmpty(player.getInventory().getItems())) { diff --git a/resources/documentation/profile-matcher-service.pdf b/resources/documentation/profile-matcher-service.pdf new file mode 100644 index 0000000..840d9d9 Binary files /dev/null and b/resources/documentation/profile-matcher-service.pdf differ