congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AppDataService
Code IndexAdd Tabnine to your IDE (free)

How to use
AppDataService
in
org.apache.shindig.social.opensocial.spi

Best Java code snippets using org.apache.shindig.social.opensocial.spi.AppDataService (Showing top 20 results out of 315)

origin: org.apache.shindig/shindig-social-api

/**
 * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set on the person object. If there are no fields vars then all of the data will be
 * overridden.
 */
@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 return service.deletePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: org.apache.shindig/shindig-social-api

/**
 * /appdata/{userId}+/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 */
@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Preconditions
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 return service.getPersonData(userIds, request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: org.apache.shindig/shindig-social-api

/**
 * /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set. If there are no fields vars then all of the data will be overridden.
 */
@Operation(httpMethods = "POST", bodyParam = "data")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 @SuppressWarnings("unchecked")
 // As of today, this is the only format supported by the AppData protocol
 Map<String, Object> values = request.getTypedParameter("data", Map.class);
 for (String key : values.keySet()) {
  if (!isValidKey(key)) {
   throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
     "One or more of the app data keys are invalid: " + key);
  }
 }
 return service.updatePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), values, request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

/**
 * /appdata/{userId}+/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 */
@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Preconditions
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 return service.getPersonData(userIds, request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

/**
 * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set on the person object. If there are no fields vars then all of the data will be
 * overridden.
 */
@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 return service.deletePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

/**
 * /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set. If there are no fields vars then all of the data will be overridden.
 */
@Operation(httpMethods = "POST", bodyParam = "data")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 @SuppressWarnings("unchecked")
 // As of today, this is the only format supported by the AppData protocol
 Map<String, Object> values = request.getTypedParameter("data", Map.class);
 for (String key : values.keySet()) {
  if (!isValidKey(key)) {
   throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
     "One or more of the app data keys are invalid: " + key);
  }
 }
 return service.updatePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), values, request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

/**
 * /appdata/{userId}+/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 */
@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Preconditions
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 return service.getPersonData(userIds, request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

/**
 * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set on the person object. If there are no fields vars then all of the data will be
 * overridden.
 */
@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 return service.deletePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

/**
 * /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set. If there are no fields vars then all of the data will be overridden.
 */
@Operation(httpMethods = "POST", bodyParam = "data")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 @SuppressWarnings("unchecked")
 // As of today, this is the only format supported by the AppData protocol
 Map<String, String> values = request.getTypedParameter("data", Map.class);
 for (String key : values.keySet()) {
  if (!isValidKey(key)) {
   throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
     "One or more of the app data keys are invalid: " + key);
  }
 }
 return service.updatePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), values, request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
 String path = "/appdata/john.doe/@" + group.toString() + "/appId";
 RestHandler operation = registry.getRestHandler(path, "GET");
 DataCollection data = new DataCollection(null);
 org.easymock.EasyMock.expect(appDataService.getPersonData(eq(JOHN_DOE),
   eq(new GroupId(group, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
   .andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

 @Test
 public void testHandleDelete() throws Exception {
  Map<String, String[]> params = Maps.newHashMap();
  params.put("fields", new String[]{"pandas"});
  String path = "/appdata/john.doe/@self/appId";
  RestHandler operation = registry.getRestHandler(path, "DELETE");

  EasyMock.expect(appDataService.deletePersonData(eq(JOHN_DOE.iterator().next()),
    eq(new GroupId(GroupId.Type.self, null)),
    eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
    .andReturn(Futures.immediateFuture((Void) null));

  replay();
  assertNull(operation.execute(params, null, token, converter).get());
  verify();
 }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

private Future<?> setupPostData(String method) throws ProtocolException {
 String path = "/appdata/john.doe/@self/appId";
 RestHandler operation = registry.getRestHandler(path, method);
 String jsonAppData = "{pandas: 'are fuzzy'}";
 Map<String, String[]> params = Maps.newHashMap();
 params.put("fields", new String[]{"pandas"});
 HashMap<String, Object> values = Maps.newHashMap();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonAppData), eq(Map.class)))
   .andReturn(values);
 org.easymock.EasyMock.expect(appDataService.updatePersonData(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)),
   eq("appId"), eq(ImmutableSet.of("pandas")), eq(values), eq(token)))
   .andReturn(Futures.immediateFuture((Void) null));
 replay();
 return operation.execute(params, new StringReader(jsonAppData), token, converter);
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandleGetWithoutFields() throws Exception {
 String path = "/appdata/john.doe/@friends/appId";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Map<String, String[]> params = Maps.newHashMap();
 params.put("fields", new String[]{"pandas"});
 DataCollection data = new DataCollection(null);
 org.easymock.EasyMock.expect(appDataService.getPersonData(eq(JOHN_DOE),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
   .andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(params, null, token, converter).get());
 verify();
}
origin: org.apache.shindig/shindig-social-api

 @Test
 public void testHandleDelete() throws Exception {
  Map<String, String[]> params = Maps.newHashMap();
  params.put("fields", new String[]{"pandas"});
  String path = "/appdata/john.doe/@self/appId";
  RestHandler operation = registry.getRestHandler(path, "DELETE");

  EasyMock.expect(appDataService.deletePersonData(eq(JOHN_DOE.iterator().next()),
    eq(new GroupId(GroupId.Type.self, null)),
    eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
    .andReturn(Futures.immediateFuture((Void) null));

  replay();
  assertNull(operation.execute(params, null, token, converter).get());
  verify();
 }
}
origin: org.apache.shindig/shindig-social-api

private Future<?> setupPostData(String method) throws ProtocolException {
 String path = "/appdata/john.doe/@self/appId";
 RestHandler operation = registry.getRestHandler(path, method);
 String jsonAppData = "{pandas: 'are fuzzy'}";
 Map<String, String[]> params = Maps.newHashMap();
 params.put("fields", new String[]{"pandas"});
 HashMap<String, Object> values = Maps.newHashMap();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonAppData), eq(Map.class)))
   .andReturn(values);
 org.easymock.EasyMock.expect(appDataService.updatePersonData(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)),
   eq("appId"), eq(ImmutableSet.of("pandas")), eq(values), eq(token)))
   .andReturn(Futures.immediateFuture((Void) null));
 replay();
 return operation.execute(params, new StringReader(jsonAppData), token, converter);
}
origin: org.apache.shindig/shindig-social-api

private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
 String path = "/appdata/john.doe/@" + group.toString() + "/appId";
 RestHandler operation = registry.getRestHandler(path, "GET");
 DataCollection data = new DataCollection(null);
 org.easymock.EasyMock.expect(appDataService.getPersonData(eq(JOHN_DOE),
   eq(new GroupId(group, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
   .andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
origin: com.lmco.shindig/shindig-social-api

 @Test
 public void testHandleDelete() throws Exception {
  Map<String, String[]> params = Maps.newHashMap();
  params.put("fields", new String[]{"pandas"});
  String path = "/appdata/john.doe/@self/appId";
  RestHandler operation = registry.getRestHandler(path, "DELETE");

  EasyMock.expect(appDataService.deletePersonData(eq(JOHN_DOE.iterator().next()),
    eq(new GroupId(GroupId.Type.self, null)),
    eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
    .andReturn(ImmediateFuture.newInstance((Void) null));

  replay();
  assertNull(operation.execute(params, null, token, converter).get());
  verify();
 }
}
origin: com.lmco.shindig/shindig-social-api

private Future<?> setupPostData(String method) throws ProtocolException {
 String path = "/appdata/john.doe/@self/appId";
 RestHandler operation = registry.getRestHandler(path, method);
 String jsonAppData = "{pandas: 'are fuzzy'}";
 Map<String, String[]> params = Maps.newHashMap();
 params.put("fields", new String[]{"pandas"});
 HashMap<String, String> values = Maps.newHashMap();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonAppData), eq(Map.class)))
   .andReturn(values);
 org.easymock.EasyMock.expect(appDataService.updatePersonData(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)),
   eq("appId"), eq(ImmutableSet.of("pandas")), eq(values), eq(token)))
   .andReturn(ImmediateFuture.newInstance((Void) null));
 replay();
 return operation.execute(params, new StringReader(jsonAppData), token, converter);
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleGetPlural() throws Exception {
 String path = "/appdata/john.doe,jane.doe/@self/appId";
 RestHandler operation = registry.getRestHandler(path, "GET");
 DataCollection data = new DataCollection(null);
 Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
 userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
 org.easymock.EasyMock.expect(appDataService.getPersonData(eq(userIdSet),
   eq(new GroupId(GroupId.Type.self, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
   .andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleGetWithoutFields() throws Exception {
 String path = "/appdata/john.doe/@friends/appId";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Map<String, String[]> params = Maps.newHashMap();
 params.put("fields", new String[]{"pandas"});
 DataCollection data = new DataCollection(null);
 org.easymock.EasyMock.expect(appDataService.getPersonData(eq(JOHN_DOE),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
   .andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(params, null, token, converter).get());
 verify();
}
org.apache.shindig.social.opensocial.spiAppDataService

Javadoc

Data Service SPI interface. This interface represents is used to retrieve information bound to a person, there are methods to update and delete data.

Most used methods

  • deletePersonData
    Deletes data for the specified user and group.
  • getPersonData
    Retrives app data for the specified user list and group.
  • updatePersonData
    Updates app data for the specified user and group with the new values.

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now