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;
@Table(name = "access_rights")
@NamedQueries( {
@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.findByAccessRight", query = "SELECT a FROM AccessRight a WHERE a.accessRight = :accessRight") })
@NamedQuery(name = "AccessRight.findById", query = "SELECT a FROM AccessRight a WHERE a.id = :id"),
@NamedQuery(name = "AccessRight.findByName", query = "SELECT a FROM AccessRight a WHERE a.name = :name") })
public class AccessRight implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "access_rights_id", nullable = false)
private Integer id;
@Column(name = "access_right", nullable = false)
private String accessRight;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRightsId")
private List<NewsGroup> newsGroupList;
@OneToMany(mappedBy = "accessRightsId")
private List<RoleRight> roleRightList;
@Column(name = "right_name", nullable = false)
private String name;
@Column(name = "right_description")
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "id")
private List<NewsGroup> newsGroups;
@OneToMany(mappedBy = "id")
private List<RoleRight> roleRights;
public Integer getId() {
return id;
......@@ -60,31 +65,31 @@ public class AccessRight implements ModelInterface {
public AccessRight(Integer accessRightsId, String accessRight) {
this.id = accessRightsId;
this.accessRight = accessRight;
this.name = accessRight;
}
public String getAccessRight() {
return accessRight;
return name;
}
public void setAccessRight(String accessRight) {
this.accessRight = accessRight;
this.name = accessRight;
}
public List<NewsGroup> getNewsGroupList() {
return newsGroupList;
return newsGroups;
}
public void setNewsGroupList(List<NewsGroup> newsGroupList) {
this.newsGroupList = newsGroupList;
this.newsGroups = newsGroupList;
}
public List<RoleRight> getRoleRightList() {
return roleRightList;
return roleRights;
}
public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRightList = roleRightList;
this.roleRights = roleRightList;
}
@Override
......@@ -111,8 +116,7 @@ public class AccessRight implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.AccessRight[accessRightsId=" + id
+ "]";
return "fi.insomnia.bortal.model.AccessRight[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
......@@ -123,4 +127,12 @@ public class AccessRight implements ModelInterface {
return jpaVersionField;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
......@@ -5,7 +5,7 @@
package fi.insomnia.bortal.model;
import java.math.BigInteger;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
......@@ -17,6 +17,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
......@@ -24,45 +25,59 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "account_events")
@NamedQueries( {
@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.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.findByDelivered", query = "SELECT a FROM AccountEvent a WHERE a.delivered = :delivered") })
public class AccountEvent implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "account_events_id", nullable = false)
private Integer id;
@Column(name = "unit_price", nullable = false)
private BigInteger unitPrice;
private BigDecimal unitPrice;
@Column(name = "unit_count", nullable = false)
private int unitCount;
private BigDecimal units;
@Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date eventTime;
@Column(name = "delivered")
@Temporal(TemporalType.TIMESTAMP)
private Date delivered;
@JoinColumn(name = "food_waves_id", referencedColumnName = "food_waves_id")
@ManyToOne
private FoodWave foodWavesId;
private FoodWave foodWave;
@JoinColumn(name = "products_id", referencedColumnName = "products_id", nullable = false)
@ManyToOne(optional = false)
private Product productsId;
private Product product;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false)
private User usersId;
@OneToMany(mappedBy = "accountEventsId")
private List<DiscountInstance> discountInstanceList;
@OneToMany(mappedBy = "accoutEventsId")
private List<Bill> billList;
private User user;
@JoinColumn(name = "seller", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = true)
private User seller;
@OneToMany(mappedBy = "accountEvent")
private List<DiscountInstance> discountInstances;
@OneToOne
private Bill bill;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -90,30 +105,14 @@ public class AccountEvent implements ModelInterface {
this.id = accountEventsId;
}
public AccountEvent(Integer accountEventsId, BigInteger unitPrice,
int unitCount, Date eventTime) {
public AccountEvent(Integer accountEventsId, BigDecimal unitPrice,
BigDecimal unitCount, Date eventTime) {
this.id = accountEventsId;
this.unitPrice = unitPrice;
this.unitCount = unitCount;
this.setUnitPrice(unitPrice);
this.setUnits(unitCount);
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() {
return eventTime;
}
......@@ -130,45 +129,20 @@ public class AccountEvent implements ModelInterface {
this.delivered = delivered;
}
public FoodWave getFoodWavesId() {
return foodWavesId;
}
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 User getUser() {
return user;
}
public void setUsersId(User usersId) {
this.usersId = usersId;
public void setUser(User usersId) {
this.user = usersId;
}
public List<DiscountInstance> getDiscountInstanceList() {
return discountInstanceList;
public List<DiscountInstance> getDiscountInstances() {
return discountInstances;
}
public void setDiscountInstanceList(
List<DiscountInstance> discountInstanceList) {
this.discountInstanceList = discountInstanceList;
}
public List<Bill> getBillList() {
return billList;
}
public void setBillList(List<Bill> billList) {
this.billList = billList;
public void setDiscountInstances(List<DiscountInstance> discountInstanceList) {
this.discountInstances = discountInstanceList;
}
@Override
......@@ -180,7 +154,8 @@ public class AccountEvent implements ModelInterface {
@Override
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
if (!(object instanceof AccountEvent)) {
return false;
......@@ -195,8 +170,55 @@ public class AccountEvent implements ModelInterface {
@Override
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;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
......@@ -28,7 +29,7 @@ import javax.persistence.Version;
@Table(name = "bills")
@NamedQueries( {
@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.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"),
......@@ -39,24 +40,31 @@ public class Bill implements ModelInterface {
@Id
@Column(name = "bills_id", nullable = false)
private Integer id;
@Column(name = "due_date")
@Temporal(TemporalType.TIMESTAMP)
private Date dueDate;
@Column(name = "paid_date")
@Temporal(TemporalType.TIMESTAMP)
private Date paidDate;
@Column(name = "reference_number")
private String referenceNumber;
@Column(name = "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")
@ManyToOne
private AccountEvent accoutEventsId;
@OneToOne
private AccountEvent accountEvent;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false)
private User usersId;
private User user;
public Integer getId() {
return id;
......@@ -109,28 +117,28 @@ public class Bill implements ModelInterface {
this.notes = notes;
}
public List<BillLine> getBillLineList() {
return billLineList;
public List<BillLine> getBillLines() {
return billLines;
}
public void setBillLineList(List<BillLine> billLineList) {
this.billLineList = billLineList;
public void setBillLines(List<BillLine> billLineList) {
this.billLines = billLineList;
}
public AccountEvent getAccoutEventsId() {
return accoutEventsId;
public AccountEvent getAccountEvent() {
return accountEvent;
}
public void setAccoutEventsId(AccountEvent accoutEventsId) {
this.accoutEventsId = accoutEventsId;
public void setAccountEvent(AccountEvent accoutEventsId) {
this.accountEvent = accoutEventsId;
}
public User getUsersId() {
return usersId;
public User getUser() {
return user;
}
public void setUsersId(User usersId) {
this.usersId = usersId;
public void setUser(User usersId) {
this.user = usersId;
}
@Override
......@@ -157,7 +165,7 @@ public class Bill implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.Bill[billsId=" + id + "]";
return "fi.insomnia.bortal.model.Bill[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
......
......@@ -5,6 +5,8 @@
package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
......@@ -17,14 +19,13 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "bill_lines")
@NamedQueries( {
@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.findByProduct", query = "SELECT b FROM BillLine b WHERE b.product = :product"),
@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 = :name"),
@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.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") })
......@@ -34,20 +35,21 @@ public class BillLine implements ModelInterface {
@Column(name = "bill_lines_id", nullable = false)
private Integer id;
@Column(name = "product", nullable = false)
private String product;
@Column(name = "name", nullable = false)
private String name;
@Column(name = "units", nullable = false)
private int units;
private BigDecimal units;
@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")
@ManyToOne
private Bill billsId;
private Bill bill;
@Version
@Column(nullable = false)
......@@ -60,53 +62,29 @@ public class BillLine implements ModelInterface {
this.id = billLinesId;
}
public BillLine(Integer billLinesId, String product, int units,
float unitPrice, float vat) {
public BillLine(Integer billLinesId, String product, BigDecimal units,
BigDecimal unitPrice, BigDecimal vat) {
this.id = billLinesId;
this.product = product;
this.units = units;
this.unitPrice = unitPrice;
this.vat = 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;
this.name = product;
this.setUnits(units);
this.setUnitPrice(unitPrice);
this.setVat(vat);
}
public float getVat() {
return vat;
public String getName() {
return name;
}
public void setVat(float vat) {
this.vat = vat;
public void setName(String product) {
this.name = product;
}
public Bill getBillsId() {
return billsId;
public Bill getBill() {
return bill;
}
public void setBillsId(Bill billsId) {
this.billsId = billsId;
public void setBill(Bill billsId) {
this.bill = billsId;
}
@Override
......@@ -133,7 +111,7 @@ public class BillLine implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.BillLine[billLinesId=" + id + "]";
return "fi.insomnia.bortal.model.BillLine[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
......@@ -152,4 +130,28 @@ public class BillLine implements ModelInterface {
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;
/**
*
* @author jkj
*/
@Entity
@Table(name = "card_templates")
@NamedQueries( {
@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.findByTemplateName", query = "SELECT c FROM CardTemplate c WHERE c.templateName = :templateName") })
@NamedQuery(name = "CardTemplate.findById", query = "SELECT c FROM CardTemplate c WHERE c.id = :id"),
@NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") })
public class CardTemplate implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "card_templates_id", nullable = false)
private Integer id;
@Lob
@Column(name = "template_image")
private byte[] templateImage;
private byte[] image;
@Column(name = "template_name", nullable = false)
private String templateName;
private String name;
@JoinColumn(name = "events_id", referencedColumnName = "events_id")
@ManyToOne
private Event eventsId;
@OneToMany(mappedBy = "cardTemplatesId")
private List<Role> roleList;
private Event event;
@OneToMany(mappedBy = "cardTemplate")
private List<Role> roles;
@Version
@Column(nullable = false)
......@@ -59,27 +61,27 @@ public class CardTemplate implements ModelInterface {
public CardTemplate(Integer cardTemplatesId, String templateName) {
this.id = cardTemplatesId;
this.templateName = templateName;
this.name = templateName;
}
public byte[] getTemplateImage() {
return templateImage;
public byte[] getImage() {
return image;
}
public void setTemplateImage(byte[] templateImage) {
this.templateImage = templateImage;
public void setImage(byte[] templateImage) {
this.image = templateImage;
}
public String getTemplateName() {
return templateName;
public String getName() {
return name;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
public void setName(String templateName) {
this.name = templateName;
}
public Event getEventsId() {
return eventsId;
public Event getEvent() {
return event;
}
public Integer getId() {
......@@ -90,16 +92,16 @@ public class CardTemplate implements ModelInterface {
this.id = id;
}
public void setEventsId(Event eventsId) {
this.eventsId = eventsId;
public void setEvent(Event eventsId) {
this.event = eventsId;
}
public List<Role> getRoleList() {
return roleList;
public List<Role> getRoles() {
return roles;
}
public void setRoleList(List<Role> roleList) {
this.roleList = roleList;
public void setRoles(List<Role> roleList) {
this.roles = roleList;
}
@Override
......@@ -126,8 +128,7 @@ public class CardTemplate implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.CardTemplate[cardTemplatesId=" + id
+ "]";
return "fi.insomnia.bortal.model.CardTemplate[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
......
......@@ -24,20 +24,20 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "compos")
@NamedQueries( {
@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.findByCompoName", query = "SELECT c FROM Compo c WHERE c.compoName = :compoName"),
@NamedQuery(name = "Compo.findByCompoStart", query = "SELECT c FROM Compo c WHERE c.compoStart = :compoStart"),
@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 = :name"),
@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.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.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 {
private static final long serialVersionUID = 1L;
@Id
......@@ -45,30 +45,40 @@ public class Compo implements ModelInterface {
private Integer id;
@Column(name = "compo_name", nullable = false)
private String compoName;
private String name;
@Column(name = "compo_start")
@Temporal(TemporalType.TIMESTAMP)
private Date compoStart;
private Date startTime;
@Column(name = "vote_start")
@Temporal(TemporalType.TIMESTAMP)
private Date voteStart;
@Column(name = "vote_end")
@Temporal(TemporalType.TIMESTAMP)
private Date voteEnd;
@Column(name = "submit_start")
@Temporal(TemporalType.TIMESTAMP)
private Date submitStart;
@Column(name = "submit_end")
@Temporal(TemporalType.TIMESTAMP)
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;
@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)
@ManyToOne(optional = false)
private Event eventsId;
private Event event;
@Version
@Column(nullable = false)
......@@ -91,24 +101,24 @@ public class Compo implements ModelInterface {
public Compo(Integer composId, String compoName, boolean holdVoting) {
this.id = composId;
this.compoName = compoName;
this.name = compoName;
this.holdVoting = holdVoting;
}
public String getCompoName() {
return compoName;
public String getName() {
return name;
}
public void setCompoName(String compoName) {
this.compoName = compoName;
public void setName(String compoName) {
this.name = compoName;
}
public Date getCompoStart() {
return compoStart;
public Date getStartTime() {
return startTime;
}
public void setCompoStart(Date compoStart) {
this.compoStart = compoStart;
public void setStartTime(Date compoStart) {
this.startTime = compoStart;
}
public Date getVoteStart() {
......@@ -151,20 +161,20 @@ public class Compo implements ModelInterface {
this.holdVoting = holdVoting;
}
public List<CompoEntry> getCompoEntryList() {
return compoEntryList;
public List<CompoEntry> getCompoEntries() {
return compoEntries;
}
public void setCompoEntryList(List<CompoEntry> compoEntryList) {
this.compoEntryList = compoEntryList;
public void setCompoEntries(List<CompoEntry> compoEntryList) {
this.compoEntries = compoEntryList;
}
public Event getEventsId() {
return eventsId;
public Event getEvent() {
return event;
}
public void setEventsId(Event eventsId) {
this.eventsId = eventsId;
public void setEvent(Event eventsId) {
this.event = eventsId;
}
@Override
......@@ -191,7 +201,7 @@ public class Compo implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.Compo[composId=" + id + "]";
return "fi.insomnia.bortal.model.Compo[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
......@@ -202,4 +212,12 @@ public class Compo implements ModelInterface {
return jpaVersionField;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
......@@ -17,6 +17,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
......@@ -24,15 +25,14 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "entries")
@NamedQueries( {
@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.findByEntryCreated", query = "SELECT c FROM CompoEntry c WHERE c.entryCreated = :entryCreated"),
@NamedQuery(name = "CompoEntry.findByEntryName", query = "SELECT c FROM CompoEntry c WHERE c.entryName = :entryName"),
@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 = :created"),
@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.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") })
......@@ -44,25 +44,39 @@ public class CompoEntry implements ModelInterface {
@Column(name = "entry_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date entryCreated;
private Date created;
@Column(name = "entry_name", nullable = false)
private String entryName;
private String name;
@Column(name = "notes")
private String notes;
@Column(name = "screen_message")
private String screenMessage;
@Column(name = "sort")
private Integer sort;
@Column(name = "final_position")
private Integer finalPosition;
@OneToOne
private CompoEntryFile currentFile;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "compoEntry")
private List<Vote> voteList;
private List<Vote> votes;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry")
private List<CompoEntryFile> compoEntryFileList;
private List<CompoEntryFile> files;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry")
private List<CompoEntryParticipant> compoEntryParticipantList;
private List<CompoEntryParticipant> participants;
@JoinColumn(name = "compos_id", referencedColumnName = "compos_id", nullable = false)
@ManyToOne(optional = false)
private Compo composId;
@JoinColumn(name = "creator", referencedColumnName = "users_id")
@ManyToOne
private User creator;
......@@ -88,24 +102,24 @@ public class CompoEntry implements ModelInterface {
public CompoEntry(Integer entriesId, Date entryCreated, String entryName) {
this.id = entriesId;
this.entryCreated = entryCreated;
this.entryName = entryName;
this.created = entryCreated;
this.name = entryName;
}
public Date getEntryCreated() {
return entryCreated;
public Date getCreated() {
return created;
}
public void setEntryCreated(Date entryCreated) {
this.entryCreated = entryCreated;
public void setCreated(Date entryCreated) {
this.created = entryCreated;
}
public String getEntryName() {
return entryName;
public String getName() {
return name;
}
public void setEntryName(String entryName) {
this.entryName = entryName;
public void setName(String entryName) {
this.name = entryName;
}
public String getNotes() {
......@@ -132,29 +146,29 @@ public class CompoEntry implements ModelInterface {
this.sort = sort;
}
public List<Vote> getVoteList() {
return voteList;
public List<Vote> getVotes() {
return votes;
}
public void setVoteList(List<Vote> voteList) {
this.voteList = voteList;
public void setVotes(List<Vote> voteList) {
this.votes = voteList;
}
public List<CompoEntryFile> getCompoEntryFileList() {
return compoEntryFileList;
public List<CompoEntryFile> getFiles() {
return files;
}
public void setCompoEntryFileList(List<CompoEntryFile> compoEntryFileList) {
this.compoEntryFileList = compoEntryFileList;
public void setFiles(List<CompoEntryFile> compoEntryFileList) {
this.files = compoEntryFileList;
}
public List<CompoEntryParticipant> getCompoEntryParticipantList() {
return compoEntryParticipantList;
public List<CompoEntryParticipant> getParticipants() {
return participants;
}
public void setCompoEntryParticipantList(
public void setParticipants(
List<CompoEntryParticipant> compoEntryParticipantList) {
this.compoEntryParticipantList = compoEntryParticipantList;
this.participants = compoEntryParticipantList;
}
public Compo getComposId() {
......@@ -208,4 +222,20 @@ public class CompoEntry implements ModelInterface {
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;
/**
*
* @author jkj
*/
@Entity
@Table(name = "entry_files")
......@@ -40,16 +39,19 @@ public class CompoEntryFile implements ModelInterface {
@Id
@Column(name = "entry_files_id", nullable = false)
private Integer id;
@Column(name = "mime_type")
private String mimeType;
@Column(name = "file_name")
private String fileName;
@Column(name = "description")
private String description;
@Column(name = "hash")
private String hash;
@Column(name = "comment")
private String comment;
@Lob
@Column(name = "file_data")
private byte[] fileData;
......@@ -57,6 +59,7 @@ public class CompoEntryFile implements ModelInterface {
@Column(name = "uploaded", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date uploaded;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
@ManyToOne(optional = false)
private CompoEntry entry;
......@@ -117,14 +120,6 @@ public class CompoEntryFile implements ModelInterface {
this.hash = hash;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public byte[] getFileData() {
return fileData;
}
......
......@@ -17,24 +17,27 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "entry_participations")
@NamedQueries( {
@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") })
public class CompoEntryParticipant implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "entry_participations_id", nullable = false)
private Integer id;
@Column(name = "role")
private String role;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
@ManyToOne(optional = false)
private CompoEntry entry;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false)
private User users;
......
......@@ -5,13 +5,14 @@
package fi.insomnia.bortal.model;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
......@@ -20,13 +21,12 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "discounts")
@NamedQueries( {
@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.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"),
......@@ -41,29 +41,40 @@ public class Discount implements ModelInterface {
@Column(name = "discounts_id", nullable = false)
private Integer id;
@Column(name = "percentage", nullable = false)
private BigInteger percentage;
@Column(name = "percentage", nullable = false, columnDefinition = "integer default 0")
private int percentage = 0;
@Column(name = "code")
private String code;
@Column(name = "details")
private String details;
@Column(name = "amount_min", nullable = false)
private int amountMin;
@Column(name = "amount_min", nullable = false, columnDefinition = "integer default 0")
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)
private int amountMax;
@Column(name = "max_num", nullable = false, columnDefinition = "integer default 0")
private int maxNum = 0;
@Column(name = "active", nullable = false)
private boolean active;
@Column(name = "per_user", nullable = false, columnDefinition = "integer default 0")
private int perUser = 0;
@Column(name = "max_num", nullable = false)
private int maxNum;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "discount")
private List<DiscountInstance> discountInstances;
@Column(name = "per_user", nullable = false)
private int perUser;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "discountsId")
private List<DiscountInstance> discountInstanceList;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false)
private Role role;
@JoinColumn(name = "products_id", referencedColumnName = "products_id", nullable = false)
@ManyToOne(optional = false)
private Product product;
@Version
@Column(nullable = false)
......@@ -84,10 +95,10 @@ public class Discount implements ModelInterface {
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) {
this.id = discountsId;
this.percentage = percentage;
this.setPercentage(percentage);
this.amountMin = amountMin;
this.amountMax = amountMax;
this.active = active;
......@@ -95,14 +106,6 @@ public class Discount implements ModelInterface {
this.perUser = perUser;
}
public BigInteger getPercentage() {
return percentage;
}
public void setPercentage(BigInteger percentage) {
this.percentage = percentage;
}
public String getCode() {
return code;
}
......@@ -159,13 +162,12 @@ public class Discount implements ModelInterface {
this.perUser = perUser;
}
public List<DiscountInstance> getDiscountInstanceList() {
return discountInstanceList;
public List<DiscountInstance> getDiscountInstances() {
return discountInstances;
}
public void setDiscountInstanceList(
List<DiscountInstance> discountInstanceList) {
this.discountInstanceList = discountInstanceList;
public void setDiscountInstances(List<DiscountInstance> discountInstanceList) {
this.discountInstances = discountInstanceList;
}
@Override
......@@ -192,7 +194,7 @@ public class Discount implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.Discount[discountsId=" + id + "]";
return "fi.insomnia.bortal.model.Discount[id=" + id + "]";
}
public void setJpaVersionField(int jpaVersionField) {
......@@ -203,4 +205,28 @@ public class Discount implements ModelInterface {
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 @@
*/
package fi.insomnia.bortal.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
......@@ -16,28 +18,34 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "discount_instances")
@NamedQueries( {
@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 {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "discounts_instances_id", nullable = false)
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")
@ManyToOne
private AccountEvent accountEventsId;
private AccountEvent accountEvent;
@JoinColumn(name = "discounts_id", referencedColumnName = "discounts_id", nullable = false)
@ManyToOne(optional = false)
private Discount discountsId;
private Discount discount;
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
@ManyToOne(optional = false)
private User usersId;
private User user;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -49,28 +57,28 @@ public class DiscountInstance implements ModelInterface {
this.id = discountsInstancesId;
}
public AccountEvent getAccountEventsId() {
return accountEventsId;
public AccountEvent getAccountEvent() {
return accountEvent;
}
public void setAccountEventsId(AccountEvent accountEventsId) {
this.accountEventsId = accountEventsId;
public void setAccountEvent(AccountEvent accountEventsId) {
this.accountEvent = accountEventsId;
}
public Discount getDiscountsId() {
return discountsId;
public Discount getDiscount() {
return discount;
}
public void setDiscountsId(Discount discountsId) {
this.discountsId = discountsId;
public void setDiscount(Discount discountsId) {
this.discount = discountsId;
}
public User getUsersId() {
return usersId;
public User getUser() {
return user;
}
public void setUsersId(User usersId) {
this.usersId = usersId;
public void setUser(User usersId) {
this.user = usersId;
}
@Override
......@@ -130,4 +138,12 @@ public class DiscountInstance implements ModelInterface {
public void setJpaVersionField(int 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;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
......@@ -23,7 +24,6 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "events")
......@@ -40,34 +40,45 @@ public class Event implements ModelInterface {
@Id
@Column(name = "events_id", nullable = false)
private Integer id;
@Column(name = "start_time")
@Temporal(TemporalType.TIMESTAMP)
private Date startTime;
@Column(name = "end_time")
@Temporal(TemporalType.TIMESTAMP)
private Date endTime;
@Column(name = "name", nullable = false)
private String name;
@Column(name = "referer")
private String referer;
@JoinColumn(name = "event_settings_id", referencedColumnName = "event_settings_id", nullable = false)
@ManyToOne(optional = false)
private EventSettings eventSettingsId;
private EventSettings settings;
@JoinColumn(name = "event_status_id", referencedColumnName = "event_status_id", nullable = false)
@ManyToOne(optional = false)
private EventStatus eventStatusId;
private EventStatus status;
@JoinColumn(name = "default_role", referencedColumnName = "roles_id")
@ManyToOne
@OneToOne
private Role defaultRole;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId")
private List<Compo> compoList;
@OneToMany(mappedBy = "eventsId")
private List<CardTemplate> cardTemplateList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId")
private List<EventMap> eventMapList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId")
private List<Role> roleList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<Compo> compos;
@OneToMany(mappedBy = "event")
private List<CardTemplate> cardTemplates;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<EventMap> eventMaps;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<Role> roles;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -116,20 +127,20 @@ public class Event implements ModelInterface {
this.referer = referer;
}
public EventSettings getEventSettingsId() {
return eventSettingsId;
public EventSettings getSettings() {
return settings;
}
public void setEventSettingsId(EventSettings eventSettingsId) {
this.eventSettingsId = eventSettingsId;
public void setSettings(EventSettings eventSettingsId) {
this.settings = eventSettingsId;
}
public EventStatus getEventStatusId() {
return eventStatusId;
public EventStatus getStatus() {
return status;
}
public void setEventStatusId(EventStatus eventStatusId) {
this.eventStatusId = eventStatusId;
public void setStatus(EventStatus eventStatusId) {
this.status = eventStatusId;
}
public Role getDefaultRole() {
......@@ -140,36 +151,36 @@ public class Event implements ModelInterface {
this.defaultRole = defaultRole;
}
public List<Compo> getCompoList() {
return compoList;
public List<Compo> getCompos() {
return compos;
}
public void setCompoList(List<Compo> compoList) {
this.compoList = compoList;
public void setCompos(List<Compo> compoList) {
this.compos = compoList;
}
public List<CardTemplate> getCardTemplateList() {
return cardTemplateList;
public List<CardTemplate> getCardTemplates() {
return cardTemplates;
}
public void setCardTemplateList(List<CardTemplate> cardTemplateList) {
this.cardTemplateList = cardTemplateList;
public void setCardTemplates(List<CardTemplate> cardTemplateList) {
this.cardTemplates = cardTemplateList;
}
public List<EventMap> getEventMapList() {
return eventMapList;
public List<EventMap> getEventMaps() {
return eventMaps;
}
public void setEventMapList(List<EventMap> eventMapList) {
this.eventMapList = eventMapList;
public void setEventMaps(List<EventMap> eventMapList) {
this.eventMaps = eventMapList;
}
public List<Role> getRoleList() {
return roleList;
public List<Role> getRoles() {
return roles;
}
public void setRoleList(List<Role> roleList) {
this.roleList = roleList;
public void setRoles(List<Role> roleList) {
this.roles = roleList;
}
@Override
......
......@@ -18,33 +18,30 @@ import javax.persistence.Version;
/**
*
* @author jkj
*/
@Entity
@Table(name = "event_settings")
@NamedQueries( {
@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.findByResourceBundle", query = "SELECT e FROM EventSettings e WHERE e.resourceBundle = :resourceBundle"),
@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") })
@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 = :baseName"),
@NamedQuery(name = "EventSettings.findByStyleSheet", query = "SELECT e FROM EventSettings e WHERE e.styleSheet = :styleSheet") })
public class EventSettings implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "event_settings_id", nullable = false)
private Integer id;
@Column(name = "resource_bundle")
private String resourceBundle;
@Column(name = "base_name")
private String baseName;
@Column(name = "style_sheet")
private String styleSheet;
@Column(name = "name_general_form")
private String nameGeneralForm;
@Column(name = "name_possissive_form")
private String namePossissiveForm;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventSettingsId")
private List<Event> eventList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "settings")
private List<Event> events;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -56,12 +53,12 @@ public class EventSettings implements ModelInterface {
this.id = eventSettingsId;
}
public String getResourceBundle() {
return resourceBundle;
public String getBaseName() {
return baseName;
}
public void setResourceBundle(String resourceBundle) {
this.resourceBundle = resourceBundle;
public void setBaseName(String resourceBundle) {
this.baseName = resourceBundle;
}
public String getStyleSheet() {
......@@ -72,28 +69,12 @@ public class EventSettings implements ModelInterface {
this.styleSheet = styleSheet;
}
public String getNameGeneralForm() {
return nameGeneralForm;
}
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 List<Event> getEvents() {
return events;
}
public void setEventList(List<Event> eventList) {
this.eventList = eventList;
public void setEvents(List<Event> eventList) {
this.events = eventList;
}
@Override
......@@ -120,8 +101,7 @@ public class EventSettings implements ModelInterface {
@Override
public String toString() {
return "fi.insomnia.bortal.model.EventSettings[eventSettingsId="
+ getId() + "]";
return "fi.insomnia.bortal.model.EventSettings[id=" + getId() + "]";
}
/**
......
......@@ -36,7 +36,7 @@ public class EventStatus implements ModelInterface {
@Column(name = "status_name", nullable = false)
private String statusName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventStatusId")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "status")
private List<Event> eventList;
@Version
@Column(nullable = false)
......
......@@ -36,9 +36,11 @@ import javax.persistence.Version;
public class Product implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "products_id", nullable = false)
private Integer id;
@Column(name = "product_name")
private String productName;
......@@ -47,15 +49,23 @@ public class Product implements ModelInterface {
@Column(name = "sort", nullable = false)
private int sort;
@Column(name = "barcode")
private String barcode;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productsId")
private List<Place> placeList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "productsId")
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") })
@ManyToMany
private List<FoodWaveTemplate> foodWaveTemplate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "product")
private List<Discount> discounts;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -192,4 +202,12 @@ public class Product implements ModelInterface {
public void setJpaVersionField(int 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;
public class Role implements ModelInterface {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "roles_id", nullable = false)
private Integer id;
@Column(name = "role_name", nullable = false)
private String roleName;
@OneToMany(mappedBy = "defaultRole")
private List<Event> eventList;
@ManyToMany(cascade = CascadeType.ALL)
private List<User> users;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId")
private List<RoleInheritance> roleInheritanceList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "inherits")
private List<RoleInheritance> roleInheritanceList1;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "rolesId")
private List<RoleRight> roleRightList;
@JoinColumn(name = "card_templates_id", referencedColumnName = "card_templates_id")
@ManyToOne
private CardTemplate cardTemplatesId;
@JoinColumn(name = "events_id", referencedColumnName = "events_id", nullable = false)
@ManyToOne(optional = false)
private Event eventsId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "role")
private List<Discount> discounts;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -78,14 +87,6 @@ public class Role implements ModelInterface {
this.roleName = roleName;
}
public List<Event> getEventList() {
return eventList;
}
public void setEventList(List<Event> eventList) {
this.eventList = eventList;
}
public List<RoleInheritance> getRoleInheritanceList() {
return roleInheritanceList;
}
......@@ -191,4 +192,12 @@ public class Role implements ModelInterface {
public List<User> getUsers() {
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 {
private List<DiscountInstance> discountInstanceList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "usersId")
private List<Bill> billList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "seller")
private List<AccountEvent> soldItems;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -418,4 +420,12 @@ public class User implements ModelInterface {
public List<Role> getRoles() {
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!