Interface ActivityManager


@ProviderType public interface ActivityManager
The activity manager is used as entry point to read, create and write activities and activity streams.
  • Method Details

    • newActivity

      MutableActivity newActivity()
      Creates a new mutable activity for populating with the input data.
      Returns:
      a new mutable activity.
    • newActivity

      MutableActivity newActivity(JSONObject jsonObject)
      Creates a new mutable activity populated with input data of a JSON object.
      Parameters:
      jsonObject - JSON object representing the activity.
      Returns:
      a new mutable activity.
    • newActivityObject

      MutableActivityObject newActivityObject()
      Creates a new mutable activity object for populating with the input data.
      Returns:
      a new mutable activity object.
    • newMediaLink

      MutableMediaLink newMediaLink()
      Creates a new mutable media link for populating with the input data.
      Returns:
      a new mutable media link.
    • getActivities

      ActivityCollection getActivities(ResourceResolver resolver, String userId) throws ActivityException
      Returns the activity collection for the given user. The collection is an aggregate of the users stream and all the streams the user follows.
      Parameters:
      resolver - resource resolver to resolve the path
      userId - the userid of the user. If null the user bound to the resource resolver is used.
      Returns:
      the ActivityCollection
      Throws:
      ActivityException
    • getActivities

      ActivityCollection getActivities(ResourceResolver resolver, String userId, AggregateOptions options) throws ActivityException
      Returns the activity collection for the given user. The collection is an aggregate of the users stream and all the streams the user follows controlled by the aggregate options.
      Parameters:
      resolver - resource resolver
      userId - the userid of the user. If null the user bound to the resource resolver is used.
      options - the aggregate options
      Returns:
      the ActivityCollection
      Throws:
      ActivityException - if an error occurs
      Since:
      0.0.14
    • getActivity

      Activity getActivity(ResourceResolver resolver, String id) throws ActivityException
      Returns the activity with the given id or null if not exists.
      Parameters:
      resolver - resource resolver to resolve the id
      id - the id of the activity
      Returns:
      the activity or null
      Throws:
      ActivityException - if an error occurs.
    • getUserStream

      ActivityStream getUserStream(ResourceResolver resolver, String userId, String streamName, boolean create) throws ActivityException
      Gets the distinct activity stream for the given user.
      Parameters:
      resolver - resource resolver to resolve the path
      userId - the userid of the user
      streamName - the name of the stream or null to use the default stream
      Returns:
      the activity stream or null if the user or his stream does not exist.
      Throws:
      ActivityException - if an error occurs.
    • getGroupStream

      ActivityStream getGroupStream(ResourceResolver resolver, String groupName, String streamName, boolean create) throws ActivityException
      Gets the distinct activity stream for the given group.
      Parameters:
      resolver - resource resolver to resolve the path
      groupName - the name of the group
      streamName - the name of the stream or null to use the default stream
      Returns:
      the activity stream or null if the user or his stream does not exist.
      Throws:
      ActivityException - if an error occurs.
    • getStream

      ActivityStream getStream(ResourceResolver resolver, Authorizable auth, String streamName, boolean create) throws ActivityException
      Gets the distinct activity stream for the given authorizable.
      Parameters:
      resolver - resource resolver to resolve the path
      auth - the jackrabbit authorizable
      streamName - the name of the stream or null to use the default stream
      Returns:
      the activity stream or null if the user or his stream does not exist.
      Throws:
      ActivityException - if an error occurs
    • getStream

      ActivityStream getStream(Resource streamResource) throws ActivityException
      Returns the activity stream for the given resource.
      Parameters:
      streamResource - the stream resource
      Returns:
      the stream
      Throws:
      ActivityException - if an error occurs
    • getStream

      ActivityStream getStream(Resource containerResource, String name, boolean create) throws ActivityException
      Returns the activity stream for the given container resource, e.g. user, group, document. If the stream does not exist and create is true a new stream is created.
      Parameters:
      containerResource - the container resource
      name - the stream name
      Returns:
      the stream or null if no such stream exists
      Throws:
      ActivityException - if an error occurs
    • listStreams

      Collection<ActivityStream> listStreams(Resource containerResource) throws ActivityException
      Lists all streams of the given container resource (user, group, document);
      Parameters:
      containerResource - the resource to list the streams
      Returns:
      a collection of streams or null if the resource is invalid.
      Throws:
      ActivityException - if an error occurs
    • listStreams

      Collection<ActivityStream> listStreams(ResourceResolver resolver, String userId, AggregateOptions options) throws ActivityException
      Lists all streams for the given user that would be used to build the activity collection.
      Parameters:
      resolver - resource resolver
      userId - the user id
      options - the aggregate options
      Returns:
      a collection of streams or null if the resource is invalid.
      Throws:
      ActivityException - if an error occurs
      Since:
      0.0.10
    • getFollowers

      Returns an iterable over a list of users that see this activity in their default aggregate stream. Note that the resource resolver bound to the activity is used to resolve all paths and authorizables.
      Parameters:
      activity - the activity
      Returns:
      an iterable over all user ids.
      Throws:
      ActivityException - if an error occurs
      IllegalArgumentException - if the activity is not persisted in the underlying repository
      Since:
      0.0.10
    • getFollowers

      Returns an iterable over a list of users that follow this stream stream. Note that the resource resolver bound to the activity is used to resolve all paths and authorizables.
      Parameters:
      stream - the stream
      Returns:
      an iterable over all user ids.
      Throws:
      ActivityException - if an error occurs
      IllegalArgumentException - if the activity is not persisted in the underlying repository
      Since:
      0.0.14
    • getUserStream

      @Deprecated ActivityStream getUserStream(ResourceResolver resolver, String userId, String streamName) throws ActivityException
      Gets the distinct activity stream for the given user.
      Parameters:
      resolver - resource resolver to resolve the path
      userId - the userid of the user
      streamName - the name of the stream or null to use the default stream
      Returns:
      the activity stream or null if the user or his stream does not exist.
      Throws:
      ActivityException - if an error occurs.
    • getUserStream

      @Deprecated ActivityStream getUserStream(ResourceResolver resolver, User user, String streamName) throws ActivityException
      Gets the distinct activity stream for the given user.
      Parameters:
      resolver - resource resolver to resolve the path
      user - the jackrabbit user
      streamName - the name of the stream or null to use the default stream
      Returns:
      the activity stream or null if the user or his stream does not exist.
      Throws:
      ActivityException - if an error occurs
    • getTopicStream

      @Deprecated ActivityStream getTopicStream(Resource topicResource, String streamName) throws ActivityException
      Returns the activity stream for the given resource.
      Parameters:
      topicResource - the topic for which the stream is retrieved
      streamName - the name of the stream or null to use the default stream
      Returns:
      the stream
      Throws:
      ActivityException - if an error occurs