Exemple #1
0
  private List<org.apache.rave.model.Person> getGroupMembersFromRepository(
      CollectionOptions collectionOptions, String groupId, String appId) {

    String filter = collectionOptions == null ? null : collectionOptions.getFilter();
    List<org.apache.rave.model.Person> current;

    if (filter == null
        || filter.equals(PersonService.ALL_FILTER)
        || filter.equals(PersonService.TOP_FRIENDS_FILTER)) {
      current = repository.findByGroup(groupId);

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

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

      // Represents the default case (filter by field)
    } else {
      current =
          repository.findByGroup(
              groupId,
              filter,
              collectionOptions.getFilterOperation(),
              collectionOptions.getFilterValue());
    }
    return current;
  }
Exemple #2
0
  private List<org.apache.rave.model.Person> getConnectedPeopleFromRepository(
      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.findAllConnectedPeople(userId);

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

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

      // Represents the default case (filter by field)
    } else {
      current =
          repository.findAllConnectedPeople(
              userId,
              filter,
              collectionOptions.getFilterOperation(),
              collectionOptions.getFilterValue());
    }
    return current;
  }
Exemple #3
0
  private org.apache.rave.model.Person getFromRepository(String userId) {

    org.apache.rave.model.Person person = repository.findByUsername(userId);
    if (person == null) {
      throw new ProtocolException(
          HttpServletResponse.SC_NOT_FOUND, "The person with the id " + userId + " was not found.");
    }
    return person;
  }