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()); }
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()); }
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; }
public List<User> getConnectionsByEmail(String email) { return connectionRepository.getConnectionsByEmail(email); }