Skip to content

Commit

Permalink
added more java doc in code
Browse files Browse the repository at this point in the history
  • Loading branch information
vladutmargineanu committed Jan 23, 2024
1 parent 400f990 commit 0297e82
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<CampaignDto> getCurrentCampaignsRealService() {
writeLog("CampaignService.getCurrentCampaignsRealService() IN");
Expand Down Expand Up @@ -56,7 +59,9 @@ public List<CampaignDto> getCurrentCampaignsRealService() {
}

/**
* @return
* Method to retrieve a mocked response for current campaign
*
* @return CampaignDto
*/
public List<CampaignDto> getCurrentCampaignsMockedService() {
writeLog("CampaignService.getCurrentCampaignsMockedService() IN");
Expand Down Expand Up @@ -96,9 +101,11 @@ public List<CampaignDto> getCurrentCampaignsMockedService() {
}

/**
* Method used to create a campaign entity
*
* @param campaignDto
* @param player
* @return
* @return Optional of campaign
*/
public Optional<Campaign> createCampaignEntity(CampaignDto campaignDto, Player player) {
if (null != campaignDto) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Player> getPlayerDetails(String idPlayer) {
Expand Down Expand Up @@ -81,9 +83,11 @@ public Optional<Player> 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())) {
Expand All @@ -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
Expand All @@ -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<Player, CampaignDto> matchLevel = (player, campaign) -> {
if (null != player.getLevel()) {
Expand All @@ -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<Player, CampaignDto> matchCountry = (player, campaign) -> {
if (null != player.getCountry()) {
Expand All @@ -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<Player, CampaignDto> matchItems = (player, campaign) -> {
if (null != player.getInventory() && !CollectionUtils.isEmpty(player.getInventory().getItems())) {
Expand All @@ -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<Player, CampaignDto> matchDoesNotHaveItems = (player, campaign) -> {
if (null != player.getInventory() && !CollectionUtils.isEmpty(player.getInventory().getItems())) {
Expand Down
Binary file not shown.

0 comments on commit 0297e82

Please sign in to comment.