Commit 4218fe4c by Antti Tönkyrä

II-Match

1 parent f818b38f
package fi.codecrew.moya.model;
import fi.codecrew.moya.model.GenericEntity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* Entity implementation class for Entity: Match
*
*/
@Entity
@Table(name="matches")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Match extends GenericEntity implements Serializable {
private static final long serialVersionUID = 1L;
@OneToMany
private List<Match> sourceMatches;
@ManyToMany
private List<TournamentParticipant> matchParticipants;
@OneToMany
@OrderBy("ranking")
private List<MatchResult> matchResults;
public Match() {
super();
}
}
package fi.codecrew.moya.model;
import java.io.Serializable;
import javax.persistence.*;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* Entity implementation class for Entity: MatchResult
*
*/
@Entity
@Table(name="match_results")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class MatchResult extends GenericEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name="score")
private Integer score;
@Column(name="rank")
private Integer rank;
@JoinColumn(name="tournament_participant")
private TournamentParticipant tournamentParticipant;
public MatchResult() {
super();
}
}
package fi.codecrew.moya.model;
import fi.codecrew.moya.enums.TournamentType;
import fi.codecrew.moya.model.GenericEntity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* Entity implementation class for Entity: Tournament
*
*/
@Entity
@Table(name="tournaments")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Tournament extends GenericEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name="talyn_tournament_id", nullable=true)
private Integer talynTournamentId;
@Column(name="tournament_name")
private String tournamentName;
@Column(name="registration_opens_at")
private Date registrationOpensAt;
@Column(name="registration_closes_at")
private Date registrationClosesAt;
@Column(name="tournament_type")
@Enumerated(EnumType.STRING)
private TournamentType tournamentType;
@JoinColumn(name="tournament_root")
private Match tournamentRoot;
@OneToMany
private List<Tournament> subTournaments;
public Tournament() { super(); }
public Integer getTalynTournamentId() {
return talynTournamentId;
}
public void setTalynTournamentId(Integer talynTournamendId) {
this.talynTournamentId = talynTournamendId;
}
public String getTournamentName() {
return tournamentName;
}
public void setTournamentName(String tournamentName) {
this.tournamentName = tournamentName;
}
public Date getRegistrationOpensAt() {
return registrationOpensAt;
}
public void setRegistrationOpensAt(Date registrationOpensAt) {
this.registrationOpensAt = registrationOpensAt;
}
public Date getRegistrationClosesAt() {
return registrationClosesAt;
}
public void setRegistrationClosesAt(Date registrationClosesAt) {
this.registrationClosesAt = registrationClosesAt;
}
public TournamentType getTournamentType() {
return tournamentType;
}
public void setTournamentType(TournamentType tournamentType) {
this.tournamentType = tournamentType;
}
}
package fi.codecrew.moya.model;
import fi.codecrew.moya.model.GenericEntity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* Entity implementation class for Entity: TournamentParticipant
*
*/
@Entity
@Table(name="tournament_participants")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class TournamentParticipant extends GenericEntity implements Serializable {
private static final long serialVersionUID = 1L;
@JoinColumn(name="participator")
private EventUser participator;
@OneToMany
private List<EventUser> teamMembers;
public TournamentParticipant() {
super();
}
}
package fi.codecrew.moya.enums;
public enum TournamentType {
SINGLE_ELIMINATION,
DOUBLE_ELIMINATION
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!