public interface SequenceProvider
{
    /**
     * Creates new sequence for a given name
     *
     * @param name
     *            of sequence
     * @return next number of sequence
     */
    public UUIDGenerator create(String name);

    /**
     * Create a new sequence for a given name and last number, so the sequence can
     * start with the next number
     *
     * @param name
     * @param number
     */
    public UUIDGenerator create(String name, long number);
} public interface UUIDGenerator
{
    public String generate();
} public interface BlindLevelBO extends TournamentRoundBO
{
    Integer getSmallBlind();

    Integer getBigBlind();

    Integer getAnte();
} public interface PauseBO extends TournamentRoundBO
{
    // no additional methods required
} public interface RankBO
{
    /**
     * @return the identifier (artificial key)
     */
    String getID();

    Integer getFirstPosition();

    Integer getLastPosition();

    BigDecimal getPercentage();

    Money getAmountPerPlayer();

    Money getAmount();
} public interface TournamentBO extends GameBO
{
    /**
     * @return the start date and time of the tournament
     */
    Date getStartTime();

    /**
     * set start date and time of the tournament
     */
    void setStartTime(Date date);

    /**
     * @return name of tournament
     */
    String getName();

    /**
     * Set name of tournament
     */
    void setName(String name);

    /**
     * Creates a new blind level for the tournament
     *
     * @param duration
     * @param smallBlind
     * @param bigBlind
     * @param ante
     * @return
     */
    BlindLevelBO createBlindLevel(int duration, int smallBlind, int bigBlind, int ante);

    /**
     * Creates a new blind level for the tournament
     *
     * @param duration
     * @return
     */
    PauseBO createPause(int duration);

    /**
     * @return rounds of tournament
     */
    List<TournamentRoundBO> getTournamentRounds();

    /**
     * Removes a previously created pause or blind level
     *
     * @param round
     */
    void remove(TournamentRoundBO round);

    /**
     * @return current amount of rebuy (null if no rebuy possible)
     */
    Money getCurrentRebuy();

    /**
     * Defines the upper limit of players per table. This limit has an higher priority than the lower limit.
     *
     * @return maximum amount of player at one table
     */
    int getMaximumNumberOfPlayersPerTable();

    void setMaximumNumberOfPlayersPerTable(int number);

    /**
     * The initial stack size is used to convert the buy in value to chip amount. The ratio is used for re-buy, also.
     *
     * @return initial stack size per player
     */
    int getInitialStacksize();

    void setInitialStacksize(int initialStacksize);

    /**
     * Calculate the stack size of the winner. This includes all initial stacks plus re-buy stacks.
     *
     * @return stack size of the winner
     */
    int getFinalStacksize();

    /**
     * assign all active competitors to tables
     */
    void placePlayersAtTables();

    /**
     * @return tables with assigned competitors
     */
    List<TableBO> getTables();

    /**
     * @return get players, which are inactive but take part of tournament (which are placed)
     */
    List<CompetitorBO> getPlacedCompetitors();

    /**
     * Moves players from tables with more players to smaller tables.
     *
     * @return moved competitors
     */
    Collection<CompetitorBO> levelOutTables();

    /**
     * Registration can be done without buyin, a preparation step for the tournament
     *
     * @param playerBO
     * @return
     */
    CompetitorBO register(PlayerBO playerBO);

    /**
     * Competitor pays the buy-in and is allowed to play (is active afterwards)
     *
     * @param competitorBO
     */
    void buyin(CompetitorBO competitorBO);

    /**
     * Competitor pays additional re-buy and is allowed to play (is still active)
     *
     * @param competitorBO
     */
    void rebuy(CompetitorBO competitorBO);

    /**
     * Player leaves the table and the tournament pays depends on rank (is inactive afterwards).
     *
     * @param competitorBO
     */
    void seatOpen(CompetitorBO competitorBO);

    /**
     * Creates a new rank
     *
     * @param firstPosition
     *            (mandatory)
     * @param lastPosition
     *            (optional)
     * @param percentage
     *            (optional)
     * @param amount
     *            of rank (optional)
     */
    RankBO createRank(int firstPosition, int lastPosition, BigDecimal percentage, BigDecimal amount);

    default RankBO createFixRank(int firstPosition, int lastPosition, BigDecimal amount)
    {
        return createRank(firstPosition, lastPosition, null, amount);
    }

    default RankBO createRank(int firstPosition, int lastPosition, BigDecimal percentage)
    {
        return createRank(firstPosition, lastPosition, percentage, null);
    }

    default RankBO createRank(int firstPosition, int lastPosition)
    {
        return createRank(firstPosition, lastPosition, null, null);
    }

    List<RankBO> getRanks();

    void remove(RankBO rank);

    /**
     * Starts the tournament (current round is set to 0), registration, modifications of ranks, blind levels is not
     * longer possible.
     */
    void start();

    /**
     * @param competitorID
     * @return competitor by given identifier
     */
    CompetitorBO getCompetitorBO(String competitorID);

    /**
     * Defines the amount of rebuy, the currency is defined by the buy in. The {@link TournamentRoundBO} defines that a
     * rebuy is possible.
     *
     * @param rebuy
     *            amount
     */
    void setReBuy(BigDecimal rebuy);

    /**
     * @return the defined rebuy
     */
    Money getReBuy();

    /**
     * @return the current blind level
     *         <li>in case the current level is a pause it will return null
     *         <li>in case the tournament wasn't started yet, it returns the first blind level
     *         <li>in case the tournament is over, it return null
     */
    BlindLevelBO getCurrentBlindLevel();

    /**
     * @return the next blind level
     *         <li>in case the next level is a pause, it will return null
     *         <li>in case the tournament wasn't started yet, it returns the second blind level (in case it's pause then
     *         null)
     *         <li>in case the tournament is over, it return null
     */
    BlindLevelBO getNextBlindLevel();

    /**
     * @return next pause or null in case there is no pause
     */
    PauseBO getNextPause();

    String getGroupRef();

    void setGroupRef(String groupRef);
} public interface TournamentBusinessFactory
{
    CashGameCompetitorBO getCompetitorBO(CompetitorPO competitorPO, CashGameBO cashGameBO);

    CompetitorBO getCompetitorBO(CompetitorPO competitorPO, TournamentBO tournamentBO);

    PlayerBO getPlayerBO(PlayerPO playerPO);

    PlayerBORepository getPlayerBORepository(String accountRef);

    CashGameBO getCashGameBO(TournamentPO tournamentPO);

    TournamentBO getTournamentBO(TournamentPO tournamentPO);

    TournamentBORepository getTournamentBORepository(String accountRef);

    HistoryEntryBO getHistoryBO(HistoryPO historyPO);

    BlindLevelBO getBlindLevelBO(BlindLevelPO blindLevelPO, ITournamentBO tournament);

    PauseBO getPauseBO(BlindLevelPO blindLevelPO, ITournamentBO tournament);

    RankBO getRankBO(RankPO rankPO, TournamentBO tournamentBO);

    ITableBO getTableBO(int tableNo);
} public interface HistoryDao extends Dao<HistoryPO>
{
    /**
     * Add history entry to tournament
     * @param tournamentPO
     * @param playerPO
     * @param date
     * @return
     */
    HistoryPO createAndInsert(TournamentPO tournamentPO, String player, Date date);
} public interface PlayerDao extends Dao<PlayerPO>
{
    /**
     * @param accountRef
     * @param name
     *            of player
     * @return
     */
    public PlayerPO createAndInsert(String accountRef, String externalRef, String name);

    public PlayerPO findByName(String accountRef, String name);

    public PlayerPO findByExternalRef(String accountRef, String externalRef);

    public Collection<PlayerPO> getByAccountRef(String accountRef);
} @Entity
public class BlindLevelPO implements Serializable, IdentifiableEntity
{
    private static final long serialVersionUID = 1L;

    @Id
    @XmlTransient
    private String id;

    @NotNull
    @ManyToOne
    @JoinColumn(name = "tournament", updatable = false)
    @XmlTransient
    private TournamentPO tournament;

    @XmlAttribute
    private Integer smallBlind;

    @XmlAttribute
    private Integer bigBlind;

    @XmlTransient
    private int position;

    @XmlAttribute
    private Integer ante;

    @NotNull
    @XmlAttribute
    private boolean isReBuy= false;

    @NotNull
    @XmlAttribute
    private boolean isPause = false;

    /**
     * Duration in minutes
     */
    @NotNull
    @XmlAttribute
    private Integer duration;

    @Temporal(TemporalType.TIMESTAMP)
    @XmlAttribute
    @XmlJavaTypeAdapter(DateXmlAdapter.class)
    private Date startDate;

    public BlindLevelPO()
    {

    }

    @Override
    @XmlTransient
    public String getId()
    {
        return id;
    }

    @Override
    public void setId(String id)
    {
        this.id = id;
    }

    @XmlTransient
    public TournamentPO getTournamentPO()
    {
        return tournament;
    }

    public void setTournamentPO(TournamentPO tournament)
    {
        this.tournament = tournament;
    }

    @XmlTransient
    public Integer getSmallBlind()
    {
        return smallBlind;
    }

    public void setSmallBlind(Integer smallBlind)
    {
        this.smallBlind = smallBlind;
    }

    @XmlTransient
    public Integer getBigBlind()
    {
        return bigBlind;
    }

    public void setBigBlind(Integer bigBlind)
    {
        this.bigBlind = bigBlind;
    }

    @XmlTransient
    public Integer getAnte()
    {
        return ante;
    }

    public void setAnte(Integer ante)
    {
        this.ante = ante;
    }

    @XmlTransient
    public boolean isPause()
    {
        return isPause;
    }

    public void setPause(boolean isPause)
    {
        this.isPause = isPause;
    }

    @XmlTransient
    public Integer getDuration()
    {
        return duration;
    }

    public void setDuration(Integer duration)
    {
        this.duration = duration;
    }

    @XmlTransient
    public Integer getPosition()
    {
        return position;
    }

    public void setPosition(Integer position)
    {
        this.position = position;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return true;
        }
        if (obj == null)
        {
            return false;
        }
        if (getClass() != obj.getClass())
        {
            return false;
        }
        BlindLevelPO other = (BlindLevelPO)obj;
        if (id == null)
        {
            if (other.id != null)
            {
                return false;
            }
        }
        else if (!id.equals(other.id))
        {
            return false;
        }
        return true;
    }

    @XmlTransient
    public boolean isReBuy()
    {
        return isReBuy;
    }

    public void setReBuy(boolean isRebuy)
    {
        this.isReBuy = isRebuy;
    }

    @XmlTransient
    public Date getStartDate()
    {
        return startDate;
    }

    public void setStartDate(Date startDate)
    {
        this.startDate = startDate;
    }
} @Entity
public class CompetitorPO implements Serializable, IdentifiableEntity
{
    private static final long serialVersionUID = 1L;

    @Id
    @XmlTransient
    private String id;

    @ManyToOne
    @JoinColumn(name = "playerRef", updatable = true)
    @XmlIDREF
    @XmlAttribute(name="playerRef")
    private PlayerPO playerRef;

    @NotNull
    @XmlAttribute(name="player")
    private String player;

    @NotNull
    @ManyToOne
    @JoinColumn(name = "tournament", updatable = false)
    @XmlTransient
    private TournamentPO tournament;

    /**
     * The player is out and was placed at position
     */
    @XmlAttribute
    private Integer position;

    @Embedded
    @AttributeOverrides({ @AttributeOverride(name = "currencyCode", column = @Column(name = "inplayCur")),
                    @AttributeOverride(name = "amount", column = @Column(name = "inplayAmount")) })
    @XmlElement(name="inplay")
    private MoneyPO moneyInPlay;

    @Embedded
    @AttributeOverrides({ @AttributeOverride(name = "currencyCode", column = @Column(name = "resultCur")),
                    @AttributeOverride(name = "amount", column = @Column(name = "resultAmount")) })
    @XmlElement(name="result")
    private MoneyPO moneyResult;

    /**
     * state of player see {@link CompetitorState}
     */
    @NotNull
    @XmlAttribute
    private String state;

    /**
     * The player seats on table
     */
    @XmlAttribute
    private int tableNo = -1;

    /**
     * The player seats at seat on table
     */
    @XmlAttribute
    private int seatNo = -1;


    public CompetitorPO()
    {

    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        CompetitorPO other = (CompetitorPO)obj;
        if (id == null)
        {
            if (other.id != null)
                return false;
        }
        else if (!id.equals(other.id))
            return false;
        return true;
    }

    @Override
    @XmlTransient
    public String getId()
    {
        return id;
    }

    @XmlTransient
    public MoneyPO getMoneyInPlay()
    {
        return moneyInPlay;
    }

    @XmlTransient
    public MoneyPO getMoneyResult()
    {
        return moneyResult;
    }

    @XmlTransient
    public PlayerPO getPlayerPO()
    {
        return playerRef;
    }

    @XmlTransient
    public Integer getPosition()
    {
        return position;
    }

    @XmlTransient
    public TournamentPO getTournamentPO()
    {
        return tournament;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    @Override
    public void setId(String id)
    {
        this.id = id;
    }

    public void setMoneyInPlay(MoneyPO moneyInPlay)
    {
        this.moneyInPlay = moneyInPlay;
    }

    public void setMoneyResult(MoneyPO moneyResult)
    {
        this.moneyResult = moneyResult;
    }

    public void setPlayerPO(PlayerPO playerPO)
    {
        this.playerRef = playerPO;
    }

    public void setPosition(Integer position)
    {
        this.position = position;
    }

    public void setTournamentPO(TournamentPO tournamentPO)
    {
        tournament = tournamentPO;
    }

    @XmlTransient
    public String getState()
    {
        return state;
    }

    public void setState(String state)
    {
        this.state = state;
    }

    @XmlTransient
    public int getTableNo()
    {
        return tableNo;
    }

    public void setTableNo(int tableNo)
    {
        this.tableNo = tableNo;
    }

    @XmlTransient
    public int getSeatNo()
    {
        return seatNo;
    }

    public void setSeatNo(int seatNo)
    {
        this.seatNo = seatNo;
    }

    @XmlTransient
    public String getPlayer()
    {
        return player;
    }

    public void setPlayer(String player)
    {
        this.player = player;
    }
} @Entity
public class HistoryPO implements Serializable, IdentifiableEntity
{
    private static final long serialVersionUID = 1L;

    @Id
    @XmlTransient
    private String id;

    @NotNull
    @XmlAttribute(name="player")
    private String player;

    @NotNull
    @ManyToOne
    @JoinColumn(name = "tournament", updatable = false)
    @XmlTransient
    private TournamentPO tournament;

    /**
     * The player is in play
     */
    @XmlAttribute
    private String actionKey;

    /**
     * The player is out and was placed at position
     */
    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @XmlAttribute
    @XmlJavaTypeAdapter(DateXmlAdapter.class)
    private Date date;

    @Embedded
    @AttributeOverrides({ @AttributeOverride(name = "currencyCode", column = @Column(name = "amountCur")),
        @AttributeOverride(name = "amount", column = @Column(name = "amount")) })
    @XmlElement(name="amount")
    private MoneyPO amount;

    public HistoryPO()
    {

    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        HistoryPO other = (HistoryPO)obj;
        if (id == null)
        {
            if (other.id != null)
                return false;
        }
        else if (!id.equals(other.id))
            return false;
        return true;
    }

    @Override
    @XmlTransient
    public String getId()
    {
        return id;
    }

    @XmlTransient
    public MoneyPO getAmount()
    {
        return amount;
    }

    @XmlTransient
    public String getPlayer()
    {
        return player;
    }

    @XmlTransient
    public TournamentPO getTournamentPO()
    {
        return tournament;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    @Override
    public void setId(String id)
    {
        this.id = id;
    }

    public void setAmount(MoneyPO moneyAmount)
    {
        this.amount = moneyAmount;
    }

    public void setPlayer(String player)
    {
        this.player = player;
    }

    public void setTournamentPO(TournamentPO tournamentPO)
    {
        this.tournament = tournamentPO;
    }

    @XmlTransient
    public String getActionKey()
    {
        return actionKey;
    }

    public void setActionKey(String actionKey)
    {
        this.actionKey = actionKey;
    }

    @XmlTransient
    public Date getDate()
    {
        return date;
    }

    public void setDate(Date date)
    {
        this.date = date;
    }
} @Entity
@NamedQueries(value = {
                @NamedQuery(name = "PlayerPO.findByAccountRef", query = "select a from PlayerPO a where a.accountRef = :accountRef"),
                @NamedQuery(name = "PlayerPO.findByName", query = "select a from PlayerPO a where a.accountRef = :accountRef and a.name = :name"),
                @NamedQuery(name = "PlayerPO.findByExternalRef", query = "select a from PlayerPO a where a.accountRef = :accountRef and a.externalRef = :externalRef")
})
@XmlRootElement(name="player")
public class PlayerPO implements Serializable, IdentifiableEntity
{
    private static final long serialVersionUID = 1L;

    @XmlTransient
    @Id
    private String id;

    @NotNull
    @XmlID
    @XmlAttribute(name="id")
    private String externalRef;

    @NotNull
    private String accountRef;

    @NotNull
    @XmlAttribute
    private String name;

    @XmlAttribute
    private String eMail;

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((accountRef == null) ? 0 : accountRef.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        PlayerPO other = (PlayerPO)obj;
        if (accountRef == null)
        {
            if (other.accountRef != null)
                return false;
        }
        else if (!accountRef.equals(other.accountRef))
            return false;
        if (name == null)
        {
            if (other.name != null)
                return false;
        }
        else if (!name.equals(other.name))
            return false;
        return true;
    }

    @OneToMany(mappedBy = "playerRef")
    @XmlTransient
    private Set<CompetitorPO> competitors = new HashSet<>();

    public PlayerPO()
    {
    }

    @XmlTransient
    public String getAccountRef()
    {
        return accountRef;
    }

    @XmlTransient
    public Set<CompetitorPO> getCompetitors()
    {
        return competitors;
    }

    @Override
    @XmlTransient
    public String getId()
    {
        return id;
    }

    @XmlTransient
    public String getName()
    {
        return name;
    }

    public void setAccountRef(String accountRef)
    {
        this.accountRef = accountRef;
    }

    public void setCompetitors(Set<CompetitorPO> competitors)
    {
        this.competitors = competitors;
    }

    @Override
    public void setId(String id)
    {
        this.id = id;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @XmlTransient
    public String getExternalRef()
    {
        return externalRef;
    }

    public void setExternalRef(String externalRef)
    {
        this.externalRef = externalRef;
    }

    @XmlTransient
    public String getEMail()
    {
        return eMail;
    }

    public void setEMail(String eMail)
    {
        this.eMail = eMail;
    }

} @Entity
public class RankPO implements Serializable, IdentifiableEntity
{
    private static final long serialVersionUID = 1L;

    @Id
    @XmlTransient
    private String id;

    @NotNull
    @ManyToOne
    @JoinColumn(name = "tournament", updatable = false)
    @XmlTransient
    private TournamentPO tournament;

    @XmlAttribute
    private int firstPosition;
    @XmlAttribute
    private int lastPosition;
    @XmlAttribute
    @Column(precision=10, scale=4)
    private BigDecimal percentage; // 0.5 for 50%
    @XmlAttribute
    @Column(precision=10, scale=4)
    private BigDecimal amount;

    @Override
    @XmlTransient
    public String getId()
    {
        return id;
    }

    @Override
    public void setId(String id)
    {
        this.id = id;
    }

    @XmlTransient
    public int getFirstPosition()
    {
        return firstPosition;
    }

    public void setFirstPosition(int firstPosition)
    {
        this.firstPosition = firstPosition;
    }

    @XmlTransient
    public int getLastPosition()
    {
        return lastPosition;
    }

    public void setLastPosition(int lastPosition)
    {
        this.lastPosition = lastPosition;
    }

    @XmlTransient
    public BigDecimal getPercentage()
    {
        return percentage;
    }

    public void setPercentage(BigDecimal percentage)
    {
        this.percentage = percentage;
    }

    /**
     * Amount per player
     * @return
     */
    @XmlTransient
    public BigDecimal getAmount()
    {
        return amount;
    }

    public void setAmount(BigDecimal amount)
    {
        this.amount = amount;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return true;
        }
        if (obj == null)
        {
            return false;
        }
        if (getClass() != obj.getClass())
        {
            return false;
        }
        RankPO other = (RankPO)obj;
        if (id == null)
        {
            if (other.id != null)
            {
                return false;
            }
        }
        else if (!id.equals(other.id))
        {
            return false;
        }
        return true;
    }

    @XmlTransient
    public TournamentPO getTournament()
    {
        return tournament;
    }

    public void setTournament(TournamentPO tournament)
    {
        this.tournament = tournament;
    }

} @Entity
@NamedQueries(value = {
                @NamedQuery(name = "TournamentPO.findByAccountRef", query = "select a from TournamentPO a where a.accountRef = :accountRef"),
                @NamedQuery(name = "TournamentPO.findByExternalRef", query = "select a from TournamentPO a where a.accountRef = :accountRef and a.externalRef = :externalRef") })
public class TournamentPO implements Serializable, IdentifiableEntity
{
    private static final long serialVersionUID = 1L;

    @Id
    @XmlTransient
    private String id;

    @NotNull
    @XmlID
    @XmlAttribute(name = "id")
    private String externalRef;

    @NotNull
    private String accountRef;
    @NotNull
    @XmlAttribute
    private boolean isCashGame;
    @NotNull
    private String name;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @XmlAttribute
    @XmlJavaTypeAdapter(DateXmlAdapter.class)
    private Date date;

    @Embedded
    @AttributeOverrides({ @AttributeOverride(name = "currencyCode", column = @Column(name = "buyInCur")),
                    @AttributeOverride(name = "amount", column = @Column(name = "buyInAmount")) })
    private MoneyPO buyIn;

    @Embedded
    @AttributeOverrides({ @AttributeOverride(name = "currencyCode", column = @Column(name = "reBuyCur")),
                    @AttributeOverride(name = "amount", column = @Column(name = "reBuyAmount")) })
    private MoneyPO reBuy;

    @OneToMany(mappedBy = "tournament", cascade=CascadeType.ALL)
    @XmlElement(name = "blindLevel")
    private List<BlindLevelPO> blindLevels = new ArrayList<>();

    @OneToMany(mappedBy = "tournament", cascade=CascadeType.ALL)
    @XmlElement(name = "rank")
    private List<RankPO> ranks = new ArrayList<>();

    @OneToMany(mappedBy = "tournament")
    @XmlElement(name = "competitor")
    private Set<CompetitorPO> competitors = new HashSet<>();

    @OneToMany(mappedBy = "tournament")
    @XmlElement(name = "historyEntry")
    private List<HistoryPO> historyEntries = new ArrayList<>();

    @NotNull
    @XmlAttribute
    private int maxPlayerPerTable = 10;

    @NotNull
    @XmlAttribute
    private int initialStacksize= 1000;

    @NotNull
    @XmlAttribute
    private int currentRound = -1;

    @NotNull
    private String groupRef;

    public TournamentPO()
    {
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        TournamentPO other = (TournamentPO)obj;
        if (id == null)
        {
            if (other.id != null)
                return false;
        }
        else if (!id.equals(other.id))
            return false;
        return true;
    }

    @XmlTransient
    public String getAccountRef()
    {
        return accountRef;
    }

    public MoneyPO getBuyIn()
    {
        return buyIn;
    }

    @XmlTransient
    public Set<CompetitorPO> getCompetitors()
    {
        return competitors;
    }

    @XmlTransient
    public Date getDate()
    {
        return date;
    }

    @XmlTransient
    @Override
    public String getId()
    {
        return id;
    }

    @XmlTransient
    public String getName()
    {
        return name;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    public void setAccountRef(String accountRef)
    {
        this.accountRef = accountRef;
    }

    public void setBuyIn(MoneyPO buyIn)
    {
        this.buyIn = buyIn;
    }

    public void setCompetitors(Set<CompetitorPO> competitors)
    {
        this.competitors = competitors;
    }

    public void setDate(Date date)
    {
        this.date = date;
    }

    @Override
    public void setId(String id)
    {
        this.id = id;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @XmlTransient
    public boolean isCashGame()
    {
        return isCashGame;
    }

    public void setCashGame(boolean isCashGame)
    {
        this.isCashGame = isCashGame;
    }

    @XmlTransient
    public List<HistoryPO> getHistoryEntries()
    {
        return historyEntries;
    }

    public void setHistoryEntries(List<HistoryPO> historyEntries)
    {
        this.historyEntries = historyEntries;
    }

    @XmlTransient
    public List<BlindLevelPO> getBlindLevels()
    {
        return blindLevels;
    }

    public void setBlindLevels(List<BlindLevelPO> blindLevels)
    {
        this.blindLevels = blindLevels;
    }

    @XmlTransient
    public int getMaxPlayerPerTable()
    {
        return maxPlayerPerTable;
    }

    public void setMaxPlayerPerTable(int maxPlayerPerTable)
    {
        this.maxPlayerPerTable = maxPlayerPerTable;
    }

    @XmlTransient
    public int getCurrentRound()
    {
        return currentRound;
    }

    public void setCurrentRound(int currentRound)
    {
        this.currentRound = currentRound;
    }

    @XmlTransient
    public String getExternalRef()
    {
        return externalRef;
    }

    public void setExternalRef(String externalRef)
    {
        this.externalRef = externalRef;
    }

    @XmlTransient
    public List<RankPO> getRanks()
    {
        return ranks;
    }

    public void setRanks(List<RankPO> ranks)
    {
        this.ranks = ranks;
    }

    @XmlTransient
    public int getInitialStacksize()
    {
        return initialStacksize;
    }

    public void setInitialStacksize(int initialStacksize)
    {
        this.initialStacksize = initialStacksize;
    }

    public MoneyPO getReBuy()
    {
        return reBuy;
    }

    public void setReBuy(MoneyPO reBuy)
    {
        this.reBuy = reBuy;
    }

    public String getGroupRef()
    {
        return groupRef;
    }

    public void setGroupRef(String groupRef)
    {
        this.groupRef = groupRef;
    }
}
import java.util.Date;
import javax.inject.Inject;
import com.google.inject.Provider;
import de.hatoka.common.capi.dao.SequenceProvider;
import de.hatoka.common.capi.dao.TransactionProvider;
import de.hatoka.common.capi.dao.UUIDGenerator;
import de.hatoka.tournament.capi.business.BlindLevelBO;
import de.hatoka.tournament.capi.business.CashGameBO;
import de.hatoka.tournament.capi.business.CashGameCompetitorBO;
import de.hatoka.tournament.capi.business.CompetitorBO;
import de.hatoka.tournament.capi.business.HistoryEntryBO;
import de.hatoka.tournament.capi.business.PauseBO;
import de.hatoka.tournament.capi.business.PlayerBO;
import de.hatoka.tournament.capi.business.PlayerBORepository;
import de.hatoka.tournament.capi.business.RankBO;
import de.hatoka.tournament.capi.business.TournamentBO;
import de.hatoka.tournament.capi.business.TournamentBORepository;
import de.hatoka.tournament.capi.business.TournamentBusinessFactory;
import de.hatoka.tournament.capi.dao.BlindLevelDao;
import de.hatoka.tournament.capi.dao.CompetitorDao;
import de.hatoka.tournament.capi.dao.HistoryDao;
import de.hatoka.tournament.capi.dao.PlayerDao;
import de.hatoka.tournament.capi.dao.RankDao;
import de.hatoka.tournament.capi.dao.TournamentDao;
import de.hatoka.tournament.capi.entities.BlindLevelPO;
import de.hatoka.tournament.capi.entities.CompetitorPO;
import de.hatoka.tournament.capi.entities.HistoryPO;
import de.hatoka.tournament.capi.entities.PlayerPO;
import de.hatoka.tournament.capi.entities.RankPO;
import de.hatoka.tournament.capi.entities.TournamentPO;
package de.hatoka.tournament.internal.business;





public class TournamentBusinessFactoryImpl implements TournamentBusinessFactory
{
    @Inject
    private TournamentDao tournamentDao;

    @Inject
    private PlayerDao playerDao;