Commit 069d20a8 by Tuomas Riihimäki

Eventuser entitymuutokset

1 parent 79ff9107
...@@ -64,7 +64,7 @@ public class AccountEvent extends GenericEntity { ...@@ -64,7 +64,7 @@ public class AccountEvent extends GenericEntity {
* to that foodwave. * to that foodwave.
*/ */
@JoinColumn(name = "food_wave_id", referencedColumnName = "id") @JoinColumn(name = "food_wave_id", referencedColumnName = FoodWave.ID_COLUMN)
@ManyToOne @ManyToOne
private FoodWave foodWave; private FoodWave foodWave;
...@@ -72,23 +72,23 @@ public class AccountEvent extends GenericEntity { ...@@ -72,23 +72,23 @@ public class AccountEvent extends GenericEntity {
* The product user has acquired and this this AccountEvent is a reference * The product user has acquired and this this AccountEvent is a reference
* to. * to.
*/ */
@JoinColumn(name = "product_id", referencedColumnName = "id", nullable = false) @JoinColumn(name = "product_id", referencedColumnName = Product.ID_COLUMN, nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Product product; private Product product;
/** /**
* The user that bought the products. * The user that bought the products.
*/ */
@JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false) @JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN, nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User user; private EventUser user;
/** /**
* Who sold the items to the user. * Who sold the items to the user.
*/ */
@JoinColumn(name = "seller_user_id", referencedColumnName = "id") @JoinColumn(name = "seller_eventuser_id", referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne(optional = true) @ManyToOne(optional = true)
private User seller; private EventUser seller;
/** /**
* What discounts user has for this account event. Some magic is applied to * What discounts user has for this account event. Some magic is applied to
...@@ -111,8 +111,7 @@ public class AccountEvent extends GenericEntity { ...@@ -111,8 +111,7 @@ public class AccountEvent extends GenericEntity {
public AccountEvent() { public AccountEvent() {
} }
public AccountEvent(User u, Product prod, BigDecimal unitPrice, BigDecimal quantity, Calendar eventTime) { public AccountEvent(EventUser u, Product prod, BigDecimal unitPrice, BigDecimal quantity, Calendar eventTime) {
this.setUnitPrice(unitPrice); this.setUnitPrice(unitPrice);
this.setQuantity(quantity); this.setQuantity(quantity);
this.product = prod; this.product = prod;
...@@ -136,11 +135,11 @@ public class AccountEvent extends GenericEntity { ...@@ -136,11 +135,11 @@ public class AccountEvent extends GenericEntity {
this.delivered = delivered; this.delivered = delivered;
} }
public User getUser() { public EventUser getUser() {
return user; return user;
} }
public void setUser(User usersId) { public void setUser(EventUser usersId) {
this.user = usersId; this.user = usersId;
} }
...@@ -168,11 +167,11 @@ public class AccountEvent extends GenericEntity { ...@@ -168,11 +167,11 @@ public class AccountEvent extends GenericEntity {
return product; return product;
} }
public void setSeller(User seller) { public void setSeller(EventUser seller) {
this.seller = seller; this.seller = seller;
} }
public User getSeller() { public EventUser getSeller() {
return seller; return seller;
} }
......
...@@ -129,8 +129,8 @@ public class Bill extends GenericEntity { ...@@ -129,8 +129,8 @@ public class Bill extends GenericEntity {
* User who should pay this bill. * User who should pay this bill.
*/ */
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(updatable = false) @JoinColumn(updatable = false, name = "eventuser_id")
private User user; private EventUser user;
private static final Logger logger = LoggerFactory.getLogger(Bill.class); private static final Logger logger = LoggerFactory.getLogger(Bill.class);
...@@ -180,7 +180,7 @@ public class Bill extends GenericEntity { ...@@ -180,7 +180,7 @@ public class Bill extends GenericEntity {
return total; return total;
} }
public Bill(LanEvent event, User user) { public Bill(LanEvent event, EventUser user) {
this(event); this(event);
this.setUser(user); this.setUser(user);
this.setAddr1(user.getFirstnames() + " " + user.getLastname()); this.setAddr1(user.getFirstnames() + " " + user.getLastname());
...@@ -228,11 +228,11 @@ public class Bill extends GenericEntity { ...@@ -228,11 +228,11 @@ public class Bill extends GenericEntity {
this.accountEvent = accoutEventsId; this.accountEvent = accoutEventsId;
} }
public User getUser() { public EventUser getUser() {
return user; return user;
} }
public void setUser(User usersId) { public void setUser(EventUser usersId) {
this.user = usersId; this.user = usersId;
} }
......
...@@ -72,9 +72,9 @@ public class CompoEntry extends GenericEntity { ...@@ -72,9 +72,9 @@ public class CompoEntry extends GenericEntity {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry") @OneToMany(cascade = CascadeType.ALL, mappedBy = "entry")
private List<CompoEntryParticipant> participants; private List<CompoEntryParticipant> participants;
@JoinColumn(name = "creator_user_id", referencedColumnName = "id") @JoinColumn(name = "creator_eventuser_id", referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne @ManyToOne
private User creator; private EventUser creator;
public CompoEntry() { public CompoEntry() {
super(); super();
...@@ -159,11 +159,11 @@ public class CompoEntry extends GenericEntity { ...@@ -159,11 +159,11 @@ public class CompoEntry extends GenericEntity {
this.compo = composId; this.compo = composId;
} }
public User getCreator() { public EventUser getCreator() {
return creator; return creator;
} }
public void setCreator(User creator) { public void setCreator(EventUser creator) {
this.creator = creator; this.creator = creator;
} }
......
...@@ -36,9 +36,9 @@ public class CompoEntryParticipant extends GenericEntity { ...@@ -36,9 +36,9 @@ public class CompoEntryParticipant extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar confirmed; private Calendar confirmed;
@JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false, updatable = false) @JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN, nullable = false, updatable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User user; private EventUser user;
public CompoEntry getEntry() { public CompoEntry getEntry() {
return entry; return entry;
...@@ -48,7 +48,7 @@ public class CompoEntryParticipant extends GenericEntity { ...@@ -48,7 +48,7 @@ public class CompoEntryParticipant extends GenericEntity {
this.entry = entry; this.entry = entry;
} }
public CompoEntryParticipant(CompoEntry entry, User participant) { public CompoEntryParticipant(CompoEntry entry, EventUser participant) {
super(); super();
this.entry = entry; this.entry = entry;
this.user = participant; this.user = participant;
...@@ -66,11 +66,11 @@ public class CompoEntryParticipant extends GenericEntity { ...@@ -66,11 +66,11 @@ public class CompoEntryParticipant extends GenericEntity {
this.role = role; this.role = role;
} }
public User getUser() { public EventUser getUser() {
return user; return user;
} }
public void setUser(User user) { public void setUser(EventUser user) {
this.user = user; this.user = user;
} }
......
...@@ -7,7 +7,6 @@ import javax.persistence.CascadeType; ...@@ -7,7 +7,6 @@ import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
...@@ -26,6 +25,62 @@ public class EventUser extends GenericEntity { ...@@ -26,6 +25,62 @@ public class EventUser extends GenericEntity {
protected static final String USER_ID_COLUMN = "user_id"; protected static final String USER_ID_COLUMN = "user_id";
protected static final String EVENT_ID_COLUMN = "event_id"; protected static final String EVENT_ID_COLUMN = "event_id";
@ManyToOne
@JoinColumn(nullable = false, name = USER_ID_COLUMN)
private User user;
@ManyToOne
@JoinColumn(nullable = false, name = EVENT_ID_COLUMN)
private LanEvent event;
private static final long serialVersionUID = 6042691271548196815L;
@OneToMany(mappedBy = "voter", cascade = CascadeType.ALL)
private List<Vote> votes;
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
private List<UserNote> notes;
@ManyToMany(cascade = CascadeType.ALL)
private List<Role> roles = new ArrayList<Role>();
@OneToMany(mappedBy = "user")
private List<CompoEntryParticipant> compoEntryParticipants;
@OneToMany(mappedBy = "creator")
@OrderBy("id")
private List<CompoEntry> compoEntries;
@OneToMany(mappedBy = "creator", cascade = CascadeType.ALL)
private List<PlaceGroup> placeGroups = new ArrayList<PlaceGroup>();
@OneToMany(mappedBy = "user")
private List<GroupMembership> groupMemberships;
/**
* The places this user has registered into.
*/
@OneToMany(mappedBy = "currentUser", fetch = FetchType.LAZY)
@OrderBy(Place.ID_COLUMN)
private List<Place> currentPlaces;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<PrintedCard> printedCards;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
@OrderBy(AccountEvent.ID_COLUMN)
private List<AccountEvent> accountEvents;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
@OrderBy(Bill.ID_COLUMN)
private List<Bill> bills;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "seller")
@OrderBy(AccountEvent.ID_COLUMN)
private List<AccountEvent> soldItems;
@OneToMany(mappedBy = "user")
private List<PollAnswer> pollAnswers;
public User getUser() { public User getUser() {
return user; return user;
} }
...@@ -66,14 +121,6 @@ public class EventUser extends GenericEntity { ...@@ -66,14 +121,6 @@ public class EventUser extends GenericEntity {
this.roles = roles; this.roles = roles;
} }
public List<LogEntry> getLogEntryList() {
return logEntryList;
}
public void setLogEntryList(List<LogEntry> logEntryList) {
this.logEntryList = logEntryList;
}
public List<CompoEntryParticipant> getCompoEntryParticipants() { public List<CompoEntryParticipant> getCompoEntryParticipants() {
return compoEntryParticipants; return compoEntryParticipants;
} }
...@@ -146,14 +193,6 @@ public class EventUser extends GenericEntity { ...@@ -146,14 +193,6 @@ public class EventUser extends GenericEntity {
this.soldItems = soldItems; this.soldItems = soldItems;
} }
public List<EventOrganiser> getEventOrganiser() {
return eventOrganiser;
}
public void setEventOrganiser(List<EventOrganiser> eventOrganiser) {
this.eventOrganiser = eventOrganiser;
}
public List<PollAnswer> getPollAnswers() { public List<PollAnswer> getPollAnswers() {
return pollAnswers; return pollAnswers;
} }
...@@ -162,70 +201,4 @@ public class EventUser extends GenericEntity { ...@@ -162,70 +201,4 @@ public class EventUser extends GenericEntity {
this.pollAnswers = pollAnswers; this.pollAnswers = pollAnswers;
} }
@ManyToOne
@JoinColumn(nullable = false, name = USER_ID_COLUMN)
private User user;
@ManyToOne
@JoinColumn(nullable = false, name = EVENT_ID_COLUMN)
private LanEvent event;
private static final long serialVersionUID = 6042691271548196815L;
@OneToMany(mappedBy = "voter", cascade = CascadeType.ALL)
private List<Vote> votes;
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
private List<UserNote> notes;
@ManyToMany()
@JoinTable(name = "role_memberships", inverseJoinColumns = {
@JoinColumn(name = "role_id", referencedColumnName = Role.ID_COLUMN) },
joinColumns = { @JoinColumn(name = "user_id", referencedColumnName =
"id") })
private List<Role> roles = new ArrayList<Role>();
@OneToMany(mappedBy = "user")
private List<LogEntry> logEntryList;
@OneToMany(mappedBy = "user")
private List<CompoEntryParticipant> compoEntryParticipants;
@OneToMany(mappedBy = "creator")
@OrderBy("id")
private List<CompoEntry> compoEntries;
@OneToMany(mappedBy = "creator", cascade = CascadeType.ALL)
private List<PlaceGroup> placeGroups = new ArrayList<PlaceGroup>();
@OneToMany(mappedBy = "user")
private List<GroupMembership> groupMemberships;
/**
* The places this user has registered into.
*/
@OneToMany(mappedBy = "currentUser", fetch = FetchType.LAZY)
@OrderBy("id")
private List<Place> currentPlaces;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<PrintedCard> printedCards;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
@OrderBy("id")
private List<AccountEvent> accountEvents;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
@OrderBy("id")
private List<Bill> bills;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "seller")
@OrderBy("id")
private List<AccountEvent> soldItems;
@OneToMany(mappedBy = "admin")
private List<EventOrganiser> eventOrganiser;
@OneToMany(mappedBy = "user")
private List<PollAnswer> pollAnswers;
} }
...@@ -53,9 +53,9 @@ public class GroupMembership extends GenericEntity { ...@@ -53,9 +53,9 @@ public class GroupMembership extends GenericEntity {
@JoinColumn(name = "place_reservation_id", referencedColumnName = "id", nullable = true) @JoinColumn(name = "place_reservation_id", referencedColumnName = "id", nullable = true)
private Place placeReservation; private Place placeReservation;
@JoinColumn(name = "user_id", referencedColumnName = "id") @JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne @ManyToOne
private User user; private EventUser user;
@Column(name = "entered_event") @Column(name = "entered_event")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -111,11 +111,11 @@ public class GroupMembership extends GenericEntity { ...@@ -111,11 +111,11 @@ public class GroupMembership extends GenericEntity {
this.placeReservation = placeReservation; this.placeReservation = placeReservation;
} }
public User getUser() { public EventUser getUser() {
return user; return user;
} }
public void setUser(User usersId) { public void setUser(EventUser usersId) {
this.user = usersId; this.user = usersId;
} }
......
...@@ -13,8 +13,6 @@ import javax.persistence.Entity; ...@@ -13,8 +13,6 @@ import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
...@@ -26,10 +24,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -26,10 +24,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/ */
@Entity @Entity
@Table(name = "event_log") @Table(name = "event_log")
@NamedQueries({
@NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"),
@NamedQuery(name = "LogEntry.findByTime", query = "SELECT l FROM LogEntry l WHERE l.time = :time"),
@NamedQuery(name = "LogEntry.findByDescription", query = "SELECT l FROM LogEntry l WHERE l.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LogEntry extends GenericEntity { public class LogEntry extends GenericEntity {
......
...@@ -21,20 +21,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -21,20 +21,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/ */
@Entity @Entity
@Table(name = "places") @Table(name = "places")
// @NamedQueries({
// @NamedQuery(name = "Place.findAll", query = "SELECT p FROM Place p"),
// @NamedQuery(name = "Place.findByDescription", query =
// "SELECT p FROM Place p WHERE p.description = :description"),
// @NamedQuery(name = "Place.findByName", query =
// "SELECT p FROM Place p WHERE p.name = :name"),
// @NamedQuery(name = "Place.findByMapX", query =
// "SELECT p FROM Place p WHERE p.mapX = :mapX"),
// @NamedQuery(name = "Place.findByMapY", query =
// "SELECT p FROM Place p WHERE p.mapY = :mapY"),
// @NamedQuery(name = "Place.findByDetails", query =
// "SELECT p FROM Place p WHERE p.details = :details"),
// @NamedQuery(name = "Place.findByCode", query =
// "SELECT p FROM Place p WHERE p.code = :code") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Place extends GenericEntity { public class Place extends GenericEntity {
...@@ -80,25 +66,25 @@ public class Place extends GenericEntity { ...@@ -80,25 +66,25 @@ public class Place extends GenericEntity {
private PlaceGroup group; private PlaceGroup group;
@ManyToOne @ManyToOne
@JoinColumn(name = "provided_role_id", referencedColumnName = "id") @JoinColumn(name = "provided_role_id", referencedColumnName = Role.ID_COLUMN)
private Role providesRole; private Role providesRole;
@JoinColumn(name = "map_id", referencedColumnName = "id", nullable = false) @JoinColumn(name = "map_id", referencedColumnName = EventMap.ID_COLUMN, nullable = false)
@ManyToOne(optional = false, cascade = CascadeType.ALL) @ManyToOne(optional = false, cascade = CascadeType.ALL)
private EventMap map; private EventMap map;
/** /**
* Which ticket type is this place sold as * Which ticket type is this place sold as
*/ */
@JoinColumn(name = "products_id", referencedColumnName = "id") @JoinColumn(name = "products_id", referencedColumnName = Product.ID_COLUMN)
@ManyToOne() @ManyToOne()
private Product product; private Product product;
/** /**
* Who is the current currentUser (mapped with code printed on the place) of * Who is the current currentUser (mapped with code printed on the place) of
* the place. Used in Vectorama currentUser tracking. * the place. Used in Vectorama currentUser tracking.
*/ */
@JoinColumn(name = "current_user_id", referencedColumnName = "id") @JoinColumn(name = "current_eventuser_id", referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne @ManyToOne
private User currentUser; private EventUser currentUser;
public Place() { public Place() {
super(); super();
...@@ -184,11 +170,11 @@ public class Place extends GenericEntity { ...@@ -184,11 +170,11 @@ public class Place extends GenericEntity {
this.product = productsId; this.product = productsId;
} }
public User getCurrentUser() { public EventUser getCurrentUser() {
return currentUser; return currentUser;
} }
public void setCurrentUser(User usersId) { public void setCurrentUser(EventUser usersId) {
this.currentUser = usersId; this.currentUser = usersId;
} }
......
...@@ -14,8 +14,6 @@ import javax.persistence.Entity; ...@@ -14,8 +14,6 @@ import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OrderBy; import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -30,16 +28,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -30,16 +28,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/ */
@Entity @Entity
@Table(name = "groups") @Table(name = "groups")
@NamedQueries({
@NamedQuery(name = "PlaceGroup.findAll", query = "SELECT p FROM PlaceGroup p"),
@NamedQuery(name = "PlaceGroup.findByCreated", query = "SELECT p FROM PlaceGroup p WHERE p.created = :created"),
// @NamedQuery(name = "PlaceGroup.findByEdited", query =
// "SELECT p FROM PlaceGroup p WHERE p.edited = :edited"),
@NamedQuery(name = "PlaceGroup.findByCode", query = "SELECT p FROM PlaceGroup p WHERE p.code = :code"),
@NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"),
@NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"),
@NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PlaceGroup extends GenericEntity { public class PlaceGroup extends GenericEntity {
...@@ -72,9 +60,9 @@ public class PlaceGroup extends GenericEntity { ...@@ -72,9 +60,9 @@ public class PlaceGroup extends GenericEntity {
@Column(name = "group_details") @Column(name = "group_details")
private String details; private String details;
@JoinColumn(name = "creator_user_id", referencedColumnName = "id") @JoinColumn(name = "creator_eventuser_id", referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne @ManyToOne
private User creator; private EventUser creator;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "placeGroup") @OneToMany(cascade = CascadeType.ALL, mappedBy = "placeGroup")
private List<GroupMembership> members = new ArrayList<GroupMembership>(); private List<GroupMembership> members = new ArrayList<GroupMembership>();
...@@ -143,11 +131,11 @@ public class PlaceGroup extends GenericEntity { ...@@ -143,11 +131,11 @@ public class PlaceGroup extends GenericEntity {
this.details = groupDetails; this.details = groupDetails;
} }
public User getCreator() { public EventUser getCreator() {
return creator; return creator;
} }
public void setCreator(User groupCreator) { public void setCreator(EventUser groupCreator) {
this.creator = groupCreator; this.creator = groupCreator;
} }
......
...@@ -30,12 +30,12 @@ public class PollAnswer extends GenericEntity implements Serializable { ...@@ -30,12 +30,12 @@ public class PollAnswer extends GenericEntity implements Serializable {
private Boolean answerBoolean = false; private Boolean answerBoolean = false;
@ManyToOne @ManyToOne
@JoinColumn(name = "possible_answer_id", referencedColumnName = "id", nullable = false) @JoinColumn(name = "possible_answer_id", referencedColumnName = PossibleAnswer.ID_COLUMN, nullable = false)
private PossibleAnswer choice; private PossibleAnswer choice;
@ManyToOne @ManyToOne
@JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false) @JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN, nullable = false)
private User user; private EventUser user;
public PollAnswer() { public PollAnswer() {
super(); super();
...@@ -83,11 +83,11 @@ public class PollAnswer extends GenericEntity implements Serializable { ...@@ -83,11 +83,11 @@ public class PollAnswer extends GenericEntity implements Serializable {
return choice; return choice;
} }
public void setUser(User user) { public void setUser(EventUser user) {
this.user = user; this.user = user;
} }
public User getUser() { public EventUser getUser() {
return user; return user;
} }
......
...@@ -66,15 +66,15 @@ public class PrintedCard extends GenericEntity { ...@@ -66,15 +66,15 @@ public class PrintedCard extends GenericEntity {
@ManyToOne @ManyToOne
private Location currentLocation; private Location currentLocation;
@JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false) @JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN, nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User user; private EventUser user;
@JoinColumn(nullable = false, name = "card_template_id", referencedColumnName = CardTemplate.ID_COLUMN) @JoinColumn(nullable = false, name = "card_template_id", referencedColumnName = CardTemplate.ID_COLUMN)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private CardTemplate template; private CardTemplate template;
public PrintedCard(User usr, CardTemplate templ, Calendar printTime, boolean cardEnabled) { public PrintedCard(EventUser usr, CardTemplate templ, Calendar printTime, boolean cardEnabled) {
super(); super();
this.event = templ.getEvent(); this.event = templ.getEvent();
this.template = templ; this.template = templ;
...@@ -144,11 +144,11 @@ public class PrintedCard extends GenericEntity { ...@@ -144,11 +144,11 @@ public class PrintedCard extends GenericEntity {
this.currentLocation = currentLocation; this.currentLocation = currentLocation;
} }
public User getUser() { public EventUser getUser() {
return user; return user;
} }
public void setUser(User usersId) { public void setUser(EventUser usersId) {
this.user = usersId; this.user = usersId;
} }
...@@ -173,9 +173,9 @@ public class PrintedCard extends GenericEntity { ...@@ -173,9 +173,9 @@ public class PrintedCard extends GenericEntity {
@Override @Override
public int compare(PrintedCard o1, PrintedCard o2) { public int compare(PrintedCard o1, PrintedCard o2) {
int ret = o2.getGamepoints().compareTo(o1.getGamepoints()); int ret = o2.getGamepoints().compareTo(o1.getGamepoints());
if (ret == 0 && o1.getUser().getNick() != null && o2.getUser().getNick() != null) if (ret == 0 && o1.getUser().getUser().getNick() != null && o2.getUser().getUser().getNick() != null)
{ {
ret = o1.getUser().getNick().compareTo(o2.getUser().getNick()); ret = o1.getUser().getUser().getNick().compareTo(o2.getUser().getUser().getNick());
} }
return ret; return ret;
} }
......
...@@ -40,8 +40,8 @@ public class Role extends GenericEntity { ...@@ -40,8 +40,8 @@ public class Role extends GenericEntity {
@ManyToMany() @ManyToMany()
@JoinTable(name = "role_memberships", @JoinTable(name = "role_memberships",
joinColumns = { @JoinColumn(name = "role_id", referencedColumnName = Role.ID_COLUMN) }, joinColumns = { @JoinColumn(name = "role_id", referencedColumnName = Role.ID_COLUMN) },
inverseJoinColumns = { @JoinColumn(name = "user_id", referencedColumnName = User.ID_COLUMN) }) inverseJoinColumns = { @JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN) })
private List<User> users; private List<EventUser> users;
@ManyToMany(mappedBy = "parents") @ManyToMany(mappedBy = "parents")
private List<Role> children = new ArrayList<Role>(); private List<Role> children = new ArrayList<Role>();
...@@ -109,14 +109,6 @@ public class Role extends GenericEntity { ...@@ -109,14 +109,6 @@ public class Role extends GenericEntity {
this.cardTemplate = cardTemplatesId; this.cardTemplate = cardTemplatesId;
} }
public void setUsers(List<User> users) {
this.users = users;
}
public List<User> getUsers() {
return users;
}
public void setDiscounts(List<Discount> discounts) { public void setDiscounts(List<Discount> discounts) {
this.discounts = discounts; this.discounts = discounts;
} }
...@@ -190,4 +182,12 @@ public class Role extends GenericEntity { ...@@ -190,4 +182,12 @@ public class Role extends GenericEntity {
return permissions; return permissions;
} }
public List<EventUser> getUsers() {
return users;
}
public void setUsers(List<EventUser> users) {
this.users = users;
}
} }
...@@ -14,13 +14,11 @@ public class UserNote extends GenericEntity { ...@@ -14,13 +14,11 @@ public class UserNote extends GenericEntity {
private static final long serialVersionUID = 6128095532481826770L; private static final long serialVersionUID = 6128095532481826770L;
@ManyToOne private static final String EVENTUSER_ID_COLUMN = "eventuser_id";
@JoinColumn(nullable = false)
private User user;
@ManyToOne @ManyToOne
@JoinColumn(nullable = false) @JoinColumn(nullable = false, name = EVENTUSER_ID_COLUMN)
private LanEvent event; private EventUser user;
@Lob @Lob
private String content; private String content;
...@@ -30,22 +28,6 @@ public class UserNote extends GenericEntity { ...@@ -30,22 +28,6 @@ public class UserNote extends GenericEntity {
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private UserNoteType notetype; private UserNoteType notetype;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public String getContent() { public String getContent() {
return content; return content;
} }
...@@ -62,4 +44,12 @@ public class UserNote extends GenericEntity { ...@@ -62,4 +44,12 @@ public class UserNote extends GenericEntity {
this.notetype = notetype; this.notetype = notetype;
} }
public EventUser getUser() {
return user;
}
public void setUser(EventUser user) {
this.user = user;
}
} }
...@@ -27,7 +27,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -27,7 +27,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Vote extends GenericEntity { public class Vote extends GenericEntity {
protected static final String VOTER_USER_ID = "voter_user_id"; protected static final String VOTER_USER_ID = "voter_userevent_id";
protected static final String ENTRY_ID = "entry_id"; protected static final String ENTRY_ID = "entry_id";
private static final long serialVersionUID = 2L; private static final long serialVersionUID = 2L;
...@@ -42,13 +42,13 @@ public class Vote extends GenericEntity { ...@@ -42,13 +42,13 @@ public class Vote extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar time; private Calendar time;
@JoinColumn(name = ENTRY_ID, referencedColumnName = "id", nullable = false) @JoinColumn(name = ENTRY_ID, referencedColumnName = CompoEntry.ID_COLUMN, nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private CompoEntry compoEntry; private CompoEntry compoEntry;
@JoinColumn(name = VOTER_USER_ID, referencedColumnName = "id", nullable = false) @JoinColumn(name = VOTER_USER_ID, referencedColumnName = EventUser.ID_COLUMN, nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User voter; private EventUser voter;
public Vote(LanEvent event, Calendar voteTime) { public Vote(LanEvent event, Calendar voteTime) {
super(); super();
...@@ -90,21 +90,6 @@ public class Vote extends GenericEntity { ...@@ -90,21 +90,6 @@ public class Vote extends GenericEntity {
this.compoEntry = compoEntry; this.compoEntry = compoEntry;
} }
/**
* @return the voter
*/
public User getVoter() {
return voter;
}
/**
* @param voter
* the voter to set
*/
public void setVoter(User voter) {
this.voter = voter;
}
public String getMessage() { public String getMessage() {
return message; return message;
} }
...@@ -112,4 +97,13 @@ public class Vote extends GenericEntity { ...@@ -112,4 +97,13 @@ public class Vote extends GenericEntity {
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;
} }
public EventUser getVoter() {
return voter;
}
public void setVoter(EventUser voter) {
this.voter = voter;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!