Codota Logo
ActivityStreamService
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: org.apache.shindig/shindig-social-api

private Future<?> setupBodyRequest(String method) throws ProtocolException {
 String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";
 String path = "/activitystreams/john.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, method);
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
   .andReturn(entry);
 org.easymock.EasyMock.expect(service.createActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(entry), eq(token))).andReturn(Futures.immediateFuture((ActivityEntry) null));
 replay();
 return operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivityEntry), token, converter);
}
origin: org.apache.shindig/shindig-social-api

/**
 * Allowed end-points /activitystreams/{userId}/@self/{appId}/{activityId}+
 *
 * Examples: /activitystreams/john.doe/@self/1/object1,object2
 *
 * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
 * @return a {@link java.util.concurrent.Future} object.
 * @throws org.apache.shindig.protocol.ProtocolException if any.
 */
@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");
 HandlerPreconditions.requireNotEmpty(activityIds, "At least one activity ID must be specified");
 return service.deleteActivityEntries(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), activityIds, request.getToken());
}
origin: org.apache.shindig/shindig-social-api

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

private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
 String path = "/activitystreams/john.doe/@" + group.toString();
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<ActivityEntry> entries = ImmutableList.of();
 RestfulCollection<ActivityEntry> data = new RestfulCollection<ActivityEntry>(entries);
 org.easymock.EasyMock.expect(service.getActivityEntries(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 /activitystreams/{userId}/@self/{appId}/{activityId}
 *
 * Examples: /activitystreams/john.doe/@self/1/object2 - postBody is an activity object
 *
 * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
 * @return a {@link java.util.concurrent.Future} object.
 * @throws org.apache.shindig.protocol.ProtocolException if any.
 */
@Operation(httpMethods="PUT", bodyParam = "activity")
public Future<?> update(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");
 HandlerPreconditions.requireSingular(activityIds, "Must specify exactly one activity ID");
 return service.updateActivityEntry(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), request.getFields(),
   request.getTypedParameter("activity", ActivityEntry.class),
   activityIds.iterator().next(),
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandleGetActivityEntryById() throws Exception {
 String path = "/activitystreams/john.doe/@friends/@app/myObjectId123";  // TODO: change id=1 in DB for consistency
 RestHandler operation = registry.getRestHandler(path, "GET");
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(service.getActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq("myObjectId123"), eq(token))).andReturn(
   Futures.immediateFuture(entry));
 replay();
 assertEquals(entry, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleGetPlural() throws Exception {
 String path = "/activitystreams/john.doe,jane.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<ActivityEntry> entries = ImmutableList.of();
 RestfulCollection<ActivityEntry> data = new RestfulCollection<ActivityEntry>(entries);
 Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
 userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
 org.easymock.EasyMock.expect(service.getActivityEntries(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

/**
 * Allowed end-points /activitystreams/{userId}/@self/{appId}/{activityId}
 *
 * Examples: /activitystreams/john.doe/@self/1/object2 - postBody is an activity object
 *
 * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
 * @return a {@link java.util.concurrent.Future} object.
 * @throws org.apache.shindig.protocol.ProtocolException if any.
 */
@Operation(httpMethods="PUT", bodyParam = "activity")
public Future<?> update(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");
 HandlerPreconditions.requireSingular(activityIds, "Must specify exactly one activity ID");
 return service.updateActivityEntry(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), request.getFields(),
   request.getTypedParameter("activity", ActivityEntry.class),
   activityIds.iterator().next(),
   request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleGetActivityEntryById() throws Exception {
 String path = "/activitystreams/john.doe/@friends/@app/myObjectId123";  // TODO: change id=1 in DB for consistency
 RestHandler operation = registry.getRestHandler(path, "GET");
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(service.getActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.friends, null)),
   eq("appId"), eq(ImmutableSet.<String>of()), eq("myObjectId123"), eq(token))).andReturn(
   Futures.immediateFuture(entry));
 replay();
 assertEquals(entry, operation.execute(Maps.<String, String[]>newHashMap(),
   null, token, converter).get());
 verify();
 reset();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

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

private Future<?> setupBodyRequest(String method) throws ProtocolException {
 String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";
 String path = "/activitystreams/john.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, method);
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
   .andReturn(entry);
 org.easymock.EasyMock.expect(service.createActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(entry), eq(token))).andReturn(Futures.immediateFuture((ActivityEntry) null));
 replay();
 return operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivityEntry), token, converter);
}
origin: org.wso2.org.apache.shindig/shindig-social-api

/**
 * Allowed end-points /activitystreams/{userId}/@self/{appId}/{activityId}+
 *
 * Examples: /activitystreams/john.doe/@self/1/object1,object2
 *
 * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
 * @return a {@link java.util.concurrent.Future} object.
 * @throws org.apache.shindig.protocol.ProtocolException if any.
 */
@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");
 HandlerPreconditions.requireNotEmpty(activityIds, "At least one activity ID must be specified");
 return service.deleteActivityEntries(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), activityIds, request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Test
public void testHandleGetPlural() throws Exception {
 String path = "/activitystreams/john.doe,jane.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<ActivityEntry> entries = ImmutableList.of();
 RestfulCollection<ActivityEntry> data = new RestfulCollection<ActivityEntry>(entries);
 Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
 userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
 org.easymock.EasyMock.expect(service.getActivityEntries(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

@Test
public void testHandlePut() throws Exception {
 String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";
 String path = "/activitystreams/john.doe/@self/@app/testObject";
 RestHandler operation = registry.getRestHandler(path, "PUT");
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
   .andReturn(entry);
 org.easymock.EasyMock.expect(service.updateActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(entry), eq("testObject"), eq(token))).andReturn(Futures.immediateFuture((ActivityEntry) null));
 replay();
 Future<?> future = operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivityEntry), token, converter);
 assertNull(future.get());
 verify();
 reset();
}
origin: org.apache.shindig/shindig-social-api

/**
 * Allowed end-points /activitystreams/{userId}/@self/{appId}
 *
 * Examples: /activitystreams/john.doe/@self/{appId} - postBody is an activity object
 *
 * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
 * @return a {@link java.util.concurrent.Future} object.
 * @throws org.apache.shindig.protocol.ProtocolException if any.
 */
@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");
 HandlerPreconditions.requireEmpty(activityIds, "Cannot specify activity ID in create");
 return service.createActivityEntry(Iterables.getOnlyElement(userIds), request.getGroup(),
   request.getAppId(), request.getFields(),
   request.getTypedParameter("activity", ActivityEntry.class),
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

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

private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
 String path = "/activitystreams/john.doe/@" + group.toString();
 RestHandler operation = registry.getRestHandler(path, "GET");
 List<ActivityEntry> entries = ImmutableList.of();
 RestfulCollection<ActivityEntry> data = new RestfulCollection<ActivityEntry>(entries);
 org.easymock.EasyMock.expect(service.getActivityEntries(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.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandlePut() throws Exception {
 String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";
 String path = "/activitystreams/john.doe/@self/@app/testObject";
 RestHandler operation = registry.getRestHandler(path, "PUT");
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
   .andReturn(entry);
 org.easymock.EasyMock.expect(service.updateActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(entry), eq("testObject"), eq(token))).andReturn(Futures.immediateFuture((ActivityEntry) null));
 replay();
 Future<?> future = operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivityEntry), token, converter);
 assertNull(future.get());
 verify();
 reset();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandlePost() throws Exception {
 String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";
 String path = "/activitystreams/john.doe/@self/@app";
 RestHandler operation = registry.getRestHandler(path, "POST");
 ActivityEntry entry = new ActivityEntryImpl();
 org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
   .andReturn(entry);
 org.easymock.EasyMock.expect(service.createActivityEntry(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
   eq(entry), eq(token))).andReturn(Futures.immediateFuture((ActivityEntry) null));
 replay();
 Future<?> future = operation.execute(Maps.<String, String[]>newHashMap(),
   new StringReader(jsonActivityEntry), token, converter);
 assertNull(future.get());
 verify();
 reset();
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Test
public void testHandleDelete() throws Exception {
 String path = "/activitystreams/john.doe/@self/@app/myObjectId123";
 RestHandler operation = registry.getRestHandler(path, "DELETE");
 org.easymock.EasyMock.expect(service.deleteActivityEntries(eq(JOHN_DOE.iterator().next()),
   eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.of("myObjectId123")),
   eq(token))).andReturn(Futures.immediateFuture((Void) null));
 replay();
 assertNull(operation.execute(Maps.<String, String[]>newHashMap(), null,
   token, converter).get());
 verify();
 reset();
}
org.apache.shindig.social.opensocial.spiActivityStreamService

Javadoc

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

Most used methods

  • createActivityEntry
    Creates the passed in activity for the passed in user and group. Once createActivity is called, getA
  • deleteActivityEntries
    Deletes the activity for the passed in user and group that corresponds to the activityId.
  • getActivityEntries
    Returns a set of activities for the passed in user and group that corresponds to a list of activityI
  • getActivityEntry
    Returns an activity for the passed in user and group that corresponds to a single activityId.
  • updateActivityEntry
    Updates the specified Activity.

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Reference (javax.naming)
  • 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
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now