Exemplo n.º 1
0
  @Override
  public User getUser(User user) {
    User dbUser;
    Session session = sessionFactory.getCurrentSession();
    @SuppressWarnings("JpaQlInspection")
    Query q = session.createQuery("from User u where u.email = :email and u.password = :password");
    q.setParameter("email", user.getEmail());
    q.setParameter("password", user.getPassword());
    dbUser = (User) q.uniqueResult();

    return dbUser;
  }
Exemplo n.º 2
0
 @Override
 public Player getActivePlayer(User user, Game game) {
   for (Player p : user.getProfile().getPlayers()) {
     for (Player gamePlayer : game.getPlayers()) {
       if (gamePlayer.getPlayerId() == p.getPlayerId()) {
         return gamePlayer;
       }
     }
   }
   throw new SpaceCrackUnexpectedException("This user isn't playing this game");
 }
Exemplo n.º 3
0
 @Override
 public List<Game> getGames(User user) {
   return gameRepository.getGamesByProfile(user.getProfile());
 }