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.
    • Method Detail

      • 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
      • 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
      • 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
      • 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 & titleIds
      • 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 viewer)
        Determines whether a user can view an activity or not
        Parameters:
        activity - ExoSocialActivity
        viewer - Identity
        Returns:
        true if has access, else return false
      • isActivityDeletable

        default boolean isActivityDeletable​(ExoSocialActivity activity,
                                            org.exoplatform.services.security.Identity viewer)
        Return whether an activity is deletable or not
        Parameters:
        activity - checked activity
        viewer - user identity
        Returns:
        true is user can delete 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
      • 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:
        activityShareAction - ActivityShareAction for share
        activityTemplate - Activity to create as shared activity in all targeted spaces
        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