/** * 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); }
/** * 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); }
/** * 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; }
public List getPlayersByTable(Long tablePK) { List entities = mDAO.getPlayersByTable(tablePK); PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil"); List players = pu.createPlayersList(entities); return players; }
public List getPlayersByName(String name) { List entities = mDAO.getPlayersByName(name); PlayerUtil pu = (PlayerUtil) getBeanFactory().getBean("playerUtil"); List players = pu.createPlayersList(entities); return players; }
public void createNewPlayer(PlayerBean pb) { mDAO.createNewPlayer(pb); }
public void updatePlayer(PlayerBean pb) { mDAO.updatePlayer(pb); }