@Override
    protected void onSubmit() {
      Player player = getModelObject();
      long facebookid = player.getFacebookId();
      if (signIn(player.getUsername(), player.getPassword())) {
        // save facebook id
        player = getPlayer();
        player.setFacebookId(facebookid);
        playerManager.createUpdatePlayer(player);
        setResponsePage(((LeagueFacebookApplication) getApplication()).getLoggedInHomePage());
      } else {

      }
    }
Beispiel #2
0
  public void removePlayerFromLeague(League league, Player player) {
    //		List<PlayerLeague> playerLeagues = hibernateTemplate.find(getPlayerLeagueQuery("", "where
    // playerleague.player.id=? and playerleague.league.id=?"),
    //				new Object[] {player.getId(), league.getId()});
    //		if (!playerLeagues.isEmpty())
    //		{
    //		 hibernateTemplate.delete(playerLeagues.iterator().next());
    //		}
    //		if (!playerLeagues.isEmpty())
    //		{
    //			dao.delete(playerLeagues.iterator().next());
    //		}

    Query query =
        getQuery(
            getPlayerLeagueQuery(
                "", "where playerleague.player.id=? and playerleague.league.id=?"));
    query.setParameter(0, player.getId());
    query.setParameter(1, league.getId());

    List<PlayerLeague> playerLeagues = query.list();

    for (PlayerLeague playerLeague : playerLeagues) {
      Query query2 = getQuery("delete from playerLeague where id = ?");
      query2.setParameter(0, playerLeague.getId());

      query2.executeUpdate();
    }
  }
Beispiel #3
0
  public List<League> findLeaguesByPlayer(Player player) {

    //		return hibernateTemplate.find(getPlayerLeagueQuery("select playerleague.league ", "where
    // playerleague.player.id=? order by playerleague.sortOrder, playerleague.league.id desc"),
    //				player.getId());

    Query query =
        getQuery(
            "select pl.league from PlayerLeague pl where pl.player.id=? order by pl.sortOrder, pl.league.id desc");
    query.setParameter(0, player.getId());

    return query.list();
  }
Beispiel #4
0
  public List<League> findLeaguesByPlayer(Player player, boolean isDisplay) {
    //		return hibernateTemplate.find(getPlayerLeagueQuery("select playerleague.league ", "where
    // playerleague.player.id=? and playerleague.displayInNav=? order by playerleague.sortOrder,
    // playerleague.league.id desc"),
    //			new Object[]{player.getId(), isDisplay});

    Query query =
        getQuery(
            getPlayerLeagueQuery(
                "select playerleague.league ",
                "where playerleague.player.id=? and playerleague.displayInNav=? order by playerleague.sortOrder, playerleague.league.id desc"));
    query.setParameter(0, player.getId());
    query.setParameter(1, isDisplay);

    return query.list();
  }