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

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

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

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

/**
 * Allowed end-points /activities/{userId}/@self/{actvityId}+
 *
 * examples: /activities/john.doe/@self/1
 */
@Operation(httpMethods="DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 Set<String> activityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // Throws exceptions if userIds contains more than one element or zero elements
 return service.deleteActivities(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), activityIds, request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

  return service.getActivity(userIds.iterator().next(), request.getGroup(),
    request.getAppId(), request.getFields(), optionalActivityIds.iterator().next(),
    request.getToken());
 } else {
  return service.getActivities(userIds.iterator().next(), request.getGroup(),
    request.getAppId(), request.getFields(), options, optionalActivityIds, request.getToken());
return service.getActivities(userIds, request.getGroup(),
  request.getAppId(),
origin: org.wso2.org.apache.shindig/shindig-social-api

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

private Future<?> setupBodyRequest(String method) throws ProtocolException {
 String jsonActivity = "{title: hi mom!, etc etc}";
 String path = "/activities/john.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, method);
 Activity activity = new ActivityImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivity), eq(Activity.class)))
   .andReturn(activity);
 org.easymock.EasyMock.expect(activityService.createActivity(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(activity), eq(token))).andReturn(Futures.immediateFuture((Void) null));
 replay();
 return operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivity), token, converter);
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandleGetActivityById() throws Exception {
 String path = "/activities/john.doe/@friends/@app/1";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Activity activity = new ActivityImpl();
 org.easymock.EasyMock.expect(activityService.getActivity(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq("1"), eq(token))).andReturn(
   Futures.immediateFuture(activity));
 replay();
 assertEquals(activity, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: org.apache.shindig/shindig-social-api

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

private Future<?> setupBodyRequest(String method) throws ProtocolException {
 String jsonActivity = "{title: hi mom!, etc etc}";
 String path = "/activities/john.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, method);
 Activity activity = new ActivityImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivity), eq(Activity.class)))
   .andReturn(activity);
 org.easymock.EasyMock.expect(activityService.createActivity(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(activity), eq(token))).andReturn(Futures.immediateFuture((Void) null));
 replay();
 return operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivity), token, converter);
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleGetActivityById() throws Exception {
 String path = "/activities/john.doe/@friends/@app/1";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Activity activity = new ActivityImpl();
 org.easymock.EasyMock.expect(activityService.getActivity(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq("1"), eq(token))).andReturn(
   Futures.immediateFuture(activity));
 replay();
 assertEquals(activity, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: org.apache.shindig/shindig-social-api

  return service.getActivity(userIds.iterator().next(), request.getGroup(),
    request.getAppId(), request.getFields(), optionalActivityIds.iterator().next(),
    request.getToken());
 } else {
  return service.getActivities(userIds.iterator().next(), request.getGroup(),
    request.getAppId(), request.getFields(), options, optionalActivityIds, request.getToken());
return service.getActivities(userIds, request.getGroup(),
  request.getAppId(),
origin: com.lmco.shindig/shindig-social-api

/**
 * Allowed end-points /activities/{userId}/@self/{actvityId}+
 *
 * examples: /activities/john.doe/@self/1
 */
@Operation(httpMethods="DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 Set<String> activityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // Throws exceptions if userIds contains more than one element or zero elements
 return service.deleteActivities(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), activityIds, request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
 String path = "/activities/john.doe/@" + group.toString();
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<Activity> activityList = ImmutableList.of();
 RestfulCollection<Activity> data = new RestfulCollection<Activity>(activityList);
 org.easymock.EasyMock.expect(activityService.getActivities(eq(JOHN_DOE),
   eq(new GroupId(group, null)), (String)isNull(), eq(ImmutableSet.<String>of()),
   org.easymock.EasyMock.isA(CollectionOptions.class), eq(token))).
   andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: com.lmco.shindig/shindig-social-api

private Future<?> setupBodyRequest(String method) throws ProtocolException {
 String jsonActivity = "{title: hi mom!, etc etc}";
 String path = "/activities/john.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, method);
 Activity activity = new ActivityImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivity), eq(Activity.class)))
   .andReturn(activity);
 org.easymock.EasyMock.expect(activityService.createActivity(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(activity), eq(token))).andReturn(ImmediateFuture.newInstance((Void) null));
 replay();
 return operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivity), token, converter);
}
origin: com.lmco.shindig/shindig-social-api

@Test
public void testHandleGetActivityById() throws Exception {
 String path = "/activities/john.doe/@friends/@app/1";
 RestHandler operation = registry.getRestHandler(path, "GET");
 Activity activity = new ActivityImpl();
 org.easymock.EasyMock.expect(activityService.getActivity(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq("1"), eq(token))).andReturn(
   ImmediateFuture.newInstance(activity));
 replay();
 assertEquals(activity, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

  return service.getActivity(userIds.iterator().next(), request.getGroup(),
    request.getAppId(), request.getFields(), optionalActivityIds.iterator().next(),
    request.getToken());
 } else {
  return service.getActivities(userIds.iterator().next(), request.getGroup(),
    request.getAppId(), request.getFields(), options, optionalActivityIds, request.getToken());
return service.getActivities(userIds, request.getGroup(),
  request.getAppId(),
origin: org.apache.shindig/shindig-social-api

/**
 * Allowed end-points /activities/{userId}/@self/{actvityId}+
 *
 * examples: /activities/john.doe/@self/1
 */
@Operation(httpMethods="DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 Set<String> activityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // Throws exceptions if userIds contains more than one element or zero elements
 return service.deleteActivities(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), activityIds, request.getToken());
}
origin: org.apache.shindig/shindig-social-api

private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
 String path = "/activities/john.doe/@" + group.toString();
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<Activity> activityList = ImmutableList.of();
 RestfulCollection<Activity> data = new RestfulCollection<Activity>(activityList);
 org.easymock.EasyMock.expect(activityService.getActivities(eq(JOHN_DOE),
   eq(new GroupId(group, null)), (String)isNull(), eq(ImmutableSet.<String>of()),
   org.easymock.EasyMock.isA(CollectionOptions.class), eq(token))).
   andReturn(Futures.immediateFuture(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: org.apache.shindig/shindig-social-api

/**
 * Allowed end-points /activities/{userId}/@self
 *
 * examples: /activities/john.doe/@self - postBody is an activity object
 */
@Operation(httpMethods="POST", bodyParam = "activity")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 List<String> activityIds = request.getListParameter("activityId");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // TODO(lryan) This seems reasonable to allow on PUT but we don't have an update verb.
 HandlerPreconditions.requireEmpty(activityIds, "Cannot specify activityId in create");
 return service.createActivity(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), request.getFields(),
   request.getTypedParameter("activity", Activity.class),
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandleDelete() throws Exception {
 String path = "/activities/john.doe/@self/@app/1";
 RestHandler operation = registry.getRestHandler(path, "DELETE");
 org.easymock.EasyMock.expect(activityService.deleteActivities(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.of("1")),
   eq(token))).andReturn(Futures.immediateFuture((Void) null));
 replay();
 assertNull(operation.execute(Maps.<String, String[]>newHashMap(), null,
   token, converter).get());
 verify();
 reset();
}
origin: com.lmco.shindig/shindig-social-api

@Test
public void testHandleGetPlural() throws Exception {
 String path = "/activities/john.doe,jane.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<Activity> activities = ImmutableList.of();
 RestfulCollection<Activity> data = new RestfulCollection<Activity>(activities);
 Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
 userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
 org.easymock.EasyMock.expect(activityService.getActivities(eq(userIdSet),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"),eq(ImmutableSet.<String>of()),
   org.easymock.EasyMock.isA((CollectionOptions.class)), eq(token))).andReturn(
    ImmediateFuture.newInstance(data));
 replay();
 assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: com.lmco.shindig/shindig-social-api

/**
 * Allowed end-points /activities/{userId}/@self
 *
 * examples: /activities/john.doe/@self - postBody is an activity object
 */
@Operation(httpMethods="POST", bodyParam = "activity")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 List<String> activityIds = request.getListParameter("activityId");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // TODO(lryan) This seems reasonable to allow on PUT but we don't have an update verb.
 HandlerPreconditions.requireEmpty(activityIds, "Cannot specify activityId in create");
 return service.createActivity(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), request.getFields(),
   request.getTypedParameter("activity", Activity.class),
   request.getToken());
}
org.apache.shindig.social.opensocial.spiActivityService

Javadoc

The ActivityService interface defines the service provider interface to retrieve activities from the underlying SNS.

Most used methods

  • createActivity
    Creates the passed in activity for the passed in user and group. Once createActivity is called, getA
  • deleteActivities
    Deletes the activity for the passed in user and group that corresponds to the activityId.
  • getActivities
    Returns a set of activities for the passed in user and group that corresponds to a list of activityI
  • getActivity
    Returns an activity for the passed in user and group that corresponds to a single activityId.

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • scheduleAtFixedRate (Timer)
  • onCreateOptionsMenu (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • JList (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Best IntelliJ plugins
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