com.atlassian.gadgets.opensocial.spi
Interface ActivityService


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
 com.atlassian.gadgets.opensocial.model.Activity createActivity(com.atlassian.gadgets.opensocial.model.PersonId personId, com.atlassian.gadgets.opensocial.model.AppId appId, com.atlassian.gadgets.opensocial.model.Activity activity, com.atlassian.gadgets.opensocial.OpenSocialRequestContext requestContext)
          Creates the passed in activity for the passed in user and group.
 void deleteActivities(com.atlassian.gadgets.opensocial.model.PersonId personId, com.atlassian.gadgets.opensocial.model.AppId appId, Set<String> activityIds, com.atlassian.gadgets.opensocial.OpenSocialRequestContext token)
          Deletes the activity for the passed in person that corresponds to the activityIds.
 List<com.atlassian.gadgets.opensocial.model.Activity> getActivities(com.atlassian.gadgets.opensocial.model.PersonId personId, com.atlassian.gadgets.opensocial.model.AppId appId, Set<String> activityIds, com.atlassian.gadgets.opensocial.OpenSocialRequestContext requestContext)
          Returns a list of activities for the passed in person that corresponds to a list of activityIds.
 List<com.atlassian.gadgets.opensocial.model.Activity> getActivities(Set<com.atlassian.gadgets.opensocial.model.PersonId> peopleIds, com.atlassian.gadgets.opensocial.model.AppId appId, com.atlassian.gadgets.opensocial.OpenSocialRequestContext requestContext)
          Returns a list of activities that correspond to the passed in users
 com.atlassian.gadgets.opensocial.model.Activity getActivity(com.atlassian.gadgets.opensocial.model.PersonId personId, com.atlassian.gadgets.opensocial.model.AppId appId, String activityId, com.atlassian.gadgets.opensocial.OpenSocialRequestContext requestContext)
          Returns an activity for the passed in person that corresponds to an activityId
 

Method Detail

getActivities

List<com.atlassian.gadgets.opensocial.model.Activity> getActivities(Set<com.atlassian.gadgets.opensocial.model.PersonId> peopleIds,
                                                                    com.atlassian.gadgets.opensocial.model.AppId appId,
                                                                    com.atlassian.gadgets.opensocial.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<com.atlassian.gadgets.opensocial.model.Activity> getActivities(com.atlassian.gadgets.opensocial.model.PersonId personId,
                                                                    com.atlassian.gadgets.opensocial.model.AppId appId,
                                                                    Set<String> activityIds,
                                                                    com.atlassian.gadgets.opensocial.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
com.atlassian.gadgets.opensocial.model.Activity getActivity(com.atlassian.gadgets.opensocial.model.PersonId personId,
                                                                     com.atlassian.gadgets.opensocial.model.AppId appId,
                                                                     String activityId,
                                                                     com.atlassian.gadgets.opensocial.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(com.atlassian.gadgets.opensocial.model.PersonId personId,
                      com.atlassian.gadgets.opensocial.model.AppId appId,
                      Set<String> activityIds,
                      com.atlassian.gadgets.opensocial.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

com.atlassian.gadgets.opensocial.model.Activity createActivity(com.atlassian.gadgets.opensocial.model.PersonId personId,
                                                               com.atlassian.gadgets.opensocial.model.AppId appId,
                                                               com.atlassian.gadgets.opensocial.model.Activity activity,
                                                               com.atlassian.gadgets.opensocial.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.