@Override public void updateUserScore(String email, int score) { try { UsersDAO usersDAO = new UsersDAO(connectionUsers); usersDAO.updateUserScore(email, score); } catch (SQLException e) { e.printStackTrace(); } }
@Override public Collection<UserProfile> getAllUsers() { try { UsersDAO usersDAO = new UsersDAO(connectionUsers); return usersDAO.getAllUsers(); } catch (SQLException e) { e.printStackTrace(); } return null; }
@Override public int getUsersCount() { try { UsersDAO usersDAO = new UsersDAO(connectionUsers); return usersDAO.getUsersCount(); } catch (SQLException e) { e.printStackTrace(); } return 0; }
@Override public boolean isUserExist(String email) { try { UsersDAO usersDAO = new UsersDAO(connectionUsers); return usersDAO.isUserExists(email); } catch (SQLException e) { e.printStackTrace(); } return false; }
@Override public void signUpUser(UserProfile user) { try { UsersDAO usersDAO = new UsersDAO(connectionUsers); usersDAO.signUpUser(user); } catch (SQLException e) { if (e.getErrorCode() != DUPLICATE_ENTRY_ERROR_CODE) { e.printStackTrace(); } } }
@Override public UserProfile getUserByEmail(String email) { try { UsersDAO usersDAO = new UsersDAO(connectionUsers); UsersDataSet userDataSet = usersDAO.getByEmail(email); UserProfile user = new UserProfile( userDataSet.getFirstName(), userDataSet.getLastName(), userDataSet.getEmail(), userDataSet.getAvatarUrl()); user.setScore(userDataSet.getScore()); return user; } catch (SQLException e) { e.printStackTrace(); } return null; }