Пример #1
0
  public List<User> getConnectionsNotInvitedToChat(String email, int chatId) {

    List<User> connections = connectionRepository.getConnectionsByEmail(email);
    List<User> chatUsers = chatUserRepository.getChatUsersInGroup(chatId);
    return connections
        .stream()
        .filter(user -> !chatUsers.contains(user))
        .collect(Collectors.toList());
  }
Пример #2
0
 public List<User> getConnectionsNotInGroupByGroupIdAndEmail(int groupId, String email) {
   List<User> connectionGroupUsers =
       connectionGroupUserRepository.getUsersInConnectionGroup(groupId);
   List<User> connections = connectionRepository.getConnectionsByEmail(email);
   return connections
       .stream()
       .filter(user -> !connectionGroupUsers.contains(user))
       .collect(Collectors.toList());
 }
Пример #3
0
 public List<User> getConnectionsNotInvited(String email, Integer eventId) {
   List<User> list = connectionRepository.getConnectionsByEmail(email);
   Event event = eventRepository.findOne(eventId);
   for (EventInvite invite : event.getEventInvites()) {
     if (list.contains(invite.getUserInvited())) {
       list.remove(invite.getUserInvited());
     }
   }
   if (list.contains(event.getCreator())) {
     list.remove(event.getCreator());
   }
   return list;
 }
Пример #4
0
 public List<User> getConnectionsByEmail(String email) {
   return connectionRepository.getConnectionsByEmail(email);
 }