Class GamificationService
- java.lang.Object
-
- org.exoplatform.addons.gamification.service.effective.GamificationService
-
public class GamificationService extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected GamificationHistoryDAOgamificationHistoryDAO
-
Constructor Summary
Constructors Constructor Description GamificationService(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, GamificationHistoryDAO gamificationHistoryDAO, DomainMapper domainMapper, RuleService ruleService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GamificationActionsHistorybuild(RuleDTO ruleDto, String actor, String receiver, String objectId)List<ProfileReputation>buildDomainScoreByIdentityId(String earnerId)Compute User reputation score by DomainList<PiechartLeaderboard>buildStatsByUser(String earnerId, Date startDate, Date endDate)Build stats dashboard of a given user (based on domain)longcomputeTotalScore(String actorIdentityId)voidcreateHistory(String event, String sender, String receiver, String object)List<StandardLeaderboard>filter(LeaderboardFilter filter)Filter Leaderboard logic (filter by Domain or/and by period)List<GamificationActionsHistory>findActionHistoryByDateByEarnerId(Date date, String earnerId)Get actionsHistory entitiesList<GamificationActionsHistory>findActionsHistoryByEarnerId(String earnerId, int limit)Provided as an API from points n list to find gamification history from the GamificationInformationsPortlet's earner earned points by dateList<StandardLeaderboard>findAllLeaderboardBetweenDate(IdentityType earnedType, Date fromDate, Date toDate)GamificationActionsHistoryfindLatestActionHistoryByEarnerId(String earnerId)longfindReputationByEarnerId(String earnerId)Compute reputation's scorelongfindUserReputationScoreBetweenDate(String earnerId, Date fromDate, Date toDate)longfindUserReputationScoreByDomainBetweenDate(String earnerId, String domain, Date fromDate, Date toDate)longfindUserReputationScoreByMonth(String earnerId, Date currentMonth)intgetLeaderboardRank(String earnerId, Date date, String domain)voidsaveActionHistory(GamificationActionsHistory history)Save a GamificationActionsHistory in DB
-
-
-
Field Detail
-
gamificationHistoryDAO
protected final GamificationHistoryDAO gamificationHistoryDAO
-
-
Constructor Detail
-
GamificationService
public GamificationService(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, GamificationHistoryDAO gamificationHistoryDAO, DomainMapper domainMapper, RuleService ruleService)
-
-
Method Detail
-
findActionHistoryByDateByEarnerId
public List<GamificationActionsHistory> findActionHistoryByDateByEarnerId(Date date, String earnerId)
Get actionsHistory entities- Parameters:
date- : filter by dateearnerId- : filter by identity id- Returns:
ListofGamificationActionsHistory
-
findReputationByEarnerId
public long findReputationByEarnerId(String earnerId)
Compute reputation's score- Parameters:
earnerId- : the current user earner id- Returns:
- long score of user
-
buildDomainScoreByIdentityId
public List<ProfileReputation> buildDomainScoreByIdentityId(String earnerId)
Compute User reputation score by Domain- Parameters:
earnerId- earner identity id- Returns:
- list of objects of type ProfileReputation
-
saveActionHistory
public void saveActionHistory(GamificationActionsHistory history)
Save a GamificationActionsHistory in DB- Parameters:
history- history entru to save
-
createHistory
public void createHistory(String event, String sender, String receiver, String object)
-
findLatestActionHistoryByEarnerId
public GamificationActionsHistory findLatestActionHistoryByEarnerId(String earnerId)
-
filter
public List<StandardLeaderboard> filter(LeaderboardFilter filter)
Filter Leaderboard logic (filter by Domain or/and by period)- Parameters:
filter- of typeLeaderboardFilter, used to filter query- Returns:
- list of objects of type StandardLeaderboard
-
buildStatsByUser
public List<PiechartLeaderboard> buildStatsByUser(String earnerId, Date startDate, Date endDate)
Build stats dashboard of a given user (based on domain)- Parameters:
earnerId- earner identity idstartDate-endDate-- Returns:
- a list of object of type PiechartLeaderboard
-
findUserReputationScoreBetweenDate
public long findUserReputationScoreBetweenDate(String earnerId, Date fromDate, Date toDate)
-
findUserReputationScoreByMonth
public long findUserReputationScoreByMonth(String earnerId, Date currentMonth)
-
findUserReputationScoreByDomainBetweenDate
public long findUserReputationScoreByDomainBetweenDate(String earnerId, String domain, Date fromDate, Date toDate)
-
findAllLeaderboardBetweenDate
public List<StandardLeaderboard> findAllLeaderboardBetweenDate(IdentityType earnedType, Date fromDate, Date toDate)
-
findActionsHistoryByEarnerId
public List<GamificationActionsHistory> findActionsHistoryByEarnerId(String earnerId, int limit)
Provided as an API from points n list to find gamification history from the GamificationInformationsPortlet's earner earned points by date- Parameters:
earnerId- earner identity Idlimit- limit entries to return- Returns:
ListofGamificationActionsHistory
-
build
public GamificationActionsHistory build(RuleDTO ruleDto, String actor, String receiver, String objectId)
-
computeTotalScore
public long computeTotalScore(String actorIdentityId)
-
-