Class GamificationHistoryDAO

java.lang.Object
org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<GamificationActionsHistory,Long>
org.exoplatform.addons.gamification.storage.dao.GamificationHistoryDAO
All Implemented Interfaces:
org.exoplatform.commons.api.persistence.GenericDAO<GamificationActionsHistory,Long>

public class GamificationHistoryDAO extends org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<GamificationActionsHistory,Long>
  • Field Details

  • Constructor Details

    • GamificationHistoryDAO

      public GamificationHistoryDAO()
  • Method Details

    • findAllActionsHistoryAgnostic

      public List<StandardLeaderboard> findAllActionsHistoryAgnostic(IdentityType earnerType)
      Get all ActionHistory records and convert them to list of type StandardLeaderboard
      Parameters:
      earnerType - : IdentityType USER or SPACE
      Returns:
      list of type StandardLeaderboard
    • findAllActionsHistoryByDateByDomain

      public List<StandardLeaderboard> findAllActionsHistoryByDateByDomain(IdentityType earnerType, Date date, String domain)
      Find all gamification entries by domain and by type
      Parameters:
      earnerType - : IdentityType USER or SPACE
      date - : date from when we load gamification entries
      domain - : domain filter
      Returns:
      list of object of type StandardLeaderboard
    • findAllActionsHistoryByDomain

      public List<StandardLeaderboard> findAllActionsHistoryByDomain(IdentityType earnerType, String domain)
      Find all gamification entries by domain
      Parameters:
      earnerType - : IdentityType USER or SPACE
      domain - : domain filter
      Returns:
      list of object of type StandardLeaderboard
    • findAllActionsHistoryByDomain

      public List<StandardLeaderboard> findAllActionsHistoryByDomain(String domain, IdentityType earnerType, int limit)
      Find all gamification entries by domain
      Parameters:
      domain - : domain filter
      earnerType - : IdentityType USER or SPACE
      limit - : limit of the query
      Returns:
      list of object of type StandardLeaderboard
    • findAllActionsHistoryByDate

      public List<StandardLeaderboard> findAllActionsHistoryByDate(IdentityType earnerType, Date date)
      Find all gamification entries by date
      Parameters:
      date - : date from when entries are loaded
      earnerType - : IdentityType USER or SPACE
      Returns:
      list of object of type StandardLeaderboard
    • findAllActionsHistoryByDate

      public List<StandardLeaderboard> findAllActionsHistoryByDate(Date date, IdentityType earnerType, int limit)
      Find all gamification entries by date
      Parameters:
      date - : date from when entries are loaded
      earnerType - : IdentityType USER or SPACE
      limit - : limit of the query
      Returns:
      list of object of type StandardLeaderboard
    • findActionsHistoryByEarnerId

      public List<GamificationActionsHistory> findActionsHistoryByEarnerId(String earnerId, int limit)
      Get an ActionHistory record based on userId
      Parameters:
      earnerId - : the userId used in projection
      limit - : limit of the query
      Returns:
      list of objects of type GamificationActionsHistory
    • findAllActionsHistory

      public List<StandardLeaderboard> findAllActionsHistory(IdentityType earnerType, int limit)
      Get all ActionHistory records paginated
      Parameters:
      earnerType - : IdentityType USER or SPACE
      limit - : limit of the query
      Returns:
      list of object of type StandardLeaderboard
    • findActionHistoryByDateByEarnerId

      public List<GamificationActionsHistory> findActionHistoryByDateByEarnerId(Date date, String earnerId)
      Get The last ActionHistory record
      Parameters:
      date - : date from when we aim to track the user
      earnerId - identity id of earner
      Returns:
      an instance of type GamificationActionsHistory
    • findActionsHistoryByDateByDomain

      public List<StandardLeaderboard> findActionsHistoryByDateByDomain(Date date, IdentityType earnerType, String domain, int limit)
      Find actionsHistory by data and domain
      Parameters:
      date - : date from when we aim to track user
      earnerType - : IdentityType USER or SPACE
      domain - : domain we aim to track
      limit - : how many records we should load from DB
      Returns:
      a list of object of type StandardLraderboard
    • findStatsByUserId

      public List<PiechartLeaderboard> findStatsByUserId(String earnerId, Date fromDate, Date toDate)
      Get earner stats
      Parameters:
      earnerId - identity id of earner
      fromDate - a start Date used in query to filter
      toDate - a end Date used in query to filter
      Returns:
      a list of objects of type PiechartLeaderboard
    • findDomainScoreByIdentityId

      public List<ProfileReputation> findDomainScoreByIdentityId(String earnerId)
      Compute for a given user the score earned for each doman
      Parameters:
      earnerId - ProfileReputation
      Returns:
      a list of objects of type
    • findUserReputationScoreBetweenDate

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

      public Map<Long,Long> findUsersReputationScoreBetweenDate(List<String> earnersId, 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 earnerType, Date fromDate, Date toDate)
    • findActionsHistoryByEarnerIdSortedByDate

      public List<GamificationActionsHistory> findActionsHistoryByEarnerIdSortedByDate(String earnerId, int limit)
      Find actionsHistory by data and domain and date and points
      Parameters:
      earnerId - : earner identity id
      limit - : how many records we should load from DB
      Returns:
      a list of object of type GamificationActionsHistory
    • getTotalScore

      public long getTotalScore(String earnerId)
    • getAllPointsByDomain

      public List<GamificationActionsHistory> getAllPointsByDomain(String domain)
    • getAllPointsWithNullDomain

      public List<GamificationActionsHistory> getAllPointsWithNullDomain()
    • getDomainList

      public List<String> getDomainList()
    • countAnnouncementsByChallenge

      public Long countAnnouncementsByChallenge(Long challengeId)
    • countAnnouncementsByChallengeAndEarnerType

      public Long countAnnouncementsByChallengeAndEarnerType(Long challengeId, IdentityType earnerType)
    • findAllAnnouncementByChallenge

      public List<GamificationActionsHistory> findAllAnnouncementByChallenge(Long challengeId, int offset, int limit, PeriodType periodType, IdentityType earnerType)
    • findMostRealizedRuleIds

      public List<Long> findMostRealizedRuleIds(List<Long> spacesIds, int offset, int limit, EntityType type)
    • findRealizationsByFilter

      public List<GamificationActionsHistory> findRealizationsByFilter(RealizationsFilter realizationFilter, int offset, int limit)
      Find realizations by filter with offset, limit.
      Parameters:
      realizationFilter - : data Transfert Object RealizationsFilter
      offset - : the starting index, when supplied. Starts at 0.
      limit - : how many realizations we should load from DB
      Returns:
      a list of object of type GamificationActionsHistory
    • countRealizationsByFilter

      public int countRealizationsByFilter(RealizationsFilter filter)