示例#1
0
 @Override
 public List<org.apache.rave.model.Person> getPeople(
     Set<UserId> userIds,
     GroupId groupId,
     CollectionOptions collectionOptions,
     SecurityToken token) {
   switch (groupId.getType()) {
     case all:
       return getUniqueListOfConnectedPeople(userIds, collectionOptions, token);
     case friends:
       return getUniqueListOfFriends(userIds, collectionOptions, token);
     case objectId:
       return getGroupMembersFromRepository(
           collectionOptions, groupId.getObjectId().toString(), token.getAppId());
     case self:
       UserId id =
           userIds.size() == 1 ? userIds.iterator().next() : new UserId(UserId.Type.me, null);
       return Lists.newArrayList(getPersonForId(id, token));
     case custom:
       throw new ProtocolException(
           HttpServletResponse.SC_NOT_IMPLEMENTED,
           "Custom GroupIDs are not tracked by the container");
     default:
       throw new ProtocolException(
           HttpServletResponse.SC_BAD_REQUEST, "Invalid group id specified by request");
   }
 }
示例#2
0
  private List<org.apache.rave.model.Person> getUniqueListOfFriends(
      Set<UserId> userIds, CollectionOptions collectionOptions, SecurityToken token) {

    List<org.apache.rave.model.Person> people = new ArrayList<org.apache.rave.model.Person>();
    for (UserId id : userIds) {
      org.apache.rave.model.Person person = this.getPersonForId(id, token);
      CollectionUtils.addUniqueValues(
          getFriendsFromRepository(collectionOptions, token.getAppId(), person.getUsername()),
          people);
    }
    return people;
  }