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; }
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; }
private CollectionOptions manipulateCollectionOptions( CollectionOptions options, SecurityToken token) { if (options != null && options.getFilterValue() != null) { if (options.getFilterValue().equalsIgnoreCase(AbstractSecurityToken.Keys.OWNER.name())) options.setFilterValue(token.getOwnerId()); else if (options.getFilterValue().equalsIgnoreCase(AbstractSecurityToken.Keys.VIEWER.name())) options.setFilterValue(token.getViewerId()); } return options; }