com.atlassian.gadgets.opensocial.spi
Interface ActivityService

All Known Implementing Classes:
PluginSettingsActivityService

public interface ActivityService

Interface for handling Activity requests. The appId parameter in the methods below is a unique identifier for a particular gadget (e.g. Chart Gadget). This parameter should be used to enforce that only activities created by a particular gadget should be available to that gadget.

This is an optional SPI that host applications may implement if they wish to provide the ability to read and post activity data using the OpenSocial APIs. If the ActivityService is implemented, an implementation of [@link PersonService} must also be provided. If an implementation of ActivityService is not supplied, the OpenSocial activity API will not be supported, but other OpenSocial and Gadget functionality will work normally.

Since:
2.0

Method Summary
 Activity createActivity(PersonId personId, AppId appId, Activity activity, OpenSocialRequestContext requestContext)
          Creates the passed in activity for the passed in user and group.
 void deleteActivities(PersonId personId, AppId appId, Set<String> activityIds, OpenSocialRequestContext token)
          Deletes the activity for the passed in person that corresponds to the activityIds.
 List<Activity> getActivities(PersonId personId, AppId appId, Set<String> activityIds, OpenSocialRequestContext requestContext)
          Returns a list of activities for the passed in person that corresponds to a list of activityIds.
 List<Activity> getActivities(Set<PersonId> peopleIds, AppId appId, OpenSocialRequestContext requestContext)
          Returns a list of activities that correspond to the passed in users
 Activity getActivity(PersonId personId, AppId appId, String activityId, OpenSocialRequestContext requestContext)
          Returns an activity for the passed in person that corresponds to an activityId
 

Method Detail

getActivities

List<Activity> getActivities(Set<PersonId> peopleIds,
                             AppId appId,
                             OpenSocialRequestContext requestContext)
                             throws ActivityServiceException
Returns a list of activities that correspond to the passed in users

Parameters:
peopleIds - The people whose data is being requested
appId - The app id for the gadget making this request
requestContext - The request context
Returns:
the list of activities.
Throws:
ActivityServiceException - if there is a problem while performing this operation

getActivities

List<Activity> getActivities(PersonId personId,
                             AppId appId,
                             Set<String> activityIds,
                             OpenSocialRequestContext requestContext)
                             throws ActivityServiceException
Returns a list of activities for the passed in person that corresponds to a list of activityIds.

Parameters:
personId - The person to fetch activities for
appId - The app id for the gadget making this request
activityIds - The set of activity ids to fetch.
requestContext - The request context
Returns:
the list of activities
Throws:
ActivityServiceException - if there is a problem while performing this operation

getActivity

@Nullable
Activity getActivity(PersonId personId,
                              AppId appId,
                              String activityId,
                              OpenSocialRequestContext requestContext)
                     throws ActivityServiceException
Returns an activity for the passed in person that corresponds to an activityId

Parameters:
personId - The person to fetch an activity for.
appId - The app id for the gadget making this request.
activityId - The activity id to fetch.
requestContext - The request context
Returns:
the requested activity, or null if the request doesn't match any activity (e.g. if the activityId doesn't exist
Throws:
ActivityServiceException - if there is a problem while performing this operation

deleteActivities

void deleteActivities(PersonId personId,
                      AppId appId,
                      Set<String> activityIds,
                      OpenSocialRequestContext token)
                      throws ActivityServiceException
Deletes the activity for the passed in person that corresponds to the activityIds.

Parameters:
personId - The person whose activity is being deleted.
appId - The app id for the gadget making this request.
activityIds - A list of activity ids to delete.
token - A valid SecurityToken.
Throws:
ActivityServiceException - if there is a problem while performing this operation

createActivity

Activity createActivity(PersonId personId,
                        AppId appId,
                        Activity activity,
                        OpenSocialRequestContext requestContext)
                        throws ActivityServiceException
Creates the passed in activity for the passed in user and group. Once createActivity is called, getActivities will be able to return the Activity.

Parameters:
personId - The id of the person to create an activity for.
appId - The app id for the gadget making this request.
activity - The activity to create.
requestContext - The request context
Returns:
the activity created.
Throws:
ActivityServiceException - if there is a problem while performing this operation


Copyright © 2011 Atlassian. All Rights Reserved.