예제 #1
0
  /**
   * gets a player by its PK
   *
   * @param playerPK
   * @return
   */
  public PlayerBean getPlayerByPK(Long playerPK) {
    List entities = null;
    try {
      entities = mDAO.getPlayerByPK(playerPK);
      if (entities.size() > 1) {
        throw new Exception("more than 1 player with same PK" + playerPK);
      }
    } catch (Exception e) {
      logger.error(e.getMessage());
    }

    PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil");
    List playersList = pu.createPlayersList(entities);
    return (PlayerBean) playersList.get(0);
  }
예제 #2
0
  /**
   * gets the active player in a table
   *
   * @param tablePK
   * @return
   */
  public PlayerBean getActivePlayer(Long tablePK) {
    List entities = null;
    try {
      entities = mDAO.getActivePlayer(tablePK);
      if (entities == null || entities.isEmpty()) return null;
      if (entities.size() > 1) {
        throw new Exception("more than 1 player active in table " + tablePK);
      }
    } catch (Exception e) {
      logger.error(e.getMessage());
    }

    PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil");
    List playersList = pu.createPlayersList(entities);
    return (PlayerBean) playersList.get(0);
  }
예제 #3
0
 /**
  * get players by gamePK (not obs)
  *
  * @param gamePK
  * @param isOrderedBySits
  * @return
  */
 public List getPlayersByGame(Long gamePK, boolean isOrderedBySits) {
   List entities = mDAO.getPlayersByGame(gamePK, isOrderedBySits);
   PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil");
   List players = pu.createPlayersList(entities);
   return players;
 }
예제 #4
0
 public List getPlayersByTable(Long tablePK) {
   List entities = mDAO.getPlayersByTable(tablePK);
   PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil");
   List players = pu.createPlayersList(entities);
   return players;
 }
예제 #5
0
 public List getPlayersByName(String name) {
   List entities = mDAO.getPlayersByName(name);
   PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil");
   List players = pu.createPlayersList(entities);
   return players;
 }
예제 #6
0
 public void createNewPlayer(PlayerBean pb) {
   mDAO.createNewPlayer(pb);
 }
예제 #7
0
 public void updatePlayer(PlayerBean pb) {
   mDAO.updatePlayer(pb);
 }