示例#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
 @Transactional
 public void saveConnection(Connection connection) {
   connectionRepository.save(connection);
 }
示例#5
0
 @Transactional
 public void deleteConnection(User user1, User user2) {
   connectionRepository.deleteConnection(user1, user2);
 }
示例#6
0
 @Transactional
 public void deleteConnection(Connection connection) {
   connectionRepository.delete(connection);
 }
示例#7
0
 /** Checks if user1 and user2 are already connected */
 public boolean isAlreadyConnected(User user1, User user2) {
   return connectionRepository.isConnected(user1, user2);
 }
示例#8
0
 public List<User> getConnectionsByEmail(String email) {
   return connectionRepository.getConnectionsByEmail(email);
 }