Example #1
0
 public User findUserByName(String username) {
   for (User user : users) {
     if (user.getUsername().equals(username)) {
       return user;
     }
   }
   return null;
 }
Example #2
0
 public void addUser(User user) {
   if (users.size() > 0) {
     for (int i = users.size() - 1; i >= 0; i--) {
       if (users.get(i).getUsername().equals(user.getUsername())) {
         users.remove(i);
       }
     }
   }
   users.add(user);
 }
Example #3
0
 private static User createUser(
     long id,
     String username,
     String firstName,
     String lastName,
     String email,
     String phone,
     int userStatus) {
   User user = new User();
   user.setId(id);
   user.setUsername(username);
   user.setFirstName(firstName);
   user.setLastName(lastName);
   user.setEmail(email);
   user.setPassword("XXXXXXXXXXX");
   user.setPhone(phone);
   user.setUserStatus(userStatus);
   return user;
 }