Package org.apache.shindig.social.opensocial.spi

Examples of org.apache.shindig.social.opensocial.spi.UserId


          "A message collection is required");
    }
   
    HandlerPreconditions.requireNotEmpty(messageIds, "No message IDs specified");

    UserId user = request.getUsers().iterator().next();

    return service.deleteMessages(user, msgCollId, messageIds, request.getToken());
  }
View Full Code Here


    CollectionOptions options = new CollectionOptions(request);

    HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
    HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");

    UserId user = request.getUsers().iterator().next();

    if (msgCollId == null) {
      // No message collection specified, return list of message collections
      Set<String> fields = request.getFields(MessageCollection.Field.ALL_FIELDS);
      return service.getMessageCollections(user, fields, options, request.getToken());
View Full Code Here

    List<String> messageIds = request.getListParameter("messageIds");

    HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
    HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");

    UserId user = request.getUsers().iterator().next();


    if (msgCollId == null) {
      // Request to create a new message collection
      MessageCollection msgCollection = request.getTypedParameter("entity", MessageCollection.class);
View Full Code Here

    List<String> messageIds = request.getListParameter("messageIds");

    HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
    HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");

    UserId user = request.getUsers().iterator().next();

    if (msgCollId == null) {
      throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
          "A message collection is required");
    }
View Full Code Here

          return personService.getPeople(userIds, groupId, options, fields, request.getToken());
        }
      } else if (optionalPersonId.size() == 1) {
        // TODO: Add some crazy concept to handle the userId?
        Set<UserId> optionalUserIds = ImmutableSet.of(
            new UserId(UserId.Type.userId, optionalPersonId.iterator().next()));

        Future<RestfulCollection<Person>> people = personService.getPeople(
            optionalUserIds, new GroupId(GroupId.Type.self, null),
            options, fields, request.getToken());
        return FutureUtil.getFirstFromCollection(people);
      } else {
        ImmutableSet.Builder<UserId> personIds = ImmutableSet.builder();
        for (String pid : optionalPersonId) {
          personIds.add(new UserId(UserId.Type.userId, pid));
        }
        // Every other case is a collection response of optional person ids
        return personService.getPeople(personIds.build(), new GroupId(GroupId.Type.self, null),
            options, fields, request.getToken());
      }
View Full Code Here

    bootstrap.tearDown();
  }
 
  @Test
  public void getCanonicalPerson() throws Exception {
     Future<Person> person = this.personServiceDb.getPerson(new UserId(Type.userId, "canonical"), Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
     SpiTestUtil.assertPersonEquals(person.get(), canonical);
  }
View Full Code Here

   */
  public static Set<UserId> buildUserIds(String... userIds) {
    // Set user id list
    Set<UserId> userIdSet = Sets.newHashSet();
    for (String userId: userIds) {
      userIdSet.add(new UserId(Type.userId, userId));
    }
    return userIdSet;
  }
View Full Code Here

  public void setUp() throws Exception {
    token = new FakeGadgetToken();
    messageService = EasyMock.createMock(MessageService.class);
    messageService = EasyMock.createMock(MessageService.class);
    converter = EasyMock.createMock(BeanJsonConverter.class);
    sender = new UserId(UserId.Type.userId, "message.sender");
    recipients = ImmutableList.of("second.recipient", "first.recipient");

    handler = new MessageHandler(messageService);
    registry = new DefaultHandlerRegistry(null, converter,
        new HandlerExecutionListener.NoOpHandler());
View Full Code Here

    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(ImmediateFuture.newInstance(data));
View Full Code Here

    }

    private void testGetPersonData(Set<String> fields, String ownerId, String viewerId, String applicationId,
                                   ApplicationData applicationData, Map<String, String> expectedData) throws Exception {

        Set<UserId> userIds = new HashSet<UserId>(Arrays.asList(new UserId(UserId.Type.userId, VALID_USER_ID)));

        SecurityToken securityToken = getMockSecurityToken(ownerId, viewerId, applicationId, VALID_MODULE_ID);

        List<Person> users = Arrays.asList(validPerson);
        GroupId groupId = new GroupId(GroupId.Type.self, "@self");
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.spi.UserId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.