Commit 3cc07666 by jkj

model cleanup

git-svn-id: https://dev.intra.insomnia.fi/svn/trunk@57 8cf89bec-f6a3-4178-919f-364fb3449fe5
1 parent 945f3aa6
...@@ -24,20 +24,25 @@ import javax.persistence.Version; ...@@ -24,20 +24,25 @@ import javax.persistence.Version;
@Table(name = "access_rights") @Table(name = "access_rights")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "AccessRight.findAll", query = "SELECT a FROM AccessRight a"), @NamedQuery(name = "AccessRight.findAll", query = "SELECT a FROM AccessRight a"),
@NamedQuery(name = "AccessRight.findByAccessRightsId", query = "SELECT a FROM AccessRight a WHERE a.accessRightsId = :accessRightsId"), @NamedQuery(name = "AccessRight.findById", query = "SELECT a FROM AccessRight a WHERE a.id = :id"),
@NamedQuery(name = "AccessRight.findByAccessRight", query = "SELECT a FROM AccessRight a WHERE a.accessRight = :accessRight") }) @NamedQuery(name = "AccessRight.findByName", query = "SELECT a FROM AccessRight a WHERE a.name = :name") })
public class AccessRight implements ModelInterface { public class AccessRight implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "access_rights_id", nullable = false) @Column(name = "access_rights_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "access_right", nullable = false) @Column(name = "right_name", nullable = false)
private String accessRight; private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRightsId")
private List<NewsGroup> newsGroupList; @Column(name = "right_description")
@OneToMany(mappedBy = "accessRightsId") private String description;
private List<RoleRight> roleRightList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "id")
private List<NewsGroup> newsGroups;
@OneToMany(mappedBy = "id")
private List<RoleRight> roleRights;
public Integer getId() { public Integer getId() {
return id; return id;
...@@ -60,31 +65,31 @@ public class AccessRight implements ModelInterface { ...@@ -60,31 +65,31 @@ public class AccessRight implements ModelInterface {
public AccessRight(Integer accessRightsId, String accessRight) { public AccessRight(Integer accessRightsId, String accessRight) {
this.id = accessRightsId; this.id = accessRightsId;
this.accessRight = accessRight; this.name = accessRight;
} }
public String getAccessRight() { public String getAccessRight() {
return accessRight; return name;
} }
public void setAccessRight(String accessRight) { public void setAccessRight(String accessRight) {
this.accessRight = accessRight; this.name = accessRight;
} }
public List<NewsGroup> getNewsGroupList() { public List<NewsGroup> getNewsGroupList() {
return newsGroupList; return newsGroups;
} }
public void setNewsGroupList(List<NewsGroup> newsGroupList) { public void setNewsGroupList(List<NewsGroup> newsGroupList) {
this.newsGroupList = newsGroupList; this.newsGroups = newsGroupList;
} }
public List<RoleRight> getRoleRightList() { public List<RoleRight> getRoleRightList() {
return roleRightList; return roleRights;
} }
public void setRoleRightList(List<RoleRight> roleRightList) { public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRightList = roleRightList; this.roleRights = roleRightList;
} }
@Override @Override
...@@ -111,8 +116,7 @@ public class AccessRight implements ModelInterface { ...@@ -111,8 +116,7 @@ public class AccessRight implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.AccessRight[accessRightsId=" + id return "fi.insomnia.bortal.model.AccessRight[id=" + id + "]";
+ "]";
} }
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
...@@ -123,4 +127,12 @@ public class AccessRight implements ModelInterface { ...@@ -123,4 +127,12 @@ public class AccessRight implements ModelInterface {
return jpaVersionField; return jpaVersionField;
} }
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.math.BigInteger; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -17,6 +17,7 @@ import javax.persistence.ManyToOne; ...@@ -17,6 +17,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
...@@ -24,45 +25,59 @@ import javax.persistence.Version; ...@@ -24,45 +25,59 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "account_events") @Table(name = "account_events")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "AccountEvent.findAll", query = "SELECT a FROM AccountEvent a"), @NamedQuery(name = "AccountEvent.findAll", query = "SELECT a FROM AccountEvent a"),
@NamedQuery(name = "AccountEvent.findByAccountEventsId", query = "SELECT a FROM AccountEvent a WHERE a.accountEventsId = :accountEventsId"), @NamedQuery(name = "AccountEvent.findById", query = "SELECT a FROM AccountEvent a WHERE a.id = :id"),
@NamedQuery(name = "AccountEvent.findByUnitPrice", query = "SELECT a FROM AccountEvent a WHERE a.unitPrice = :unitPrice"), @NamedQuery(name = "AccountEvent.findByUnitPrice", query = "SELECT a FROM AccountEvent a WHERE a.unitPrice = :unitPrice"),
@NamedQuery(name = "AccountEvent.findByUnitCount", query = "SELECT a FROM AccountEvent a WHERE a.unitCount = :unitCount"), @NamedQuery(name = "AccountEvent.findByUnits", query = "SELECT a FROM AccountEvent a WHERE a.units = :units"),
@NamedQuery(name = "AccountEvent.findByEventTime", query = "SELECT a FROM AccountEvent a WHERE a.eventTime = :eventTime"), @NamedQuery(name = "AccountEvent.findByEventTime", query = "SELECT a FROM AccountEvent a WHERE a.eventTime = :eventTime"),
@NamedQuery(name = "AccountEvent.findByDelivered", query = "SELECT a FROM AccountEvent a WHERE a.delivered = :delivered") }) @NamedQuery(name = "AccountEvent.findByDelivered", query = "SELECT a FROM AccountEvent a WHERE a.delivered = :delivered") })
public class AccountEvent implements ModelInterface { public class AccountEvent implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "account_events_id", nullable = false) @Column(name = "account_events_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "unit_price", nullable = false) @Column(name = "unit_price", nullable = false)
private BigInteger unitPrice; private BigDecimal unitPrice;
@Column(name = "unit_count", nullable = false) @Column(name = "unit_count", nullable = false)
private int unitCount; private BigDecimal units;
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date eventTime; private Date eventTime;
@Column(name = "delivered") @Column(name = "delivered")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date delivered; private Date delivered;
@JoinColumn(name = "food_waves_id", referencedColumnName = "food_waves_id") @JoinColumn(name = "food_waves_id", referencedColumnName = "food_waves_id")
@ManyToOne @ManyToOne
private FoodWave foodWavesId; private FoodWave foodWave;
@JoinColumn(name = "products_id", referencedColumnName = "products_id", nullable = false) @JoinColumn(name = "products_id", referencedColumnName = "products_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Product productsId; private Product product;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false) @JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User usersId; private User user;
@OneToMany(mappedBy = "accountEventsId")
private List<DiscountInstance> discountInstanceList; @JoinColumn(name = "seller", referencedColumnName = "users_id", nullable = false)
@OneToMany(mappedBy = "accoutEventsId") @ManyToOne(optional = true)
private List<Bill> billList; private User seller;
@OneToMany(mappedBy = "accountEvent")
private List<DiscountInstance> discountInstances;
@OneToOne
private Bill bill;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -90,30 +105,14 @@ public class AccountEvent implements ModelInterface { ...@@ -90,30 +105,14 @@ public class AccountEvent implements ModelInterface {
this.id = accountEventsId; this.id = accountEventsId;
} }
public AccountEvent(Integer accountEventsId, BigInteger unitPrice, public AccountEvent(Integer accountEventsId, BigDecimal unitPrice,
int unitCount, Date eventTime) { BigDecimal unitCount, Date eventTime) {
this.id = accountEventsId; this.id = accountEventsId;
this.unitPrice = unitPrice; this.setUnitPrice(unitPrice);
this.unitCount = unitCount; this.setUnits(unitCount);
this.eventTime = eventTime; this.eventTime = eventTime;
} }
public BigInteger getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(BigInteger unitPrice) {
this.unitPrice = unitPrice;
}
public int getUnitCount() {
return unitCount;
}
public void setUnitCount(int unitCount) {
this.unitCount = unitCount;
}
public Date getEventTime() { public Date getEventTime() {
return eventTime; return eventTime;
} }
...@@ -130,45 +129,20 @@ public class AccountEvent implements ModelInterface { ...@@ -130,45 +129,20 @@ public class AccountEvent implements ModelInterface {
this.delivered = delivered; this.delivered = delivered;
} }
public FoodWave getFoodWavesId() { public User getUser() {
return foodWavesId; return user;
}
public void setFoodWavesId(FoodWave foodWavesId) {
this.foodWavesId = foodWavesId;
}
public Product getProductsId() {
return productsId;
}
public void setProductsId(Product productsId) {
this.productsId = productsId;
}
public User getUsersId() {
return usersId;
} }
public void setUsersId(User usersId) { public void setUser(User usersId) {
this.usersId = usersId; this.user = usersId;
} }
public List<DiscountInstance> getDiscountInstanceList() { public List<DiscountInstance> getDiscountInstances() {
return discountInstanceList; return discountInstances;
} }
public void setDiscountInstanceList( public void setDiscountInstances(List<DiscountInstance> discountInstanceList) {
List<DiscountInstance> discountInstanceList) { this.discountInstances = discountInstanceList;
this.discountInstanceList = discountInstanceList;
}
public List<Bill> getBillList() {
return billList;
}
public void setBillList(List<Bill> billList) {
this.billList = billList;
} }
@Override @Override
...@@ -180,7 +154,8 @@ public class AccountEvent implements ModelInterface { ...@@ -180,7 +154,8 @@ public class AccountEvent implements ModelInterface {
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are // TODO: Warning - this method won't work in the case the
// id fields are
// not set // not set
if (!(object instanceof AccountEvent)) { if (!(object instanceof AccountEvent)) {
return false; return false;
...@@ -195,8 +170,55 @@ public class AccountEvent implements ModelInterface { ...@@ -195,8 +170,55 @@ public class AccountEvent implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.AccountEvent[accountEventsId=" + id return "fi.insomnia.bortal.model.AccountEvent[id=" + id + "]";
+ "]"; }
public void setFoodWave(FoodWave foodWave) {
this.foodWave = foodWave;
}
public FoodWave getFoodWave() {
return foodWave;
}
public void setProduct(Product product) {
this.product = product;
}
public Product getProduct() {
return product;
}
public void setSeller(User seller) {
this.seller = seller;
}
public User getSeller() {
return seller;
}
public void setBill(Bill bill) {
this.bill = bill;
}
public Bill getBill() {
return bill;
}
public void setUnitPrice(BigDecimal unitPrice) {
this.unitPrice = unitPrice;
}
public BigDecimal getUnitPrice() {
return unitPrice;
}
public void setUnits(BigDecimal units) {
this.units = units;
}
public BigDecimal getUnits() {
return units;
} }
} }
...@@ -15,6 +15,7 @@ import javax.persistence.ManyToOne; ...@@ -15,6 +15,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
...@@ -28,7 +29,7 @@ import javax.persistence.Version; ...@@ -28,7 +29,7 @@ import javax.persistence.Version;
@Table(name = "bills") @Table(name = "bills")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"), @NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"),
@NamedQuery(name = "Bill.findByBillsId", query = "SELECT b FROM Bill b WHERE b.billsId = :billsId"), @NamedQuery(name = "Bill.findByBillsId", query = "SELECT b FROM Bill b WHERE id = :id"),
@NamedQuery(name = "Bill.findByDueDate", query = "SELECT b FROM Bill b WHERE b.dueDate = :dueDate"), @NamedQuery(name = "Bill.findByDueDate", query = "SELECT b FROM Bill b WHERE b.dueDate = :dueDate"),
@NamedQuery(name = "Bill.findByPaidDate", query = "SELECT b FROM Bill b WHERE b.paidDate = :paidDate"), @NamedQuery(name = "Bill.findByPaidDate", query = "SELECT b FROM Bill b WHERE b.paidDate = :paidDate"),
@NamedQuery(name = "Bill.findByReferenceNumber", query = "SELECT b FROM Bill b WHERE b.referenceNumber = :referenceNumber"), @NamedQuery(name = "Bill.findByReferenceNumber", query = "SELECT b FROM Bill b WHERE b.referenceNumber = :referenceNumber"),
...@@ -39,24 +40,31 @@ public class Bill implements ModelInterface { ...@@ -39,24 +40,31 @@ public class Bill implements ModelInterface {
@Id @Id
@Column(name = "bills_id", nullable = false) @Column(name = "bills_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "due_date") @Column(name = "due_date")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date dueDate; private Date dueDate;
@Column(name = "paid_date") @Column(name = "paid_date")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date paidDate; private Date paidDate;
@Column(name = "reference_number") @Column(name = "reference_number")
private String referenceNumber; private String referenceNumber;
@Column(name = "notes") @Column(name = "notes")
private String notes; private String notes;
@OneToMany(mappedBy = "billsId")
private List<BillLine> billLineList; @OneToMany(mappedBy = "bill")
private List<BillLine> billLines;
@JoinColumn(name = "accout_events_id", referencedColumnName = "account_events_id") @JoinColumn(name = "accout_events_id", referencedColumnName = "account_events_id")
@ManyToOne @OneToOne
private AccountEvent accoutEventsId; private AccountEvent accountEvent;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false) @JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User usersId; private User user;
public Integer getId() { public Integer getId() {
return id; return id;
...@@ -109,28 +117,28 @@ public class Bill implements ModelInterface { ...@@ -109,28 +117,28 @@ public class Bill implements ModelInterface {
this.notes = notes; this.notes = notes;
} }
public List<BillLine> getBillLineList() { public List<BillLine> getBillLines() {
return billLineList; return billLines;
} }
public void setBillLineList(List<BillLine> billLineList) { public void setBillLines(List<BillLine> billLineList) {
this.billLineList = billLineList; this.billLines = billLineList;
} }
public AccountEvent getAccoutEventsId() { public AccountEvent getAccountEvent() {
return accoutEventsId; return accountEvent;
} }
public void setAccoutEventsId(AccountEvent accoutEventsId) { public void setAccountEvent(AccountEvent accoutEventsId) {
this.accoutEventsId = accoutEventsId; this.accountEvent = accoutEventsId;
} }
public User getUsersId() { public User getUser() {
return usersId; return user;
} }
public void setUsersId(User usersId) { public void setUser(User usersId) {
this.usersId = usersId; this.user = usersId;
} }
@Override @Override
...@@ -157,7 +165,7 @@ public class Bill implements ModelInterface { ...@@ -157,7 +165,7 @@ public class Bill implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Bill[billsId=" + id + "]"; return "fi.insomnia.bortal.model.Bill[id=" + id + "]";
} }
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -17,14 +19,13 @@ import javax.persistence.Version; ...@@ -17,14 +19,13 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "bill_lines") @Table(name = "bill_lines")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "BillLine.findAll", query = "SELECT b FROM BillLine b"), @NamedQuery(name = "BillLine.findAll", query = "SELECT b FROM BillLine b"),
@NamedQuery(name = "BillLine.findByBillLinesId", query = "SELECT b FROM BillLine b WHERE b.billLinesId = :billLinesId"), @NamedQuery(name = "BillLine.findById", query = "SELECT b FROM BillLine b WHERE id = :id"),
@NamedQuery(name = "BillLine.findByProduct", query = "SELECT b FROM BillLine b WHERE b.product = :product"), @NamedQuery(name = "BillLine.findByProduct", query = "SELECT b FROM BillLine b WHERE b.product = :name"),
@NamedQuery(name = "BillLine.findByUnits", query = "SELECT b FROM BillLine b WHERE b.units = :units"), @NamedQuery(name = "BillLine.findByUnits", query = "SELECT b FROM BillLine b WHERE b.units = :units"),
@NamedQuery(name = "BillLine.findByUnitPrice", query = "SELECT b FROM BillLine b WHERE b.unitPrice = :unitPrice"), @NamedQuery(name = "BillLine.findByUnitPrice", query = "SELECT b FROM BillLine b WHERE b.unitPrice = :unitPrice"),
@NamedQuery(name = "BillLine.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") }) @NamedQuery(name = "BillLine.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") })
...@@ -34,20 +35,21 @@ public class BillLine implements ModelInterface { ...@@ -34,20 +35,21 @@ public class BillLine implements ModelInterface {
@Column(name = "bill_lines_id", nullable = false) @Column(name = "bill_lines_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "product", nullable = false) @Column(name = "name", nullable = false)
private String product; private String name;
@Column(name = "units", nullable = false) @Column(name = "units", nullable = false)
private int units; private BigDecimal units;
@Column(name = "unit_price", nullable = false) @Column(name = "unit_price", nullable = false)
private float unitPrice; private BigDecimal unitPrice;
@Column(name = "vat", nullable = false, columnDefinition = "numeric default 0.22")
private BigDecimal vat;
@Column(name = "vat", nullable = false)
private float vat;
@JoinColumn(name = "bills_id", referencedColumnName = "bills_id") @JoinColumn(name = "bills_id", referencedColumnName = "bills_id")
@ManyToOne @ManyToOne
private Bill billsId; private Bill bill;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
...@@ -60,53 +62,29 @@ public class BillLine implements ModelInterface { ...@@ -60,53 +62,29 @@ public class BillLine implements ModelInterface {
this.id = billLinesId; this.id = billLinesId;
} }
public BillLine(Integer billLinesId, String product, int units, public BillLine(Integer billLinesId, String product, BigDecimal units,
float unitPrice, float vat) { BigDecimal unitPrice, BigDecimal vat) {
this.id = billLinesId; this.id = billLinesId;
this.product = product; this.name = product;
this.units = units; this.setUnits(units);
this.unitPrice = unitPrice; this.setUnitPrice(unitPrice);
this.vat = vat; this.setVat(vat);
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public int getUnits() {
return units;
}
public void setUnits(int units) {
this.units = units;
}
public float getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(float unitPrice) {
this.unitPrice = unitPrice;
} }
public float getVat() { public String getName() {
return vat; return name;
} }
public void setVat(float vat) { public void setName(String product) {
this.vat = vat; this.name = product;
} }
public Bill getBillsId() { public Bill getBill() {
return billsId; return bill;
} }
public void setBillsId(Bill billsId) { public void setBill(Bill billsId) {
this.billsId = billsId; this.bill = billsId;
} }
@Override @Override
...@@ -133,7 +111,7 @@ public class BillLine implements ModelInterface { ...@@ -133,7 +111,7 @@ public class BillLine implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.BillLine[billLinesId=" + id + "]"; return "fi.insomnia.bortal.model.BillLine[id=" + id + "]";
} }
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
...@@ -152,4 +130,28 @@ public class BillLine implements ModelInterface { ...@@ -152,4 +130,28 @@ public class BillLine implements ModelInterface {
this.id = id; this.id = id;
} }
public void setUnits(BigDecimal units) {
this.units = units;
}
public BigDecimal getUnits() {
return units;
}
public void setUnitPrice(BigDecimal price) {
this.unitPrice = price;
}
public BigDecimal getUnitPrice() {
return unitPrice;
}
public void setVat(BigDecimal vat) {
this.vat = vat;
}
public BigDecimal getVat() {
return vat;
}
} }
...@@ -21,30 +21,32 @@ import javax.persistence.Version; ...@@ -21,30 +21,32 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "card_templates") @Table(name = "card_templates")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"), @NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"),
@NamedQuery(name = "CardTemplate.findByCardTemplatesId", query = "SELECT c FROM CardTemplate c WHERE c.cardTemplatesId = :cardTemplatesId"), @NamedQuery(name = "CardTemplate.findById", query = "SELECT c FROM CardTemplate c WHERE c.id = :id"),
@NamedQuery(name = "CardTemplate.findByTemplateName", query = "SELECT c FROM CardTemplate c WHERE c.templateName = :templateName") }) @NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") })
public class CardTemplate implements ModelInterface { public class CardTemplate implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "card_templates_id", nullable = false) @Column(name = "card_templates_id", nullable = false)
private Integer id; private Integer id;
@Lob @Lob
@Column(name = "template_image") @Column(name = "template_image")
private byte[] templateImage; private byte[] image;
@Column(name = "template_name", nullable = false) @Column(name = "template_name", nullable = false)
private String templateName; private String name;
@JoinColumn(name = "events_id", referencedColumnName = "events_id") @JoinColumn(name = "events_id", referencedColumnName = "events_id")
@ManyToOne @ManyToOne
private Event eventsId; private Event event;
@OneToMany(mappedBy = "cardTemplatesId")
private List<Role> roleList; @OneToMany(mappedBy = "cardTemplate")
private List<Role> roles;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
...@@ -59,27 +61,27 @@ public class CardTemplate implements ModelInterface { ...@@ -59,27 +61,27 @@ public class CardTemplate implements ModelInterface {
public CardTemplate(Integer cardTemplatesId, String templateName) { public CardTemplate(Integer cardTemplatesId, String templateName) {
this.id = cardTemplatesId; this.id = cardTemplatesId;
this.templateName = templateName; this.name = templateName;
} }
public byte[] getTemplateImage() { public byte[] getImage() {
return templateImage; return image;
} }
public void setTemplateImage(byte[] templateImage) { public void setImage(byte[] templateImage) {
this.templateImage = templateImage; this.image = templateImage;
} }
public String getTemplateName() { public String getName() {
return templateName; return name;
} }
public void setTemplateName(String templateName) { public void setName(String templateName) {
this.templateName = templateName; this.name = templateName;
} }
public Event getEventsId() { public Event getEvent() {
return eventsId; return event;
} }
public Integer getId() { public Integer getId() {
...@@ -90,16 +92,16 @@ public class CardTemplate implements ModelInterface { ...@@ -90,16 +92,16 @@ public class CardTemplate implements ModelInterface {
this.id = id; this.id = id;
} }
public void setEventsId(Event eventsId) { public void setEvent(Event eventsId) {
this.eventsId = eventsId; this.event = eventsId;
} }
public List<Role> getRoleList() { public List<Role> getRoles() {
return roleList; return roles;
} }
public void setRoleList(List<Role> roleList) { public void setRoles(List<Role> roleList) {
this.roleList = roleList; this.roles = roleList;
} }
@Override @Override
...@@ -126,8 +128,7 @@ public class CardTemplate implements ModelInterface { ...@@ -126,8 +128,7 @@ public class CardTemplate implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.CardTemplate[cardTemplatesId=" + id return "fi.insomnia.bortal.model.CardTemplate[id=" + id + "]";
+ "]";
} }
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
......
...@@ -24,20 +24,20 @@ import javax.persistence.Version; ...@@ -24,20 +24,20 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "compos") @Table(name = "compos")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "Compo.findAll", query = "SELECT c FROM Compo c"), @NamedQuery(name = "Compo.findAll", query = "SELECT c FROM Compo c"),
@NamedQuery(name = "Compo.findByComposId", query = "SELECT c FROM Compo c WHERE c.composId = :composId"), @NamedQuery(name = "Compo.findById", query = "SELECT c FROM Compo c WHERE c.id = :id"),
@NamedQuery(name = "Compo.findByCompoName", query = "SELECT c FROM Compo c WHERE c.compoName = :compoName"), @NamedQuery(name = "Compo.findByCompoName", query = "SELECT c FROM Compo c WHERE c.compoName = :name"),
@NamedQuery(name = "Compo.findByCompoStart", query = "SELECT c FROM Compo c WHERE c.compoStart = :compoStart"), @NamedQuery(name = "Compo.findByCompoStart", query = "SELECT c FROM Compo c WHERE c.compoStart = :startTime"),
@NamedQuery(name = "Compo.findByVoteStart", query = "SELECT c FROM Compo c WHERE c.voteStart = :voteStart"), @NamedQuery(name = "Compo.findByVoteStart", query = "SELECT c FROM Compo c WHERE c.voteStart = :voteStart"),
@NamedQuery(name = "Compo.findByVoteEnd", query = "SELECT c FROM Compo c WHERE c.voteEnd = :voteEnd"), @NamedQuery(name = "Compo.findByVoteEnd", query = "SELECT c FROM Compo c WHERE c.voteEnd = :voteEnd"),
@NamedQuery(name = "Compo.findBySubmitStart", query = "SELECT c FROM Compo c WHERE c.submitStart = :submitStart"), @NamedQuery(name = "Compo.findBySubmitStart", query = "SELECT c FROM Compo c WHERE c.submitStart = :submitStart"),
@NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"), @NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"),
@NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting") }) @NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting"),
@NamedQuery(name = "Compo.findByDescription", query = "SELECT c FROM Compo c WHERE c.description = :description") })
public class Compo implements ModelInterface { public class Compo implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
...@@ -45,30 +45,40 @@ public class Compo implements ModelInterface { ...@@ -45,30 +45,40 @@ public class Compo implements ModelInterface {
private Integer id; private Integer id;
@Column(name = "compo_name", nullable = false) @Column(name = "compo_name", nullable = false)
private String compoName; private String name;
@Column(name = "compo_start") @Column(name = "compo_start")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date compoStart; private Date startTime;
@Column(name = "vote_start") @Column(name = "vote_start")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date voteStart; private Date voteStart;
@Column(name = "vote_end") @Column(name = "vote_end")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date voteEnd; private Date voteEnd;
@Column(name = "submit_start") @Column(name = "submit_start")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date submitStart; private Date submitStart;
@Column(name = "submit_end") @Column(name = "submit_end")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date submitEnd; private Date submitEnd;
@Column(name = "hold_voting", nullable = false) @Column(name = "description")
private String description;
@Column(name = "hold_voting", nullable = false, columnDefinition = "boolean default true")
private boolean holdVoting; private boolean holdVoting;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "composId")
private List<CompoEntry> compoEntryList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "compo")
private List<CompoEntry> compoEntries;
@JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false) @JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Event eventsId; private Event event;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
...@@ -91,24 +101,24 @@ public class Compo implements ModelInterface { ...@@ -91,24 +101,24 @@ public class Compo implements ModelInterface {
public Compo(Integer composId, String compoName, boolean holdVoting) { public Compo(Integer composId, String compoName, boolean holdVoting) {
this.id = composId; this.id = composId;
this.compoName = compoName; this.name = compoName;
this.holdVoting = holdVoting; this.holdVoting = holdVoting;
} }
public String getCompoName() { public String getName() {
return compoName; return name;
} }
public void setCompoName(String compoName) { public void setName(String compoName) {
this.compoName = compoName; this.name = compoName;
} }
public Date getCompoStart() { public Date getStartTime() {
return compoStart; return startTime;
} }
public void setCompoStart(Date compoStart) { public void setStartTime(Date compoStart) {
this.compoStart = compoStart; this.startTime = compoStart;
} }
public Date getVoteStart() { public Date getVoteStart() {
...@@ -151,20 +161,20 @@ public class Compo implements ModelInterface { ...@@ -151,20 +161,20 @@ public class Compo implements ModelInterface {
this.holdVoting = holdVoting; this.holdVoting = holdVoting;
} }
public List<CompoEntry> getCompoEntryList() { public List<CompoEntry> getCompoEntries() {
return compoEntryList; return compoEntries;
} }
public void setCompoEntryList(List<CompoEntry> compoEntryList) { public void setCompoEntries(List<CompoEntry> compoEntryList) {
this.compoEntryList = compoEntryList; this.compoEntries = compoEntryList;
} }
public Event getEventsId() { public Event getEvent() {
return eventsId; return event;
} }
public void setEventsId(Event eventsId) { public void setEvent(Event eventsId) {
this.eventsId = eventsId; this.event = eventsId;
} }
@Override @Override
...@@ -191,7 +201,7 @@ public class Compo implements ModelInterface { ...@@ -191,7 +201,7 @@ public class Compo implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Compo[composId=" + id + "]"; return "fi.insomnia.bortal.model.Compo[id=" + id + "]";
} }
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
...@@ -202,4 +212,12 @@ public class Compo implements ModelInterface { ...@@ -202,4 +212,12 @@ public class Compo implements ModelInterface {
return jpaVersionField; return jpaVersionField;
} }
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
} }
...@@ -17,6 +17,7 @@ import javax.persistence.ManyToOne; ...@@ -17,6 +17,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
...@@ -24,15 +25,14 @@ import javax.persistence.Version; ...@@ -24,15 +25,14 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "entries") @Table(name = "entries")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "CompoEntry.findAll", query = "SELECT c FROM CompoEntry c"), @NamedQuery(name = "CompoEntry.findAll", query = "SELECT c FROM CompoEntry c"),
@NamedQuery(name = "CompoEntry.findByEntriesId", query = "SELECT c FROM CompoEntry c WHERE c.entriesId = :entriesId"), @NamedQuery(name = "CompoEntry.findById", query = "SELECT c FROM CompoEntry c WHERE c.id = :id"),
@NamedQuery(name = "CompoEntry.findByEntryCreated", query = "SELECT c FROM CompoEntry c WHERE c.entryCreated = :entryCreated"), @NamedQuery(name = "CompoEntry.findByEntryCreated", query = "SELECT c FROM CompoEntry c WHERE c.entryCreated = :created"),
@NamedQuery(name = "CompoEntry.findByEntryName", query = "SELECT c FROM CompoEntry c WHERE c.entryName = :entryName"), @NamedQuery(name = "CompoEntry.findByEntryName", query = "SELECT c FROM CompoEntry c WHERE c.entryName = :name"),
@NamedQuery(name = "CompoEntry.findByNotes", query = "SELECT c FROM CompoEntry c WHERE c.notes = :notes"), @NamedQuery(name = "CompoEntry.findByNotes", query = "SELECT c FROM CompoEntry c WHERE c.notes = :notes"),
@NamedQuery(name = "CompoEntry.findByScreenMessage", query = "SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"), @NamedQuery(name = "CompoEntry.findByScreenMessage", query = "SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"),
@NamedQuery(name = "CompoEntry.findBySort", query = "SELECT c FROM CompoEntry c WHERE c.sort = :sort") }) @NamedQuery(name = "CompoEntry.findBySort", query = "SELECT c FROM CompoEntry c WHERE c.sort = :sort") })
...@@ -44,25 +44,39 @@ public class CompoEntry implements ModelInterface { ...@@ -44,25 +44,39 @@ public class CompoEntry implements ModelInterface {
@Column(name = "entry_created", nullable = false) @Column(name = "entry_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date entryCreated; private Date created;
@Column(name = "entry_name", nullable = false) @Column(name = "entry_name", nullable = false)
private String entryName; private String name;
@Column(name = "notes") @Column(name = "notes")
private String notes; private String notes;
@Column(name = "screen_message") @Column(name = "screen_message")
private String screenMessage; private String screenMessage;
@Column(name = "sort") @Column(name = "sort")
private Integer sort; private Integer sort;
@Column(name = "final_position")
private Integer finalPosition;
@OneToOne
private CompoEntryFile currentFile;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "compoEntry") @OneToMany(cascade = CascadeType.ALL, mappedBy = "compoEntry")
private List<Vote> voteList; private List<Vote> votes;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry") @OneToMany(cascade = CascadeType.ALL, mappedBy = "entry")
private List<CompoEntryFile> compoEntryFileList; private List<CompoEntryFile> files;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry") @OneToMany(cascade = CascadeType.ALL, mappedBy = "entry")
private List<CompoEntryParticipant> compoEntryParticipantList; private List<CompoEntryParticipant> participants;
@JoinColumn(name = "compos_id", referencedColumnName = "compos_id", nullable = false) @JoinColumn(name = "compos_id", referencedColumnName = "compos_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Compo composId; private Compo composId;
@JoinColumn(name = "creator", referencedColumnName = "users_id") @JoinColumn(name = "creator", referencedColumnName = "users_id")
@ManyToOne @ManyToOne
private User creator; private User creator;
...@@ -88,24 +102,24 @@ public class CompoEntry implements ModelInterface { ...@@ -88,24 +102,24 @@ public class CompoEntry implements ModelInterface {
public CompoEntry(Integer entriesId, Date entryCreated, String entryName) { public CompoEntry(Integer entriesId, Date entryCreated, String entryName) {
this.id = entriesId; this.id = entriesId;
this.entryCreated = entryCreated; this.created = entryCreated;
this.entryName = entryName; this.name = entryName;
} }
public Date getEntryCreated() { public Date getCreated() {
return entryCreated; return created;
} }
public void setEntryCreated(Date entryCreated) { public void setCreated(Date entryCreated) {
this.entryCreated = entryCreated; this.created = entryCreated;
} }
public String getEntryName() { public String getName() {
return entryName; return name;
} }
public void setEntryName(String entryName) { public void setName(String entryName) {
this.entryName = entryName; this.name = entryName;
} }
public String getNotes() { public String getNotes() {
...@@ -132,29 +146,29 @@ public class CompoEntry implements ModelInterface { ...@@ -132,29 +146,29 @@ public class CompoEntry implements ModelInterface {
this.sort = sort; this.sort = sort;
} }
public List<Vote> getVoteList() { public List<Vote> getVotes() {
return voteList; return votes;
} }
public void setVoteList(List<Vote> voteList) { public void setVotes(List<Vote> voteList) {
this.voteList = voteList; this.votes = voteList;
} }
public List<CompoEntryFile> getCompoEntryFileList() { public List<CompoEntryFile> getFiles() {
return compoEntryFileList; return files;
} }
public void setCompoEntryFileList(List<CompoEntryFile> compoEntryFileList) { public void setFiles(List<CompoEntryFile> compoEntryFileList) {
this.compoEntryFileList = compoEntryFileList; this.files = compoEntryFileList;
} }
public List<CompoEntryParticipant> getCompoEntryParticipantList() { public List<CompoEntryParticipant> getParticipants() {
return compoEntryParticipantList; return participants;
} }
public void setCompoEntryParticipantList( public void setParticipants(
List<CompoEntryParticipant> compoEntryParticipantList) { List<CompoEntryParticipant> compoEntryParticipantList) {
this.compoEntryParticipantList = compoEntryParticipantList; this.participants = compoEntryParticipantList;
} }
public Compo getComposId() { public Compo getComposId() {
...@@ -208,4 +222,20 @@ public class CompoEntry implements ModelInterface { ...@@ -208,4 +222,20 @@ public class CompoEntry implements ModelInterface {
return jpaVersionField; return jpaVersionField;
} }
public void setFinalPosition(Integer finalPosition) {
this.finalPosition = finalPosition;
}
public Integer getFinalPosition() {
return finalPosition;
}
public void setCurrentFile(CompoEntryFile currentFile) {
this.currentFile = currentFile;
}
public CompoEntryFile getCurrentFile() {
return currentFile;
}
} }
...@@ -22,7 +22,6 @@ import javax.persistence.Version; ...@@ -22,7 +22,6 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "entry_files") @Table(name = "entry_files")
...@@ -40,16 +39,19 @@ public class CompoEntryFile implements ModelInterface { ...@@ -40,16 +39,19 @@ public class CompoEntryFile implements ModelInterface {
@Id @Id
@Column(name = "entry_files_id", nullable = false) @Column(name = "entry_files_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "mime_type") @Column(name = "mime_type")
private String mimeType; private String mimeType;
@Column(name = "file_name") @Column(name = "file_name")
private String fileName; private String fileName;
@Column(name = "description") @Column(name = "description")
private String description; private String description;
@Column(name = "hash") @Column(name = "hash")
private String hash; private String hash;
@Column(name = "comment")
private String comment;
@Lob @Lob
@Column(name = "file_data") @Column(name = "file_data")
private byte[] fileData; private byte[] fileData;
...@@ -57,6 +59,7 @@ public class CompoEntryFile implements ModelInterface { ...@@ -57,6 +59,7 @@ public class CompoEntryFile implements ModelInterface {
@Column(name = "uploaded", nullable = false) @Column(name = "uploaded", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date uploaded; private Date uploaded;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false) @JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private CompoEntry entry; private CompoEntry entry;
...@@ -117,14 +120,6 @@ public class CompoEntryFile implements ModelInterface { ...@@ -117,14 +120,6 @@ public class CompoEntryFile implements ModelInterface {
this.hash = hash; this.hash = hash;
} }
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public byte[] getFileData() { public byte[] getFileData() {
return fileData; return fileData;
} }
......
...@@ -17,24 +17,27 @@ import javax.persistence.Version; ...@@ -17,24 +17,27 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "entry_participations") @Table(name = "entry_participations")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "CompoEntryParticipant.findAll", query = "SELECT c FROM CompoEntryParticipant c"), @NamedQuery(name = "CompoEntryParticipant.findAll", query = "SELECT c FROM CompoEntryParticipant c"),
@NamedQuery(name = "CompoEntryParticipant.findByEntryParticipationsId", query = "SELECT c FROM CompoEntryParticipant c WHERE c.entryParticipationsId = :entryParticipationsId"), @NamedQuery(name = "CompoEntryParticipant.findById", query = "SELECT c FROM CompoEntryParticipant c WHERE c.id = :id"),
@NamedQuery(name = "CompoEntryParticipant.findByRole", query = "SELECT c FROM CompoEntryParticipant c WHERE c.role = :role") }) @NamedQuery(name = "CompoEntryParticipant.findByRole", query = "SELECT c FROM CompoEntryParticipant c WHERE c.role = :role") })
public class CompoEntryParticipant implements ModelInterface { public class CompoEntryParticipant implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "entry_participations_id", nullable = false) @Column(name = "entry_participations_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "role") @Column(name = "role")
private String role; private String role;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false) @JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private CompoEntry entry; private CompoEntry entry;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false) @JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User users; private User users;
......
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.math.BigInteger;
import java.util.List; import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
...@@ -20,13 +21,12 @@ import javax.persistence.Version; ...@@ -20,13 +21,12 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "discounts") @Table(name = "discounts")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "Discount.findAll", query = "SELECT d FROM Discount d"), @NamedQuery(name = "Discount.findAll", query = "SELECT d FROM Discount d"),
@NamedQuery(name = "Discount.findByDiscountsId", query = "SELECT d FROM Discount d WHERE d.discountsId = :discountsId"), @NamedQuery(name = "Discount.findByDiscountsId", query = "SELECT d FROM Discount d WHERE d.id = :id"),
@NamedQuery(name = "Discount.findByPercentage", query = "SELECT d FROM Discount d WHERE d.percentage = :percentage"), @NamedQuery(name = "Discount.findByPercentage", query = "SELECT d FROM Discount d WHERE d.percentage = :percentage"),
@NamedQuery(name = "Discount.findByCode", query = "SELECT d FROM Discount d WHERE d.code = :code"), @NamedQuery(name = "Discount.findByCode", query = "SELECT d FROM Discount d WHERE d.code = :code"),
@NamedQuery(name = "Discount.findByDetails", query = "SELECT d FROM Discount d WHERE d.details = :details"), @NamedQuery(name = "Discount.findByDetails", query = "SELECT d FROM Discount d WHERE d.details = :details"),
...@@ -41,29 +41,40 @@ public class Discount implements ModelInterface { ...@@ -41,29 +41,40 @@ public class Discount implements ModelInterface {
@Column(name = "discounts_id", nullable = false) @Column(name = "discounts_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "percentage", nullable = false) @Column(name = "percentage", nullable = false, columnDefinition = "integer default 0")
private BigInteger percentage; private int percentage = 0;
@Column(name = "code") @Column(name = "code")
private String code; private String code;
@Column(name = "details") @Column(name = "details")
private String details; private String details;
@Column(name = "amount_min", nullable = false) @Column(name = "amount_min", nullable = false, columnDefinition = "integer default 0")
private int amountMin; private int amountMin = 0;
@Column(name = "amount_max", nullable = false, columnDefinition = "integer default 0")
private int amountMax = 0;
@Column(name = "active", nullable = false, columnDefinition = "boolean default false")
private boolean active = false;
@Column(name = "amount_max", nullable = false) @Column(name = "max_num", nullable = false, columnDefinition = "integer default 0")
private int amountMax; private int maxNum = 0;
@Column(name = "active", nullable = false) @Column(name = "per_user", nullable = false, columnDefinition = "integer default 0")
private boolean active; private int perUser = 0;
@Column(name = "max_num", nullable = false) @OneToMany(cascade = CascadeType.ALL, mappedBy = "discount")
private int maxNum; private List<DiscountInstance> discountInstances;
@Column(name = "per_user", nullable = false) @JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
private int perUser; @ManyToOne(optional = false)
@OneToMany(cascade = CascadeType.ALL, mappedBy = "discountsId") private Role role;
private List<DiscountInstance> discountInstanceList;
@JoinColumn(name = "products_id", referencedColumnName = "products_id", nullable = false)
@ManyToOne(optional = false)
private Product product;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
...@@ -84,10 +95,10 @@ public class Discount implements ModelInterface { ...@@ -84,10 +95,10 @@ public class Discount implements ModelInterface {
this.id = id; this.id = id;
} }
public Discount(Integer discountsId, BigInteger percentage, int amountMin, public Discount(Integer discountsId, int percentage, int amountMin,
int amountMax, boolean active, int maxNum, int perUser) { int amountMax, boolean active, int maxNum, int perUser) {
this.id = discountsId; this.id = discountsId;
this.percentage = percentage; this.setPercentage(percentage);
this.amountMin = amountMin; this.amountMin = amountMin;
this.amountMax = amountMax; this.amountMax = amountMax;
this.active = active; this.active = active;
...@@ -95,14 +106,6 @@ public class Discount implements ModelInterface { ...@@ -95,14 +106,6 @@ public class Discount implements ModelInterface {
this.perUser = perUser; this.perUser = perUser;
} }
public BigInteger getPercentage() {
return percentage;
}
public void setPercentage(BigInteger percentage) {
this.percentage = percentage;
}
public String getCode() { public String getCode() {
return code; return code;
} }
...@@ -159,13 +162,12 @@ public class Discount implements ModelInterface { ...@@ -159,13 +162,12 @@ public class Discount implements ModelInterface {
this.perUser = perUser; this.perUser = perUser;
} }
public List<DiscountInstance> getDiscountInstanceList() { public List<DiscountInstance> getDiscountInstances() {
return discountInstanceList; return discountInstances;
} }
public void setDiscountInstanceList( public void setDiscountInstances(List<DiscountInstance> discountInstanceList) {
List<DiscountInstance> discountInstanceList) { this.discountInstances = discountInstanceList;
this.discountInstanceList = discountInstanceList;
} }
@Override @Override
...@@ -192,7 +194,7 @@ public class Discount implements ModelInterface { ...@@ -192,7 +194,7 @@ public class Discount implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Discount[discountsId=" + id + "]"; return "fi.insomnia.bortal.model.Discount[id=" + id + "]";
} }
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
...@@ -203,4 +205,28 @@ public class Discount implements ModelInterface { ...@@ -203,4 +205,28 @@ public class Discount implements ModelInterface {
return jpaVersionField; return jpaVersionField;
} }
public void setPercentage(int percentage) {
this.percentage = percentage;
}
public int getPercentage() {
return percentage;
}
public void setRole(Role role) {
this.role = role;
}
public Role getRole() {
return role;
}
public void setProduct(Product product) {
this.product = product;
}
public Product getProduct() {
return product;
}
} }
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -16,28 +18,34 @@ import javax.persistence.Version; ...@@ -16,28 +18,34 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "discount_instances") @Table(name = "discount_instances")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d"), @NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d"),
@NamedQuery(name = "DiscountInstance.findByDiscountsInstancesId", query = "SELECT d FROM DiscountInstance d WHERE d.discountsInstancesId = :discountsInstancesId") }) @NamedQuery(name = "DiscountInstance.findById", query = "SELECT d FROM DiscountInstance d WHERE d.id = :id") })
public class DiscountInstance implements ModelInterface { public class DiscountInstance implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "discounts_instances_id", nullable = false) @Column(name = "discounts_instances_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "create_time", nullable = false, columnDefinition = "timestamptz default now()")
private Date createTime = new Date();
@JoinColumn(name = "account_events_id", referencedColumnName = "account_events_id") @JoinColumn(name = "account_events_id", referencedColumnName = "account_events_id")
@ManyToOne @ManyToOne
private AccountEvent accountEventsId; private AccountEvent accountEvent;
@JoinColumn(name = "discounts_id", referencedColumnName = "discounts_id", nullable = false) @JoinColumn(name = "discounts_id", referencedColumnName = "discounts_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Discount discountsId; private Discount discount;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false) @JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User usersId; private User user;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -49,28 +57,28 @@ public class DiscountInstance implements ModelInterface { ...@@ -49,28 +57,28 @@ public class DiscountInstance implements ModelInterface {
this.id = discountsInstancesId; this.id = discountsInstancesId;
} }
public AccountEvent getAccountEventsId() { public AccountEvent getAccountEvent() {
return accountEventsId; return accountEvent;
} }
public void setAccountEventsId(AccountEvent accountEventsId) { public void setAccountEvent(AccountEvent accountEventsId) {
this.accountEventsId = accountEventsId; this.accountEvent = accountEventsId;
} }
public Discount getDiscountsId() { public Discount getDiscount() {
return discountsId; return discount;
} }
public void setDiscountsId(Discount discountsId) { public void setDiscount(Discount discountsId) {
this.discountsId = discountsId; this.discount = discountsId;
} }
public User getUsersId() { public User getUser() {
return usersId; return user;
} }
public void setUsersId(User usersId) { public void setUser(User usersId) {
this.usersId = usersId; this.user = usersId;
} }
@Override @Override
...@@ -130,4 +138,12 @@ public class DiscountInstance implements ModelInterface { ...@@ -130,4 +138,12 @@ public class DiscountInstance implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField; this.jpaVersionField = jpaVersionField;
} }
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getCreateTime() {
return createTime;
}
} }
...@@ -16,6 +16,7 @@ import javax.persistence.ManyToOne; ...@@ -16,6 +16,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
...@@ -23,7 +24,6 @@ import javax.persistence.Version; ...@@ -23,7 +24,6 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "events") @Table(name = "events")
...@@ -40,34 +40,45 @@ public class Event implements ModelInterface { ...@@ -40,34 +40,45 @@ public class Event implements ModelInterface {
@Id @Id
@Column(name = "events_id", nullable = false) @Column(name = "events_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "start_time") @Column(name = "start_time")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date startTime; private Date startTime;
@Column(name = "end_time") @Column(name = "end_time")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date endTime; private Date endTime;
@Column(name = "name", nullable = false) @Column(name = "name", nullable = false)
private String name; private String name;
@Column(name = "referer") @Column(name = "referer")
private String referer; private String referer;
@JoinColumn(name = "event_settings_id", referencedColumnName = "event_settings_id", nullable = false) @JoinColumn(name = "event_settings_id", referencedColumnName = "event_settings_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private EventSettings eventSettingsId; private EventSettings settings;
@JoinColumn(name = "event_status_id", referencedColumnName = "event_status_id", nullable = false) @JoinColumn(name = "event_status_id", referencedColumnName = "event_status_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private EventStatus eventStatusId; private EventStatus status;
@JoinColumn(name = "default_role", referencedColumnName = "roles_id") @JoinColumn(name = "default_role", referencedColumnName = "roles_id")
@ManyToOne @OneToOne
private Role defaultRole; private Role defaultRole;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId")
private List<Compo> compoList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
@OneToMany(mappedBy = "eventsId") private List<Compo> compos;
private List<CardTemplate> cardTemplateList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId") @OneToMany(mappedBy = "event")
private List<EventMap> eventMapList; private List<CardTemplate> cardTemplates;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId")
private List<Role> roleList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<EventMap> eventMaps;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<Role> roles;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -116,20 +127,20 @@ public class Event implements ModelInterface { ...@@ -116,20 +127,20 @@ public class Event implements ModelInterface {
this.referer = referer; this.referer = referer;
} }
public EventSettings getEventSettingsId() { public EventSettings getSettings() {
return eventSettingsId; return settings;
} }
public void setEventSettingsId(EventSettings eventSettingsId) { public void setSettings(EventSettings eventSettingsId) {
this.eventSettingsId = eventSettingsId; this.settings = eventSettingsId;
} }
public EventStatus getEventStatusId() { public EventStatus getStatus() {
return eventStatusId; return status;
} }
public void setEventStatusId(EventStatus eventStatusId) { public void setStatus(EventStatus eventStatusId) {
this.eventStatusId = eventStatusId; this.status = eventStatusId;
} }
public Role getDefaultRole() { public Role getDefaultRole() {
...@@ -140,36 +151,36 @@ public class Event implements ModelInterface { ...@@ -140,36 +151,36 @@ public class Event implements ModelInterface {
this.defaultRole = defaultRole; this.defaultRole = defaultRole;
} }
public List<Compo> getCompoList() { public List<Compo> getCompos() {
return compoList; return compos;
} }
public void setCompoList(List<Compo> compoList) { public void setCompos(List<Compo> compoList) {
this.compoList = compoList; this.compos = compoList;
} }
public List<CardTemplate> getCardTemplateList() { public List<CardTemplate> getCardTemplates() {
return cardTemplateList; return cardTemplates;
} }
public void setCardTemplateList(List<CardTemplate> cardTemplateList) { public void setCardTemplates(List<CardTemplate> cardTemplateList) {
this.cardTemplateList = cardTemplateList; this.cardTemplates = cardTemplateList;
} }
public List<EventMap> getEventMapList() { public List<EventMap> getEventMaps() {
return eventMapList; return eventMaps;
} }
public void setEventMapList(List<EventMap> eventMapList) { public void setEventMaps(List<EventMap> eventMapList) {
this.eventMapList = eventMapList; this.eventMaps = eventMapList;
} }
public List<Role> getRoleList() { public List<Role> getRoles() {
return roleList; return roles;
} }
public void setRoleList(List<Role> roleList) { public void setRoles(List<Role> roleList) {
this.roleList = roleList; this.roles = roleList;
} }
@Override @Override
......
...@@ -18,33 +18,30 @@ import javax.persistence.Version; ...@@ -18,33 +18,30 @@ import javax.persistence.Version;
/** /**
* *
* @author jkj
*/ */
@Entity @Entity
@Table(name = "event_settings") @Table(name = "event_settings")
@NamedQueries( { @NamedQueries( {
@NamedQuery(name = "EventSettings.findAll", query = "SELECT e FROM EventSettings e"), @NamedQuery(name = "EventSettings.findAll", query = "SELECT e FROM EventSettings e"),
@NamedQuery(name = "EventSettings.findByEventSettingsId", query = "SELECT e FROM EventSettings e WHERE e.eventSettingsId = :eventSettingsId"), @NamedQuery(name = "EventSettings.findById", query = "SELECT e FROM EventSettings e WHERE e.id = :id"),
@NamedQuery(name = "EventSettings.findByResourceBundle", query = "SELECT e FROM EventSettings e WHERE e.resourceBundle = :resourceBundle"), @NamedQuery(name = "EventSettings.findByResourceBundle", query = "SELECT e FROM EventSettings e WHERE e.resourceBundle = :baseName"),
@NamedQuery(name = "EventSettings.findByStyleSheet", query = "SELECT e FROM EventSettings e WHERE e.styleSheet = :styleSheet"), @NamedQuery(name = "EventSettings.findByStyleSheet", query = "SELECT e FROM EventSettings e WHERE e.styleSheet = :styleSheet") })
@NamedQuery(name = "EventSettings.findByNameGeneralForm", query = "SELECT e FROM EventSettings e WHERE e.nameGeneralForm = :nameGeneralForm"),
@NamedQuery(name = "EventSettings.findByNamePossissiveForm", query = "SELECT e FROM EventSettings e WHERE e.namePossissiveForm = :namePossissiveForm") })
public class EventSettings implements ModelInterface { public class EventSettings implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "event_settings_id", nullable = false) @Column(name = "event_settings_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "resource_bundle")
private String resourceBundle; @Column(name = "base_name")
private String baseName;
@Column(name = "style_sheet") @Column(name = "style_sheet")
private String styleSheet; private String styleSheet;
@Column(name = "name_general_form")
private String nameGeneralForm; @OneToMany(cascade = CascadeType.ALL, mappedBy = "settings")
@Column(name = "name_possissive_form") private List<Event> events;
private String namePossissiveForm;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventSettingsId")
private List<Event> eventList;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -56,12 +53,12 @@ public class EventSettings implements ModelInterface { ...@@ -56,12 +53,12 @@ public class EventSettings implements ModelInterface {
this.id = eventSettingsId; this.id = eventSettingsId;
} }
public String getResourceBundle() { public String getBaseName() {
return resourceBundle; return baseName;
} }
public void setResourceBundle(String resourceBundle) { public void setBaseName(String resourceBundle) {
this.resourceBundle = resourceBundle; this.baseName = resourceBundle;
} }
public String getStyleSheet() { public String getStyleSheet() {
...@@ -72,28 +69,12 @@ public class EventSettings implements ModelInterface { ...@@ -72,28 +69,12 @@ public class EventSettings implements ModelInterface {
this.styleSheet = styleSheet; this.styleSheet = styleSheet;
} }
public String getNameGeneralForm() { public List<Event> getEvents() {
return nameGeneralForm; return events;
}
public void setNameGeneralForm(String nameGeneralForm) {
this.nameGeneralForm = nameGeneralForm;
}
public String getNamePossissiveForm() {
return namePossissiveForm;
}
public void setNamePossissiveForm(String namePossissiveForm) {
this.namePossissiveForm = namePossissiveForm;
}
public List<Event> getEventList() {
return eventList;
} }
public void setEventList(List<Event> eventList) { public void setEvents(List<Event> eventList) {
this.eventList = eventList; this.events = eventList;
} }
@Override @Override
...@@ -120,8 +101,7 @@ public class EventSettings implements ModelInterface { ...@@ -120,8 +101,7 @@ public class EventSettings implements ModelInterface {
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.EventSettings[eventSettingsId=" return "fi.insomnia.bortal.model.EventSettings[id=" + getId() + "]";
+ getId() + "]";
} }
/** /**
......
...@@ -36,7 +36,7 @@ public class EventStatus implements ModelInterface { ...@@ -36,7 +36,7 @@ public class EventStatus implements ModelInterface {
@Column(name = "status_name", nullable = false) @Column(name = "status_name", nullable = false)
private String statusName; private String statusName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventStatusId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "status")
private List<Event> eventList; private List<Event> eventList;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
......
...@@ -36,9 +36,11 @@ import javax.persistence.Version; ...@@ -36,9 +36,11 @@ import javax.persistence.Version;
public class Product implements ModelInterface { public class Product implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "products_id", nullable = false) @Column(name = "products_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "product_name") @Column(name = "product_name")
private String productName; private String productName;
...@@ -47,15 +49,23 @@ public class Product implements ModelInterface { ...@@ -47,15 +49,23 @@ public class Product implements ModelInterface {
@Column(name = "sort", nullable = false) @Column(name = "sort", nullable = false)
private int sort; private int sort;
@Column(name = "barcode") @Column(name = "barcode")
private String barcode; private String barcode;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "productsId")
private List<Place> placeList; private List<Place> placeList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "productsId")
private List<AccountEvent> accountEventList; private List<AccountEvent> accountEventList;
@JoinTable(name = "food_wave_templates_products", joinColumns = { @JoinColumn(name = "products_id", referencedColumnName = "products_id") }, inverseJoinColumns = { @JoinColumn(name = "food_wave_templates_id", referencedColumnName = "food_wave_templates_id") }) @JoinTable(name = "food_wave_templates_products", joinColumns = { @JoinColumn(name = "products_id", referencedColumnName = "products_id") }, inverseJoinColumns = { @JoinColumn(name = "food_wave_templates_id", referencedColumnName = "food_wave_templates_id") })
@ManyToMany @ManyToMany
private List<FoodWaveTemplate> foodWaveTemplate; private List<FoodWaveTemplate> foodWaveTemplate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "product")
private List<Discount> discounts;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -192,4 +202,12 @@ public class Product implements ModelInterface { ...@@ -192,4 +202,12 @@ public class Product implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) { public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField; this.jpaVersionField = jpaVersionField;
} }
public void setDiscounts(List<Discount> discounts) {
this.discounts = discounts;
}
public List<Discount> getDiscounts() {
return discounts;
}
} }
...@@ -32,28 +32,37 @@ import javax.persistence.Version; ...@@ -32,28 +32,37 @@ import javax.persistence.Version;
public class Role implements ModelInterface { public class Role implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "roles_id", nullable = false) @Column(name = "roles_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "role_name", nullable = false) @Column(name = "role_name", nullable = false)
private String roleName; private String roleName;
@OneToMany(mappedBy = "defaultRole")
private List<Event> eventList;
@ManyToMany(cascade = CascadeType.ALL) @ManyToMany(cascade = CascadeType.ALL)
private List<User> users; private List<User> users;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId")
private List<RoleInheritance> roleInheritanceList; private List<RoleInheritance> roleInheritanceList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "inherits") @OneToMany(cascade = CascadeType.ALL, mappedBy = "inherits")
private List<RoleInheritance> roleInheritanceList1; private List<RoleInheritance> roleInheritanceList1;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId")
private List<RoleRight> roleRightList; private List<RoleRight> roleRightList;
@JoinColumn(name = "card_templates_id", referencedColumnName = "card_templates_id") @JoinColumn(name = "card_templates_id", referencedColumnName = "card_templates_id")
@ManyToOne @ManyToOne
private CardTemplate cardTemplatesId; private CardTemplate cardTemplatesId;
@JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false) @JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Event eventsId; private Event eventsId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "role")
private List<Discount> discounts;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -78,14 +87,6 @@ public class Role implements ModelInterface { ...@@ -78,14 +87,6 @@ public class Role implements ModelInterface {
this.roleName = roleName; this.roleName = roleName;
} }
public List<Event> getEventList() {
return eventList;
}
public void setEventList(List<Event> eventList) {
this.eventList = eventList;
}
public List<RoleInheritance> getRoleInheritanceList() { public List<RoleInheritance> getRoleInheritanceList() {
return roleInheritanceList; return roleInheritanceList;
} }
...@@ -191,4 +192,12 @@ public class Role implements ModelInterface { ...@@ -191,4 +192,12 @@ public class Role implements ModelInterface {
public List<User> getUsers() { public List<User> getUsers() {
return users; return users;
} }
public void setDiscounts(List<Discount> discounts) {
this.discounts = discounts;
}
public List<Discount> getDiscounts() {
return discounts;
}
} }
...@@ -108,6 +108,8 @@ public class User implements ModelInterface { ...@@ -108,6 +108,8 @@ public class User implements ModelInterface {
private List<DiscountInstance> discountInstanceList; private List<DiscountInstance> discountInstanceList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "usersId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "usersId")
private List<Bill> billList; private List<Bill> billList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "seller")
private List<AccountEvent> soldItems;
@Version @Version
@Column(nullable = false) @Column(nullable = false)
private int jpaVersionField; private int jpaVersionField;
...@@ -418,4 +420,12 @@ public class User implements ModelInterface { ...@@ -418,4 +420,12 @@ public class User implements ModelInterface {
public List<Role> getRoles() { public List<Role> getRoles() {
return roles; return roles;
} }
public void setSoldItems(List<AccountEvent> accountEvents) {
this.soldItems = accountEvents;
}
public List<AccountEvent> getSoldItems() {
return soldItems;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!