Ejemplo n.º 1
0
  private List<org.apache.rave.model.Person> getFriendsFromRepository(
      CollectionOptions collectionOptions, String appId, String userId) {

    String filter = collectionOptions == null ? null : collectionOptions.getFilter();
    List<org.apache.rave.model.Person> current;
    // Currently ignoring TOP FRIENDS as it hasn't been defined what a top friend is
    if (filter == null
        || filter.equals(PersonService.ALL_FILTER)
        || filter.equals(PersonService.TOP_FRIENDS_FILTER)) {
      current = repository.findFriends(userId);

    } else if (filter.equals(PersonService.HAS_APP_FILTER)) {
      current = repository.findFriends(userId, appId);

    } else if (filter.equals(PersonService.IS_WITH_FRIENDS_FILTER)) {
      current = repository.findFriendsWithFriend(userId, collectionOptions.getFilterValue());

      // Represents the default case (filter by field)
    } else {
      current =
          repository.findFriends(
              userId,
              filter,
              collectionOptions.getFilterOperation(),
              collectionOptions.getFilterValue());
    }
    return current;
  }