예제 #1
0
  @Override
  public void updateLocation(String userToken, double latitude, double longitude, Date time) {

    Location location = new Location(latitude, longitude, time);

    // TODO: side effect, move it to a separate method
    User user = userDAO.findByToken(userToken);
    if (user == null) {
      user = new User(userToken, location);
    }

    user.setLocation(location);
    userDAO.store(user);
  }
예제 #2
0
  @Override
  public void updatePreferences(String userToken, Long itemId, float score) {

    User user = userDAO.findByToken(userToken);
    if (user != null) {
      Preference preference = preferenceDAO.findForUserByItemId(user.getId(), itemId);
      if (preference != null) {
        preference.setScore(score);
        preferenceDAO.store(preference);
      }
    }
  }
예제 #3
0
 @Override
 public User findUser(String userToken) {
   return userDAO.findByToken(userToken);
 }