Class GamificationService

java.lang.Object
org.exoplatform.addons.gamification.service.effective.GamificationService

public class GamificationService extends Object
  • Field Details

  • Constructor Details

    • GamificationService

      public GamificationService(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, GamificationHistoryDAO gamificationHistoryDAO, RuleService ruleService)
  • Method Details

    • findActionHistoryByDateByEarnerId

      public List<GamificationActionsHistory> findActionHistoryByDateByEarnerId(Date date, String earnerId)
      Get actionsHistory entities
      Parameters:
      date - : filter by date
      earnerId - : filter by identity id
      Returns:
      List of GamificationActionsHistory
    • getLeaderboardRank

      public int getLeaderboardRank(String earnerId, Date date, Long domainId)
    • 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 GamificationActionsHistory saveActionHistory(GamificationActionsHistory history)
      Save a GamificationActionsHistory in DB
      Parameters:
      history - history entru to save
      Returns:
      GamificationActionsHistory
    • 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 type LeaderboardFilter, 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 id
      startDate -
      endDate -
      Returns:
      a list of object of type PiechartLeaderboard
    • findUserReputationScoreBetweenDate

      public long findUserReputationScoreBetweenDate(String earnerId, Date fromDate, Date toDate)
    • findUsersReputationScoreBetweenDate

      public Map<Long,Long> findUsersReputationScoreBetweenDate(List<String> earnersId, 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 Id
      limit - limit entries to return
      Returns:
      List of GamificationActionsHistory
    • build

      public GamificationActionsHistory build(RuleDTO ruleDto, String actor, String receiver, String objectId)
    • computeTotalScore

      public long computeTotalScore(String actorIdentityId)