Class ActivityDAOImpl

java.lang.Object
org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<ActivityEntity,Long>
org.exoplatform.social.core.jpa.storage.dao.jpa.ActivityDAOImpl
All Implemented Interfaces:
org.exoplatform.commons.api.persistence.GenericDAO<ActivityEntity,Long>, ActivityDAO

public class ActivityDAOImpl extends org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<ActivityEntity,Long> implements ActivityDAO
Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com May 18, 2015
  • Field Details

  • Constructor Details

    • ActivityDAOImpl

      public ActivityDAOImpl(ConnectionDAO connectionDAO)
  • Method Details

    • getActivities

      public List<Long> getActivities(org.exoplatform.social.core.identity.model.Identity owner, org.exoplatform.social.core.identity.model.Identity viewer, long offset, long limit) throws org.exoplatform.social.core.storage.ActivityStorageException
      Specified by:
      getActivities in interface ActivityDAO
      Parameters:
      owner - the Identity
      viewer - the viewer Identity
      offset - the start index
      limit - max number of entities to load
      Returns:
      list of activity entities
      Throws:
      org.exoplatform.social.core.storage.ActivityStorageException - if has any error
    • getUserIdsActivities

      public List<String> getUserIdsActivities(org.exoplatform.social.core.identity.model.Identity owner, long offset, long limit) throws org.exoplatform.social.core.storage.ActivityStorageException
      Description copied from interface: ActivityDAO
      Gets Ids for User stream
      Specified by:
      getUserIdsActivities in interface ActivityDAO
      Parameters:
      owner - the Identity
      offset - the offset index
      limit - maximum number item to load
      Returns:
      the list of activity id
      Throws:
      org.exoplatform.social.core.storage.ActivityStorageException - if has any error
    • getActivityFeed

      public List<Long> getActivityFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, int offset, int limit, List<String> spaceIds)
      Specified by:
      getActivityFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      offset - the start index
      limit - max number of entities to load
      spaceIds - list of space ids
      Returns:
      list of activity entities
    • getActivityByFilter

      public List<Long> getActivityByFilter(org.exoplatform.social.core.activity.ActivityFilter activityFilter, List<String> streamIdentityIds, int offset, int limit)
      Specified by:
      getActivityByFilter in interface ActivityDAO
      Parameters:
      activityFilter - the activity filter
      streamIdentityIds - the space identity ids
      offset - the offset index
      limit - the maximum number of ActivityEntity to load
      Returns:
      the activity entities
    • getActivityIdsByFilter

      public List<String> getActivityIdsByFilter(org.exoplatform.social.core.activity.ActivityFilter activityFilter, List<String> streamIdentityIds, int offset, int limit)
      Specified by:
      getActivityIdsByFilter in interface ActivityDAO
      Parameters:
      activityFilter - the activity filter
      streamIdentityIds - the space identity ids
      offset - the offset index
      limit - maximum number item to load
      Returns:
      the list of activity id
    • getActivitiesCountByFilter

      public int getActivitiesCountByFilter(org.exoplatform.social.core.activity.ActivityFilter activityFilter, List<String> streamIdentityIds)
      Specified by:
      getActivitiesCountByFilter in interface ActivityDAO
      Parameters:
      activityFilter - the activity filter
      streamIdentityIds - the space identity ids
      Returns:
      the number of activities by filter
    • getActivityIdsFeed

      public List<String> getActivityIdsFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, int offset, int limit, List<String> spaceIds)
      Specified by:
      getActivityIdsFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      offset - the start index
      limit - max number of ids to load
      spaceIds - list of space ids
      Returns:
      list of activity ids
    • getNumberOfActivitesOnActivityFeed

      public int getNumberOfActivitesOnActivityFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, List<String> spaceIds)
      Specified by:
      getNumberOfActivitesOnActivityFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      spaceIds - list of space ids
      Returns:
      number of activities
    • getNewerOnActivityFeed

      public List<Long> getNewerOnActivityFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit, List<String> spaceIds)
      Specified by:
      getNewerOnActivityFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      limit - max number of entities to load
      spaceIds - list of space ids
      Returns:
      list of activity entities
    • getNumberOfNewerOnActivityFeed

      public int getNumberOfNewerOnActivityFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, List<String> spaceIds)
      Specified by:
      getNumberOfNewerOnActivityFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      spaceIds - list of space ids
      Returns:
      number of actvitites
    • getOlderOnActivityFeed

      public List<Long> getOlderOnActivityFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit, List<String> spaceIds)
      Specified by:
      getOlderOnActivityFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      limit - max number entities to load
      spaceIds - list of space ids
      Returns:
      list of activity entities
    • getNumberOfOlderOnActivityFeed

      public int getNumberOfOlderOnActivityFeed(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, List<String> spaceIds)
      Specified by:
      getNumberOfOlderOnActivityFeed in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      spaceIds - list of space ids
      Returns:
      number of activities
    • getUserActivities

      public List<Long> getUserActivities(org.exoplatform.social.core.identity.model.Identity owner, long offset, long limit) throws org.exoplatform.social.core.storage.ActivityStorageException
      Specified by:
      getUserActivities in interface ActivityDAO
      Parameters:
      owner - the identity
      offset - the offset index
      limit - the maximum number of ActivityEntity to load
      Returns:
      the activity entities
      Throws:
      org.exoplatform.social.core.storage.ActivityStorageException - if has any error
    • getNumberOfUserActivities

      public int getNumberOfUserActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity)
      Specified by:
      getNumberOfUserActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      Returns:
      the number of activities
    • getNewerOnUserActivities

      public List<Long> getNewerOnUserActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit)
      Specified by:
      getNewerOnUserActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      limit - the number of entities to load
      Returns:
      list of activity entities
    • getNumberOfNewerOnUserActivities

      public int getNumberOfNewerOnUserActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime)
      Specified by:
      getNumberOfNewerOnUserActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      Returns:
      number of activities
    • getOlderOnUserActivities

      public List<Long> getOlderOnUserActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit)
      Specified by:
      getOlderOnUserActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the ending time
      limit - the number of entities to load
      Returns:
      list of activity entities
    • getNumberOfOlderOnUserActivities

      public int getNumberOfOlderOnUserActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime)
      Specified by:
      getNumberOfOlderOnUserActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      Returns:
      number of activities
    • getSpaceActivities

      public List<Long> getSpaceActivities(org.exoplatform.social.core.identity.model.Identity spaceOwner, long offset, long limit) throws org.exoplatform.social.core.storage.ActivityStorageException
      Specified by:
      getSpaceActivities in interface ActivityDAO
      Parameters:
      spaceOwner - the Identity
      offset - the start index
      limit - number of activity entities to load
      Returns:
      list of activity entities
      Throws:
      org.exoplatform.social.core.storage.ActivityStorageException - if has any error
    • getSpaceActivityIds

      public List<String> getSpaceActivityIds(org.exoplatform.social.core.identity.model.Identity spaceIdentity, long offset, long limit) throws org.exoplatform.social.core.storage.ActivityStorageException
      Specified by:
      getSpaceActivityIds in interface ActivityDAO
      Parameters:
      spaceIdentity - the Identity
      offset - the start index
      limit - max number activity Id to load
      Returns:
      list of activity Ids
      Throws:
      org.exoplatform.social.core.storage.ActivityStorageException - if has any error
    • getNumberOfSpaceActivities

      public int getNumberOfSpaceActivities(org.exoplatform.social.core.identity.model.Identity spaceIdentity)
      Specified by:
      getNumberOfSpaceActivities in interface ActivityDAO
      Parameters:
      spaceIdentity - the space Identity
      Returns:
      number of activities
    • getNewerOnSpaceActivities

      public List<Long> getNewerOnSpaceActivities(org.exoplatform.social.core.identity.model.Identity spaceIdentity, long sinceTime, int limit)
      Specified by:
      getNewerOnSpaceActivities in interface ActivityDAO
      Parameters:
      spaceIdentity - the space Identity
      sinceTime - the beginning time
      limit - max number of entities to load
      Returns:
      list of activity entities
    • getNumberOfNewerOnSpaceActivities

      public int getNumberOfNewerOnSpaceActivities(org.exoplatform.social.core.identity.model.Identity spaceIdentity, long sinceTime)
      Specified by:
      getNumberOfNewerOnSpaceActivities in interface ActivityDAO
      Parameters:
      spaceIdentity - the space Identity
      sinceTime - the beginning time
      Returns:
      number of activities
    • getOlderOnSpaceActivities

      public List<Long> getOlderOnSpaceActivities(org.exoplatform.social.core.identity.model.Identity spaceIdentity, long sinceTime, int limit)
      Specified by:
      getOlderOnSpaceActivities in interface ActivityDAO
      Parameters:
      spaceIdentity - the space Identity
      sinceTime - the beginning time
      limit - max number of entities to load
      Returns:
      list of activity entities
    • getNumberOfOlderOnSpaceActivities

      public int getNumberOfOlderOnSpaceActivities(org.exoplatform.social.core.identity.model.Identity spaceIdentity, long sinceTime)
      Specified by:
      getNumberOfOlderOnSpaceActivities in interface ActivityDAO
      Parameters:
      spaceIdentity - the space Identity
      sinceTime - the beginning time
      Returns:
      number of activities
    • getUserSpacesActivities

      public List<Long> getUserSpacesActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, int offset, int limit, List<String> spaceIds)
      Specified by:
      getUserSpacesActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      offset - the start index
      limit - max number of entities to load
      spaceIds - list of space ids
      Returns:
      lsit of activity entities
    • getUserSpacesActivityIds

      public List<String> getUserSpacesActivityIds(org.exoplatform.social.core.identity.model.Identity ownerIdentity, int offset, int limit, List<String> spaceIds)
      Specified by:
      getUserSpacesActivityIds in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      offset - the start index
      limit - max number ids to load
      spaceIds - list of space ids
      Returns:
      list of activity ids
    • getNumberOfUserSpacesActivities

      public int getNumberOfUserSpacesActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, List<String> spaceIds)
      Specified by:
      getNumberOfUserSpacesActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      spaceIds - list of space ids
      Returns:
      the number of activities
    • getNewerOnUserSpacesActivities

      public List<Long> getNewerOnUserSpacesActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit, List<String> spaceIds)
      Specified by:
      getNewerOnUserSpacesActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      limit - max number item to load
      spaceIds - list of space ids
      Returns:
      list of activity entities
    • getNumberOfNewerOnUserSpacesActivities

      public int getNumberOfNewerOnUserSpacesActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, List<String> spaceIds)
      Specified by:
      getNumberOfNewerOnUserSpacesActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      spaceIds - list of space ids
      Returns:
      number of activities
    • getOlderOnUserSpacesActivities

      public List<Long> getOlderOnUserSpacesActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit, List<String> spaceIds)
      Specified by:
      getOlderOnUserSpacesActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      limit - max number items to load
      spaceIds - list of space ids
      Returns:
      list of activity entities
    • getNumberOfOlderOnUserSpacesActivities

      public int getNumberOfOlderOnUserSpacesActivities(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, List<String> spaceIds)
      Specified by:
      getNumberOfOlderOnUserSpacesActivities in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      spaceIds - list of space ids
      Returns:
      number of activities
    • getActivitiesOfConnections

      public List<Long> getActivitiesOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity, int offset, int limit)
      Specified by:
      getActivitiesOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      offset - the start index
      limit - max number of items to load
      Returns:
      list of activity entities
    • getActivityIdsOfConnections

      public List<String> getActivityIdsOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity, int offset, int limit)
      Specified by:
      getActivityIdsOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      offset - the start index
      limit - max number items to load
      Returns:
      list of activity Ids
    • getNumberOfActivitiesOfConnections

      public int getNumberOfActivitiesOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity)
      Specified by:
      getNumberOfActivitiesOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      Returns:
      number of activities
    • getNewerOnActivitiesOfConnections

      public List<Long> getNewerOnActivitiesOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, long limit)
      Specified by:
      getNewerOnActivitiesOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the beginning time
      limit - max number items to load
      Returns:
      list of activity entities
    • getNumberOfNewerOnActivitiesOfConnections

      public int getNumberOfNewerOnActivitiesOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime)
      Specified by:
      getNumberOfNewerOnActivitiesOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the start time
      Returns:
      number of activities
    • getOlderOnActivitiesOfConnections

      public List<Long> getOlderOnActivitiesOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime, int limit)
      Specified by:
      getOlderOnActivitiesOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      limit - max items to load
      Returns:
      list of activity entities
    • getNumberOfOlderOnActivitiesOfConnections

      public int getNumberOfOlderOnActivitiesOfConnections(org.exoplatform.social.core.identity.model.Identity ownerIdentity, long sinceTime)
      Specified by:
      getNumberOfOlderOnActivitiesOfConnections in interface ActivityDAO
      Parameters:
      ownerIdentity - the Identity
      sinceTime - the end time
      Returns:
      number of activities
    • getActivitiesByPoster

      public List<Long> getActivitiesByPoster(org.exoplatform.social.core.identity.model.Identity posterIdentity, int offset, int limit, String... activityTypes)
      Specified by:
      getActivitiesByPoster in interface ActivityDAO
      Parameters:
      posterIdentity - the Identity
      offset - the start index
      limit - max number items to load
      activityTypes - the activity Type
      Returns:
      list of activities
    • getNumberOfActivitiesByPoster

      public int getNumberOfActivitiesByPoster(org.exoplatform.social.core.identity.model.Identity posterIdentity, String... activityTypes)
      Specified by:
      getNumberOfActivitiesByPoster in interface ActivityDAO
      Parameters:
      posterIdentity - the Identity
      activityTypes - the activity Type
      Returns:
      number of activities
    • getNumberOfComments

      public long getNumberOfComments(long activityId)
      Specified by:
      getNumberOfComments in interface ActivityDAO
      Parameters:
      activityId - the Id of activity
      Returns:
      number of comments
    • getNumberOfAllComments

      public int getNumberOfAllComments(long activityId)
      Specified by:
      getNumberOfAllComments in interface ActivityDAO
      Parameters:
      activityId - the Id of activity
      Returns:
      the total number of comments
    • findCommentsOfActivities

      public List<ActivityEntity> findCommentsOfActivities(List<Long> ids)
      Description copied from interface: ActivityDAO
      find Sub Comments of some comments
      Specified by:
      findCommentsOfActivities in interface ActivityDAO
      Parameters:
      ids -
      Returns:
    • findCommentsAndSubCommentsOfActivity

      public List<ActivityEntity> findCommentsAndSubCommentsOfActivity(Long activityId)
      Description copied from interface: ActivityDAO
      find comments and Sub Comments of some activity
      Specified by:
      findCommentsAndSubCommentsOfActivity in interface ActivityDAO
      Parameters:
      activityId -
      Returns:
    • getComments

      public List<ActivityEntity> getComments(long activityId, int offset, int limit, boolean sortDescending)
      Specified by:
      getComments in interface ActivityDAO
      Parameters:
      activityId - the Id of activity
      offset - the start index
      limit - max comments to load
      sortDescending -
      Returns:
      list of activity entities represent comment
    • getNewerComments

      public List<ActivityEntity> getNewerComments(long activityId, Date sinceTime, int offset, int limit)
      Specified by:
      getNewerComments in interface ActivityDAO
      Parameters:
      activityId - the id of activity
      sinceTime - the start time
      offset - the start index
      limit - max items to load
      Returns:
      list of activity entities
    • getOlderComments

      public List<ActivityEntity> getOlderComments(long activityId, Date sinceTime, int offset, int limit)
      Specified by:
      getOlderComments in interface ActivityDAO
      Parameters:
      activityId - the Id of activity
      sinceTime - the end time
      offset - the start index
      limit - max items to load
      Returns:
      list of activity entities
    • getParentActivity

      public ActivityEntity getParentActivity(long commentId)
      Description copied from interface: ActivityDAO
      Get Activity of comment
      Specified by:
      getParentActivity in interface ActivityDAO
      Parameters:
      commentId - the comment Id
      Returns:
      activity entity
    • getAllActivities

      public List<ActivityEntity> getAllActivities()
      Specified by:
      getAllActivities in interface ActivityDAO
      Returns:
      all activities
    • deleteActivitiesByOwnerId

      public void deleteActivitiesByOwnerId(String ownerId)
      Description copied from interface: ActivityDAO
      delete an activity by ownerId
      Specified by:
      deleteActivitiesByOwnerId in interface ActivityDAO
      Parameters:
      ownerId - the owner Id
    • getOwnerActivities

      public List<Long> getOwnerActivities(List<String> owners, long newerTime, long olderTime, long offset, long limit) throws org.exoplatform.social.core.storage.ActivityStorageException
      Throws:
      org.exoplatform.social.core.storage.ActivityStorageException
    • findActivities

      public List<ActivityEntity> findActivities(List<Long> activityIds)
      Description copied from interface: ActivityDAO
      Get list of activities switch list of IDs
      Specified by:
      findActivities in interface ActivityDAO
      Parameters:
      activityIds -
      Returns:
    • getActivityCategoryIds

      public List<Long> getActivityCategoryIds(long spaceIdentityId)
      Specified by:
      getActivityCategoryIds in interface ActivityDAO
      Parameters:
      spaceIdentityId - Space Identity identifier
      Returns:
      List of Category Ids used in Activities