コード例 #1
0
  @Override
  public void updateUserScore(String email, int score) {
    try {
      UsersDAO usersDAO = new UsersDAO(connectionUsers);
      usersDAO.updateUserScore(email, score);

    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
 @Override
 public Collection<UserProfile> getAllUsers() {
   try {
     UsersDAO usersDAO = new UsersDAO(connectionUsers);
     return usersDAO.getAllUsers();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return null;
 }
コード例 #3
0
 @Override
 public int getUsersCount() {
   try {
     UsersDAO usersDAO = new UsersDAO(connectionUsers);
     return usersDAO.getUsersCount();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return 0;
 }
コード例 #4
0
 @Override
 public boolean isUserExist(String email) {
   try {
     UsersDAO usersDAO = new UsersDAO(connectionUsers);
     return usersDAO.isUserExists(email);
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return false;
 }
コード例 #5
0
 @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();
     }
   }
 }
コード例 #6
0
  @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;
  }