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