com.atlassian.gadgets.refimpl
Class PluginSettingsActivityService

java.lang.Object
  extended by com.atlassian.gadgets.refimpl.PluginSettingsActivityService
All Implemented Interfaces:
ActivityService

public class PluginSettingsActivityService
extends Object
implements ActivityService

An ActivityService implementation that uses SAL's PluginSettings. This class is safe to use concurrently from multiple threads. It is not, however, safe to use concurrently across multiple clustered application instances, as there is no way to ensure that the PluginSettings retrieval and update occurs atomically. Host applications that may be deployed in a clustered environment should be sure to use their own ActivityService implementation.


Field Summary
static String KEY_PREFIX
           
static String NEXT_ACTIVITY_ID_KEY
           
static String NO_USER_KEY
           
 
Constructor Summary
PluginSettingsActivityService(com.atlassian.sal.api.pluginsettings.PluginSettingsFactory pluginSettingsFactory)
           
 
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 requestContext)
          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> people, 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
static String getActivityId()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_PREFIX

public static final String KEY_PREFIX

NO_USER_KEY

public static final String NO_USER_KEY
See Also:
Constant Field Values

NEXT_ACTIVITY_ID_KEY

public static final String NEXT_ACTIVITY_ID_KEY
See Also:
Constant Field Values
Constructor Detail

PluginSettingsActivityService

public PluginSettingsActivityService(com.atlassian.sal.api.pluginsettings.PluginSettingsFactory pluginSettingsFactory)
Method Detail

getActivityId

public static String getActivityId()

getActivities

public List<Activity> getActivities(Set<PersonId> people,
                                    AppId appId,
                                    OpenSocialRequestContext requestContext)
                             throws ActivityServiceException
Description copied from interface: ActivityService
Returns a list of activities that correspond to the passed in users

Specified by:
getActivities in interface ActivityService
Parameters:
people - 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

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

Specified by:
getActivities in interface ActivityService
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

public Activity getActivity(PersonId personId,
                            AppId appId,
                            String activityId,
                            OpenSocialRequestContext requestContext)
                     throws ActivityServiceException
Description copied from interface: ActivityService
Returns an activity for the passed in person that corresponds to an activityId

Specified by:
getActivity in interface ActivityService
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

public void deleteActivities(PersonId personId,
                             AppId appId,
                             Set<String> activityIds,
                             OpenSocialRequestContext requestContext)
                      throws ActivityServiceException
Description copied from interface: ActivityService
Deletes the activity for the passed in person that corresponds to the activityIds.

Specified by:
deleteActivities in interface ActivityService
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.
requestContext - A valid SecurityToken.
Throws:
ActivityServiceException - if there is a problem while performing this operation

createActivity

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

Specified by:
createActivity in interface ActivityService
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 © 2013 Atlassian. All Rights Reserved.