Interface ActivityManager


public interface ActivityManager
Provides APIs to manage activities. All methods to manipulate with activities, comments and likes are provided. With these API types, you can:
  • Store, get and update information of activities.
  • Get an activity by using its Id.
  • Get a list of activities by the returned result under ListAccess for lazy loading.
Also, the API which adds processors to process activities content is also included.
  • Field Details

  • Method Details

    • saveActivityNoReturn

      void saveActivityNoReturn(Identity streamOwner, ExoSocialActivity activity)
      Saves a newly created activity to a stream. The stream owner will be Activity.userId in case that information has not already been set.
      Parameters:
      streamOwner - The activity stream owner.
      activity - The activity to be saved.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • saveActivityNoReturn

      void saveActivityNoReturn(ExoSocialActivity activity)
      Saves a newly created activity to the stream. In this case, information of the stream owner has been set in the activity.
      Parameters:
      activity - The activity to be saved.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • getActivity

      ExoSocialActivity getActivity(String activityId)
      Gets an activity by its Id.
      Parameters:
      activityId - Id of the activity.
      Returns:
      The activity.
      eXo level API
      Platform
    • getParentActivity

      ExoSocialActivity getParentActivity(ExoSocialActivity comment)
      Gets an activity by its comment. The comments included in this activity are considered as its children.
      Parameters:
      comment - The comment.
      Returns:
      The activity containing the comment.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • updateActivity

      void updateActivity(ExoSocialActivity activity)
      Updates an existing activity.
      Parameters:
      activity - The activity to be updated.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • updateActivity

      default void updateActivity(ExoSocialActivity activity, boolean broadcast)
      Updates an existing activity.
      Parameters:
      activity - The activity to be updated.
      broadcast - If the broadcast value is true , then the ActivityManager should broadcast the event to all the listener that register on event updateActivity * user event listener will be called in the createUser method.
      eXo level API
      Platform
    • deleteActivity

      void deleteActivity(ExoSocialActivity activity)
      Deletes a specific activity.
      Parameters:
      activity - The activity to be deleted.
      Since:
      1.1.1
      eXo level API
      Platform
    • deleteActivity

      void deleteActivity(String activityId)
      Deletes an activity by its Id.
      Parameters:
      activityId - Id of the deleted activity.
      eXo level API
      Platform
    • hideActivity

      default ExoSocialActivity hideActivity(String activityId)
      Hides an activity to not be displayed in stream, but keep it accessible in standalone mode
      Parameters:
      activityId -
      Returns:
      Hidden ExoSocialActivity
    • saveComment

      void saveComment(ExoSocialActivity activity, ExoSocialActivity newComment)
      Creates or updates a comment or a comment reply on a specific activity.
      Parameters:
      activity - The activity.
      newComment - The comment to be saved.
      eXo level API
      Platform
    • getCommentsWithListAccess

      RealtimeListAccess<ExoSocialActivity> getCommentsWithListAccess(ExoSocialActivity activity)
      Gets comments of a specific activity. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      activity - The specific activity.
      Returns:
      The comments.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • getCommentsWithListAccess

      RealtimeListAccess<ExoSocialActivity> getCommentsWithListAccess(ExoSocialActivity activity, boolean loadSubComments)
      Gets comments of a specific activity. The type of returned result is ListAccess which can be lazy loaded. If loadSubComments is true, subComments will be added to the result list
      Parameters:
      activity - The specific activity.
      loadSubComments -
      Returns:
      The comments.
    • getCommentsWithListAccess

      default RealtimeListAccess<ExoSocialActivity> getCommentsWithListAccess(ExoSocialActivity activity, boolean loadSubComments, boolean sortDescending)
      Gets comments of a specific activity. The type of returned result is ListAccess which can be lazy loaded. If loadSubComments is true, subComments will be added to the result list If sortDescending is true, the latest posted comments will be retrieved first.
      Parameters:
      activity - The specific activity.
      loadSubComments -
      sortDescending -
      Returns:
      The comments.
    • deleteComment

      void deleteComment(String activityId, String commentId)
      Deletes an existing comment of a specific activity by its Id.
      Parameters:
      activityId - Id of the activity containing the deleted comment.
      commentId - Id of the deleted comment.
      eXo level API
      Platform
    • deleteComment

      void deleteComment(ExoSocialActivity activity, ExoSocialActivity comment)
      Deletes a comment of an activity.
      Parameters:
      activity - The activity containing the deleted comment.
      comment - The deleted comment.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • saveLike

      void saveLike(ExoSocialActivity activity, Identity identity)
      Saves the like information of an identity to a specific activity.
      Parameters:
      activity - The activity containing the like information which is saved.
      identity - The identity who likes the activity.
      eXo level API
      Platform
    • deleteLike

      void deleteLike(ExoSocialActivity activity, Identity identity)
      Deletes a like of an identity from a specific activity.
      Parameters:
      activity - The activity containing the deleted like.
      identity - The identity of the deleted like.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • pinActivity

      default ExoSocialActivity pinActivity(String activityId, String userIdentityId)
      Pins a specific activity to space stream.
      Parameters:
      activityId - ExoSocialActivity technical identifier} that will be pinned
      userIdentityId - User Identity ID who pin the activity.
      Returns:
      pinned ExoSocialActivity
    • unpinActivity

      default ExoSocialActivity unpinActivity(String activityId)
      Unpins a specific activity from space stream.
      Parameters:
      activityId - ExoSocialActivity technical identifier that will be unpinned
      Returns:
      unpinned ExoSocialActivity
    • canPinActivity

      default boolean canPinActivity(ExoSocialActivity activity, Identity identity)
      Return whether a user can pin or unpin an activity or not
      Parameters:
      activity - checked activity
      identity - user identity
      Returns:
      true is user can pin or unpin activity, else false
    • getActivitiesWithListAccess

      RealtimeListAccess<ExoSocialActivity> getActivitiesWithListAccess(Identity identity)
      Gets activities posted on the provided activity stream owner. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      identity - The provided activity stream owner.
      Returns:
      The activities.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • getActivitiesWithListAccess

      RealtimeListAccess<ExoSocialActivity> getActivitiesWithListAccess(Identity ownerIdentity, Identity viewerIdentity)
      Gets activities on the provided activity stream which is viewed by another. The type of returned result is ListAccess which can be lazy loaded. For example: Mary is connected to Demo, then Demo signs in and watches the activity stream of Mary.
      Parameters:
      ownerIdentity - The provided activity stream owner.
      viewerIdentity - The identity who views the other stream.
      Returns:
      Activities on the provided activity stream owner.
      Since:
      4.0.x
      eXo level API
      Platform
    • getActivitiesByFilterWithListAccess

      default RealtimeListAccess<ExoSocialActivity> getActivitiesByFilterWithListAccess(Identity viewerIdentity, ActivityFilter activityFilter) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Gets activities by filter. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      viewerIdentity - The viewer identity.
      activityFilter - The activity filter.
      Returns:
      The activities.
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when target space (if designated in filter selection) not found
      IllegalAccessException - when user can't acccess target space stream (if designated in filter selection)
    • getActivitiesOfConnectionsWithListAccess

      RealtimeListAccess<ExoSocialActivity> getActivitiesOfConnectionsWithListAccess(Identity identity)
      Gets activities posted by all connections with a given identity. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      identity - The identity.
      Returns:
      The activities posted by all connections with the identity.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • getActivitiesOfSpaceWithListAccess

      RealtimeListAccess<ExoSocialActivity> getActivitiesOfSpaceWithListAccess(Identity spaceIdentity)
      Gets activities posted on a space by its Id. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      spaceIdentity - The specific stream owner identity.
      Returns:
      The activities which belong to the space.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • getActivitiesOfUserSpacesWithListAccess

      RealtimeListAccess<ExoSocialActivity> getActivitiesOfUserSpacesWithListAccess(Identity identity)
      Gets activities posted on all space activity streams in which an identity joins. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      identity - The identity to get his activities on spaces.
      Returns:
      The activities of the user on spaces.
      Since:
      4.0.x
      eXo level API
      Platform
    • getActivityFeedWithListAccess

      RealtimeListAccess<ExoSocialActivity> getActivityFeedWithListAccess(Identity identity)
      Gets all activities accessible by a given identity. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      identity - The identity.
      Returns:
      All activities of the identity.
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • getActivitiesByPoster

      RealtimeListAccess<ExoSocialActivity> getActivitiesByPoster(Identity poster)
      Gets activities of a given poster. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      poster - The identity who posted activities.
      Returns:
      The activities of the poster.
      Since:
      4.0.1-GA
      eXo level API
      Platform
    • getActivitiesByPoster

      RealtimeListAccess<ExoSocialActivity> getActivitiesByPoster(Identity posterIdentity, String... activityTypes)
      Gets activities of a given poster that are specified by activity types. The type of returned result is ListAccess which can be lazy loaded.
      Parameters:
      posterIdentity - The identity who posted activities.
      activityTypes - The types to get activities.
      Returns:
      The activities of the poster.
      Since:
      4.0.2-GA, 4.1.x
      eXo level API
      Platform
    • addProcessor

      void addProcessor(ActivityProcessor activityProcessor)
      Adds a new activity processor.
      Parameters:
      activityProcessor - The activity processor to be added.
      eXo level API
      Platform
    • addProcessorPlugin

      void addProcessorPlugin(BaseActivityProcessorPlugin activityProcessorPlugin)
      Adds a new activity processor plugin.
      Parameters:
      activityProcessorPlugin - The activity processor plugin to be added.
      eXo level API
      Platform
    • addActivityTypePlugin

      default void addActivityTypePlugin(ActivityTypePlugin plugin)
      Adds an Activity Type options such as activity notification enabling
      Parameters:
      plugin - ActivityTypePlugin
    • addActivityEventListener

      void addActivityEventListener(ActivityListenerPlugin activityListenerPlugin)
    • addActivityListener

      default void addActivityListener(ActivityListener listener)
      Parameters:
      listener - ActivityListener
    • removeActivityListener

      default void removeActivityListener(ActivityListener listener)
      Parameters:
      listener - ActivityListener
    • addSystemActivityDefinition

      default void addSystemActivityDefinition(ActivitySystemTypePlugin activitySystemTypePlugin)
      Add a new Type(s) or Title(s) definition marked as system to not allow to edit them
      Parameters:
      activitySystemTypePlugin - plugin to retrieve types and titleIds
    • getAllActivitiesWithListAccess

      RealtimeListAccess<ExoSocialActivity> getAllActivitiesWithListAccess()
      Get the list access of all activities
      Returns:
    • getSubComments

      List<ExoSocialActivity> getSubComments(ExoSocialActivity comment)
      Get all sub comments of a comment
      Parameters:
      comment -
      Returns:
    • getMaxUploadSize

      int getMaxUploadSize()
      Get the max uploaded size file in activity stream
      Returns:
    • getActivities

      List<ExoSocialActivity> getActivities(List<String> activityIdList)
      Load activities switch list of IDs
      Parameters:
      activityIdList -
      Returns:
    • isActivityEditable

      boolean isActivityEditable(ExoSocialActivity activity, org.exoplatform.services.security.Identity viewer)
    • isActivityViewable

      default boolean isActivityViewable(ExoSocialActivity activity, org.exoplatform.services.security.Identity identity)
      Determines whether a user can view an activity or not
      Parameters:
      activity - ExoSocialActivity
      identity - Identity
      Returns:
      true if has access, else return false
    • isActivityDeletable

      default boolean isActivityDeletable(ExoSocialActivity activity, org.exoplatform.services.security.Identity identity)
      Return whether an activity is deletable or not
      Parameters:
      activity - checked activity
      identity - Identity
      Returns:
      true is user can delete activity, else false
    • isActivityManageable

      default boolean isActivityManageable(ExoSocialActivity activity, org.exoplatform.services.security.Identity identity)
      Return whether an activity is manageable by the designated user or not
      Parameters:
      activity - checked activity
      identity - Identity
      Returns:
      true is user can moderate the activity, else false
    • isActivityExists

      default boolean isActivityExists(String activityId)
      Parameters:
      activityId - ExoSocialActivity technical identifier
      Returns:
      true if activity exists else false
    • isActivityTypeEnabled

      default boolean isActivityTypeEnabled(String activityType)
      Checks if the Activity Type is enabled or not
      Parameters:
      activityType - the name of activity type to check
      Returns:
      true if the activity type is enabled
    • isNotificationEnabled

      default boolean isNotificationEnabled(ExoSocialActivity activity)
      Parameters:
      activity - ExoSocialActivity
      Returns:
      true if the Activity Type reuses the default activity notifications, else false.
    • isNotificationEnabled

      default boolean isNotificationEnabled(ExoSocialActivity activity, String username)
      Parameters:
      activity - ExoSocialActivity
      username - User for whom the notification will be sent
      Returns:
      true if the Activity Notification is enabled for a given user
    • canPostActivityInStream

      default boolean canPostActivityInStream(org.exoplatform.services.security.Identity viewer, Identity streamOwner)
      Checks whether a user can post an activity in a specific stream of user Or Space
      Parameters:
      viewer -
      streamOwner -
      Returns:
      true if can post an activity, else, false
    • isEnableUserComposer

      default boolean isEnableUserComposer()
      Returns:
      true if user composer is enabled in main stream page, else false
    • shareActivity

      default List<ExoSocialActivity> shareActivity(ExoSocialActivity activityTemplate, String activityId, List<String> targetSpaces, org.exoplatform.services.security.Identity viewer) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Shares an existing activity to a list of spaces identified by its pretty names with an optional message
      Parameters:
      activityTemplate - Activity to create as shared activity in all targeted spaces
      activityId - ExoSocialActivity identifier to share
      targetSpaces - List of space pretty names to share with
      viewer - current user making the share operation
      Returns:
      List of shared ExoSocialActivity
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when activity or target space not found
      IllegalAccessException - when user can't post on space stream or can't access activity to share
    • shareActivity

      default List<ExoSocialActivity> shareActivity(ExoSocialActivity activityTemplate, ActivityShareAction activityShareAction, org.exoplatform.services.security.Identity viewer) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Shares an existing activity to a list of spaces identified by its pretty names with an optional message
      Parameters:
      activityTemplate - Activity to create as shared activity in all targeted spaces
      activityShareAction - ActivityShareAction for share
      viewer - current user making the share operation
      Returns:
      List of shared ExoSocialActivity
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when activity or target space not found
      IllegalAccessException - when user can't post on space stream or can't access activity to share
    • getActivityStreamOwnerIdentity

      default Identity getActivityStreamOwnerIdentity(String activityId)
      Retrieves an ExoSocialActivity (activity or comment) stream owner
      Parameters:
      activityId - ExoSocialActivity technical identifier
      Returns:
      stream owner Identity
    • getActivityTitle

      default String getActivityTitle(String activityId)
      Return specific activity title
      Parameters:
      activityId - ExoSocialActivity identifier
      Returns:
      activity title if specific type
    • getActivityTitle

      default String getActivityTitle(ExoSocialActivity activity)
      Return specific activity title
      Parameters:
      activity - ExoSocialActivity
      Returns:
      activity title if specific type
    • getActivityCategoryIds

      default List<Long> getActivityCategoryIds(long spaceId)
      Parameters:
      spaceId - Space identifier
      Returns:
      List of category identifiers associated to all activities if spaceId = 0 else of designated space activities
    • getNumberOfAllComments

      default int getNumberOfAllComments(String activityId)
      Gets the number of comments and subcomments of an activity.
      Parameters:
      activityId - ExoSocialActivity identifier
      Returns: