public class JsonDbOpensocialService extends Object implements ActivityService, PersonService, AppDataService, MessageService, AlbumService, MediaItemService, GroupService
MessageService.NotImplementedMessageServiceAlbumService.NotImplementedAlbumServiceMediaItemService.NotImplementedMediaItemServiceALL_FILTER, HAS_APP_FILTER, IS_WITH_FRIENDS_FILTER, TOP_FRIENDS_FILTER, TOP_FRIENDS_SORT| Constructor and Description |
|---|
JsonDbOpensocialService(String jsonLocation,
BeanConverter converter)
Initializes the JsonDbOpensocialService using Guice
|
| Modifier and Type | Method and Description |
|---|---|
Future<Void> |
createActivity(UserId userId,
GroupId groupId,
String appId,
Set<String> fields,
Activity activity,
SecurityToken token)
Creates the passed in activity for the passed in user and group.
|
Future<Void> |
createAlbum(UserId userId,
String appId,
Album album,
SecurityToken token) |
Future<Void> |
createMediaItem(UserId userId,
String appId,
String albumId,
MediaItem mediaItem,
SecurityToken token) |
Future<Void> |
createMessage(UserId userId,
String appId,
String msgCollId,
Message message,
SecurityToken token)
Posts a message to the user's specified message collection, to be sent to the set of recipients specified in
the message.
|
Future<MessageCollection> |
createMessageCollection(UserId userId,
MessageCollection msgCollection,
SecurityToken token)
Creates a new message collection for the given arguments
|
Future<Void> |
deleteActivities(UserId userId,
GroupId groupId,
String appId,
Set<String> activityIds,
SecurityToken token)
Deletes the activity for the passed in user and group that corresponds to the activityId.
|
Future<Void> |
deleteAlbum(UserId userId,
String appId,
String albumId,
SecurityToken token) |
Future<Void> |
deleteMediaItem(UserId userId,
String appId,
String albumId,
String mediaItemId,
SecurityToken token) |
Future<Void> |
deleteMessageCollection(UserId userId,
String msgCollId,
SecurityToken token)
Deletes a message collection for the given arguments
|
Future<Void> |
deleteMessages(UserId userId,
String msgCollId,
List<String> ids,
SecurityToken token)
Deletes a set of messages for a given user/message collection
|
Future<Void> |
deletePersonData(UserId userId,
GroupId groupId,
String appId,
Set<String> fields,
SecurityToken token)
Deletes data for the specified user and group.
|
<T> T |
filterFields(org.json.JSONObject object,
Set<String> fields,
Class<T> clz) |
Future<RestfulCollection<Activity>> |
getActivities(Set<UserId> userIds,
GroupId groupId,
String appId,
Set<String> fields,
CollectionOptions options,
SecurityToken token)
Returns a list of activities that correspond to the passed in users and group.
|
Future<RestfulCollection<Activity>> |
getActivities(UserId userId,
GroupId groupId,
String appId,
Set<String> fields,
CollectionOptions options,
Set<String> activityIds,
SecurityToken token)
Returns a set of activities for the passed in user and group that corresponds to a list of
activityIds.
|
Future<Activity> |
getActivity(UserId userId,
GroupId groupId,
String appId,
Set<String> fields,
String activityId,
SecurityToken token)
Returns an activity for the passed in user and group that corresponds to a single
activityId.
|
Future<Album> |
getAlbum(UserId userId,
String appId,
Set<String> fields,
String albumId,
SecurityToken token) |
Future<RestfulCollection<Album>> |
getAlbums(Set<UserId> userIds,
GroupId groupId,
String appId,
Set<String> fields,
CollectionOptions options,
SecurityToken token) |
Future<RestfulCollection<Album>> |
getAlbums(UserId userId,
String appId,
Set<String> fields,
CollectionOptions options,
Set<String> albumIds,
SecurityToken token) |
org.json.JSONObject |
getDb()
Allows access to the underlying json db.
|
Future<RestfulCollection<Group>> |
getGroups(UserId userId,
CollectionOptions options,
Set<String> fields,
SecurityToken token) |
Set<String> |
getIdSet(Set<UserId> users,
GroupId group,
SecurityToken token)
Get the set of user id's for a set of users and a group
|
Future<MediaItem> |
getMediaItem(UserId userId,
String appId,
String albumId,
String mediaItemId,
Set<String> fields,
SecurityToken token) |
Future<RestfulCollection<MediaItem>> |
getMediaItems(Set<UserId> userIds,
GroupId groupId,
String appId,
Set<String> fields,
CollectionOptions options,
SecurityToken token) |
Future<RestfulCollection<MediaItem>> |
getMediaItems(UserId userId,
String appId,
String albumId,
Set<String> fields,
CollectionOptions options,
SecurityToken token) |
Future<RestfulCollection<MediaItem>> |
getMediaItems(UserId userId,
String appId,
String albumId,
Set<String> mediaItemIds,
Set<String> fields,
CollectionOptions options,
SecurityToken token) |
Future<RestfulCollection<MessageCollection>> |
getMessageCollections(UserId userId,
Set<String> fields,
CollectionOptions options,
SecurityToken token)
Returns a list of message collections corresponding to the given user
|
Future<RestfulCollection<Message>> |
getMessages(UserId userId,
String msgCollId,
Set<String> fields,
List<String> msgIds,
CollectionOptions options,
SecurityToken token)
Returns a list of messages that correspond to the passed in data
|
String |
getPassword(String username)
Public methods for use with Authentication Classes
|
Future<RestfulCollection<Person>> |
getPeople(Set<UserId> userIds,
GroupId groupId,
CollectionOptions options,
Set<String> fields,
SecurityToken token)
Returns a list of people that correspond to the passed in person ids.
|
Future<Person> |
getPerson(UserId id,
Set<String> fields,
SecurityToken token)
Returns a person that corresponds to the passed in person id.
|
Future<DataCollection> |
getPersonData(Set<UserId> userIds,
GroupId groupId,
String appId,
Set<String> fields,
SecurityToken token)
Retrives app data for the specified user list and group.
|
Future<Void> |
modifyMessage(UserId userId,
String msgCollId,
String messageId,
Message message,
SecurityToken token)
Modifies/Updates a specific message with new data
|
Future<Void> |
modifyMessageCollection(UserId userId,
MessageCollection msgCollection,
SecurityToken token)
Modifies/Updates a message collection for the given arguments
|
void |
setDb(org.json.JSONObject db)
override the json database
|
Future<Void> |
updateAlbum(UserId userId,
String appId,
Album album,
String albumId,
SecurityToken token) |
Future<Void> |
updateMediaItem(UserId userId,
String appId,
String albumId,
String mediaItemId,
MediaItem mediaItem,
SecurityToken token) |
Future<Void> |
updatePersonData(UserId userId,
GroupId groupId,
String appId,
Set<String> fields,
Map<String,String> values,
SecurityToken token)
Updates app data for the specified user and group with the new values.
|
@Inject public JsonDbOpensocialService(String jsonLocation, BeanConverter converter) throws Exception
jsonLocation - location of the json data provided by the shindig.canonical.json.db parameterconverter - an injected BeanConverterException - if anypublic org.json.JSONObject getDb()
public void setDb(org.json.JSONObject db)
db - a JSONObject.public Future<RestfulCollection<Activity>> getActivities(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException
getActivities in interface ActivityServiceuserIds - The set of ids of the people to fetch activities for.groupId - Indicates whether to fetch activities for a group.appId - The app id.fields - The fields to return. Empty set implies alloptions - The sorting/filtering/pagination optionstoken - A valid SecurityTokenProtocolExceptionpublic Future<RestfulCollection<Activity>> getActivities(UserId userId, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, Set<String> activityIds, SecurityToken token) throws ProtocolException
getActivities in interface ActivityServiceuserId - The set of ids of the people to fetch activities for.groupId - Indicates whether to fetch activities for a group.appId - The app id.fields - The fields to return. Empty set implies alloptions - The sorting/filtering/pagination optionsactivityIds - The set of activity ids to fetch.token - A valid SecurityTokenProtocolExceptionpublic Future<Activity> getActivity(UserId userId, GroupId groupId, String appId, Set<String> fields, String activityId, SecurityToken token) throws ProtocolException
getActivity in interface ActivityServiceuserId - The set of ids of the people to fetch activities for.groupId - Indicates whether to fetch activities for a group.appId - The app id.fields - The fields to return. Empty set implies allactivityId - The activity id to fetch.token - A valid SecurityTokenProtocolExceptionpublic Future<Void> deleteActivities(UserId userId, GroupId groupId, String appId, Set<String> activityIds, SecurityToken token) throws ProtocolException
deleteActivities in interface ActivityServiceuserId - The user.groupId - The group.appId - The app id.activityIds - A list of activity ids to delete.token - A valid SecurityToken.ProtocolExceptionpublic Future<Void> createActivity(UserId userId, GroupId groupId, String appId, Set<String> fields, Activity activity, SecurityToken token) throws ProtocolException
createActivity in interface ActivityServiceuserId - The id of the person to create the activity for.groupId - The group.appId - The app id.fields - The fields to return.activity - The activity to create.token - A valid SecurityTokenProtocolExceptionpublic Future<RestfulCollection<Person>> getPeople(Set<UserId> userIds, GroupId groupId, CollectionOptions options, Set<String> fields, SecurityToken token) throws ProtocolException
getPeople in interface PersonServiceuserIds - A set of usersgroupId - The groupoptions - How to filter, sort and paginate the collection being fetchedfields - The profile details to fetch. Empty set implies alltoken - The gadget token @return a list of people.ProtocolExceptionpublic Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken token) throws ProtocolException
getPerson in interface PersonServiceid - The id of the person to fetch.fields - The fields to fetch.token - The gadget tokenProtocolExceptionpublic Future<DataCollection> getPersonData(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, SecurityToken token) throws ProtocolException
getPersonData in interface AppDataServiceuserIds - A set of UserIds.groupId - The groupappId - The appfields - The fields to filter the data by. Empty set implies alltoken - The security tokenProtocolExceptionpublic Future<Void> deletePersonData(UserId userId, GroupId groupId, String appId, Set<String> fields, SecurityToken token) throws ProtocolException
deletePersonData in interface AppDataServiceuserId - The usergroupId - The groupappId - The appfields - The fields to delete. Empty set implies alltoken - The security tokenProtocolExceptionpublic Future<Void> updatePersonData(UserId userId, GroupId groupId, String appId, Set<String> fields, Map<String,String> values, SecurityToken token) throws ProtocolException
updatePersonData in interface AppDataServiceuserId - The usergroupId - The groupappId - The appfields - The fields to filter the data by. Empty set implies allvalues - The values to settoken - The security tokenProtocolExceptionpublic Future<Void> createMessage(UserId userId, String appId, String msgCollId, Message message, SecurityToken token) throws ProtocolException
createMessage in interface MessageServiceuserId - The user posting the message.appId - The app idmsgCollId - The message collection Id to post to, default @outboxmessage - The message to posttoken - A valid security token @return a response item containing any errors/ProtocolException - when invalid parameters are givenpublic Future<RestfulCollection<MessageCollection>> getMessageCollections(UserId userId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException
getMessageCollections in interface MessageServiceuserId - The User to fetch forfields - The fields to fetch for the message collectionsoptions - Pagination, etaltoken - Given security token for this requestProtocolException - when invalid parameters are givenpublic Future<Void> deleteMessages(UserId userId, String msgCollId, List<String> ids, SecurityToken token) throws ProtocolException
deleteMessages in interface MessageServiceuserId - The User to delete formsgCollId - The Message Collection ID to delete from, default @allids - List of IDs to deletetoken - Given Security Token for this requestProtocolExceptionpublic Future<RestfulCollection<Message>> getMessages(UserId userId, String msgCollId, Set<String> fields, List<String> msgIds, CollectionOptions options, SecurityToken token) throws ProtocolException
getMessages in interface MessageServiceuserId - The User to fetch formsgCollId - The message Collection ID to fetch from, default @allfields - The fields to fetch for the messagesmsgIds - An explicit set of message ids to fetchoptions - Options to control the fetchtoken - Given security token for this requestProtocolException - when invalid parameters are givenpublic Future<MessageCollection> createMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token) throws ProtocolException
createMessageCollection in interface MessageServiceuserId - The userId to create the message collection formsgCollection - A message collection that is to be createdtoken - A security token for this requestProtocolException - when invalid parameters are given or not implementedpublic Future<Void> modifyMessage(UserId userId, String msgCollId, String messageId, Message message, SecurityToken token) throws ProtocolException
modifyMessage in interface MessageServiceuserId - The User to modify formsgCollId - The Message Collection ID to modify from, default @allmessageId - The messageId to modifymessage - The message details to modifytoken - Given Security Token for this requestProtocolException - for invalid parameters or missing messages or userspublic Future<Void> modifyMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token) throws ProtocolException
modifyMessageCollection in interface MessageServiceuserId - The userId to modify the message collection formsgCollection - Data for the message collection to be modifiedtoken - A security token for this requestProtocolException - when invalid parameters are given or not implementedpublic Future<Void> deleteMessageCollection(UserId userId, String msgCollId, SecurityToken token) throws ProtocolException
deleteMessageCollection in interface MessageServiceuserId - The userId to create the message collection formsgCollId - Data for the message collection to be modifiedtoken - A security token for this requestProtocolException - when invalid parameters are given, the message collection does not exist or not implementedpublic String getPassword(String username)
public Set<String> getIdSet(Set<UserId> users, GroupId group, SecurityToken token) throws org.json.JSONException
users - set of UserIdsgroup - the grouptoken - a tokenorg.json.JSONException - if errors in Jsonpublic Future<Album> getAlbum(UserId userId, String appId, Set<String> fields, String albumId, SecurityToken token) throws ProtocolException
getAlbum in interface AlbumServiceProtocolExceptionpublic Future<RestfulCollection<Album>> getAlbums(UserId userId, String appId, Set<String> fields, CollectionOptions options, Set<String> albumIds, SecurityToken token) throws ProtocolException
getAlbums in interface AlbumServiceProtocolExceptionpublic Future<RestfulCollection<Album>> getAlbums(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException
getAlbums in interface AlbumServiceProtocolExceptionpublic Future<Void> deleteAlbum(UserId userId, String appId, String albumId, SecurityToken token) throws ProtocolException
deleteAlbum in interface AlbumServiceProtocolExceptionpublic Future<Void> createAlbum(UserId userId, String appId, Album album, SecurityToken token) throws ProtocolException
createAlbum in interface AlbumServiceProtocolExceptionpublic Future<Void> updateAlbum(UserId userId, String appId, Album album, String albumId, SecurityToken token) throws ProtocolException
updateAlbum in interface AlbumServiceProtocolExceptionpublic Future<MediaItem> getMediaItem(UserId userId, String appId, String albumId, String mediaItemId, Set<String> fields, SecurityToken token) throws ProtocolException
getMediaItem in interface MediaItemServiceProtocolExceptionpublic Future<RestfulCollection<MediaItem>> getMediaItems(UserId userId, String appId, String albumId, Set<String> mediaItemIds, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException
getMediaItems in interface MediaItemServiceProtocolExceptionpublic Future<RestfulCollection<MediaItem>> getMediaItems(UserId userId, String appId, String albumId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException
getMediaItems in interface MediaItemServiceProtocolExceptionpublic Future<RestfulCollection<MediaItem>> getMediaItems(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException
getMediaItems in interface MediaItemServiceProtocolExceptionpublic Future<Void> deleteMediaItem(UserId userId, String appId, String albumId, String mediaItemId, SecurityToken token) throws ProtocolException
deleteMediaItem in interface MediaItemServiceProtocolExceptionpublic Future<Void> createMediaItem(UserId userId, String appId, String albumId, MediaItem mediaItem, SecurityToken token) throws ProtocolException
createMediaItem in interface MediaItemServiceProtocolExceptionpublic Future<Void> updateMediaItem(UserId userId, String appId, String albumId, String mediaItemId, MediaItem mediaItem, SecurityToken token) throws ProtocolException
updateMediaItem in interface MediaItemServiceProtocolExceptionpublic <T> T filterFields(org.json.JSONObject object,
Set<String> fields,
Class<T> clz)
throws org.json.JSONException
org.json.JSONExceptionpublic Future<RestfulCollection<Group>> getGroups(UserId userId, CollectionOptions options, Set<String> fields, SecurityToken token)
getGroups in interface GroupServiceuserId - a userId objectoptions - search/sort/filtering optionsfields - Field search/sorttoken - a valid security tokenCopyright © 2007-2012. All Rights Reserved.