Commit abdfa866 by tkfftk

not ewerything is working

git-svn-id: https://dev.intra.insomnia.fi/svn/trunk@49 8cf89bec-f6a3-4178-919f-364fb3449fe5
1 parent efa7556f
Showing with 2609 additions and 1834 deletions
...@@ -17,6 +17,7 @@ import javax.persistence.NamedQueries; ...@@ -17,6 +17,7 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* An access privilege such as a privilege to login or to work with compos. * An access privilege such as a privilege to login or to work with compos.
...@@ -24,92 +25,91 @@ import javax.persistence.Table; ...@@ -24,92 +25,91 @@ import javax.persistence.Table;
@Entity @Entity
@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.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.findByAccessRight", query = "SELECT a FROM AccessRight a WHERE a.accessRight = :accessRight") })
public class AccessRight implements Serializable { public class AccessRight implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "access_rights_id", nullable = false) @Basic(optional = false)
private Integer accessRightsId; @Column(name = "access_rights_id", nullable = false)
@Column(name = "access_right", nullable = false) private Integer id;
private String accessRight; @Basic(optional = false)
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRightsId") @Column(name = "access_right", nullable = false)
private List<NewsGroup> newsGroupList; private String accessRight;
@OneToMany(mappedBy = "accessRightsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRightsId")
private List<RoleRight> roleRightList; private List<NewsGroup> newsGroupList;
@OneToMany(mappedBy = "accessRightsId")
public AccessRight() { private List<RoleRight> roleRightList;
}
@Version
public AccessRight(Integer accessRightsId) { @Column(nullable = false)
this.accessRightsId = accessRightsId; private int jpaVersionField;
}
public AccessRight(Integer accessRightsId, String accessRight) { public AccessRight() {
this.accessRightsId = accessRightsId;
this.accessRight = accessRight;
}
public Integer getAccessRightsId() {
return accessRightsId;
}
public void setAccessRightsId(Integer accessRightsId) {
this.accessRightsId = accessRightsId;
}
public String getAccessRight() {
return accessRight;
}
public void setAccessRight(String accessRight) {
this.accessRight = accessRight;
}
public List<NewsGroup> getNewsGroupList() {
return newsGroupList;
}
public void setNewsGroupList(List<NewsGroup> newsGroupList) {
this.newsGroupList = newsGroupList;
}
public List<RoleRight> getRoleRightList() {
return roleRightList;
}
public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRightList = roleRightList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (accessRightsId != null ? accessRightsId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are
// not set
if (!(object instanceof AccessRight)) {
return false;
} }
AccessRight other = (AccessRight) object;
if ((this.accessRightsId == null && other.accessRightsId != null) public AccessRight(Integer accessRightsId) {
|| (this.accessRightsId != null && !this.accessRightsId this.id = accessRightsId;
.equals(other.accessRightsId))) { }
return false;
public AccessRight(Integer accessRightsId, String accessRight) {
this.id = accessRightsId;
this.accessRight = accessRight;
}
public String getAccessRight() {
return accessRight;
}
public void setAccessRight(String accessRight) {
this.accessRight = accessRight;
}
public List<NewsGroup> getNewsGroupList() {
return newsGroupList;
}
public void setNewsGroupList(List<NewsGroup> newsGroupList) {
this.newsGroupList = newsGroupList;
}
public List<RoleRight> getRoleRightList() {
return roleRightList;
}
public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRightList = roleRightList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are
// not set
if (!(object instanceof AccessRight)) {
return false;
}
AccessRight other = (AccessRight) object;
if ((this.id == null && other.id != null)
|| (this.id != null && !this.id
.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "fi.insomnia.bortal.model.AccessRight[accessRightsId="
+ id + "]";
} }
return true;
}
@Override
public String toString() {
return "fi.insomnia.bortal.model.AccessRight[accessRightsId="
+ accessRightsId + "]";
}
} }
...@@ -10,6 +10,12 @@ import java.math.BigInteger; ...@@ -10,6 +10,12 @@ import java.math.BigInteger;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
>>>>>>>>>>>>>>>>>>>> File 1
>>>>>>>>>>>>>>>>>>>> File 2
import javax.persistence.Basic;
>>>>>>>>>>>>>>>>>>>> File 3
import javax.persistence.Basic;
<<<<<<<<<<<<<<<<<<<<
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -21,13 +27,25 @@ import javax.persistence.OneToMany; ...@@ -21,13 +27,25 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
>>>>>>>>>>>>>>>>>>>> File 1
>>>>>>>>>>>>>>>>>>>> File 2
>>>>>>>>>>>>>>>>>>>> File 3
import javax.persistence.Version;
<<<<<<<<<<<<<<<<<<<<
/** /**
>>>>>>>>>>>>>>>>>>>> File 1
* *
>>>>>>>>>>>>>>>>>>>> File 2
*
>>>>>>>>>>>>>>>>>>>> File 3
*
<<<<<<<<<<<<<<<<<<<<
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "account_events") @Table(name = "account_events")
>>>>>>>>>>>>>>>>>>>> File 1
@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.findByAccountEventsId", query = "SELECT a FROM AccountEvent a WHERE a.accountEventsId = :accountEventsId"),
...@@ -35,15 +53,51 @@ import javax.persistence.TemporalType; ...@@ -35,15 +53,51 @@ import javax.persistence.TemporalType;
@NamedQuery(name = "AccountEvent.findByUnitCount", query = "SELECT a FROM AccountEvent a WHERE a.unitCount = :unitCount"), @NamedQuery(name = "AccountEvent.findByUnitCount", query = "SELECT a FROM AccountEvent a WHERE a.unitCount = :unitCount"),
@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") })
>>>>>>>>>>>>>>>>>>>> File 2
@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.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.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")})
>>>>>>>>>>>>>>>>>>>> File 3
@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.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.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 Serializable { public class AccountEvent implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
>>>>>>>>>>>>>>>>>>>> File 1
>>>>>>>>>>>>>>>>>>>> File 2
@Basic(optional = false)
>>>>>>>>>>>>>>>>>>>> File 3
@Basic(optional = false)
<<<<<<<<<<<<<<<<<<<<
@Column(name = "account_events_id", nullable = false) @Column(name = "account_events_id", nullable = false)
private Integer accountEventsId; private Integer id;
@Basic(optional = false)
@Column(name = "unit_price", nullable = false) @Column(name = "unit_price", nullable = false)
private BigInteger unitPrice; private BigInteger unitPrice;
>>>>>>>>>>>>>>>>>>>> File 1
>>>>>>>>>>>>>>>>>>>> File 2
@Basic(optional = false)
>>>>>>>>>>>>>>>>>>>> File 3
@Basic(optional = false)
<<<<<<<<<<<<<<<<<<<<
@Column(name = "unit_count", nullable = false) @Column(name = "unit_count", nullable = false)
private int unitCount; private int unitCount;
>>>>>>>>>>>>>>>>>>>> File 1
>>>>>>>>>>>>>>>>>>>> File 2
@Basic(optional = false)
>>>>>>>>>>>>>>>>>>>> File 3
@Basic(optional = false)
<<<<<<<<<<<<<<<<<<<<
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date eventTime; private Date eventTime;
...@@ -64,6 +118,7 @@ public class AccountEvent implements Serializable { ...@@ -64,6 +118,7 @@ public class AccountEvent implements Serializable {
@OneToMany(mappedBy = "accoutEventsId") @OneToMany(mappedBy = "accoutEventsId")
private List<Bill> billList; private List<Bill> billList;
>>>>>>>>>>>>>>>>>>>> File 1
public AccountEvent() { public AccountEvent() {
} }
...@@ -77,98 +132,263 @@ public class AccountEvent implements Serializable { ...@@ -77,98 +132,263 @@ public class AccountEvent implements Serializable {
this.unitPrice = unitPrice; this.unitPrice = unitPrice;
this.unitCount = unitCount; this.unitCount = unitCount;
this.eventTime = eventTime; this.eventTime = eventTime;
>>>>>>>>>>>>>>>>>>>> File 2
public AccountEvent() {
>>>>>>>>>>>>>>>>>>>> File 3
@Version
@Column(nullable = false)
private int jpaVersionField;
public AccountEvent() {
<<<<<<<<<<<<<<<<<<<<
} }
>>>>>>>>>>>>>>>>>>>> File 1
public Integer getAccountEventsId() { public Integer getAccountEventsId() {
return accountEventsId; return accountEventsId;
>>>>>>>>>>>>>>>>>>>> File 2
public AccountEvent(Integer accountEventsId) {
this.accountEventsId = accountEventsId;
>>>>>>>>>>>>>>>>>>>> File 3
public AccountEvent(Integer accountEventsId) {
this.id = accountEventsId;
<<<<<<<<<<<<<<<<<<<<
} }
>>>>>>>>>>>>>>>>>>>> File 1
public void setAccountEventsId(Integer accountEventsId) { public void setAccountEventsId(Integer accountEventsId) {
this.accountEventsId = accountEventsId; this.accountEventsId = accountEventsId;
>>>>>>>>>>>>>>>>>>>> File 2
public AccountEvent(Integer accountEventsId, BigInteger unitPrice, int unitCount, Date eventTime) {
this.accountEventsId = accountEventsId;
this.unitPrice = unitPrice;
this.unitCount = unitCount;
this.eventTime = eventTime;
>>>>>>>>>>>>>>>>>>>> File 3
public AccountEvent(Integer accountEventsId, BigInteger unitPrice, int unitCount, Date eventTime) {
this.id = accountEventsId;
this.unitPrice = unitPrice;
this.unitCount = unitCount;
this.eventTime = eventTime;
<<<<<<<<<<<<<<<<<<<<
}
>>>>>>>>>>>>>>>>>>>> File 1
>>>>>>>>>>>>>>>>>>>> File 2
public Integer getAccountEventsId() {
return accountEventsId;
}
public void setAccountEventsId(Integer accountEventsId) {
this.accountEventsId = accountEventsId;
} }
>>>>>>>>>>>>>>>>>>>> File 3
<<<<<<<<<<<<<<<<<<<<
public BigInteger getUnitPrice() { public BigInteger getUnitPrice() {
>>>>>>>>>>>>>>>>>>>> File 1
return unitPrice; return unitPrice;
>>>>>>>>>>>>>>>>>>>> File 2
return unitPrice;
>>>>>>>>>>>>>>>>>>>> File 3
return unitPrice;
<<<<<<<<<<<<<<<<<<<<
} }
public void setUnitPrice(BigInteger unitPrice) { public void setUnitPrice(BigInteger unitPrice) {
>>>>>>>>>>>>>>>>>>>> File 1
this.unitPrice = unitPrice; this.unitPrice = unitPrice;
>>>>>>>>>>>>>>>>>>>> File 2
this.unitPrice = unitPrice;
>>>>>>>>>>>>>>>>>>>> File 3
this.unitPrice = unitPrice;
<<<<<<<<<<<<<<<<<<<<
} }
public int getUnitCount() { public int getUnitCount() {
>>>>>>>>>>>>>>>>>>>> File 1
return unitCount; return unitCount;
>>>>>>>>>>>>>>>>>>>> File 2
return unitCount;
>>>>>>>>>>>>>>>>>>>> File 3
return unitCount;
<<<<<<<<<<<<<<<<<<<<
} }
public void setUnitCount(int unitCount) { public void setUnitCount(int unitCount) {
>>>>>>>>>>>>>>>>>>>> File 1
this.unitCount = unitCount; this.unitCount = unitCount;
>>>>>>>>>>>>>>>>>>>> File 2
this.unitCount = unitCount;
>>>>>>>>>>>>>>>>>>>> File 3
this.unitCount = unitCount;
<<<<<<<<<<<<<<<<<<<<
} }
public Date getEventTime() { public Date getEventTime() {
>>>>>>>>>>>>>>>>>>>> File 1
return eventTime; return eventTime;
>>>>>>>>>>>>>>>>>>>> File 2
return eventTime;
>>>>>>>>>>>>>>>>>>>> File 3
return eventTime;
<<<<<<<<<<<<<<<<<<<<
} }
public void setEventTime(Date eventTime) { public void setEventTime(Date eventTime) {
>>>>>>>>>>>>>>>>>>>> File 1
this.eventTime = eventTime; this.eventTime = eventTime;
>>>>>>>>>>>>>>>>>>>> File 2
this.eventTime = eventTime;
>>>>>>>>>>>>>>>>>>>> File 3
this.eventTime = eventTime;
<<<<<<<<<<<<<<<<<<<<
} }
public Date getDelivered() { public Date getDelivered() {
>>>>>>>>>>>>>>>>>>>> File 1
return delivered; return delivered;
>>>>>>>>>>>>>>>>>>>> File 2
return delivered;
>>>>>>>>>>>>>>>>>>>> File 3
return delivered;
<<<<<<<<<<<<<<<<<<<<
} }
public void setDelivered(Date delivered) { public void setDelivered(Date delivered) {
>>>>>>>>>>>>>>>>>>>> File 1
this.delivered = delivered; this.delivered = delivered;
>>>>>>>>>>>>>>>>>>>> File 2
this.delivered = delivered;
>>>>>>>>>>>>>>>>>>>> File 3
this.delivered = delivered;
<<<<<<<<<<<<<<<<<<<<
} }
public FoodWave getFoodWavesId() { public FoodWave getFoodWavesId() {
>>>>>>>>>>>>>>>>>>>> File 1
return foodWavesId; return foodWavesId;
>>>>>>>>>>>>>>>>>>>> File 2
return foodWavesId;
>>>>>>>>>>>>>>>>>>>> File 3
return foodWavesId;
<<<<<<<<<<<<<<<<<<<<
} }
public void setFoodWavesId(FoodWave foodWavesId) { public void setFoodWavesId(FoodWave foodWavesId) {
>>>>>>>>>>>>>>>>>>>> File 1
this.foodWavesId = foodWavesId; this.foodWavesId = foodWavesId;
>>>>>>>>>>>>>>>>>>>> File 2
this.foodWavesId = foodWavesId;
>>>>>>>>>>>>>>>>>>>> File 3
this.foodWavesId = foodWavesId;
<<<<<<<<<<<<<<<<<<<<
} }
public Product getProductsId() { public Product getProductsId() {
>>>>>>>>>>>>>>>>>>>> File 1
return productsId; return productsId;
>>>>>>>>>>>>>>>>>>>> File 2
return productsId;
>>>>>>>>>>>>>>>>>>>> File 3
return productsId;
<<<<<<<<<<<<<<<<<<<<
} }
public void setProductsId(Product productsId) { public void setProductsId(Product productsId) {
>>>>>>>>>>>>>>>>>>>> File 1
this.productsId = productsId; this.productsId = productsId;
>>>>>>>>>>>>>>>>>>>> File 2
this.productsId = productsId;
>>>>>>>>>>>>>>>>>>>> File 3
this.productsId = productsId;
<<<<<<<<<<<<<<<<<<<<
} }
public User getUsersId() { public User getUsersId() {
>>>>>>>>>>>>>>>>>>>> File 1
return usersId; return usersId;
>>>>>>>>>>>>>>>>>>>> File 2
return usersId;
>>>>>>>>>>>>>>>>>>>> File 3
return usersId;
<<<<<<<<<<<<<<<<<<<<
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
>>>>>>>>>>>>>>>>>>>> File 1
this.usersId = usersId; this.usersId = usersId;
>>>>>>>>>>>>>>>>>>>> File 2
this.usersId = usersId;
>>>>>>>>>>>>>>>>>>>> File 3
this.usersId = usersId;
<<<<<<<<<<<<<<<<<<<<
} }
public List<DiscountInstance> getDiscountInstanceList() { public List<DiscountInstance> getDiscountInstanceList() {
>>>>>>>>>>>>>>>>>>>> File 1
return discountInstanceList; return discountInstanceList;
>>>>>>>>>>>>>>>>>>>> File 2
return discountInstanceList;
>>>>>>>>>>>>>>>>>>>> File 3
return discountInstanceList;
<<<<<<<<<<<<<<<<<<<<
} }
>>>>>>>>>>>>>>>>>>>> File 1
public void setDiscountInstanceList( public void setDiscountInstanceList(
List<DiscountInstance> discountInstanceList) { List<DiscountInstance> discountInstanceList) {
this.discountInstanceList = discountInstanceList; this.discountInstanceList = discountInstanceList;
>>>>>>>>>>>>>>>>>>>> File 2
public void setDiscountInstanceList(List<DiscountInstance> discountInstanceList) {
this.discountInstanceList = discountInstanceList;
>>>>>>>>>>>>>>>>>>>> File 3
public void setDiscountInstanceList(List<DiscountInstance> discountInstanceList) {
this.discountInstanceList = discountInstanceList;
<<<<<<<<<<<<<<<<<<<<
} }
public List<Bill> getBillList() { public List<Bill> getBillList() {
>>>>>>>>>>>>>>>>>>>> File 1
return billList; return billList;
>>>>>>>>>>>>>>>>>>>> File 2
return billList;
>>>>>>>>>>>>>>>>>>>> File 3
return billList;
<<<<<<<<<<<<<<<<<<<<
} }
public void setBillList(List<Bill> billList) { public void setBillList(List<Bill> billList) {
>>>>>>>>>>>>>>>>>>>> File 1
this.billList = billList; this.billList = billList;
>>>>>>>>>>>>>>>>>>>> File 2
this.billList = billList;
>>>>>>>>>>>>>>>>>>>> File 3
this.billList = billList;
<<<<<<<<<<<<<<<<<<<<
} }
@Override @Override
public int hashCode() { public int hashCode() {
>>>>>>>>>>>>>>>>>>>> File 1
int hash = 0; int hash = 0;
hash += (accountEventsId != null ? accountEventsId.hashCode() : 0); hash += (accountEventsId != null ? accountEventsId.hashCode() : 0);
return hash; return hash;
>>>>>>>>>>>>>>>>>>>> File 2
int hash = 0;
hash += (accountEventsId != null ? accountEventsId.hashCode() : 0);
return hash;
>>>>>>>>>>>>>>>>>>>> File 3
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
<<<<<<<<<<<<<<<<<<<<
} }
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
>>>>>>>>>>>>>>>>>>>> File 1
// 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)) {
...@@ -181,12 +401,39 @@ public class AccountEvent implements Serializable { ...@@ -181,12 +401,39 @@ public class AccountEvent implements Serializable {
return false; return false;
} }
return true; return true;
>>>>>>>>>>>>>>>>>>>> File 2
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AccountEvent)) {
return false;
}
AccountEvent other = (AccountEvent) object;
if ((this.accountEventsId == null && other.accountEventsId != null) || (this.accountEventsId != null && !this.accountEventsId.equals(other.accountEventsId))) {
return false;
}
return true;
>>>>>>>>>>>>>>>>>>>> File 3
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AccountEvent)) {
return false;
}
AccountEvent other = (AccountEvent) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
<<<<<<<<<<<<<<<<<<<<
} }
@Override @Override
public String toString() { public String toString() {
>>>>>>>>>>>>>>>>>>>> File 1
return "fi.insomnia.bortal.model.AccountEvent[accountEventsId=" return "fi.insomnia.bortal.model.AccountEvent[accountEventsId="
+ accountEventsId + "]"; + accountEventsId + "]";
>>>>>>>>>>>>>>>>>>>> File 2
return "fi.insomnia.bortal.model.AccountEvent[accountEventsId=" + accountEventsId + "]";
>>>>>>>>>>>>>>>>>>>> File 3
return "fi.insomnia.bortal.model.AccountEvent[accountEventsId=" + id + "]";
<<<<<<<<<<<<<<<<<<<<
} }
} }
...@@ -8,6 +8,7 @@ import java.io.Serializable; ...@@ -8,6 +8,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -21,33 +22,34 @@ import javax.persistence.Temporal; ...@@ -21,33 +22,34 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@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 b.billsId = :billsId"),
@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"),
@NamedQuery(name = "Bill.findByNotes", query = "SELECT b FROM Bill b WHERE b.notes = :notes") }) @NamedQuery(name = "Bill.findByNotes", query = "SELECT b FROM Bill b WHERE b.notes = :notes")})
public class Bill implements Serializable { public class Bill implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "bills_id", nullable = false) @Column(name = "bills_id", nullable = false)
private Integer billsId; 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", length = 2147483647)
private String referenceNumber; private String referenceNumber;
@Column(name = "notes") @Column(name = "notes", length = 2147483647)
private String notes; private String notes;
@OneToMany(mappedBy = "billsId") @OneToMany(mappedBy = "billsId")
private List<BillLine> billLineList; private List<BillLine> billLineList;
...@@ -58,101 +60,96 @@ public class Bill implements Serializable { ...@@ -58,101 +60,96 @@ public class Bill implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User usersId; private User usersId;
public Bill() { @Version
} @Column(nullable = false)
private int jpaVersionField;
public Bill(Integer billsId) {
this.billsId = billsId;
}
public Integer getBillsId() { public Bill() {
return billsId;
} }
public void setBillsId(Integer billsId) { public Bill(Integer billsId) {
this.billsId = billsId; this.id = billsId;
} }
public Date getDueDate() { public Date getDueDate() {
return dueDate; return dueDate;
} }
public void setDueDate(Date dueDate) { public void setDueDate(Date dueDate) {
this.dueDate = dueDate; this.dueDate = dueDate;
} }
public Date getPaidDate() { public Date getPaidDate() {
return paidDate; return paidDate;
} }
public void setPaidDate(Date paidDate) { public void setPaidDate(Date paidDate) {
this.paidDate = paidDate; this.paidDate = paidDate;
} }
public String getReferenceNumber() { public String getReferenceNumber() {
return referenceNumber; return referenceNumber;
} }
public void setReferenceNumber(String referenceNumber) { public void setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber; this.referenceNumber = referenceNumber;
} }
public String getNotes() { public String getNotes() {
return notes; return notes;
} }
public void setNotes(String notes) { public void setNotes(String notes) {
this.notes = notes; this.notes = notes;
} }
public List<BillLine> getBillLineList() { public List<BillLine> getBillLineList() {
return billLineList; return billLineList;
} }
public void setBillLineList(List<BillLine> billLineList) { public void setBillLineList(List<BillLine> billLineList) {
this.billLineList = billLineList; this.billLineList = billLineList;
} }
public AccountEvent getAccoutEventsId() { public AccountEvent getAccoutEventsId() {
return accoutEventsId; return accoutEventsId;
} }
public void setAccoutEventsId(AccountEvent accoutEventsId) { public void setAccoutEventsId(AccountEvent accoutEventsId) {
this.accoutEventsId = accoutEventsId; this.accoutEventsId = accoutEventsId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (billsId != null ? billsId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 Bill)) {
if (!(object instanceof Bill)) { return false;
return false; }
} Bill other = (Bill) object;
Bill other = (Bill) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.billsId == null && other.billsId != null) return false;
|| (this.billsId != null && !this.billsId.equals(other.billsId))) { }
return false; return true;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Bill[billsId=" + billsId + "]"; return "fi.insomnia.bortal.model.Bill[billsId=" + id + "]";
} }
} }
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Basic;
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,126 +18,123 @@ import javax.persistence.NamedQuery; ...@@ -17,126 +18,123 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
* *
* @author jkj * @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.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.findByProduct", query = "SELECT b FROM BillLine b WHERE b.product = :product"),
@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")})
public class BillLine implements Serializable { public class BillLine implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "bill_lines_id", nullable = false) @Column(name = "bill_lines_id", nullable = false)
private Integer billLinesId; private Integer id;
@Basic(optional = false)
@Column(name = "product", nullable = false, length = 2147483647) @Column(name = "product", nullable = false, length = 2147483647)
private String product; private String product;
@Basic(optional = false)
@Column(name = "units", nullable = false) @Column(name = "units", nullable = false)
private int units; private int units;
@Basic(optional = false)
@Column(name = "unit_price", nullable = false) @Column(name = "unit_price", nullable = false)
private float unitPrice; private float unitPrice;
@Basic(optional = false)
@Column(name = "vat", nullable = false) @Column(name = "vat", nullable = false)
private float vat; private float vat;
@JoinColumn(name = "bills_id", referencedColumnName = "bills_id") @JoinColumn(name = "bills_id", referencedColumnName = "bills_id")
@ManyToOne @ManyToOne
private Bill billsId; private Bill billsId;
public BillLine() { @Version
} @Column(nullable = false)
private int jpaVersionField;
public BillLine(Integer billLinesId) {
this.billLinesId = billLinesId;
}
public BillLine(Integer billLinesId, String product, int units, public BillLine() {
float unitPrice, float vat) {
this.billLinesId = billLinesId;
this.product = product;
this.units = units;
this.unitPrice = unitPrice;
this.vat = vat;
} }
public Integer getBillLinesId() { public BillLine(Integer billLinesId) {
return billLinesId; this.id = billLinesId;
} }
public void setBillLinesId(Integer billLinesId) { public BillLine(Integer billLinesId, String product, int units, float unitPrice, float vat) {
this.billLinesId = billLinesId; this.id = billLinesId;
this.product = product;
this.units = units;
this.unitPrice = unitPrice;
this.vat = vat;
} }
public String getProduct() { public String getProduct() {
return product; return product;
} }
public void setProduct(String product) { public void setProduct(String product) {
this.product = product; this.product = product;
} }
public int getUnits() { public int getUnits() {
return units; return units;
} }
public void setUnits(int units) { public void setUnits(int units) {
this.units = units; this.units = units;
} }
public float getUnitPrice() { public float getUnitPrice() {
return unitPrice; return unitPrice;
} }
public void setUnitPrice(float unitPrice) { public void setUnitPrice(float unitPrice) {
this.unitPrice = unitPrice; this.unitPrice = unitPrice;
} }
public float getVat() { public float getVat() {
return vat; return vat;
} }
public void setVat(float vat) { public void setVat(float vat) {
this.vat = vat; this.vat = vat;
} }
public Bill getBillsId() { public Bill getBillsId() {
return billsId; return billsId;
} }
public void setBillsId(Bill billsId) { public void setBillsId(Bill billsId) {
this.billsId = billsId; this.billsId = billsId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (billLinesId != null ? billLinesId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 BillLine)) {
if (!(object instanceof BillLine)) { return false;
return false; }
} BillLine other = (BillLine) object;
BillLine other = (BillLine) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.billLinesId == null && other.billLinesId != null) return false;
|| (this.billLinesId != null && !this.billLinesId }
.equals(other.billLinesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.BillLine[billLinesId=" + billLinesId return "fi.insomnia.bortal.model.BillLine[billLinesId=" + id + "]";
+ "]";
} }
} }
...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model; ...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -20,23 +21,25 @@ import javax.persistence.OneToMany; ...@@ -20,23 +21,25 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
* *
* @author jkj * @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.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.findByTemplateName", query = "SELECT c FROM CardTemplate c WHERE c.templateName = :templateName")})
public class CardTemplate implements Serializable { public class CardTemplate implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "card_templates_id", nullable = false) @Column(name = "card_templates_id", nullable = false)
private Integer cardTemplatesId; private Integer id;
@Lob @Lob
@Column(name = "template_image") @Column(name = "template_image")
private byte[] templateImage; private byte[] templateImage;
@Basic(optional = false)
@Column(name = "template_name", nullable = false, length = 2147483647) @Column(name = "template_name", nullable = false, length = 2147483647)
private String templateName; private String templateName;
@JoinColumn(name = "events_id", referencedColumnName = "events_id") @JoinColumn(name = "events_id", referencedColumnName = "events_id")
...@@ -45,85 +48,78 @@ public class CardTemplate implements Serializable { ...@@ -45,85 +48,78 @@ public class CardTemplate implements Serializable {
@OneToMany(mappedBy = "cardTemplatesId") @OneToMany(mappedBy = "cardTemplatesId")
private List<Role> roleList; private List<Role> roleList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public CardTemplate() { public CardTemplate() {
} }
public CardTemplate(Integer cardTemplatesId) { public CardTemplate(Integer cardTemplatesId) {
this.cardTemplatesId = cardTemplatesId; this.id = cardTemplatesId;
} }
public CardTemplate(Integer cardTemplatesId, String templateName) { public CardTemplate(Integer cardTemplatesId, String templateName) {
this.cardTemplatesId = cardTemplatesId; this.id = cardTemplatesId;
this.templateName = templateName; this.templateName = templateName;
}
public Integer getCardTemplatesId() {
return cardTemplatesId;
}
public void setCardTemplatesId(Integer cardTemplatesId) {
this.cardTemplatesId = cardTemplatesId;
} }
public byte[] getTemplateImage() { public byte[] getTemplateImage() {
return templateImage; return templateImage;
} }
public void setTemplateImage(byte[] templateImage) { public void setTemplateImage(byte[] templateImage) {
this.templateImage = templateImage; this.templateImage = templateImage;
} }
public String getTemplateName() { public String getTemplateName() {
return templateName; return templateName;
} }
public void setTemplateName(String templateName) { public void setTemplateName(String templateName) {
this.templateName = templateName; this.templateName = templateName;
} }
public Event getEventsId() { public Event getEventsId() {
return eventsId; return eventsId;
} }
public void setEventsId(Event eventsId) { public void setEventsId(Event eventsId) {
this.eventsId = eventsId; this.eventsId = eventsId;
} }
public List<Role> getRoleList() { public List<Role> getRoleList() {
return roleList; return roleList;
} }
public void setRoleList(List<Role> roleList) { public void setRoleList(List<Role> roleList) {
this.roleList = roleList; this.roleList = roleList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (cardTemplatesId != null ? cardTemplatesId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 CardTemplate)) {
if (!(object instanceof CardTemplate)) { return false;
return false; }
} CardTemplate other = (CardTemplate) object;
CardTemplate other = (CardTemplate) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.cardTemplatesId == null && other.cardTemplatesId != null) return false;
|| (this.cardTemplatesId != null && !this.cardTemplatesId }
.equals(other.cardTemplatesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.CardTemplate[cardTemplatesId=" return "fi.insomnia.bortal.model.CardTemplate[cardTemplatesId=" + id + "]";
+ cardTemplatesId + "]";
} }
} }
...@@ -9,6 +9,7 @@ import java.io.Serializable; ...@@ -9,6 +9,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -23,26 +24,28 @@ import javax.persistence.Temporal; ...@@ -23,26 +24,28 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
/** /**
* *
* @author jkj * @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.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.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.findByCompoStart", query = "SELECT c FROM Compo c WHERE c.compoStart = :compoStart"),
@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")})
public class Compo implements Serializable { public class Compo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "compos_id", nullable = false) @Column(name = "compos_id", nullable = false)
private Integer composId; private Integer id;
@Basic(optional = false)
@Column(name = "compo_name", nullable = false, length = 2147483647) @Column(name = "compo_name", nullable = false, length = 2147483647)
private String compoName; private String compoName;
@Column(name = "compo_start") @Column(name = "compo_start")
...@@ -60,6 +63,7 @@ public class Compo implements Serializable { ...@@ -60,6 +63,7 @@ public class Compo implements Serializable {
@Column(name = "submit_end") @Column(name = "submit_end")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date submitEnd; private Date submitEnd;
@Basic(optional = false)
@Column(name = "hold_voting", nullable = false) @Column(name = "hold_voting", nullable = false)
private boolean holdVoting; private boolean holdVoting;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "composId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "composId")
...@@ -68,125 +72,119 @@ public class Compo implements Serializable { ...@@ -68,125 +72,119 @@ public class Compo implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Event eventsId; private Event eventsId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Compo() { public Compo() {
} }
public Compo(Integer composId) { public Compo(Integer composId) {
this.composId = composId; this.id = composId;
} }
public Compo(Integer composId, String compoName, boolean holdVoting) { public Compo(Integer composId, String compoName, boolean holdVoting) {
this.composId = composId; this.id = composId;
this.compoName = compoName; this.compoName = compoName;
this.holdVoting = holdVoting; this.holdVoting = holdVoting;
}
public Integer getComposId() {
return composId;
}
public void setComposId(Integer composId) {
this.composId = composId;
} }
public String getCompoName() { public String getCompoName() {
return compoName; return compoName;
} }
public void setCompoName(String compoName) { public void setCompoName(String compoName) {
this.compoName = compoName; this.compoName = compoName;
} }
public Date getCompoStart() { public Date getCompoStart() {
return compoStart; return compoStart;
} }
public void setCompoStart(Date compoStart) { public void setCompoStart(Date compoStart) {
this.compoStart = compoStart; this.compoStart = compoStart;
} }
public Date getVoteStart() { public Date getVoteStart() {
return voteStart; return voteStart;
} }
public void setVoteStart(Date voteStart) { public void setVoteStart(Date voteStart) {
this.voteStart = voteStart; this.voteStart = voteStart;
} }
public Date getVoteEnd() { public Date getVoteEnd() {
return voteEnd; return voteEnd;
} }
public void setVoteEnd(Date voteEnd) { public void setVoteEnd(Date voteEnd) {
this.voteEnd = voteEnd; this.voteEnd = voteEnd;
} }
public Date getSubmitStart() { public Date getSubmitStart() {
return submitStart; return submitStart;
} }
public void setSubmitStart(Date submitStart) { public void setSubmitStart(Date submitStart) {
this.submitStart = submitStart; this.submitStart = submitStart;
} }
public Date getSubmitEnd() { public Date getSubmitEnd() {
return submitEnd; return submitEnd;
} }
public void setSubmitEnd(Date submitEnd) { public void setSubmitEnd(Date submitEnd) {
this.submitEnd = submitEnd; this.submitEnd = submitEnd;
} }
public boolean getHoldVoting() { public boolean getHoldVoting() {
return holdVoting; return holdVoting;
} }
public void setHoldVoting(boolean holdVoting) { public void setHoldVoting(boolean holdVoting) {
this.holdVoting = holdVoting; this.holdVoting = holdVoting;
} }
public List<CompoEntry> getCompoEntryList() { public List<CompoEntry> getCompoEntryList() {
return compoEntryList; return compoEntryList;
} }
public void setCompoEntryList(List<CompoEntry> compoEntryList) { public void setCompoEntryList(List<CompoEntry> compoEntryList) {
this.compoEntryList = compoEntryList; this.compoEntryList = compoEntryList;
} }
public Event getEventsId() { public Event getEventsId() {
return eventsId; return eventsId;
} }
public void setEventsId(Event eventsId) { public void setEventsId(Event eventsId) {
this.eventsId = eventsId; this.eventsId = eventsId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (composId != null ? composId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 Compo)) {
if (!(object instanceof Compo)) { return false;
return false; }
} Compo other = (Compo) object;
Compo other = (Compo) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.composId == null && other.composId != null) return false;
|| (this.composId != null && !this.composId }
.equals(other.composId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Compo[composId=" + composId + "]"; return "fi.insomnia.bortal.model.Compo[composId=" + id + "]";
} }
} }
...@@ -9,6 +9,7 @@ import java.io.Serializable; ...@@ -9,6 +9,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -23,27 +24,30 @@ import javax.persistence.Temporal; ...@@ -23,27 +24,30 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
/** /**
* *
* @author jkj * @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.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.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.findByEntryName", query = "SELECT c FROM CompoEntry c WHERE c.entryName = :entryName"),
@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")})
public class CompoEntry implements Serializable { public class CompoEntry implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "entries_id", nullable = false) @Column(name = "entries_id", nullable = false)
private Integer entriesId; private Integer id;
@Basic(optional = false)
@Column(name = "entry_created", nullable = false) @Column(name = "entry_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date entryCreated; private Date entryCreated;
@Basic(optional = false)
@Column(name = "entry_name", nullable = false, length = 2147483647) @Column(name = "entry_name", nullable = false, length = 2147483647)
private String entryName; private String entryName;
@Column(name = "notes", length = 2147483647) @Column(name = "notes", length = 2147483647)
...@@ -65,135 +69,127 @@ public class CompoEntry implements Serializable { ...@@ -65,135 +69,127 @@ public class CompoEntry implements Serializable {
@ManyToOne @ManyToOne
private User creator; private User creator;
@Version
@Column(nullable = false)
private int jpaVersionField;
public CompoEntry() { public CompoEntry() {
} }
public CompoEntry(Integer entriesId) { public CompoEntry(Integer entriesId) {
this.entriesId = entriesId; this.id = entriesId;
} }
public CompoEntry(Integer entriesId, Date entryCreated, String entryName) { public CompoEntry(Integer entriesId, Date entryCreated, String entryName) {
this.entriesId = entriesId; this.id = entriesId;
this.entryCreated = entryCreated; this.entryCreated = entryCreated;
this.entryName = entryName; this.entryName = entryName;
}
public Integer getEntriesId() {
return entriesId;
}
public void setEntriesId(Integer entriesId) {
this.entriesId = entriesId;
} }
public Date getEntryCreated() { public Date getEntryCreated() {
return entryCreated; return entryCreated;
} }
public void setEntryCreated(Date entryCreated) { public void setEntryCreated(Date entryCreated) {
this.entryCreated = entryCreated; this.entryCreated = entryCreated;
} }
public String getEntryName() { public String getEntryName() {
return entryName; return entryName;
} }
public void setEntryName(String entryName) { public void setEntryName(String entryName) {
this.entryName = entryName; this.entryName = entryName;
} }
public String getNotes() { public String getNotes() {
return notes; return notes;
} }
public void setNotes(String notes) { public void setNotes(String notes) {
this.notes = notes; this.notes = notes;
} }
public String getScreenMessage() { public String getScreenMessage() {
return screenMessage; return screenMessage;
} }
public void setScreenMessage(String screenMessage) { public void setScreenMessage(String screenMessage) {
this.screenMessage = screenMessage; this.screenMessage = screenMessage;
} }
public Integer getSort() { public Integer getSort() {
return sort; return sort;
} }
public void setSort(Integer sort) { public void setSort(Integer sort) {
this.sort = sort; this.sort = sort;
} }
public List<Vote> getVoteList() { public List<Vote> getVoteList() {
return voteList; return voteList;
} }
public void setVoteList(List<Vote> voteList) { public void setVoteList(List<Vote> voteList) {
this.voteList = voteList; this.voteList = voteList;
} }
public List<CompoEntryFile> getCompoEntryFileList() { public List<CompoEntryFile> getCompoEntryFileList() {
return compoEntryFileList; return compoEntryFileList;
} }
public void setCompoEntryFileList(List<CompoEntryFile> compoEntryFileList) { public void setCompoEntryFileList(List<CompoEntryFile> compoEntryFileList) {
this.compoEntryFileList = compoEntryFileList; this.compoEntryFileList = compoEntryFileList;
} }
public List<CompoEntryParticipant> getCompoEntryParticipantList() { public List<CompoEntryParticipant> getCompoEntryParticipantList() {
return compoEntryParticipantList; return compoEntryParticipantList;
} }
public void setCompoEntryParticipantList( public void setCompoEntryParticipantList(List<CompoEntryParticipant> compoEntryParticipantList) {
List<CompoEntryParticipant> compoEntryParticipantList) { this.compoEntryParticipantList = compoEntryParticipantList;
this.compoEntryParticipantList = compoEntryParticipantList;
} }
public Compo getComposId() { public Compo getComposId() {
return composId; return composId;
} }
public void setComposId(Compo composId) { public void setComposId(Compo composId) {
this.composId = composId; this.composId = composId;
} }
public User getCreator() { public User getCreator() {
return creator; return creator;
} }
public void setCreator(User creator) { public void setCreator(User creator) {
this.creator = creator; this.creator = creator;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (entriesId != null ? entriesId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 CompoEntry)) {
if (!(object instanceof CompoEntry)) { return false;
return false; }
} CompoEntry other = (CompoEntry) object;
CompoEntry other = (CompoEntry) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.entriesId == null && other.entriesId != null) return false;
|| (this.entriesId != null && !this.entriesId }
.equals(other.entriesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.CompoEntry[entriesId=" + entriesId return "fi.insomnia.bortal.model.CompoEntry[entriesId=" + id + "]";
+ "]";
} }
} }
...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model; ...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -21,25 +22,26 @@ import javax.persistence.Temporal; ...@@ -21,25 +22,26 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "entry_files") @Table(name = "entry_files")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "CompoEntryFile.findAll", query = "SELECT c FROM CompoEntryFile c"), @NamedQuery(name = "CompoEntryFile.findAll", query = "SELECT c FROM CompoEntryFile c"),
@NamedQuery(name = "CompoEntryFile.findByEntryFilesId", query = "SELECT c FROM CompoEntryFile c WHERE c.entryFilesId = :entryFilesId"), @NamedQuery(name = "CompoEntryFile.findByEntryFilesId", query = "SELECT c FROM CompoEntryFile c WHERE c.entryFilesId = :entryFilesId"),
@NamedQuery(name = "CompoEntryFile.findByMimeType", query = "SELECT c FROM CompoEntryFile c WHERE c.mimeType = :mimeType"), @NamedQuery(name = "CompoEntryFile.findByMimeType", query = "SELECT c FROM CompoEntryFile c WHERE c.mimeType = :mimeType"),
@NamedQuery(name = "CompoEntryFile.findByFileName", query = "SELECT c FROM CompoEntryFile c WHERE c.fileName = :fileName"), @NamedQuery(name = "CompoEntryFile.findByFileName", query = "SELECT c FROM CompoEntryFile c WHERE c.fileName = :fileName"),
@NamedQuery(name = "CompoEntryFile.findByDescription", query = "SELECT c FROM CompoEntryFile c WHERE c.description = :description"), @NamedQuery(name = "CompoEntryFile.findByDescription", query = "SELECT c FROM CompoEntryFile c WHERE c.description = :description"),
@NamedQuery(name = "CompoEntryFile.findByHash", query = "SELECT c FROM CompoEntryFile c WHERE c.hash = :hash"), @NamedQuery(name = "CompoEntryFile.findByHash", query = "SELECT c FROM CompoEntryFile c WHERE c.hash = :hash"),
@NamedQuery(name = "CompoEntryFile.findByComment", query = "SELECT c FROM CompoEntryFile c WHERE c.comment = :comment"), @NamedQuery(name = "CompoEntryFile.findByComment", query = "SELECT c FROM CompoEntryFile c WHERE c.comment = :comment"),
@NamedQuery(name = "CompoEntryFile.findByUploaded", query = "SELECT c FROM CompoEntryFile c WHERE c.uploaded = :uploaded") }) @NamedQuery(name = "CompoEntryFile.findByUploaded", query = "SELECT c FROM CompoEntryFile c WHERE c.uploaded = :uploaded")})
public class CompoEntryFile implements Serializable { public class CompoEntryFile implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "entry_files_id", nullable = false) @Column(name = "entry_files_id", nullable = false)
private Integer entryFilesId; private Integer id;
@Column(name = "mime_type", length = 2147483647) @Column(name = "mime_type", length = 2147483647)
private String mimeType; private String mimeType;
@Column(name = "file_name", length = 2147483647) @Column(name = "file_name", length = 2147483647)
...@@ -53,6 +55,7 @@ public class CompoEntryFile implements Serializable { ...@@ -53,6 +55,7 @@ public class CompoEntryFile implements Serializable {
@Lob @Lob
@Column(name = "file_data") @Column(name = "file_data")
private byte[] fileData; private byte[] fileData;
@Basic(optional = false)
@Column(name = "uploaded", nullable = false) @Column(name = "uploaded", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date uploaded; private Date uploaded;
...@@ -60,117 +63,110 @@ public class CompoEntryFile implements Serializable { ...@@ -60,117 +63,110 @@ public class CompoEntryFile implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
private CompoEntry entriesId; private CompoEntry entriesId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public CompoEntryFile() { public CompoEntryFile() {
} }
public CompoEntryFile(Integer entryFilesId) { public CompoEntryFile(Integer entryFilesId) {
this.entryFilesId = entryFilesId; this.id = entryFilesId;
} }
public CompoEntryFile(Integer entryFilesId, Date uploaded) { public CompoEntryFile(Integer entryFilesId, Date uploaded) {
this.entryFilesId = entryFilesId; this.id = entryFilesId;
this.uploaded = uploaded; this.uploaded = uploaded;
}
public Integer getEntryFilesId() {
return entryFilesId;
}
public void setEntryFilesId(Integer entryFilesId) {
this.entryFilesId = entryFilesId;
} }
public String getMimeType() { public String getMimeType() {
return mimeType; return mimeType;
} }
public void setMimeType(String mimeType) { public void setMimeType(String mimeType) {
this.mimeType = mimeType; this.mimeType = mimeType;
} }
public String getFileName() { public String getFileName() {
return fileName; return fileName;
} }
public void setFileName(String fileName) { public void setFileName(String fileName) {
this.fileName = fileName; this.fileName = fileName;
} }
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
public String getHash() { public String getHash() {
return hash; return hash;
} }
public void setHash(String hash) { public void setHash(String hash) {
this.hash = hash; this.hash = hash;
} }
public String getComment() { public String getComment() {
return comment; return comment;
} }
public void setComment(String comment) { public void setComment(String comment) {
this.comment = comment; this.comment = comment;
} }
public byte[] getFileData() { public byte[] getFileData() {
return fileData; return fileData;
} }
public void setFileData(byte[] fileData) { public void setFileData(byte[] fileData) {
this.fileData = fileData; this.fileData = fileData;
} }
public Date getUploaded() { public Date getUploaded() {
return uploaded; return uploaded;
} }
public void setUploaded(Date uploaded) { public void setUploaded(Date uploaded) {
this.uploaded = uploaded; this.uploaded = uploaded;
} }
public CompoEntry getEntriesId() { public CompoEntry getEntriesId() {
return entriesId; return entriesId;
} }
public void setEntriesId(CompoEntry entriesId) { public void setEntriesId(CompoEntry entriesId) {
this.entriesId = entriesId; this.entriesId = entriesId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (entryFilesId != null ? entryFilesId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 CompoEntryFile)) {
if (!(object instanceof CompoEntryFile)) { return false;
return false; }
} CompoEntryFile other = (CompoEntryFile) object;
CompoEntryFile other = (CompoEntryFile) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.entryFilesId == null && other.entryFilesId != null) return false;
|| (this.entryFilesId != null && !this.entryFilesId }
.equals(other.entryFilesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.CompoEntryFile[entryFilesId=" return "fi.insomnia.bortal.model.CompoEntryFile[entryFilesId=" + id + "]";
+ entryFilesId + "]";
} }
} }
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Basic;
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,20 +18,21 @@ import javax.persistence.NamedQuery; ...@@ -17,20 +18,21 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
* *
* @author jkj * @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.findByEntryParticipationsId", query = "SELECT c FROM CompoEntryParticipant c WHERE c.entryParticipationsId = :entryParticipationsId"),
@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 Serializable { public class CompoEntryParticipant implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "entry_participations_id", nullable = false) @Column(name = "entry_participations_id", nullable = false)
private Integer entryParticipationsId; private Integer id;
@Column(name = "role", length = 2147483647) @Column(name = "role", length = 2147483647)
private String role; private String role;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false) @JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
...@@ -40,73 +42,65 @@ public class CompoEntryParticipant implements Serializable { ...@@ -40,73 +42,65 @@ public class CompoEntryParticipant implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User usersId; private User usersId;
public CompoEntryParticipant() { @Version
} @Column(nullable = false)
private int jpaVersionField;
public CompoEntryParticipant(Integer entryParticipationsId) {
this.entryParticipationsId = entryParticipationsId;
}
public Integer getEntryParticipationsId() { public CompoEntryParticipant() {
return entryParticipationsId;
} }
public void setEntryParticipationsId(Integer entryParticipationsId) { public CompoEntryParticipant(Integer entryParticipationsId) {
this.entryParticipationsId = entryParticipationsId; this.id = entryParticipationsId;
} }
public String getRole() { public String getRole() {
return role; return role;
} }
public void setRole(String role) { public void setRole(String role) {
this.role = role; this.role = role;
} }
public CompoEntry getEntriesId() { public CompoEntry getEntriesId() {
return entriesId; return entriesId;
} }
public void setEntriesId(CompoEntry entriesId) { public void setEntriesId(CompoEntry entriesId) {
this.entriesId = entriesId; this.entriesId = entriesId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (entryParticipationsId != null ? entryParticipationsId hash += (id != null ? id.hashCode() : 0);
.hashCode() : 0); return hash;
return hash;
} }
@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 CompoEntryParticipant)) {
if (!(object instanceof CompoEntryParticipant)) { return false;
return false; }
} CompoEntryParticipant other = (CompoEntryParticipant) object;
CompoEntryParticipant other = (CompoEntryParticipant) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.entryParticipationsId == null && other.entryParticipationsId != null) return false;
|| (this.entryParticipationsId != null && !this.entryParticipationsId }
.equals(other.entryParticipationsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.CompoEntryParticipant[entryParticipationsId=" return "fi.insomnia.bortal.model.CompoEntryParticipant[entryParticipationsId=" + id + "]";
+ entryParticipationsId + "]";
} }
} }
...@@ -9,6 +9,7 @@ import java.io.Serializable; ...@@ -9,6 +9,7 @@ import java.io.Serializable;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -19,172 +20,170 @@ import javax.persistence.OneToMany; ...@@ -19,172 +20,170 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
* *
* @author jkj * @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.discountsId = :discountsId"),
@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"),
@NamedQuery(name = "Discount.findByAmountMin", query = "SELECT d FROM Discount d WHERE d.amountMin = :amountMin"), @NamedQuery(name = "Discount.findByAmountMin", query = "SELECT d FROM Discount d WHERE d.amountMin = :amountMin"),
@NamedQuery(name = "Discount.findByAmountMax", query = "SELECT d FROM Discount d WHERE d.amountMax = :amountMax"), @NamedQuery(name = "Discount.findByAmountMax", query = "SELECT d FROM Discount d WHERE d.amountMax = :amountMax"),
@NamedQuery(name = "Discount.findByActive", query = "SELECT d FROM Discount d WHERE d.active = :active"), @NamedQuery(name = "Discount.findByActive", query = "SELECT d FROM Discount d WHERE d.active = :active"),
@NamedQuery(name = "Discount.findByMaxNum", query = "SELECT d FROM Discount d WHERE d.maxNum = :maxNum"), @NamedQuery(name = "Discount.findByMaxNum", query = "SELECT d FROM Discount d WHERE d.maxNum = :maxNum"),
@NamedQuery(name = "Discount.findByPerUser", query = "SELECT d FROM Discount d WHERE d.perUser = :perUser") }) @NamedQuery(name = "Discount.findByPerUser", query = "SELECT d FROM Discount d WHERE d.perUser = :perUser")})
public class Discount implements Serializable { public class Discount implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "discounts_id", nullable = false) @Column(name = "discounts_id", nullable = false)
private Integer discountsId; private Integer id;
@Basic(optional = false)
@Column(name = "percentage", nullable = false) @Column(name = "percentage", nullable = false)
private BigInteger percentage; private BigInteger percentage;
@Column(name = "code", length = 2147483647) @Column(name = "code", length = 2147483647)
private String code; private String code;
@Column(name = "details", length = 2147483647) @Column(name = "details", length = 2147483647)
private String details; private String details;
@Basic(optional = false)
@Column(name = "amount_min", nullable = false) @Column(name = "amount_min", nullable = false)
private int amountMin; private int amountMin;
@Basic(optional = false)
@Column(name = "amount_max", nullable = false) @Column(name = "amount_max", nullable = false)
private int amountMax; private int amountMax;
@Basic(optional = false)
@Column(name = "active", nullable = false) @Column(name = "active", nullable = false)
private boolean active; private boolean active;
@Basic(optional = false)
@Column(name = "max_num", nullable = false) @Column(name = "max_num", nullable = false)
private int maxNum; private int maxNum;
@Basic(optional = false)
@Column(name = "per_user", nullable = false) @Column(name = "per_user", nullable = false)
private int perUser; private int perUser;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "discountsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "discountsId")
private List<DiscountInstance> discountInstanceList; private List<DiscountInstance> discountInstanceList;
public Discount() { @Version
} @Column(nullable = false)
private int jpaVersionField;
public Discount(Integer discountsId) {
this.discountsId = discountsId;
}
public Discount(Integer discountsId, BigInteger percentage, int amountMin, public Discount() {
int amountMax, boolean active, int maxNum, int perUser) {
this.discountsId = discountsId;
this.percentage = percentage;
this.amountMin = amountMin;
this.amountMax = amountMax;
this.active = active;
this.maxNum = maxNum;
this.perUser = perUser;
} }
public Integer getDiscountsId() { public Discount(Integer discountsId) {
return discountsId; this.id = discountsId;
} }
public void setDiscountsId(Integer discountsId) { public Discount(Integer discountsId, BigInteger percentage, int amountMin, int amountMax, boolean active, int maxNum, int perUser) {
this.discountsId = discountsId; this.id = discountsId;
this.percentage = percentage;
this.amountMin = amountMin;
this.amountMax = amountMax;
this.active = active;
this.maxNum = maxNum;
this.perUser = perUser;
} }
public BigInteger getPercentage() { public BigInteger getPercentage() {
return percentage; return percentage;
} }
public void setPercentage(BigInteger percentage) { public void setPercentage(BigInteger percentage) {
this.percentage = percentage; this.percentage = percentage;
} }
public String getCode() { public String getCode() {
return code; return code;
} }
public void setCode(String code) { public void setCode(String code) {
this.code = code; this.code = code;
} }
public String getDetails() { public String getDetails() {
return details; return details;
} }
public void setDetails(String details) { public void setDetails(String details) {
this.details = details; this.details = details;
} }
public int getAmountMin() { public int getAmountMin() {
return amountMin; return amountMin;
} }
public void setAmountMin(int amountMin) { public void setAmountMin(int amountMin) {
this.amountMin = amountMin; this.amountMin = amountMin;
} }
public int getAmountMax() { public int getAmountMax() {
return amountMax; return amountMax;
} }
public void setAmountMax(int amountMax) { public void setAmountMax(int amountMax) {
this.amountMax = amountMax; this.amountMax = amountMax;
} }
public boolean getActive() { public boolean getActive() {
return active; return active;
} }
public void setActive(boolean active) { public void setActive(boolean active) {
this.active = active; this.active = active;
} }
public int getMaxNum() { public int getMaxNum() {
return maxNum; return maxNum;
} }
public void setMaxNum(int maxNum) { public void setMaxNum(int maxNum) {
this.maxNum = maxNum; this.maxNum = maxNum;
} }
public int getPerUser() { public int getPerUser() {
return perUser; return perUser;
} }
public void setPerUser(int perUser) { public void setPerUser(int perUser) {
this.perUser = perUser; this.perUser = perUser;
} }
public List<DiscountInstance> getDiscountInstanceList() { public List<DiscountInstance> getDiscountInstanceList() {
return discountInstanceList; return discountInstanceList;
} }
public void setDiscountInstanceList( public void setDiscountInstanceList(List<DiscountInstance> discountInstanceList) {
List<DiscountInstance> discountInstanceList) { this.discountInstanceList = discountInstanceList;
this.discountInstanceList = discountInstanceList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (discountsId != null ? discountsId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 Discount)) {
if (!(object instanceof Discount)) { return false;
return false; }
} Discount other = (Discount) object;
Discount other = (Discount) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.discountsId == null && other.discountsId != null) return false;
|| (this.discountsId != null && !this.discountsId }
.equals(other.discountsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Discount[discountsId=" + discountsId return "fi.insomnia.bortal.model.Discount[discountsId=" + id + "]";
+ "]";
} }
} }
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -15,21 +13,24 @@ import javax.persistence.ManyToOne; ...@@ -15,21 +13,24 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @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.findByDiscountsInstancesId", query = "SELECT d FROM DiscountInstance d WHERE d.discountsInstancesId = :discountsInstancesId")})
public class DiscountInstance implements Serializable { public class DiscountInstance implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "discounts_instances_id", nullable = false) @Column(name = "discounts_instances_id", nullable = false)
private Integer discountsInstancesId; private Integer id;
@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 accountEventsId;
...@@ -39,74 +40,91 @@ public class DiscountInstance implements Serializable { ...@@ -39,74 +40,91 @@ public class DiscountInstance implements Serializable {
@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 usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public DiscountInstance() { public DiscountInstance() {
} }
public DiscountInstance(Integer discountsInstancesId) { public DiscountInstance(Integer discountsInstancesId) {
this.discountsInstancesId = discountsInstancesId; this.id = discountsInstancesId;
}
public Integer getDiscountsInstancesId() {
return discountsInstancesId;
}
public void setDiscountsInstancesId(Integer discountsInstancesId) {
this.discountsInstancesId = discountsInstancesId;
} }
public AccountEvent getAccountEventsId() { public AccountEvent getAccountEventsId() {
return accountEventsId; return accountEventsId;
} }
public void setAccountEventsId(AccountEvent accountEventsId) { public void setAccountEventsId(AccountEvent accountEventsId) {
this.accountEventsId = accountEventsId; this.accountEventsId = accountEventsId;
} }
public Discount getDiscountsId() { public Discount getDiscountsId() {
return discountsId; return discountsId;
} }
public void setDiscountsId(Discount discountsId) { public void setDiscountsId(Discount discountsId) {
this.discountsId = discountsId; this.discountsId = discountsId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (discountsInstancesId != null ? discountsInstancesId.hashCode() hash += (getId() != null ? getId().hashCode() : 0);
: 0); return hash;
return hash;
} }
@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 DiscountInstance)) {
if (!(object instanceof DiscountInstance)) { return false;
return false; }
} DiscountInstance other = (DiscountInstance) object;
DiscountInstance other = (DiscountInstance) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.discountsInstancesId == null && other.discountsInstancesId != null) return false;
|| (this.discountsInstancesId != null && !this.discountsInstancesId }
.equals(other.discountsInstancesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.DiscountInstance[discountsInstancesId=" return "fi.insomnia.bortal.model.DiscountInstance[discountsInstancesId=" + getId() + "]";
+ discountsInstancesId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -21,31 +20,35 @@ import javax.persistence.OneToMany; ...@@ -21,31 +20,35 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "events") @Table(name = "events")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"), @NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"),
@NamedQuery(name = "Event.findByEventsId", query = "SELECT e FROM Event e WHERE e.eventsId = :eventsId"), @NamedQuery(name = "Event.findByEventsId", query = "SELECT e FROM Event e WHERE e.eventsId = :eventsId"),
@NamedQuery(name = "Event.findByStartTime", query = "SELECT e FROM Event e WHERE e.startTime = :startTime"), @NamedQuery(name = "Event.findByStartTime", query = "SELECT e FROM Event e WHERE e.startTime = :startTime"),
@NamedQuery(name = "Event.findByEndTime", query = "SELECT e FROM Event e WHERE e.endTime = :endTime"), @NamedQuery(name = "Event.findByEndTime", query = "SELECT e FROM Event e WHERE e.endTime = :endTime"),
@NamedQuery(name = "Event.findByName", query = "SELECT e FROM Event e WHERE e.name = :name"), @NamedQuery(name = "Event.findByName", query = "SELECT e FROM Event e WHERE e.name = :name"),
@NamedQuery(name = "Event.findByReferer", query = "SELECT e FROM Event e WHERE e.referer = :referer") }) @NamedQuery(name = "Event.findByReferer", query = "SELECT e FROM Event e WHERE e.referer = :referer")})
public class Event implements Serializable { public class Event implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "events_id", nullable = false) @Column(name = "events_id", nullable = false)
private Integer eventsId; 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;
@Basic(optional = false)
@Column(name = "name", nullable = false, length = 2147483647) @Column(name = "name", nullable = false, length = 2147483647)
private String name; private String name;
@Column(name = "referer", length = 2147483647) @Column(name = "referer", length = 2147483647)
...@@ -67,141 +70,160 @@ public class Event implements Serializable { ...@@ -67,141 +70,160 @@ public class Event implements Serializable {
private List<EventMap> eventMapList; private List<EventMap> eventMapList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "eventsId")
private List<Role> roleList; private List<Role> roleList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Event() { public Event() {
} }
public Event(Integer eventsId) { public Event(Integer eventsId) {
this.eventsId = eventsId; this.id = eventsId;
} }
public Event(Integer eventsId, String name) { public Event(Integer eventsId, String name) {
this.eventsId = eventsId; this.id = eventsId;
this.name = name; this.name = name;
}
public Integer getEventsId() {
return eventsId;
}
public void setEventsId(Integer eventsId) {
this.eventsId = eventsId;
} }
public Date getStartTime() { public Date getStartTime() {
return startTime; return startTime;
} }
public void setStartTime(Date startTime) { public void setStartTime(Date startTime) {
this.startTime = startTime; this.startTime = startTime;
} }
public Date getEndTime() { public Date getEndTime() {
return endTime; return endTime;
} }
public void setEndTime(Date endTime) { public void setEndTime(Date endTime) {
this.endTime = endTime; this.endTime = endTime;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getReferer() { public String getReferer() {
return referer; return referer;
} }
public void setReferer(String referer) { public void setReferer(String referer) {
this.referer = referer; this.referer = referer;
} }
public EventSettings getEventSettingsId() { public EventSettings getEventSettingsId() {
return eventSettingsId; return eventSettingsId;
} }
public void setEventSettingsId(EventSettings eventSettingsId) { public void setEventSettingsId(EventSettings eventSettingsId) {
this.eventSettingsId = eventSettingsId; this.eventSettingsId = eventSettingsId;
} }
public EventStatus getEventStatusId() { public EventStatus getEventStatusId() {
return eventStatusId; return eventStatusId;
} }
public void setEventStatusId(EventStatus eventStatusId) { public void setEventStatusId(EventStatus eventStatusId) {
this.eventStatusId = eventStatusId; this.eventStatusId = eventStatusId;
} }
public Role getDefaultRole() { public Role getDefaultRole() {
return defaultRole; return defaultRole;
} }
public void setDefaultRole(Role defaultRole) { public void setDefaultRole(Role defaultRole) {
this.defaultRole = defaultRole; this.defaultRole = defaultRole;
} }
public List<Compo> getCompoList() { public List<Compo> getCompoList() {
return compoList; return compoList;
} }
public void setCompoList(List<Compo> compoList) { public void setCompoList(List<Compo> compoList) {
this.compoList = compoList; this.compoList = compoList;
} }
public List<CardTemplate> getCardTemplateList() { public List<CardTemplate> getCardTemplateList() {
return cardTemplateList; return cardTemplateList;
} }
public void setCardTemplateList(List<CardTemplate> cardTemplateList) { public void setCardTemplateList(List<CardTemplate> cardTemplateList) {
this.cardTemplateList = cardTemplateList; this.cardTemplateList = cardTemplateList;
} }
public List<EventMap> getEventMapList() { public List<EventMap> getEventMapList() {
return eventMapList; return eventMapList;
} }
public void setEventMapList(List<EventMap> eventMapList) { public void setEventMapList(List<EventMap> eventMapList) {
this.eventMapList = eventMapList; this.eventMapList = eventMapList;
} }
public List<Role> getRoleList() { public List<Role> getRoleList() {
return roleList; return roleList;
} }
public void setRoleList(List<Role> roleList) { public void setRoleList(List<Role> roleList) {
this.roleList = roleList; this.roleList = roleList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (eventsId != null ? eventsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 Event)) {
if (!(object instanceof Event)) { return false;
return false; }
} Event other = (Event) object;
Event other = (Event) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.eventsId == null && other.eventsId != null) return false;
|| (this.eventsId != null && !this.eventsId }
.equals(other.eventsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Event[eventsId=" + eventsId + "]"; return "fi.insomnia.bortal.model.Event[eventsId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -19,22 +18,25 @@ import javax.persistence.NamedQueries; ...@@ -19,22 +18,25 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "maps") @Table(name = "maps")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"), @NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"),
@NamedQuery(name = "EventMap.findByMapsId", query = "SELECT e FROM EventMap e WHERE e.mapsId = :mapsId"), @NamedQuery(name = "EventMap.findByMapsId", query = "SELECT e FROM EventMap e WHERE e.mapsId = :mapsId"),
@NamedQuery(name = "EventMap.findByMapName", query = "SELECT e FROM EventMap e WHERE e.mapName = :mapName") }) @NamedQuery(name = "EventMap.findByMapName", query = "SELECT e FROM EventMap e WHERE e.mapName = :mapName")})
public class EventMap implements Serializable { public class EventMap implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "maps_id", nullable = false) @Column(name = "maps_id", nullable = false)
private Integer mapsId; private Integer id;
@Lob @Lob
@Column(name = "map_data") @Column(name = "map_data")
private byte[] mapData; private byte[] mapData;
...@@ -45,79 +47,99 @@ public class EventMap implements Serializable { ...@@ -45,79 +47,99 @@ public class EventMap implements Serializable {
@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;
@Version
@Column(nullable = false)
private int jpaVersionField;
public EventMap() { public EventMap() {
} }
public EventMap(Integer mapsId) { public EventMap(Integer mapsId) {
this.mapsId = mapsId; this.id = mapsId;
}
public Integer getMapsId() {
return mapsId;
}
public void setMapsId(Integer mapsId) {
this.mapsId = mapsId;
} }
public byte[] getMapData() { public byte[] getMapData() {
return mapData; return mapData;
} }
public void setMapData(byte[] mapData) { public void setMapData(byte[] mapData) {
this.mapData = mapData; this.mapData = mapData;
} }
public String getMapName() { public String getMapName() {
return mapName; return mapName;
} }
public void setMapName(String mapName) { public void setMapName(String mapName) {
this.mapName = mapName; this.mapName = mapName;
} }
public List<Place> getPlaceList() { public List<Place> getPlaceList() {
return placeList; return placeList;
} }
public void setPlaceList(List<Place> placeList) { public void setPlaceList(List<Place> placeList) {
this.placeList = placeList; this.placeList = placeList;
} }
public Event getEventsId() { public Event getEventsId() {
return eventsId; return eventsId;
} }
public void setEventsId(Event eventsId) { public void setEventsId(Event eventsId) {
this.eventsId = eventsId; this.eventsId = eventsId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (mapsId != null ? mapsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 EventMap)) {
if (!(object instanceof EventMap)) { return false;
return false; }
} EventMap other = (EventMap) object;
EventMap other = (EventMap) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.mapsId == null && other.mapsId != null) return false;
|| (this.mapsId != null && !this.mapsId.equals(other.mapsId))) { }
return false; return true;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.EventMap[mapsId=" + mapsId + "]"; return "fi.insomnia.bortal.model.EventMap[mapsId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -16,25 +15,28 @@ import javax.persistence.NamedQueries; ...@@ -16,25 +15,28 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @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.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.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.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.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.findByNamePossissiveForm", query = "SELECT e FROM EventSettings e WHERE e.namePossissiveForm = :namePossissiveForm")})
public class EventSettings implements Serializable { public class EventSettings implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "event_settings_id", nullable = false) @Column(name = "event_settings_id", nullable = false)
private Integer eventSettingsId; private Integer id;
@Column(name = "resource_bundle", length = 2147483647) @Column(name = "resource_bundle", length = 2147483647)
private String resourceBundle; private String resourceBundle;
@Column(name = "style_sheet", length = 2147483647) @Column(name = "style_sheet", length = 2147483647)
...@@ -45,89 +47,107 @@ public class EventSettings implements Serializable { ...@@ -45,89 +47,107 @@ public class EventSettings implements Serializable {
private String namePossissiveForm; private String namePossissiveForm;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventSettingsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "eventSettingsId")
private List<Event> eventList; private List<Event> eventList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public EventSettings() { public EventSettings() {
} }
public EventSettings(Integer eventSettingsId) { public EventSettings(Integer eventSettingsId) {
this.eventSettingsId = eventSettingsId; this.id = eventSettingsId;
}
public Integer getEventSettingsId() {
return eventSettingsId;
}
public void setEventSettingsId(Integer eventSettingsId) {
this.eventSettingsId = eventSettingsId;
} }
public String getResourceBundle() { public String getResourceBundle() {
return resourceBundle; return resourceBundle;
} }
public void setResourceBundle(String resourceBundle) { public void setResourceBundle(String resourceBundle) {
this.resourceBundle = resourceBundle; this.resourceBundle = resourceBundle;
} }
public String getStyleSheet() { public String getStyleSheet() {
return styleSheet; return styleSheet;
} }
public void setStyleSheet(String styleSheet) { public void setStyleSheet(String styleSheet) {
this.styleSheet = styleSheet; this.styleSheet = styleSheet;
} }
public String getNameGeneralForm() { public String getNameGeneralForm() {
return nameGeneralForm; return nameGeneralForm;
} }
public void setNameGeneralForm(String nameGeneralForm) { public void setNameGeneralForm(String nameGeneralForm) {
this.nameGeneralForm = nameGeneralForm; this.nameGeneralForm = nameGeneralForm;
} }
public String getNamePossissiveForm() { public String getNamePossissiveForm() {
return namePossissiveForm; return namePossissiveForm;
} }
public void setNamePossissiveForm(String namePossissiveForm) { public void setNamePossissiveForm(String namePossissiveForm) {
this.namePossissiveForm = namePossissiveForm; this.namePossissiveForm = namePossissiveForm;
} }
public List<Event> getEventList() { public List<Event> getEventList() {
return eventList; return eventList;
} }
public void setEventList(List<Event> eventList) { public void setEventList(List<Event> eventList) {
this.eventList = eventList; this.eventList = eventList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (eventSettingsId != null ? eventSettingsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 EventSettings)) {
if (!(object instanceof EventSettings)) { return false;
return false; }
} EventSettings other = (EventSettings) object;
EventSettings other = (EventSettings) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.eventSettingsId == null && other.eventSettingsId != null) return false;
|| (this.eventSettingsId != null && !this.eventSettingsId }
.equals(other.eventSettingsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.EventSettings[eventSettingsId=" return "fi.insomnia.bortal.model.EventSettings[eventSettingsId=" + getId() + "]";
+ eventSettingsId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -17,90 +16,113 @@ import javax.persistence.NamedQuery; ...@@ -17,90 +16,113 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "event_status", uniqueConstraints = { @UniqueConstraint(columnNames = { "status_name" }) }) @Table(name = "event_status", uniqueConstraints = {
@NamedQueries( { @UniqueConstraint(columnNames = {"status_name"})})
@NamedQuery(name = "EventStatus.findAll", query = "SELECT e FROM EventStatus e"), @NamedQueries({
@NamedQuery(name = "EventStatus.findByEventStatusId", query = "SELECT e FROM EventStatus e WHERE e.eventStatusId = :eventStatusId"), @NamedQuery(name = "EventStatus.findAll", query = "SELECT e FROM EventStatus e"),
@NamedQuery(name = "EventStatus.findByStatusName", query = "SELECT e FROM EventStatus e WHERE e.statusName = :statusName") }) @NamedQuery(name = "EventStatus.findByEventStatusId", query = "SELECT e FROM EventStatus e WHERE e.eventStatusId = :eventStatusId"),
public class EventStatus implements Serializable { @NamedQuery(name = "EventStatus.findByStatusName", query = "SELECT e FROM EventStatus e WHERE e.statusName = :statusName")})
public class EventStatus implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "event_status_id", nullable = false) @Column(name = "event_status_id", nullable = false)
private Integer eventStatusId; private Integer id;
@Basic(optional = false)
@Column(name = "status_name", nullable = false, length = 2147483647) @Column(name = "status_name", nullable = false, length = 2147483647)
private String statusName; private String statusName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventStatusId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "eventStatusId")
private List<Event> eventList; private List<Event> eventList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public EventStatus() { public EventStatus() {
} }
public EventStatus(Integer eventStatusId) { public EventStatus(Integer eventStatusId) {
this.eventStatusId = eventStatusId; this.id = eventStatusId;
} }
public EventStatus(Integer eventStatusId, String statusName) { public EventStatus(Integer eventStatusId, String statusName) {
this.eventStatusId = eventStatusId; this.id = eventStatusId;
this.statusName = statusName; this.statusName = statusName;
}
public Integer getEventStatusId() {
return eventStatusId;
}
public void setEventStatusId(Integer eventStatusId) {
this.eventStatusId = eventStatusId;
} }
public String getStatusName() { public String getStatusName() {
return statusName; return statusName;
} }
public void setStatusName(String statusName) { public void setStatusName(String statusName) {
this.statusName = statusName; this.statusName = statusName;
} }
public List<Event> getEventList() { public List<Event> getEventList() {
return eventList; return eventList;
} }
public void setEventList(List<Event> eventList) { public void setEventList(List<Event> eventList) {
this.eventList = eventList; this.eventList = eventList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (eventStatusId != null ? eventStatusId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 EventStatus)) {
if (!(object instanceof EventStatus)) { return false;
return false; }
} EventStatus other = (EventStatus) object;
EventStatus other = (EventStatus) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.eventStatusId == null && other.eventStatusId != null) return false;
|| (this.eventStatusId != null && !this.eventStatusId }
.equals(other.eventStatusId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.EventStatus[eventStatusId=" return "fi.insomnia.bortal.model.EventStatus[eventStatusId=" + getId() + "]";
+ eventStatusId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -18,25 +17,29 @@ import javax.persistence.OneToMany; ...@@ -18,25 +17,29 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "food_waves") @Table(name = "food_waves")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "FoodWave.findAll", query = "SELECT f FROM FoodWave f"), @NamedQuery(name = "FoodWave.findAll", query = "SELECT f FROM FoodWave f"),
@NamedQuery(name = "FoodWave.findByFoodWavesId", query = "SELECT f FROM FoodWave f WHERE f.foodWavesId = :foodWavesId"), @NamedQuery(name = "FoodWave.findByFoodWavesId", query = "SELECT f FROM FoodWave f WHERE f.foodWavesId = :foodWavesId"),
@NamedQuery(name = "FoodWave.findByWaveName", query = "SELECT f FROM FoodWave f WHERE f.waveName = :waveName"), @NamedQuery(name = "FoodWave.findByWaveName", query = "SELECT f FROM FoodWave f WHERE f.waveName = :waveName"),
@NamedQuery(name = "FoodWave.findByWaveDescription", query = "SELECT f FROM FoodWave f WHERE f.waveDescription = :waveDescription"), @NamedQuery(name = "FoodWave.findByWaveDescription", query = "SELECT f FROM FoodWave f WHERE f.waveDescription = :waveDescription"),
@NamedQuery(name = "FoodWave.findByWaveTime", query = "SELECT f FROM FoodWave f WHERE f.waveTime = :waveTime"), @NamedQuery(name = "FoodWave.findByWaveTime", query = "SELECT f FROM FoodWave f WHERE f.waveTime = :waveTime"),
@NamedQuery(name = "FoodWave.findByWaveClosed", query = "SELECT f FROM FoodWave f WHERE f.waveClosed = :waveClosed") }) @NamedQuery(name = "FoodWave.findByWaveClosed", query = "SELECT f FROM FoodWave f WHERE f.waveClosed = :waveClosed")})
public class FoodWave implements Serializable { public class FoodWave implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "food_waves_id", nullable = false) @Column(name = "food_waves_id", nullable = false)
private Integer foodWavesId; private Integer id;
@Basic(optional = false)
@Column(name = "wave_name", nullable = false, length = 2147483647) @Column(name = "wave_name", nullable = false, length = 2147483647)
private String waveName; private String waveName;
@Column(name = "wave_description", length = 2147483647) @Column(name = "wave_description", length = 2147483647)
...@@ -44,99 +47,118 @@ public class FoodWave implements Serializable { ...@@ -44,99 +47,118 @@ public class FoodWave implements Serializable {
@Column(name = "wave_time") @Column(name = "wave_time")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date waveTime; private Date waveTime;
@Basic(optional = false)
@Column(name = "wave_closed", nullable = false) @Column(name = "wave_closed", nullable = false)
private boolean waveClosed; private boolean waveClosed;
@OneToMany(mappedBy = "foodWavesId") @OneToMany(mappedBy = "foodWavesId")
private List<AccountEvent> accountEventList; private List<AccountEvent> accountEventList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public FoodWave() { public FoodWave() {
} }
public FoodWave(Integer foodWavesId) { public FoodWave(Integer foodWavesId) {
this.foodWavesId = foodWavesId; this.id = foodWavesId;
} }
public FoodWave(Integer foodWavesId, String waveName, boolean waveClosed) { public FoodWave(Integer foodWavesId, String waveName, boolean waveClosed) {
this.foodWavesId = foodWavesId; this.id = foodWavesId;
this.waveName = waveName; this.waveName = waveName;
this.waveClosed = waveClosed; this.waveClosed = waveClosed;
}
public Integer getFoodWavesId() {
return foodWavesId;
}
public void setFoodWavesId(Integer foodWavesId) {
this.foodWavesId = foodWavesId;
} }
public String getWaveName() { public String getWaveName() {
return waveName; return waveName;
} }
public void setWaveName(String waveName) { public void setWaveName(String waveName) {
this.waveName = waveName; this.waveName = waveName;
} }
public String getWaveDescription() { public String getWaveDescription() {
return waveDescription; return waveDescription;
} }
public void setWaveDescription(String waveDescription) { public void setWaveDescription(String waveDescription) {
this.waveDescription = waveDescription; this.waveDescription = waveDescription;
} }
public Date getWaveTime() { public Date getWaveTime() {
return waveTime; return waveTime;
} }
public void setWaveTime(Date waveTime) { public void setWaveTime(Date waveTime) {
this.waveTime = waveTime; this.waveTime = waveTime;
} }
public boolean getWaveClosed() { public boolean getWaveClosed() {
return waveClosed; return waveClosed;
} }
public void setWaveClosed(boolean waveClosed) { public void setWaveClosed(boolean waveClosed) {
this.waveClosed = waveClosed; this.waveClosed = waveClosed;
} }
public List<AccountEvent> getAccountEventList() { public List<AccountEvent> getAccountEventList() {
return accountEventList; return accountEventList;
} }
public void setAccountEventList(List<AccountEvent> accountEventList) { public void setAccountEventList(List<AccountEvent> accountEventList) {
this.accountEventList = accountEventList; this.accountEventList = accountEventList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (foodWavesId != null ? foodWavesId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 FoodWave)) {
if (!(object instanceof FoodWave)) { return false;
return false; }
} FoodWave other = (FoodWave) object;
FoodWave other = (FoodWave) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.foodWavesId == null && other.foodWavesId != null) return false;
|| (this.foodWavesId != null && !this.foodWavesId }
.equals(other.foodWavesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.FoodWave[foodWavesId=" + foodWavesId return "fi.insomnia.bortal.model.FoodWave[foodWavesId=" + getId() + "]";
+ "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -15,110 +14,129 @@ import javax.persistence.ManyToMany; ...@@ -15,110 +14,129 @@ import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "food_wave_templates") @Table(name = "food_wave_templates")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "FoodWaveTemplate.findAll", query = "SELECT f FROM FoodWaveTemplate f"), @NamedQuery(name = "FoodWaveTemplate.findAll", query = "SELECT f FROM FoodWaveTemplate f"),
@NamedQuery(name = "FoodWaveTemplate.findByFoodWaveTemplatesId", query = "SELECT f FROM FoodWaveTemplate f WHERE f.foodWaveTemplatesId = :foodWaveTemplatesId"), @NamedQuery(name = "FoodWaveTemplate.findByFoodWaveTemplatesId", query = "SELECT f FROM FoodWaveTemplate f WHERE f.foodWaveTemplatesId = :foodWaveTemplatesId"),
@NamedQuery(name = "FoodWaveTemplate.findByTemplateName", query = "SELECT f FROM FoodWaveTemplate f WHERE f.templateName = :templateName"), @NamedQuery(name = "FoodWaveTemplate.findByTemplateName", query = "SELECT f FROM FoodWaveTemplate f WHERE f.templateName = :templateName"),
@NamedQuery(name = "FoodWaveTemplate.findByTemplateDescription", query = "SELECT f FROM FoodWaveTemplate f WHERE f.templateDescription = :templateDescription") }) @NamedQuery(name = "FoodWaveTemplate.findByTemplateDescription", query = "SELECT f FROM FoodWaveTemplate f WHERE f.templateDescription = :templateDescription")})
public class FoodWaveTemplate implements Serializable { public class FoodWaveTemplate implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "food_wave_templates_id", nullable = false) @Column(name = "food_wave_templates_id", nullable = false)
private Integer foodWaveTemplatesId; private Integer id;
@Basic(optional = false)
@Column(name = "template_name", nullable = false, length = 2147483647) @Column(name = "template_name", nullable = false, length = 2147483647)
private String templateName; private String templateName;
@Column(name = "template_description", length = 2147483647) @Column(name = "template_description", length = 2147483647)
private String templateDescription; private String templateDescription;
@ManyToMany(mappedBy = "foodWaveTemplate") @ManyToMany(mappedBy = "foodWaveTemplate")
private List<Product> products; private List<Product> products;
@Version
@Column(nullable = false)
private int jpaVersionField;
public FoodWaveTemplate() { public FoodWaveTemplate() {
} }
public FoodWaveTemplate(Integer foodWaveTemplatesId) { public FoodWaveTemplate(Integer foodWaveTemplatesId) {
this.foodWaveTemplatesId = foodWaveTemplatesId; this.id = foodWaveTemplatesId;
} }
public FoodWaveTemplate(Integer foodWaveTemplatesId, String templateName) { public FoodWaveTemplate(Integer foodWaveTemplatesId, String templateName) {
this.foodWaveTemplatesId = foodWaveTemplatesId; this.id = foodWaveTemplatesId;
this.templateName = templateName; this.templateName = templateName;
}
public Integer getFoodWaveTemplatesId() {
return foodWaveTemplatesId;
}
public void setFoodWaveTemplatesId(Integer foodWaveTemplatesId) {
this.foodWaveTemplatesId = foodWaveTemplatesId;
} }
public String getTemplateName() { public String getTemplateName() {
return templateName; return templateName;
} }
public void setTemplateName(String templateName) { public void setTemplateName(String templateName) {
this.templateName = templateName; this.templateName = templateName;
} }
public String getTemplateDescription() { public String getTemplateDescription() {
return templateDescription; return templateDescription;
} }
public void setTemplateDescription(String templateDescription) { public void setTemplateDescription(String templateDescription) {
this.templateDescription = templateDescription; this.templateDescription = templateDescription;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (foodWaveTemplatesId != null ? foodWaveTemplatesId.hashCode() hash += (getId() != null ? getId().hashCode() : 0);
: 0); return hash;
return hash;
} }
@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 FoodWaveTemplate)) {
if (!(object instanceof FoodWaveTemplate)) { return false;
return false; }
} FoodWaveTemplate other = (FoodWaveTemplate) object;
FoodWaveTemplate other = (FoodWaveTemplate) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.foodWaveTemplatesId == null && other.foodWaveTemplatesId != null) return false;
|| (this.foodWaveTemplatesId != null && !this.foodWaveTemplatesId }
.equals(other.foodWaveTemplatesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.FoodWaveTemplate[foodWaveTemplatesId=" return "fi.insomnia.bortal.model.FoodWaveTemplate[foodWaveTemplatesId=" + getId() + "]";
+ foodWaveTemplatesId + "]";
} }
/** /**
* @return the products * @return the products
*/ */
public List<Product> getProducts() { public List<Product> getProducts() {
return products; return products;
} }
/** /**
* @param products * @param products the products to set
* the products to set
*/ */
public void setProducts(List<Product> products) { public void setProducts(List<Product> products) {
this.products = products; this.products = products;
}
/**
* @return the id
*/
public Integer getId() {
return id;
} }
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -19,25 +18,28 @@ import javax.persistence.Table; ...@@ -19,25 +18,28 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "group_memberships", uniqueConstraints = { @UniqueConstraint(columnNames = { @Table(name = "group_memberships", uniqueConstraints = {
"users_id", "groups_id" }) }) @UniqueConstraint(columnNames = {"users_id", "groups_id"})})
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "GroupMembership.findAll", query = "SELECT g FROM GroupMembership g"), @NamedQuery(name = "GroupMembership.findAll", query = "SELECT g FROM GroupMembership g"),
@NamedQuery(name = "GroupMembership.findByGroupMembershipsId", query = "SELECT g FROM GroupMembership g WHERE g.groupMembershipsId = :groupMembershipsId"), @NamedQuery(name = "GroupMembership.findByGroupMembershipsId", query = "SELECT g FROM GroupMembership g WHERE g.groupMembershipsId = :groupMembershipsId"),
@NamedQuery(name = "GroupMembership.findByInviteAccepted", query = "SELECT g FROM GroupMembership g WHERE g.inviteAccepted = :inviteAccepted"), @NamedQuery(name = "GroupMembership.findByInviteAccepted", query = "SELECT g FROM GroupMembership g WHERE g.inviteAccepted = :inviteAccepted"),
@NamedQuery(name = "GroupMembership.findByInviteEmail", query = "SELECT g FROM GroupMembership g WHERE g.inviteEmail = :inviteEmail"), @NamedQuery(name = "GroupMembership.findByInviteEmail", query = "SELECT g FROM GroupMembership g WHERE g.inviteEmail = :inviteEmail"),
@NamedQuery(name = "GroupMembership.findByInviteName", query = "SELECT g FROM GroupMembership g WHERE g.inviteName = :inviteName") }) @NamedQuery(name = "GroupMembership.findByInviteName", query = "SELECT g FROM GroupMembership g WHERE g.inviteName = :inviteName")})
public class GroupMembership implements Serializable { public class GroupMembership implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "group_memberships_id", nullable = false) @Column(name = "group_memberships_id", nullable = false)
private Integer groupMembershipsId; private Integer id;
@Column(name = "invite_accepted") @Column(name = "invite_accepted")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date inviteAccepted; private Date inviteAccepted;
...@@ -54,97 +56,115 @@ public class GroupMembership implements Serializable { ...@@ -54,97 +56,115 @@ public class GroupMembership implements Serializable {
@JoinColumn(name = "users_id", referencedColumnName = "users_id") @JoinColumn(name = "users_id", referencedColumnName = "users_id")
@ManyToOne @ManyToOne
private User usersId; private User usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public GroupMembership() { public GroupMembership() {
} }
public GroupMembership(Integer groupMembershipsId) { public GroupMembership(Integer groupMembershipsId) {
this.groupMembershipsId = groupMembershipsId; this.id = groupMembershipsId;
}
public Integer getGroupMembershipsId() {
return groupMembershipsId;
}
public void setGroupMembershipsId(Integer groupMembershipsId) {
this.groupMembershipsId = groupMembershipsId;
} }
public Date getInviteAccepted() { public Date getInviteAccepted() {
return inviteAccepted; return inviteAccepted;
} }
public void setInviteAccepted(Date inviteAccepted) { public void setInviteAccepted(Date inviteAccepted) {
this.inviteAccepted = inviteAccepted; this.inviteAccepted = inviteAccepted;
} }
public String getInviteEmail() { public String getInviteEmail() {
return inviteEmail; return inviteEmail;
} }
public void setInviteEmail(String inviteEmail) { public void setInviteEmail(String inviteEmail) {
this.inviteEmail = inviteEmail; this.inviteEmail = inviteEmail;
} }
public String getInviteName() { public String getInviteName() {
return inviteName; return inviteName;
} }
public void setInviteName(String inviteName) { public void setInviteName(String inviteName) {
this.inviteName = inviteName; this.inviteName = inviteName;
} }
public PlaceGroup getGroupsId() { public PlaceGroup getGroupsId() {
return groupsId; return groupsId;
} }
public void setGroupsId(PlaceGroup groupsId) { public void setGroupsId(PlaceGroup groupsId) {
this.groupsId = groupsId; this.groupsId = groupsId;
} }
public Place getPlaceReservation() { public Place getPlaceReservation() {
return placeReservation; return placeReservation;
} }
public void setPlaceReservation(Place placeReservation) { public void setPlaceReservation(Place placeReservation) {
this.placeReservation = placeReservation; this.placeReservation = placeReservation;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (groupMembershipsId != null ? groupMembershipsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 GroupMembership)) {
if (!(object instanceof GroupMembership)) { return false;
return false; }
} GroupMembership other = (GroupMembership) object;
GroupMembership other = (GroupMembership) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.groupMembershipsId == null && other.groupMembershipsId != null) return false;
|| (this.groupMembershipsId != null && !this.groupMembershipsId }
.equals(other.groupMembershipsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.GroupMembership[groupMembershipsId=" return "fi.insomnia.bortal.model.GroupMembership[groupMembershipsId=" + getId() + "]";
+ groupMembershipsId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic; import javax.persistence.Basic;
...@@ -16,100 +14,122 @@ import javax.persistence.NamedQueries; ...@@ -16,100 +14,122 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "locations") @Table(name = "locations")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"), @NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
@NamedQuery(name = "Location.findByLocationsId", query = "SELECT l FROM Location l WHERE l.locationsId = :locationsId"), @NamedQuery(name = "Location.findByLocationsId", query = "SELECT l FROM Location l WHERE l.locationsId = :locationsId"),
@NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.locationName = :locationName") }) @NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.locationName = :locationName")})
public class Location implements Serializable { public class Location implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "locations_id", nullable = false) @Column(name = "locations_id", nullable = false)
private Integer locationsId; private Integer id;
@Basic(optional = false)
@Column(name = "location_name", nullable = false, length = 2147483647) @Column(name = "location_name", nullable = false, length = 2147483647)
private String locationName; private String locationName;
@OneToMany(mappedBy = "locationsId") @OneToMany(mappedBy = "locationsId")
private List<Reader> readerList; private List<Reader> readerList;
@OneToMany(mappedBy = "currentLocation") @OneToMany(mappedBy = "currentLocation")
private List<PrintedCard> printedCardList; private List<PrintedCard> printedCardList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Location() { public Location() {
} }
public Location(Integer locationsId) { public Location(Integer locationsId) {
this.locationsId = locationsId; this.id = locationsId;
} }
public Location(Integer locationsId, String locationName) { public Location(Integer locationsId, String locationName) {
this.locationsId = locationsId; this.id = locationsId;
this.locationName = locationName; this.locationName = locationName;
}
public Integer getLocationsId() {
return locationsId;
}
public void setLocationsId(Integer locationsId) {
this.locationsId = locationsId;
} }
public String getLocationName() { public String getLocationName() {
return locationName; return locationName;
} }
public void setLocationName(String locationName) { public void setLocationName(String locationName) {
this.locationName = locationName; this.locationName = locationName;
} }
public List<Reader> getReaderList() { public List<Reader> getReaderList() {
return readerList; return readerList;
} }
public void setReaderList(List<Reader> readerList) { public void setReaderList(List<Reader> readerList) {
this.readerList = readerList; this.readerList = readerList;
} }
public List<PrintedCard> getPrintedCardList() { public List<PrintedCard> getPrintedCardList() {
return printedCardList; return printedCardList;
} }
public void setPrintedCardList(List<PrintedCard> printedCardList) { public void setPrintedCardList(List<PrintedCard> printedCardList) {
this.printedCardList = printedCardList; this.printedCardList = printedCardList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (locationsId != null ? locationsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 Location)) {
if (!(object instanceof Location)) { return false;
return false; }
} Location other = (Location) object;
Location other = (Location) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.locationsId == null && other.locationsId != null) return false;
|| (this.locationsId != null && !this.locationsId }
.equals(other.locationsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Location[locationsId=" + locationsId return "fi.insomnia.bortal.model.Location[locationsId=" + getId() + "]";
+ "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -18,23 +17,27 @@ import javax.persistence.NamedQuery; ...@@ -18,23 +17,27 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "event_log") @Table(name = "event_log")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"), @NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"),
@NamedQuery(name = "LogEntry.findByEventLogId", query = "SELECT l FROM LogEntry l WHERE l.eventLogId = :eventLogId"), @NamedQuery(name = "LogEntry.findByEventLogId", query = "SELECT l FROM LogEntry l WHERE l.eventLogId = :eventLogId"),
@NamedQuery(name = "LogEntry.findByEventTime", query = "SELECT l FROM LogEntry l WHERE l.eventTime = :eventTime"), @NamedQuery(name = "LogEntry.findByEventTime", query = "SELECT l FROM LogEntry l WHERE l.eventTime = :eventTime"),
@NamedQuery(name = "LogEntry.findByEventDescription", query = "SELECT l FROM LogEntry l WHERE l.eventDescription = :eventDescription") }) @NamedQuery(name = "LogEntry.findByEventDescription", query = "SELECT l FROM LogEntry l WHERE l.eventDescription = :eventDescription")})
public class LogEntry implements Serializable { public class LogEntry implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "event_log_id", nullable = false) @Column(name = "event_log_id", nullable = false)
private Integer eventLogId; private Integer id;
@Basic(optional = false)
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date eventTime; private Date eventTime;
...@@ -46,86 +49,104 @@ public class LogEntry implements Serializable { ...@@ -46,86 +49,104 @@ public class LogEntry implements Serializable {
@JoinColumn(name = "users_id", referencedColumnName = "users_id") @JoinColumn(name = "users_id", referencedColumnName = "users_id")
@ManyToOne @ManyToOne
private User usersId; private User usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public LogEntry() { public LogEntry() {
} }
public LogEntry(Integer eventLogId) { public LogEntry(Integer eventLogId) {
this.eventLogId = eventLogId; this.id = eventLogId;
} }
public LogEntry(Integer eventLogId, Date eventTime) { public LogEntry(Integer eventLogId, Date eventTime) {
this.eventLogId = eventLogId; this.id = eventLogId;
this.eventTime = eventTime; this.eventTime = eventTime;
}
public Integer getEventLogId() {
return eventLogId;
}
public void setEventLogId(Integer eventLogId) {
this.eventLogId = eventLogId;
} }
public Date getEventTime() { public Date getEventTime() {
return eventTime; return eventTime;
} }
public void setEventTime(Date eventTime) { public void setEventTime(Date eventTime) {
this.eventTime = eventTime; this.eventTime = eventTime;
} }
public String getEventDescription() { public String getEventDescription() {
return eventDescription; return eventDescription;
} }
public void setEventDescription(String eventDescription) { public void setEventDescription(String eventDescription) {
this.eventDescription = eventDescription; this.eventDescription = eventDescription;
} }
public LogEntryType getEventLogTypesId() { public LogEntryType getEventLogTypesId() {
return eventLogTypesId; return eventLogTypesId;
} }
public void setEventLogTypesId(LogEntryType eventLogTypesId) { public void setEventLogTypesId(LogEntryType eventLogTypesId) {
this.eventLogTypesId = eventLogTypesId; this.eventLogTypesId = eventLogTypesId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (eventLogId != null ? eventLogId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 LogEntry)) {
if (!(object instanceof LogEntry)) { return false;
return false; }
} LogEntry other = (LogEntry) object;
LogEntry other = (LogEntry) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.eventLogId == null && other.eventLogId != null) return false;
|| (this.eventLogId != null && !this.eventLogId }
.equals(other.eventLogId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.LogEntry[eventLogId=" + eventLogId return "fi.insomnia.bortal.model.LogEntry[eventLogId=" + getId() + "]";
+ "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -16,90 +15,112 @@ import javax.persistence.NamedQueries; ...@@ -16,90 +15,112 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "event_log_types") @Table(name = "event_log_types")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"), @NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"),
@NamedQuery(name = "LogEntryType.findByEventLogTypesId", query = "SELECT l FROM LogEntryType l WHERE l.eventLogTypesId = :eventLogTypesId"), @NamedQuery(name = "LogEntryType.findByEventLogTypesId", query = "SELECT l FROM LogEntryType l WHERE l.eventLogTypesId = :eventLogTypesId"),
@NamedQuery(name = "LogEntryType.findByEventTypeDescription", query = "SELECT l FROM LogEntryType l WHERE l.eventTypeDescription = :eventTypeDescription") }) @NamedQuery(name = "LogEntryType.findByEventTypeDescription", query = "SELECT l FROM LogEntryType l WHERE l.eventTypeDescription = :eventTypeDescription")})
public class LogEntryType implements Serializable { public class LogEntryType implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "event_log_types_id", nullable = false) @Column(name = "event_log_types_id", nullable = false)
private Integer eventLogTypesId; private Integer id;
@Basic(optional = false)
@Column(name = "event_type_description", nullable = false, length = 2147483647) @Column(name = "event_type_description", nullable = false, length = 2147483647)
private String eventTypeDescription; private String eventTypeDescription;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "eventLogTypesId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "eventLogTypesId")
private List<LogEntry> logEntryList; private List<LogEntry> logEntryList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public LogEntryType() { public LogEntryType() {
} }
public LogEntryType(Integer eventLogTypesId) { public LogEntryType(Integer eventLogTypesId) {
this.eventLogTypesId = eventLogTypesId; this.id = eventLogTypesId;
} }
public LogEntryType(Integer eventLogTypesId, String eventTypeDescription) { public LogEntryType(Integer eventLogTypesId, String eventTypeDescription) {
this.eventLogTypesId = eventLogTypesId; this.id = eventLogTypesId;
this.eventTypeDescription = eventTypeDescription; this.eventTypeDescription = eventTypeDescription;
}
public Integer getEventLogTypesId() {
return eventLogTypesId;
}
public void setEventLogTypesId(Integer eventLogTypesId) {
this.eventLogTypesId = eventLogTypesId;
} }
public String getEventTypeDescription() { public String getEventTypeDescription() {
return eventTypeDescription; return eventTypeDescription;
} }
public void setEventTypeDescription(String eventTypeDescription) { public void setEventTypeDescription(String eventTypeDescription) {
this.eventTypeDescription = eventTypeDescription; this.eventTypeDescription = eventTypeDescription;
} }
public List<LogEntry> getLogEntryList() { public List<LogEntry> getLogEntryList() {
return logEntryList; return logEntryList;
} }
public void setLogEntryList(List<LogEntry> logEntryList) { public void setLogEntryList(List<LogEntry> logEntryList) {
this.logEntryList = logEntryList; this.logEntryList = logEntryList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (eventLogTypesId != null ? eventLogTypesId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 LogEntryType)) {
if (!(object instanceof LogEntryType)) { return false;
return false; }
} LogEntryType other = (LogEntryType) object;
LogEntryType other = (LogEntryType) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.eventLogTypesId == null && other.eventLogTypesId != null) return false;
|| (this.eventLogTypesId != null && !this.eventLogTypesId }
.equals(other.eventLogTypesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.LogEntryType[eventLogTypesId=" return "fi.insomnia.bortal.model.LogEntryType[eventLogTypesId=" + getId() + "]";
+ eventLogTypesId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.io.Serializable;
/**
*
* @author tuukka
*/
public interface ModelInterface extends Serializable {
public Integer getId();
public void setId(Integer id);
public int getJpaVersionField();
public void setJpaVersionField(int jpaVersionField);
}
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -18,27 +17,31 @@ import javax.persistence.NamedQuery; ...@@ -18,27 +17,31 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "news") @Table(name = "news")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "News.findAll", query = "SELECT n FROM News n"), @NamedQuery(name = "News.findAll", query = "SELECT n FROM News n"),
@NamedQuery(name = "News.findByNewsId", query = "SELECT n FROM News n WHERE n.newsId = :newsId"), @NamedQuery(name = "News.findByNewsId", query = "SELECT n FROM News n WHERE n.newsId = :newsId"),
@NamedQuery(name = "News.findByTitle", query = "SELECT n FROM News n WHERE n.title = :title"), @NamedQuery(name = "News.findByTitle", query = "SELECT n FROM News n WHERE n.title = :title"),
@NamedQuery(name = "News.findByBody", query = "SELECT n FROM News n WHERE n.body = :body"), @NamedQuery(name = "News.findByBody", query = "SELECT n FROM News n WHERE n.body = :body"),
@NamedQuery(name = "News.findByAbstract1", query = "SELECT n FROM News n WHERE n.abstract1 = :abstract1"), @NamedQuery(name = "News.findByAbstract1", query = "SELECT n FROM News n WHERE n.abstract1 = :abstract1"),
@NamedQuery(name = "News.findByPublish", query = "SELECT n FROM News n WHERE n.publish = :publish"), @NamedQuery(name = "News.findByPublish", query = "SELECT n FROM News n WHERE n.publish = :publish"),
@NamedQuery(name = "News.findByExpire", query = "SELECT n FROM News n WHERE n.expire = :expire"), @NamedQuery(name = "News.findByExpire", query = "SELECT n FROM News n WHERE n.expire = :expire"),
@NamedQuery(name = "News.findByPriority", query = "SELECT n FROM News n WHERE n.priority = :priority") }) @NamedQuery(name = "News.findByPriority", query = "SELECT n FROM News n WHERE n.priority = :priority")})
public class News implements Serializable { public class News implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "news_id", nullable = false) @Column(name = "news_id", nullable = false)
private Integer newsId; private Integer id;
@Basic(optional = false)
@Column(name = "title", nullable = false, length = 2147483647) @Column(name = "title", nullable = false, length = 2147483647)
private String title; private String title;
@Column(name = "body", length = 2147483647) @Column(name = "body", length = 2147483647)
...@@ -51,114 +54,135 @@ public class News implements Serializable { ...@@ -51,114 +54,135 @@ public class News implements Serializable {
@Column(name = "expire") @Column(name = "expire")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date expire; private Date expire;
@Basic(optional = false)
@Column(name = "priority", nullable = false) @Column(name = "priority", nullable = false)
private int priority; private int priority;
@JoinColumn(name = "news_groups_id", referencedColumnName = "news_groups_id", nullable = false) @JoinColumn(name = "news_groups_id", referencedColumnName = "news_groups_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private NewsGroup newsGroupsId; private NewsGroup newsGroupsId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public News() { public News() {
} }
public News(Integer newsId) { public News(Integer newsId) {
this.newsId = newsId; this.id = newsId;
} }
public News(Integer newsId, String title, int priority) { public News(Integer newsId, String title, int priority) {
this.newsId = newsId; this.id = newsId;
this.title = title; this.title = title;
this.priority = priority; this.priority = priority;
}
public Integer getNewsId() {
return newsId;
}
public void setNewsId(Integer newsId) {
this.newsId = newsId;
} }
public String getTitle() { public String getTitle() {
return title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
public String getBody() { public String getBody() {
return body; return body;
} }
public void setBody(String body) { public void setBody(String body) {
this.body = body; this.body = body;
} }
public String getAbstract1() { public String getAbstract1() {
return abstract1; return abstract1;
} }
public void setAbstract1(String abstract1) { public void setAbstract1(String abstract1) {
this.abstract1 = abstract1; this.abstract1 = abstract1;
} }
public Date getPublish() { public Date getPublish() {
return publish; return publish;
} }
public void setPublish(Date publish) { public void setPublish(Date publish) {
this.publish = publish; this.publish = publish;
} }
public Date getExpire() { public Date getExpire() {
return expire; return expire;
} }
public void setExpire(Date expire) { public void setExpire(Date expire) {
this.expire = expire; this.expire = expire;
} }
public int getPriority() { public int getPriority() {
return priority; return priority;
} }
public void setPriority(int priority) { public void setPriority(int priority) {
this.priority = priority; this.priority = priority;
} }
public NewsGroup getNewsGroupsId() { public NewsGroup getNewsGroupsId() {
return newsGroupsId; return newsGroupsId;
} }
public void setNewsGroupsId(NewsGroup newsGroupsId) { public void setNewsGroupsId(NewsGroup newsGroupsId) {
this.newsGroupsId = newsGroupsId; this.newsGroupsId = newsGroupsId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (newsId != null ? newsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 News)) {
if (!(object instanceof News)) { return false;
return false; }
} News other = (News) object;
News other = (News) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.newsId == null && other.newsId != null) return false;
|| (this.newsId != null && !this.newsId.equals(other.newsId))) { }
return false; return true;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.News[newsId=" + newsId + "]"; return "fi.insomnia.bortal.model.News[newsId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -18,28 +17,33 @@ import javax.persistence.NamedQueries; ...@@ -18,28 +17,33 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "news_groups") @Table(name = "news_groups")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "NewsGroup.findAll", query = "SELECT n FROM NewsGroup n"), @NamedQuery(name = "NewsGroup.findAll", query = "SELECT n FROM NewsGroup n"),
@NamedQuery(name = "NewsGroup.findByNewsGroupsId", query = "SELECT n FROM NewsGroup n WHERE n.newsGroupsId = :newsGroupsId"), @NamedQuery(name = "NewsGroup.findByNewsGroupsId", query = "SELECT n FROM NewsGroup n WHERE n.newsGroupsId = :newsGroupsId"),
@NamedQuery(name = "NewsGroup.findByGroupName", query = "SELECT n FROM NewsGroup n WHERE n.groupName = :groupName"), @NamedQuery(name = "NewsGroup.findByGroupName", query = "SELECT n FROM NewsGroup n WHERE n.groupName = :groupName"),
@NamedQuery(name = "NewsGroup.findByGroupDescription", query = "SELECT n FROM NewsGroup n WHERE n.groupDescription = :groupDescription"), @NamedQuery(name = "NewsGroup.findByGroupDescription", query = "SELECT n FROM NewsGroup n WHERE n.groupDescription = :groupDescription"),
@NamedQuery(name = "NewsGroup.findByPriority", query = "SELECT n FROM NewsGroup n WHERE n.priority = :priority") }) @NamedQuery(name = "NewsGroup.findByPriority", query = "SELECT n FROM NewsGroup n WHERE n.priority = :priority")})
public class NewsGroup implements Serializable { public class NewsGroup implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "news_groups_id", nullable = false) @Column(name = "news_groups_id", nullable = false)
private Integer newsGroupsId; private Integer id;
@Basic(optional = false)
@Column(name = "group_name", nullable = false, length = 2147483647) @Column(name = "group_name", nullable = false, length = 2147483647)
private String groupName; private String groupName;
@Column(name = "group_description", length = 2147483647) @Column(name = "group_description", length = 2147483647)
private String groupDescription; private String groupDescription;
@Basic(optional = false)
@Column(name = "priority", nullable = false) @Column(name = "priority", nullable = false)
private int priority; private int priority;
@JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id", nullable = false) @JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id", nullable = false)
...@@ -47,95 +51,113 @@ public class NewsGroup implements Serializable { ...@@ -47,95 +51,113 @@ public class NewsGroup implements Serializable {
private AccessRight accessRightsId; private AccessRight accessRightsId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "newsGroupsId") @OneToMany(cascade = CascadeType.ALL, mappedBy = "newsGroupsId")
private List<News> newsList; private List<News> newsList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public NewsGroup() { public NewsGroup() {
} }
public NewsGroup(Integer newsGroupsId) { public NewsGroup(Integer newsGroupsId) {
this.newsGroupsId = newsGroupsId; this.id = newsGroupsId;
} }
public NewsGroup(Integer newsGroupsId, String groupName, int priority) { public NewsGroup(Integer newsGroupsId, String groupName, int priority) {
this.newsGroupsId = newsGroupsId; this.id = newsGroupsId;
this.groupName = groupName; this.groupName = groupName;
this.priority = priority; this.priority = priority;
}
public Integer getNewsGroupsId() {
return newsGroupsId;
}
public void setNewsGroupsId(Integer newsGroupsId) {
this.newsGroupsId = newsGroupsId;
} }
public String getGroupName() { public String getGroupName() {
return groupName; return groupName;
} }
public void setGroupName(String groupName) { public void setGroupName(String groupName) {
this.groupName = groupName; this.groupName = groupName;
} }
public String getGroupDescription() { public String getGroupDescription() {
return groupDescription; return groupDescription;
} }
public void setGroupDescription(String groupDescription) { public void setGroupDescription(String groupDescription) {
this.groupDescription = groupDescription; this.groupDescription = groupDescription;
} }
public int getPriority() { public int getPriority() {
return priority; return priority;
} }
public void setPriority(int priority) { public void setPriority(int priority) {
this.priority = priority; this.priority = priority;
} }
public AccessRight getAccessRightsId() { public AccessRight getAccessRightsId() {
return accessRightsId; return accessRightsId;
} }
public void setAccessRightsId(AccessRight accessRightsId) { public void setAccessRightsId(AccessRight accessRightsId) {
this.accessRightsId = accessRightsId; this.accessRightsId = accessRightsId;
} }
public List<News> getNewsList() { public List<News> getNewsList() {
return newsList; return newsList;
} }
public void setNewsList(List<News> newsList) { public void setNewsList(List<News> newsList) {
this.newsList = newsList; this.newsList = newsList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (newsGroupsId != null ? newsGroupsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 NewsGroup)) {
if (!(object instanceof NewsGroup)) { return false;
return false; }
} NewsGroup other = (NewsGroup) object;
NewsGroup other = (NewsGroup) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.newsGroupsId == null && other.newsGroupsId != null) return false;
|| (this.newsGroupsId != null && !this.newsGroupsId }
.equals(other.newsGroupsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.NewsGroup[newsGroupsId=" return "fi.insomnia.bortal.model.NewsGroup[newsGroupsId=" + getId() + "]";
+ newsGroupsId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -18,27 +17,30 @@ import javax.persistence.NamedQueries; ...@@ -18,27 +17,30 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "places") @Table(name = "places")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "Place.findAll", query = "SELECT p FROM Place p"), @NamedQuery(name = "Place.findAll", query = "SELECT p FROM Place p"),
@NamedQuery(name = "Place.findByPlacesId", query = "SELECT p FROM Place p WHERE p.placesId = :placesId"), @NamedQuery(name = "Place.findByPlacesId", query = "SELECT p FROM Place p WHERE p.placesId = :placesId"),
@NamedQuery(name = "Place.findByPlaceDescription", query = "SELECT p FROM Place p WHERE p.placeDescription = :placeDescription"), @NamedQuery(name = "Place.findByPlaceDescription", query = "SELECT p FROM Place p WHERE p.placeDescription = :placeDescription"),
@NamedQuery(name = "Place.findByPlaceName", query = "SELECT p FROM Place p WHERE p.placeName = :placeName"), @NamedQuery(name = "Place.findByPlaceName", query = "SELECT p FROM Place p WHERE p.placeName = :placeName"),
@NamedQuery(name = "Place.findByMapX", query = "SELECT p FROM Place p WHERE p.mapX = :mapX"), @NamedQuery(name = "Place.findByMapX", query = "SELECT p FROM Place p WHERE p.mapX = :mapX"),
@NamedQuery(name = "Place.findByMapY", query = "SELECT p FROM Place p WHERE p.mapY = :mapY"), @NamedQuery(name = "Place.findByMapY", query = "SELECT p FROM Place p WHERE p.mapY = :mapY"),
@NamedQuery(name = "Place.findByPlaceDetails", query = "SELECT p FROM Place p WHERE p.placeDetails = :placeDetails"), @NamedQuery(name = "Place.findByPlaceDetails", query = "SELECT p FROM Place p WHERE p.placeDetails = :placeDetails"),
@NamedQuery(name = "Place.findByPlaceCode", query = "SELECT p FROM Place p WHERE p.placeCode = :placeCode") }) @NamedQuery(name = "Place.findByPlaceCode", query = "SELECT p FROM Place p WHERE p.placeCode = :placeCode")})
public class Place implements Serializable { public class Place implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "places_id", nullable = false) @Column(name = "places_id", nullable = false)
private Integer placesId; private Integer id;
@Column(name = "place_description", length = 2147483647) @Column(name = "place_description", length = 2147483647)
private String placeDescription; private String placeDescription;
@Column(name = "place_name", length = 2147483647) @Column(name = "place_name", length = 2147483647)
...@@ -65,136 +67,155 @@ public class Place implements Serializable { ...@@ -65,136 +67,155 @@ public class Place implements Serializable {
@JoinColumn(name = "users_id", referencedColumnName = "users_id") @JoinColumn(name = "users_id", referencedColumnName = "users_id")
@ManyToOne @ManyToOne
private User usersId; private User usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Place() { public Place() {
} }
public Place(Integer placesId) { public Place(Integer placesId) {
this.placesId = placesId; this.id = placesId;
}
public Integer getPlacesId() {
return placesId;
}
public void setPlacesId(Integer placesId) {
this.placesId = placesId;
} }
public String getPlaceDescription() { public String getPlaceDescription() {
return placeDescription; return placeDescription;
} }
public void setPlaceDescription(String placeDescription) { public void setPlaceDescription(String placeDescription) {
this.placeDescription = placeDescription; this.placeDescription = placeDescription;
} }
public String getPlaceName() { public String getPlaceName() {
return placeName; return placeName;
} }
public void setPlaceName(String placeName) { public void setPlaceName(String placeName) {
this.placeName = placeName; this.placeName = placeName;
} }
public Integer getMapX() { public Integer getMapX() {
return mapX; return mapX;
} }
public void setMapX(Integer mapX) { public void setMapX(Integer mapX) {
this.mapX = mapX; this.mapX = mapX;
} }
public Integer getMapY() { public Integer getMapY() {
return mapY; return mapY;
} }
public void setMapY(Integer mapY) { public void setMapY(Integer mapY) {
this.mapY = mapY; this.mapY = mapY;
} }
public String getPlaceDetails() { public String getPlaceDetails() {
return placeDetails; return placeDetails;
} }
public void setPlaceDetails(String placeDetails) { public void setPlaceDetails(String placeDetails) {
this.placeDetails = placeDetails; this.placeDetails = placeDetails;
} }
public String getPlaceCode() { public String getPlaceCode() {
return placeCode; return placeCode;
} }
public void setPlaceCode(String placeCode) { public void setPlaceCode(String placeCode) {
this.placeCode = placeCode; this.placeCode = placeCode;
} }
public List<GroupMembership> getGroupMembershipList() { public List<GroupMembership> getGroupMembershipList() {
return groupMembershipList; return groupMembershipList;
} }
public void setGroupMembershipList(List<GroupMembership> groupMembershipList) { public void setGroupMembershipList(List<GroupMembership> groupMembershipList) {
this.groupMembershipList = groupMembershipList; this.groupMembershipList = groupMembershipList;
} }
public PlaceGroup getGroupsId() { public PlaceGroup getGroupsId() {
return groupsId; return groupsId;
} }
public void setGroupsId(PlaceGroup groupsId) { public void setGroupsId(PlaceGroup groupsId) {
this.groupsId = groupsId; this.groupsId = groupsId;
} }
public EventMap getMapsId() { public EventMap getMapsId() {
return mapsId; return mapsId;
} }
public void setMapsId(EventMap mapsId) { public void setMapsId(EventMap mapsId) {
this.mapsId = mapsId; this.mapsId = mapsId;
} }
public Product getProductsId() { public Product getProductsId() {
return productsId; return productsId;
} }
public void setProductsId(Product productsId) { public void setProductsId(Product productsId) {
this.productsId = productsId; this.productsId = productsId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (placesId != null ? placesId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 Place)) {
if (!(object instanceof Place)) { return false;
return false; }
} Place other = (Place) object;
Place other = (Place) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.placesId == null && other.placesId != null) return false;
|| (this.placesId != null && !this.placesId }
.equals(other.placesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Place[placesId=" + placesId + "]"; return "fi.insomnia.bortal.model.Place[placesId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -21,30 +20,35 @@ import javax.persistence.OneToMany; ...@@ -21,30 +20,35 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "groups") @Table(name = "groups")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "PlaceGroup.findAll", query = "SELECT p FROM PlaceGroup p"), @NamedQuery(name = "PlaceGroup.findAll", query = "SELECT p FROM PlaceGroup p"),
@NamedQuery(name = "PlaceGroup.findByGroupsId", query = "SELECT p FROM PlaceGroup p WHERE p.groupsId = :groupsId"), @NamedQuery(name = "PlaceGroup.findByGroupsId", query = "SELECT p FROM PlaceGroup p WHERE p.groupsId = :groupsId"),
@NamedQuery(name = "PlaceGroup.findByGroupCreated", query = "SELECT p FROM PlaceGroup p WHERE p.groupCreated = :groupCreated"), @NamedQuery(name = "PlaceGroup.findByGroupCreated", query = "SELECT p FROM PlaceGroup p WHERE p.groupCreated = :groupCreated"),
@NamedQuery(name = "PlaceGroup.findByGroupEdited", query = "SELECT p FROM PlaceGroup p WHERE p.groupEdited = :groupEdited"), @NamedQuery(name = "PlaceGroup.findByGroupEdited", query = "SELECT p FROM PlaceGroup p WHERE p.groupEdited = :groupEdited"),
@NamedQuery(name = "PlaceGroup.findByGroupCode", query = "SELECT p FROM PlaceGroup p WHERE p.groupCode = :groupCode"), @NamedQuery(name = "PlaceGroup.findByGroupCode", query = "SELECT p FROM PlaceGroup p WHERE p.groupCode = :groupCode"),
@NamedQuery(name = "PlaceGroup.findByGroupName", query = "SELECT p FROM PlaceGroup p WHERE p.groupName = :groupName"), @NamedQuery(name = "PlaceGroup.findByGroupName", query = "SELECT p FROM PlaceGroup p WHERE p.groupName = :groupName"),
@NamedQuery(name = "PlaceGroup.findByGroupActive", query = "SELECT p FROM PlaceGroup p WHERE p.groupActive = :groupActive"), @NamedQuery(name = "PlaceGroup.findByGroupActive", query = "SELECT p FROM PlaceGroup p WHERE p.groupActive = :groupActive"),
@NamedQuery(name = "PlaceGroup.findByGroupDetails", query = "SELECT p FROM PlaceGroup p WHERE p.groupDetails = :groupDetails") }) @NamedQuery(name = "PlaceGroup.findByGroupDetails", query = "SELECT p FROM PlaceGroup p WHERE p.groupDetails = :groupDetails")})
public class PlaceGroup implements Serializable { public class PlaceGroup implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "groups_id", nullable = false) @Column(name = "groups_id", nullable = false)
private Integer groupsId; private Integer id;
@Basic(optional = false)
@Column(name = "group_created", nullable = false) @Column(name = "group_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date groupCreated; private Date groupCreated;
@Basic(optional = false)
@Column(name = "group_edited", nullable = false) @Column(name = "group_edited", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date groupEdited; private Date groupEdited;
...@@ -52,6 +56,7 @@ public class PlaceGroup implements Serializable { ...@@ -52,6 +56,7 @@ public class PlaceGroup implements Serializable {
private String groupCode; private String groupCode;
@Column(name = "group_name", length = 2147483647) @Column(name = "group_name", length = 2147483647)
private String groupName; private String groupName;
@Basic(optional = false)
@Column(name = "group_active", nullable = false) @Column(name = "group_active", nullable = false)
private boolean groupActive; private boolean groupActive;
@Column(name = "group_details", length = 2147483647) @Column(name = "group_details", length = 2147483647)
...@@ -63,128 +68,146 @@ public class PlaceGroup implements Serializable { ...@@ -63,128 +68,146 @@ public class PlaceGroup implements Serializable {
private List<GroupMembership> groupMembershipList; private List<GroupMembership> groupMembershipList;
@OneToMany(mappedBy = "groupsId") @OneToMany(mappedBy = "groupsId")
private List<Place> placeList; private List<Place> placeList;
@Version
@Column(nullable = false)
private int jpaVersionField;
public PlaceGroup() { public PlaceGroup() {
} }
public PlaceGroup(Integer groupsId) { public PlaceGroup(Integer groupsId) {
this.groupsId = groupsId; this.id = groupsId;
}
public PlaceGroup(Integer groupsId, Date groupCreated, Date groupEdited,
boolean groupActive) {
this.groupsId = groupsId;
this.groupCreated = groupCreated;
this.groupEdited = groupEdited;
this.groupActive = groupActive;
} }
public Integer getGroupsId() { public PlaceGroup(Integer groupsId, Date groupCreated, Date groupEdited, boolean groupActive) {
return groupsId; this.id = groupsId;
} this.groupCreated = groupCreated;
this.groupEdited = groupEdited;
public void setGroupsId(Integer groupsId) { this.groupActive = groupActive;
this.groupsId = groupsId;
} }
public Date getGroupCreated() { public Date getGroupCreated() {
return groupCreated; return groupCreated;
} }
public void setGroupCreated(Date groupCreated) { public void setGroupCreated(Date groupCreated) {
this.groupCreated = groupCreated; this.groupCreated = groupCreated;
} }
public Date getGroupEdited() { public Date getGroupEdited() {
return groupEdited; return groupEdited;
} }
public void setGroupEdited(Date groupEdited) { public void setGroupEdited(Date groupEdited) {
this.groupEdited = groupEdited; this.groupEdited = groupEdited;
} }
public String getGroupCode() { public String getGroupCode() {
return groupCode; return groupCode;
} }
public void setGroupCode(String groupCode) { public void setGroupCode(String groupCode) {
this.groupCode = groupCode; this.groupCode = groupCode;
} }
public String getGroupName() { public String getGroupName() {
return groupName; return groupName;
} }
public void setGroupName(String groupName) { public void setGroupName(String groupName) {
this.groupName = groupName; this.groupName = groupName;
} }
public boolean getGroupActive() { public boolean getGroupActive() {
return groupActive; return groupActive;
} }
public void setGroupActive(boolean groupActive) { public void setGroupActive(boolean groupActive) {
this.groupActive = groupActive; this.groupActive = groupActive;
} }
public String getGroupDetails() { public String getGroupDetails() {
return groupDetails; return groupDetails;
} }
public void setGroupDetails(String groupDetails) { public void setGroupDetails(String groupDetails) {
this.groupDetails = groupDetails; this.groupDetails = groupDetails;
} }
public User getGroupCreator() { public User getGroupCreator() {
return groupCreator; return groupCreator;
} }
public void setGroupCreator(User groupCreator) { public void setGroupCreator(User groupCreator) {
this.groupCreator = groupCreator; this.groupCreator = groupCreator;
} }
public List<GroupMembership> getGroupMembershipList() { public List<GroupMembership> getGroupMembershipList() {
return groupMembershipList; return groupMembershipList;
} }
public void setGroupMembershipList(List<GroupMembership> groupMembershipList) { public void setGroupMembershipList(List<GroupMembership> groupMembershipList) {
this.groupMembershipList = groupMembershipList; this.groupMembershipList = groupMembershipList;
} }
public List<Place> getPlaceList() { public List<Place> getPlaceList() {
return placeList; return placeList;
} }
public void setPlaceList(List<Place> placeList) { public void setPlaceList(List<Place> placeList) {
this.placeList = placeList; this.placeList = placeList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (groupsId != null ? groupsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 PlaceGroup)) {
if (!(object instanceof PlaceGroup)) { return false;
return false; }
} PlaceGroup other = (PlaceGroup) object;
PlaceGroup other = (PlaceGroup) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.groupsId == null && other.groupsId != null) return false;
|| (this.groupsId != null && !this.groupsId }
.equals(other.groupsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.PlaceGroup[groupsId=" + groupsId + "]"; return "fi.insomnia.bortal.model.PlaceGroup[groupsId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -9,6 +9,7 @@ import java.io.Serializable; ...@@ -9,6 +9,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -23,31 +24,35 @@ import javax.persistence.Temporal; ...@@ -23,31 +24,35 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "printed_cards") @Table(name = "printed_cards")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "PrintedCard.findAll", query = "SELECT p FROM PrintedCard p"), @NamedQuery(name = "PrintedCard.findAll", query = "SELECT p FROM PrintedCard p"),
@NamedQuery(name = "PrintedCard.findByPrintedCardsId", query = "SELECT p FROM PrintedCard p WHERE p.printedCardsId = :printedCardsId"), @NamedQuery(name = "PrintedCard.findByPrintedCardsId", query = "SELECT p FROM PrintedCard p WHERE p.printedCardsId = :printedCardsId"),
@NamedQuery(name = "PrintedCard.findByEventRolesTypesId", query = "SELECT p FROM PrintedCard p WHERE p.eventRolesTypesId = :eventRolesTypesId"), @NamedQuery(name = "PrintedCard.findByEventRolesTypesId", query = "SELECT p FROM PrintedCard p WHERE p.eventRolesTypesId = :eventRolesTypesId"),
@NamedQuery(name = "PrintedCard.findByPrintTime", query = "SELECT p FROM PrintedCard p WHERE p.printTime = :printTime"), @NamedQuery(name = "PrintedCard.findByPrintTime", query = "SELECT p FROM PrintedCard p WHERE p.printTime = :printTime"),
@NamedQuery(name = "PrintedCard.findByBarcode", query = "SELECT p FROM PrintedCard p WHERE p.barcode = :barcode"), @NamedQuery(name = "PrintedCard.findByBarcode", query = "SELECT p FROM PrintedCard p WHERE p.barcode = :barcode"),
@NamedQuery(name = "PrintedCard.findByCardEnabled", query = "SELECT p FROM PrintedCard p WHERE p.cardEnabled = :cardEnabled"), @NamedQuery(name = "PrintedCard.findByCardEnabled", query = "SELECT p FROM PrintedCard p WHERE p.cardEnabled = :cardEnabled"),
@NamedQuery(name = "PrintedCard.findByRfidUid", query = "SELECT p FROM PrintedCard p WHERE p.rfidUid = :rfidUid") }) @NamedQuery(name = "PrintedCard.findByRfidUid", query = "SELECT p FROM PrintedCard p WHERE p.rfidUid = :rfidUid")})
public class PrintedCard implements Serializable { public class PrintedCard implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "printed_cards_id", nullable = false) @Column(name = "printed_cards_id", nullable = false)
private Integer printedCardsId; private Integer id;
@Basic(optional = false)
@Column(name = "event_roles_types_id", nullable = false) @Column(name = "event_roles_types_id", nullable = false)
private int eventRolesTypesId; private int eventRolesTypesId;
@Basic(optional = false)
@Column(name = "print_time", nullable = false) @Column(name = "print_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date printTime; private Date printTime;
@Column(name = "barcode", length = 2147483647) @Column(name = "barcode", length = 2147483647)
private String barcode; private String barcode;
@Basic(optional = false)
@Column(name = "card_enabled", nullable = false) @Column(name = "card_enabled", nullable = false)
private boolean cardEnabled; private boolean cardEnabled;
@Column(name = "rfid_uid", length = 2147483647) @Column(name = "rfid_uid", length = 2147483647)
...@@ -61,120 +66,112 @@ public class PrintedCard implements Serializable { ...@@ -61,120 +66,112 @@ public class PrintedCard implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
private User usersId; private User usersId;
public PrintedCard() { @Version
} @Column(nullable = false)
private int jpaVersionField;
public PrintedCard(Integer printedCardsId) {
this.printedCardsId = printedCardsId;
}
public PrintedCard(Integer printedCardsId, int eventRolesTypesId, public PrintedCard() {
Date printTime, boolean cardEnabled) {
this.printedCardsId = printedCardsId;
this.eventRolesTypesId = eventRolesTypesId;
this.printTime = printTime;
this.cardEnabled = cardEnabled;
} }
public Integer getPrintedCardsId() { public PrintedCard(Integer printedCardsId) {
return printedCardsId; this.id = printedCardsId;
} }
public void setPrintedCardsId(Integer printedCardsId) { public PrintedCard(Integer printedCardsId, int eventRolesTypesId, Date printTime, boolean cardEnabled) {
this.printedCardsId = printedCardsId; this.id = printedCardsId;
this.eventRolesTypesId = eventRolesTypesId;
this.printTime = printTime;
this.cardEnabled = cardEnabled;
} }
public int getEventRolesTypesId() { public int getEventRolesTypesId() {
return eventRolesTypesId; return eventRolesTypesId;
} }
public void setEventRolesTypesId(int eventRolesTypesId) { public void setEventRolesTypesId(int eventRolesTypesId) {
this.eventRolesTypesId = eventRolesTypesId; this.eventRolesTypesId = eventRolesTypesId;
} }
public Date getPrintTime() { public Date getPrintTime() {
return printTime; return printTime;
} }
public void setPrintTime(Date printTime) { public void setPrintTime(Date printTime) {
this.printTime = printTime; this.printTime = printTime;
} }
public String getBarcode() { public String getBarcode() {
return barcode; return barcode;
} }
public void setBarcode(String barcode) { public void setBarcode(String barcode) {
this.barcode = barcode; this.barcode = barcode;
} }
public boolean getCardEnabled() { public boolean getCardEnabled() {
return cardEnabled; return cardEnabled;
} }
public void setCardEnabled(boolean cardEnabled) { public void setCardEnabled(boolean cardEnabled) {
this.cardEnabled = cardEnabled; this.cardEnabled = cardEnabled;
} }
public String getRfidUid() { public String getRfidUid() {
return rfidUid; return rfidUid;
} }
public void setRfidUid(String rfidUid) { public void setRfidUid(String rfidUid) {
this.rfidUid = rfidUid; this.rfidUid = rfidUid;
} }
public List<ReaderEvent> getReaderEventList() { public List<ReaderEvent> getReaderEventList() {
return readerEventList; return readerEventList;
} }
public void setReaderEventList(List<ReaderEvent> readerEventList) { public void setReaderEventList(List<ReaderEvent> readerEventList) {
this.readerEventList = readerEventList; this.readerEventList = readerEventList;
} }
public Location getCurrentLocation() { public Location getCurrentLocation() {
return currentLocation; return currentLocation;
} }
public void setCurrentLocation(Location currentLocation) { public void setCurrentLocation(Location currentLocation) {
this.currentLocation = currentLocation; this.currentLocation = currentLocation;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (printedCardsId != null ? printedCardsId.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 PrintedCard)) {
if (!(object instanceof PrintedCard)) { return false;
return false; }
} PrintedCard other = (PrintedCard) object;
PrintedCard other = (PrintedCard) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
if ((this.printedCardsId == null && other.printedCardsId != null) return false;
|| (this.printedCardsId != null && !this.printedCardsId }
.equals(other.printedCardsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.PrintedCard[printedCardsId=" return "fi.insomnia.bortal.model.PrintedCard[printedCardsId=" + id + "]";
+ printedCardsId + "]";
} }
} }
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -20,6 +20,7 @@ import javax.persistence.NamedQueries; ...@@ -20,6 +20,7 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
...@@ -27,22 +28,26 @@ import javax.persistence.Table; ...@@ -27,22 +28,26 @@ import javax.persistence.Table;
*/ */
@Entity @Entity
@Table(name = "products") @Table(name = "products")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"), @NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"),
@NamedQuery(name = "Product.findByProductsId", query = "SELECT p FROM Product p WHERE p.productsId = :productsId"), @NamedQuery(name = "Product.findByProductsId", query = "SELECT p FROM Product p WHERE p.productsId = :productsId"),
@NamedQuery(name = "Product.findByProductName", query = "SELECT p FROM Product p WHERE p.productName = :productName"), @NamedQuery(name = "Product.findByProductName", query = "SELECT p FROM Product p WHERE p.productName = :productName"),
@NamedQuery(name = "Product.findByPrice", query = "SELECT p FROM Product p WHERE p.price = :price"), @NamedQuery(name = "Product.findByPrice", query = "SELECT p FROM Product p WHERE p.price = :price"),
@NamedQuery(name = "Product.findBySort", query = "SELECT p FROM Product p WHERE p.sort = :sort"), @NamedQuery(name = "Product.findBySort", query = "SELECT p FROM Product p WHERE p.sort = :sort"),
@NamedQuery(name = "Product.findByBarcode", query = "SELECT p FROM Product p WHERE p.barcode = :barcode") }) @NamedQuery(name = "Product.findByBarcode", query = "SELECT p FROM Product p WHERE p.barcode = :barcode")})
public class Product implements Serializable { public class Product implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "products_id", nullable = false) @Column(name = "products_id", nullable = false)
private Integer productsId; private Integer id;
@Column(name = "product_name", length = 2147483647) @Column(name = "product_name", length = 2147483647)
private String productName; private String productName;
@Basic(optional = false)
@Column(name = "price", nullable = false) @Column(name = "price", nullable = false)
private BigInteger price; private BigInteger price;
@Basic(optional = false)
@Column(name = "sort", nullable = false) @Column(name = "sort", nullable = false)
private int sort; private int sort;
@Column(name = "barcode", length = 2147483647) @Column(name = "barcode", length = 2147483647)
...@@ -51,114 +56,109 @@ public class Product implements Serializable { ...@@ -51,114 +56,109 @@ public class Product implements Serializable {
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 = {
@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") }) @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;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Product() { public Product() {
} }
public Product(Integer productsId) { public Product(Integer productsId) {
this.productsId = productsId; this.id = productsId;
} }
public Product(Integer productsId, BigInteger price, int sort) { public Product(Integer productsId, BigInteger price, int sort) {
this.productsId = productsId; this.id = productsId;
this.price = price; this.price = price;
this.sort = sort; this.sort = sort;
}
public Integer getProductsId() {
return productsId;
}
public void setProductsId(Integer productsId) {
this.productsId = productsId;
} }
public String getProductName() { public String getProductName() {
return productName; return productName;
} }
public void setProductName(String productName) { public void setProductName(String productName) {
this.productName = productName; this.productName = productName;
} }
public BigInteger getPrice() { public BigInteger getPrice() {
return price; return price;
} }
public void setPrice(BigInteger price) { public void setPrice(BigInteger price) {
this.price = price; this.price = price;
} }
public int getSort() { public int getSort() {
return sort; return sort;
} }
public void setSort(int sort) { public void setSort(int sort) {
this.sort = sort; this.sort = sort;
} }
public String getBarcode() { public String getBarcode() {
return barcode; return barcode;
} }
public void setBarcode(String barcode) { public void setBarcode(String barcode) {
this.barcode = barcode; this.barcode = barcode;
} }
public List<Place> getPlaceList() { public List<Place> getPlaceList() {
return placeList; return placeList;
} }
public void setPlaceList(List<Place> placeList) { public void setPlaceList(List<Place> placeList) {
this.placeList = placeList; this.placeList = placeList;
} }
public List<AccountEvent> getAccountEventList() { public List<AccountEvent> getAccountEventList() {
return accountEventList; return accountEventList;
} }
public void setAccountEventList(List<AccountEvent> accountEventList) { public void setAccountEventList(List<AccountEvent> accountEventList) {
this.accountEventList = accountEventList; this.accountEventList = accountEventList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (productsId != null ? productsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 Product)) { if (!(object instanceof Product)) {
return false; return false;
} }
Product other = (Product) object; Product other = (Product) object;
if ((this.productsId == null && other.productsId != null) if ((this.getId() == null && other.getId() != null)
|| (this.productsId != null && !this.productsId || (this.getId() != null && !this.id.equals(other.id))) {
.equals(other.productsId))) { return false;
return false; }
} return true;
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Product[productsId=" + productsId return "fi.insomnia.bortal.model.Product[productsId=" + getId()
+ "]"; + "]";
} }
/** /**
* @return the foodWaveTemplate * @return the foodWaveTemplate
*/ */
public List<FoodWaveTemplate> getFoodWaveTemplate() { public List<FoodWaveTemplate> getFoodWaveTemplate() {
return foodWaveTemplate; return foodWaveTemplate;
} }
/** /**
...@@ -166,7 +166,34 @@ public class Product implements Serializable { ...@@ -166,7 +166,34 @@ public class Product implements Serializable {
* the foodWaveTemplate to set * the foodWaveTemplate to set
*/ */
public void setFoodWaveTemplate(List<FoodWaveTemplate> foodWaveTemplate) { public void setFoodWaveTemplate(List<FoodWaveTemplate> foodWaveTemplate) {
this.foodWaveTemplate = foodWaveTemplate; this.foodWaveTemplate = foodWaveTemplate;
}
/**
* @return the id
*/
public Integer getId() {
return id;
} }
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -18,23 +17,26 @@ import javax.persistence.NamedQueries; ...@@ -18,23 +17,26 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "readers") @Table(name = "readers")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "Reader.findAll", query = "SELECT r FROM Reader r"), @NamedQuery(name = "Reader.findAll", query = "SELECT r FROM Reader r"),
@NamedQuery(name = "Reader.findByReadersId", query = "SELECT r FROM Reader r WHERE r.readersId = :readersId"), @NamedQuery(name = "Reader.findByReadersId", query = "SELECT r FROM Reader r WHERE r.readersId = :readersId"),
@NamedQuery(name = "Reader.findByReaderId", query = "SELECT r FROM Reader r WHERE r.readerId = :readerId"), @NamedQuery(name = "Reader.findByReaderId", query = "SELECT r FROM Reader r WHERE r.readerId = :readerId"),
@NamedQuery(name = "Reader.findByReaderDescription", query = "SELECT r FROM Reader r WHERE r.readerDescription = :readerDescription") }) @NamedQuery(name = "Reader.findByReaderDescription", query = "SELECT r FROM Reader r WHERE r.readerDescription = :readerDescription")})
public class Reader implements Serializable { public class Reader implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "readers_id", nullable = false) @Column(name = "readers_id", nullable = false)
private Integer readersId; private Integer id;
@Column(name = "reader_id", length = 2147483647) @Column(name = "reader_id", length = 2147483647)
private String readerId; private String readerId;
@Column(name = "reader_description", length = 2147483647) @Column(name = "reader_description", length = 2147483647)
...@@ -44,80 +46,99 @@ public class Reader implements Serializable { ...@@ -44,80 +46,99 @@ public class Reader implements Serializable {
@JoinColumn(name = "locations_id", referencedColumnName = "locations_id") @JoinColumn(name = "locations_id", referencedColumnName = "locations_id")
@ManyToOne @ManyToOne
private Location locationsId; private Location locationsId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Reader() { public Reader() {
} }
public Reader(Integer readersId) { public Reader(Integer readersId) {
this.readersId = readersId; this.id = readersId;
}
public Integer getReadersId() {
return readersId;
}
public void setReadersId(Integer readersId) {
this.readersId = readersId;
} }
public String getReaderId() { public String getReaderId() {
return readerId; return readerId;
} }
public void setReaderId(String readerId) { public void setReaderId(String readerId) {
this.readerId = readerId; this.readerId = readerId;
} }
public String getReaderDescription() { public String getReaderDescription() {
return readerDescription; return readerDescription;
} }
public void setReaderDescription(String readerDescription) { public void setReaderDescription(String readerDescription) {
this.readerDescription = readerDescription; this.readerDescription = readerDescription;
} }
public List<ReaderEvent> getReaderEventList() { public List<ReaderEvent> getReaderEventList() {
return readerEventList; return readerEventList;
} }
public void setReaderEventList(List<ReaderEvent> readerEventList) { public void setReaderEventList(List<ReaderEvent> readerEventList) {
this.readerEventList = readerEventList; this.readerEventList = readerEventList;
} }
public Location getLocationsId() { public Location getLocationsId() {
return locationsId; return locationsId;
} }
public void setLocationsId(Location locationsId) { public void setLocationsId(Location locationsId) {
this.locationsId = locationsId; this.locationsId = locationsId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (readersId != null ? readersId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 Reader)) {
if (!(object instanceof Reader)) { return false;
return false; }
} Reader other = (Reader) object;
Reader other = (Reader) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.readersId == null && other.readersId != null) return false;
|| (this.readersId != null && !this.readersId }
.equals(other.readersId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Reader[readersId=" + readersId + "]"; return "fi.insomnia.bortal.model.Reader[readersId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -18,23 +18,27 @@ import javax.persistence.NamedQuery; ...@@ -18,23 +18,27 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "reader_events") @Table(name = "reader_events")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "ReaderEvent.findAll", query = "SELECT r FROM ReaderEvent r"), @NamedQuery(name = "ReaderEvent.findAll", query = "SELECT r FROM ReaderEvent r"),
@NamedQuery(name = "ReaderEvent.findByReaderEventsId", query = "SELECT r FROM ReaderEvent r WHERE r.readerEventsId = :readerEventsId"), @NamedQuery(name = "ReaderEvent.findByReaderEventsId", query = "SELECT r FROM ReaderEvent r WHERE r.readerEventsId = :readerEventsId"),
@NamedQuery(name = "ReaderEvent.findByEventTime", query = "SELECT r FROM ReaderEvent r WHERE r.eventTime = :eventTime"), @NamedQuery(name = "ReaderEvent.findByEventTime", query = "SELECT r FROM ReaderEvent r WHERE r.eventTime = :eventTime"),
@NamedQuery(name = "ReaderEvent.findByValue", query = "SELECT r FROM ReaderEvent r WHERE r.value = :value") }) @NamedQuery(name = "ReaderEvent.findByValue", query = "SELECT r FROM ReaderEvent r WHERE r.value = :value")})
public class ReaderEvent implements Serializable { public class ReaderEvent implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "reader_events_id", nullable = false) @Column(name = "reader_events_id", nullable = false)
private Integer readerEventsId; private Integer id;
@Basic(optional = false)
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date eventTime; private Date eventTime;
...@@ -46,86 +50,104 @@ public class ReaderEvent implements Serializable { ...@@ -46,86 +50,104 @@ public class ReaderEvent implements Serializable {
@JoinColumn(name = "readers_id", referencedColumnName = "readers_id", nullable = false) @JoinColumn(name = "readers_id", referencedColumnName = "readers_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Reader readersId; private Reader readersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public ReaderEvent() { public ReaderEvent() {
} }
public ReaderEvent(Integer readerEventsId) { public ReaderEvent(Integer readerEventsId) {
this.readerEventsId = readerEventsId; this.id = readerEventsId;
} }
public ReaderEvent(Integer readerEventsId, Date eventTime) { public ReaderEvent(Integer readerEventsId, Date eventTime) {
this.readerEventsId = readerEventsId; this.id = readerEventsId;
this.eventTime = eventTime; this.eventTime = eventTime;
}
public Integer getReaderEventsId() {
return readerEventsId;
}
public void setReaderEventsId(Integer readerEventsId) {
this.readerEventsId = readerEventsId;
} }
public Date getEventTime() { public Date getEventTime() {
return eventTime; return eventTime;
} }
public void setEventTime(Date eventTime) { public void setEventTime(Date eventTime) {
this.eventTime = eventTime; this.eventTime = eventTime;
} }
public String getValue() { public String getValue() {
return value; return value;
} }
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
public PrintedCard getPrintedCardsId() { public PrintedCard getPrintedCardsId() {
return printedCardsId; return printedCardsId;
} }
public void setPrintedCardsId(PrintedCard printedCardsId) { public void setPrintedCardsId(PrintedCard printedCardsId) {
this.printedCardsId = printedCardsId; this.printedCardsId = printedCardsId;
} }
public Reader getReadersId() { public Reader getReadersId() {
return readersId; return readersId;
} }
public void setReadersId(Reader readersId) { public void setReadersId(Reader readersId) {
this.readersId = readersId; this.readersId = readersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (readerEventsId != null ? readerEventsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 ReaderEvent)) {
if (!(object instanceof ReaderEvent)) { return false;
return false; }
} ReaderEvent other = (ReaderEvent) object;
ReaderEvent other = (ReaderEvent) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.readerEventsId == null && other.readerEventsId != null) return false;
|| (this.readerEventsId != null && !this.readerEventsId }
.equals(other.readerEventsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.ReaderEvent[readerEventsId=" return "fi.insomnia.bortal.model.ReaderEvent[readerEventsId=" + getId() + "]";
+ readerEventsId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -18,22 +17,26 @@ import javax.persistence.NamedQueries; ...@@ -18,22 +17,26 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "roles") @Table(name = "roles")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r"), @NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r"),
@NamedQuery(name = "Role.findByRolesId", query = "SELECT r FROM Role r WHERE r.rolesId = :rolesId"), @NamedQuery(name = "Role.findByRolesId", query = "SELECT r FROM Role r WHERE r.rolesId = :rolesId"),
@NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.roleName = :roleName") }) @NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.roleName = :roleName")})
public class Role implements Serializable { public class Role implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "roles_id", nullable = false) @Column(name = "roles_id", nullable = false)
private Integer rolesId; private Integer id;
@Basic(optional = false)
@Column(name = "role_name", nullable = false, length = 2147483647) @Column(name = "role_name", nullable = false, length = 2147483647)
private String roleName; private String roleName;
@OneToMany(mappedBy = "defaultRole") @OneToMany(mappedBy = "defaultRole")
...@@ -52,117 +55,136 @@ public class Role implements Serializable { ...@@ -52,117 +55,136 @@ public class Role implements Serializable {
@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;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Role() { public Role() {
} }
public Role(Integer rolesId) { public Role(Integer rolesId) {
this.rolesId = rolesId; this.id = rolesId;
} }
public Role(Integer rolesId, String roleName) { public Role(Integer rolesId, String roleName) {
this.rolesId = rolesId; this.id = rolesId;
this.roleName = roleName; this.roleName = roleName;
}
public Integer getRolesId() {
return rolesId;
}
public void setRolesId(Integer rolesId) {
this.rolesId = rolesId;
} }
public String getRoleName() { public String getRoleName() {
return roleName; return roleName;
} }
public void setRoleName(String roleName) { public void setRoleName(String roleName) {
this.roleName = roleName; this.roleName = roleName;
} }
public List<Event> getEventList() { public List<Event> getEventList() {
return eventList; return eventList;
} }
public void setEventList(List<Event> eventList) { public void setEventList(List<Event> eventList) {
this.eventList = eventList; this.eventList = eventList;
} }
public List<RoleMembership> getRoleMembershipList() { public List<RoleMembership> getRoleMembershipList() {
return roleMembershipList; return roleMembershipList;
} }
public void setRoleMembershipList(List<RoleMembership> roleMembershipList) { public void setRoleMembershipList(List<RoleMembership> roleMembershipList) {
this.roleMembershipList = roleMembershipList; this.roleMembershipList = roleMembershipList;
} }
public List<RoleInheritance> getRoleInheritanceList() { public List<RoleInheritance> getRoleInheritanceList() {
return roleInheritanceList; return roleInheritanceList;
} }
public void setRoleInheritanceList(List<RoleInheritance> roleInheritanceList) { public void setRoleInheritanceList(List<RoleInheritance> roleInheritanceList) {
this.roleInheritanceList = roleInheritanceList; this.roleInheritanceList = roleInheritanceList;
} }
public List<RoleInheritance> getRoleInheritanceList1() { public List<RoleInheritance> getRoleInheritanceList1() {
return roleInheritanceList1; return roleInheritanceList1;
} }
public void setRoleInheritanceList1( public void setRoleInheritanceList1(List<RoleInheritance> roleInheritanceList1) {
List<RoleInheritance> roleInheritanceList1) { this.roleInheritanceList1 = roleInheritanceList1;
this.roleInheritanceList1 = roleInheritanceList1;
} }
public List<RoleRight> getRoleRightList() { public List<RoleRight> getRoleRightList() {
return roleRightList; return roleRightList;
} }
public void setRoleRightList(List<RoleRight> roleRightList) { public void setRoleRightList(List<RoleRight> roleRightList) {
this.roleRightList = roleRightList; this.roleRightList = roleRightList;
} }
public CardTemplate getCardTemplatesId() { public CardTemplate getCardTemplatesId() {
return cardTemplatesId; return cardTemplatesId;
} }
public void setCardTemplatesId(CardTemplate cardTemplatesId) { public void setCardTemplatesId(CardTemplate cardTemplatesId) {
this.cardTemplatesId = cardTemplatesId; this.cardTemplatesId = cardTemplatesId;
} }
public Event getEventsId() { public Event getEventsId() {
return eventsId; return eventsId;
} }
public void setEventsId(Event eventsId) { public void setEventsId(Event eventsId) {
this.eventsId = eventsId; this.eventsId = eventsId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (rolesId != null ? rolesId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 Role)) {
if (!(object instanceof Role)) { return false;
return false; }
} Role other = (Role) object;
Role other = (Role) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.rolesId == null && other.rolesId != null) return false;
|| (this.rolesId != null && !this.rolesId.equals(other.rolesId))) { }
return false; return true;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Role[rolesId=" + rolesId + "]"; return "fi.insomnia.bortal.model.Role[rolesId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
...@@ -17,87 +16,108 @@ import javax.persistence.NamedQueries; ...@@ -17,87 +16,108 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "role_inheritance", uniqueConstraints = { @UniqueConstraint(columnNames = { @Table(name = "role_inheritance", uniqueConstraints = {
"roles_id", "inherits" }) }) @UniqueConstraint(columnNames = {"roles_id", "inherits"})})
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "RoleInheritance.findAll", query = "SELECT r FROM RoleInheritance r"), @NamedQuery(name = "RoleInheritance.findAll", query = "SELECT r FROM RoleInheritance r"),
@NamedQuery(name = "RoleInheritance.findByRoleInheritanceId", query = "SELECT r FROM RoleInheritance r WHERE r.roleInheritanceId = :roleInheritanceId") }) @NamedQuery(name = "RoleInheritance.findByRoleInheritanceId", query = "SELECT r FROM RoleInheritance r WHERE r.roleInheritanceId = :roleInheritanceId")})
public class RoleInheritance implements Serializable { public class RoleInheritance implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "role_inheritance_id", nullable = false) @Column(name = "role_inheritance_id", nullable = false)
private Integer roleInheritanceId; private Integer id;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false) @JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Role rolesId; private Role rolesId;
@JoinColumn(name = "inherits", referencedColumnName = "roles_id", nullable = false) @JoinColumn(name = "inherits", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Role inherits; private Role inherits;
@Version
@Column(nullable = false)
private int jpaVersionField;
public RoleInheritance() { public RoleInheritance() {
} }
public RoleInheritance(Integer roleInheritanceId) { public RoleInheritance(Integer roleInheritanceId) {
this.roleInheritanceId = roleInheritanceId; this.id = roleInheritanceId;
}
public Integer getRoleInheritanceId() {
return roleInheritanceId;
}
public void setRoleInheritanceId(Integer roleInheritanceId) {
this.roleInheritanceId = roleInheritanceId;
} }
public Role getRolesId() { public Role getRolesId() {
return rolesId; return rolesId;
} }
public void setRolesId(Role rolesId) { public void setRolesId(Role rolesId) {
this.rolesId = rolesId; this.rolesId = rolesId;
} }
public Role getInherits() { public Role getInherits() {
return inherits; return inherits;
} }
public void setInherits(Role inherits) { public void setInherits(Role inherits) {
this.inherits = inherits; this.inherits = inherits;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (roleInheritanceId != null ? roleInheritanceId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 RoleInheritance)) {
if (!(object instanceof RoleInheritance)) { return false;
return false; }
} RoleInheritance other = (RoleInheritance) object;
RoleInheritance other = (RoleInheritance) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.roleInheritanceId == null && other.roleInheritanceId != null) return false;
|| (this.roleInheritanceId != null && !this.roleInheritanceId }
.equals(other.roleInheritanceId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.RoleInheritance[roleInheritanceId=" return "fi.insomnia.bortal.model.RoleInheritance[roleInheritanceId=" + getId() + "]";
+ roleInheritanceId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
...@@ -17,87 +16,108 @@ import javax.persistence.NamedQueries; ...@@ -17,87 +16,108 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "role_memberships", uniqueConstraints = { @UniqueConstraint(columnNames = { @Table(name = "role_memberships", uniqueConstraints = {
"roles_id", "users_id" }) }) @UniqueConstraint(columnNames = {"roles_id", "users_id"})})
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "RoleMembership.findAll", query = "SELECT r FROM RoleMembership r"), @NamedQuery(name = "RoleMembership.findAll", query = "SELECT r FROM RoleMembership r"),
@NamedQuery(name = "RoleMembership.findByRoleMembershipsId", query = "SELECT r FROM RoleMembership r WHERE r.roleMembershipsId = :roleMembershipsId") }) @NamedQuery(name = "RoleMembership.findByRoleMembershipsId", query = "SELECT r FROM RoleMembership r WHERE r.roleMembershipsId = :roleMembershipsId")})
public class RoleMembership implements Serializable { public class RoleMembership implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "role_memberships_id", nullable = false) @Column(name = "role_memberships_id", nullable = false)
private Integer roleMembershipsId; private Integer id;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false) @JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Role rolesId; private Role rolesId;
@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 usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public RoleMembership() { public RoleMembership() {
} }
public RoleMembership(Integer roleMembershipsId) { public RoleMembership(Integer roleMembershipsId) {
this.roleMembershipsId = roleMembershipsId; this.id = roleMembershipsId;
}
public Integer getRoleMembershipsId() {
return roleMembershipsId;
}
public void setRoleMembershipsId(Integer roleMembershipsId) {
this.roleMembershipsId = roleMembershipsId;
} }
public Role getRolesId() { public Role getRolesId() {
return rolesId; return rolesId;
} }
public void setRolesId(Role rolesId) { public void setRolesId(Role rolesId) {
this.rolesId = rolesId; this.rolesId = rolesId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (roleMembershipsId != null ? roleMembershipsId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 RoleMembership)) {
if (!(object instanceof RoleMembership)) { return false;
return false; }
} RoleMembership other = (RoleMembership) object;
RoleMembership other = (RoleMembership) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.roleMembershipsId == null && other.roleMembershipsId != null) return false;
|| (this.roleMembershipsId != null && !this.roleMembershipsId }
.equals(other.roleMembershipsId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.RoleMembership[roleMembershipsId=" return "fi.insomnia.bortal.model.RoleMembership[roleMembershipsId=" + getId() + "]";
+ roleMembershipsId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -15,114 +15,138 @@ import javax.persistence.ManyToOne; ...@@ -15,114 +15,138 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "role_rights") @Table(name = "role_rights")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "RoleRight.findAll", query = "SELECT r FROM RoleRight r"), @NamedQuery(name = "RoleRight.findAll", query = "SELECT r FROM RoleRight r"),
@NamedQuery(name = "RoleRight.findByRoleRights", query = "SELECT r FROM RoleRight r WHERE r.roleRights = :roleRights"), @NamedQuery(name = "RoleRight.findByRoleRights", query = "SELECT r FROM RoleRight r WHERE r.roleRights = :roleRights"),
@NamedQuery(name = "RoleRight.findByRead", query = "SELECT r FROM RoleRight r WHERE r.read = :read"), @NamedQuery(name = "RoleRight.findByRead", query = "SELECT r FROM RoleRight r WHERE r.read = :read"),
@NamedQuery(name = "RoleRight.findByWrite", query = "SELECT r FROM RoleRight r WHERE r.write = :write") }) @NamedQuery(name = "RoleRight.findByWrite", query = "SELECT r FROM RoleRight r WHERE r.write = :write")})
public class RoleRight implements Serializable { public class RoleRight implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name = "role_rights", nullable = false) @Basic(optional = false)
private Integer roleRights; @Column(name = "role_rights_id", nullable = false)
private Integer id;
@Basic(optional = false)
@Column(name = "read", nullable = false) @Column(name = "read", nullable = false)
private boolean read; private boolean read;
@Basic(optional = false)
@Column(name = "write", nullable = false) @Column(name = "write", nullable = false)
private boolean write; private boolean write;
//TODO: add execute
@JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id") @JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id")
@ManyToOne @ManyToOne
private AccessRight accessRightsId; private AccessRight accessRightsId;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false) @JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private Role rolesId; private Role rolesId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public RoleRight() { public RoleRight() {
} }
public RoleRight(Integer roleRights) { public RoleRight(Integer roleRights) {
this.roleRights = roleRights; this.id = roleRights;
} }
public RoleRight(Integer roleRights, boolean read, boolean write) { public RoleRight(Integer roleRights, boolean read, boolean write) {
this.roleRights = roleRights; this.id = roleRights;
this.read = read; this.read = read;
this.write = write; this.write = write;
}
public Integer getRoleRights() {
return roleRights;
}
public void setRoleRights(Integer roleRights) {
this.roleRights = roleRights;
} }
public boolean getRead() { public boolean getRead() {
return read; return read;
} }
public void setRead(boolean read) { public void setRead(boolean read) {
this.read = read; this.read = read;
} }
public boolean getWrite() { public boolean getWrite() {
return write; return write;
} }
public void setWrite(boolean write) { public void setWrite(boolean write) {
this.write = write; this.write = write;
} }
public AccessRight getAccessRightsId() { public AccessRight getAccessRightsId() {
return accessRightsId; return accessRightsId;
} }
public void setAccessRightsId(AccessRight accessRightsId) { public void setAccessRightsId(AccessRight accessRightsId) {
this.accessRightsId = accessRightsId; this.accessRightsId = accessRightsId;
} }
public Role getRolesId() { public Role getRolesId() {
return rolesId; return rolesId;
} }
public void setRolesId(Role rolesId) { public void setRolesId(Role rolesId) {
this.rolesId = rolesId; this.rolesId = rolesId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (roleRights != null ? roleRights.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 RoleRight)) {
if (!(object instanceof RoleRight)) { return false;
return false; }
} RoleRight other = (RoleRight) object;
RoleRight other = (RoleRight) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.roleRights == null && other.roleRights != null) return false;
|| (this.roleRights != null && !this.roleRights }
.equals(other.roleRights))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.RoleRight[roleRights=" + roleRights return "fi.insomnia.bortal.model.RoleRight[roleRights=" + getId() + "]";
+ "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -20,45 +20,52 @@ import javax.persistence.OneToMany; ...@@ -20,45 +20,52 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "users") @Table(name = "users")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"), @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"),
@NamedQuery(name = "User.findByUsersId", query = "SELECT u FROM User u WHERE u.usersId = :usersId"), @NamedQuery(name = "User.findByUsersId", query = "SELECT u FROM User u WHERE u.usersId = :usersId"),
@NamedQuery(name = "User.findByCreated", query = "SELECT u FROM User u WHERE u.created = :created"), @NamedQuery(name = "User.findByCreated", query = "SELECT u FROM User u WHERE u.created = :created"),
@NamedQuery(name = "User.findByActive", query = "SELECT u FROM User u WHERE u.active = :active"), @NamedQuery(name = "User.findByActive", query = "SELECT u FROM User u WHERE u.active = :active"),
@NamedQuery(name = "User.findByPassword", query = "SELECT u FROM User u WHERE u.password = :password"), @NamedQuery(name = "User.findByPassword", query = "SELECT u FROM User u WHERE u.password = :password"),
@NamedQuery(name = "User.findByLastname", query = "SELECT u FROM User u WHERE u.lastname = :lastname"), @NamedQuery(name = "User.findByLastname", query = "SELECT u FROM User u WHERE u.lastname = :lastname"),
@NamedQuery(name = "User.findByFirstnames", query = "SELECT u FROM User u WHERE u.firstnames = :firstnames"), @NamedQuery(name = "User.findByFirstnames", query = "SELECT u FROM User u WHERE u.firstnames = :firstnames"),
@NamedQuery(name = "User.findByBirthday", query = "SELECT u FROM User u WHERE u.birthday = :birthday"), @NamedQuery(name = "User.findByBirthday", query = "SELECT u FROM User u WHERE u.birthday = :birthday"),
@NamedQuery(name = "User.findByNick", query = "SELECT u FROM User u WHERE u.nick = :nick"), @NamedQuery(name = "User.findByNick", query = "SELECT u FROM User u WHERE u.nick = :nick"),
@NamedQuery(name = "User.findByEmail", query = "SELECT u FROM User u WHERE u.email = :email"), @NamedQuery(name = "User.findByEmail", query = "SELECT u FROM User u WHERE u.email = :email"),
@NamedQuery(name = "User.findByAddress", query = "SELECT u FROM User u WHERE u.address = :address"), @NamedQuery(name = "User.findByAddress", query = "SELECT u FROM User u WHERE u.address = :address"),
@NamedQuery(name = "User.findByZip", query = "SELECT u FROM User u WHERE u.zip = :zip"), @NamedQuery(name = "User.findByZip", query = "SELECT u FROM User u WHERE u.zip = :zip"),
@NamedQuery(name = "User.findByPostalCode", query = "SELECT u FROM User u WHERE u.postalCode = :postalCode"), @NamedQuery(name = "User.findByPostalCode", query = "SELECT u FROM User u WHERE u.postalCode = :postalCode"),
@NamedQuery(name = "User.findByTown", query = "SELECT u FROM User u WHERE u.town = :town"), @NamedQuery(name = "User.findByTown", query = "SELECT u FROM User u WHERE u.town = :town"),
@NamedQuery(name = "User.findByPhone", query = "SELECT u FROM User u WHERE u.phone = :phone"), @NamedQuery(name = "User.findByPhone", query = "SELECT u FROM User u WHERE u.phone = :phone"),
@NamedQuery(name = "User.findByFemale", query = "SELECT u FROM User u WHERE u.female = :female"), @NamedQuery(name = "User.findByFemale", query = "SELECT u FROM User u WHERE u.female = :female"),
@NamedQuery(name = "User.findByLogin", query = "SELECT u FROM User u WHERE u.login = :login") }) @NamedQuery(name = "User.findByLogin", query = "SELECT u FROM User u WHERE u.login = :login")})
public class User implements Serializable { public class User implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "users_id", nullable = false) @Column(name = "users_id", nullable = false)
private Integer usersId; private Integer id;
@Basic(optional = false)
@Column(name = "created", nullable = false) @Column(name = "created", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date created; private Date created;
@Basic(optional = false)
@Column(name = "active", nullable = false) @Column(name = "active", nullable = false)
private boolean active; private boolean active;
@Column(name = "password", length = 2147483647) @Column(name = "password", length = 2147483647)
private String password; private String password;
@Basic(optional = false)
@Column(name = "lastname", nullable = false, length = 2147483647) @Column(name = "lastname", nullable = false, length = 2147483647)
private String lastname; private String lastname;
@Basic(optional = false)
@Column(name = "firstnames", nullable = false, length = 2147483647) @Column(name = "firstnames", nullable = false, length = 2147483647)
private String firstnames; private String firstnames;
@Column(name = "birthday") @Column(name = "birthday")
...@@ -111,290 +118,307 @@ public class User implements Serializable { ...@@ -111,290 +118,307 @@ public class User implements Serializable {
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;
@Version
@Column(nullable = false)
private int jpaVersionField;
public User() { public User() {
} }
public User(Integer usersId) { public User(Integer usersId) {
this.usersId = usersId; this.id = usersId;
}
public User(Integer usersId, Date created, boolean active, String lastname,
String firstnames) {
this.usersId = usersId;
this.created = created;
this.active = active;
this.lastname = lastname;
this.firstnames = firstnames;
} }
public Integer getUsersId() { public User(Integer usersId, Date created, boolean active, String lastname, String firstnames) {
return usersId; this.id = usersId;
} this.created = created;
this.active = active;
public void setUsersId(Integer usersId) { this.lastname = lastname;
this.usersId = usersId; this.firstnames = firstnames;
} }
public Date getCreated() { public Date getCreated() {
return created; return created;
} }
public void setCreated(Date created) { public void setCreated(Date created) {
this.created = created; this.created = created;
} }
public boolean getActive() { public boolean getActive() {
return active; return active;
} }
public void setActive(boolean active) { public void setActive(boolean active) {
this.active = active; this.active = active;
} }
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
public String getLastname() { public String getLastname() {
return lastname; return lastname;
} }
public void setLastname(String lastname) { public void setLastname(String lastname) {
this.lastname = lastname; this.lastname = lastname;
} }
public String getFirstnames() { public String getFirstnames() {
return firstnames; return firstnames;
} }
public void setFirstnames(String firstnames) { public void setFirstnames(String firstnames) {
this.firstnames = firstnames; this.firstnames = firstnames;
} }
public Date getBirthday() { public Date getBirthday() {
return birthday; return birthday;
} }
public void setBirthday(Date birthday) { public void setBirthday(Date birthday) {
this.birthday = birthday; this.birthday = birthday;
} }
public String getNick() { public String getNick() {
return nick; return nick;
} }
public void setNick(String nick) { public void setNick(String nick) {
this.nick = nick; this.nick = nick;
} }
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public String getAddress() { public String getAddress() {
return address; return address;
} }
public void setAddress(String address) { public void setAddress(String address) {
this.address = address; this.address = address;
} }
public String getZip() { public String getZip() {
return zip; return zip;
} }
public void setZip(String zip) { public void setZip(String zip) {
this.zip = zip; this.zip = zip;
} }
public String getPostalCode() { public String getPostalCode() {
return postalCode; return postalCode;
} }
public void setPostalCode(String postalCode) { public void setPostalCode(String postalCode) {
this.postalCode = postalCode; this.postalCode = postalCode;
} }
public String getTown() { public String getTown() {
return town; return town;
} }
public void setTown(String town) { public void setTown(String town) {
this.town = town; this.town = town;
} }
public String getPhone() { public String getPhone() {
return phone; return phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
this.phone = phone; this.phone = phone;
} }
public Boolean getFemale() { public Boolean getFemale() {
return female; return female;
} }
public void setFemale(Boolean female) { public void setFemale(Boolean female) {
this.female = female; this.female = female;
} }
public Object getGender() { public Object getGender() {
return gender; return gender;
} }
public void setGender(Object gender) { public void setGender(Object gender) {
this.gender = gender; this.gender = gender;
} }
public String getLogin() { public String getLogin() {
return login; return login;
} }
public void setLogin(String login) { public void setLogin(String login) {
this.login = login; this.login = login;
} }
public List<Vote> getVoteList() { public List<Vote> getVoteList() {
return voteList; return voteList;
} }
public void setVoteList(List<Vote> voteList) { public void setVoteList(List<Vote> voteList) {
this.voteList = voteList; this.voteList = voteList;
} }
public List<RoleMembership> getRoleMembershipList() { public List<RoleMembership> getRoleMembershipList() {
return roleMembershipList; return roleMembershipList;
} }
public void setRoleMembershipList(List<RoleMembership> roleMembershipList) { public void setRoleMembershipList(List<RoleMembership> roleMembershipList) {
this.roleMembershipList = roleMembershipList; this.roleMembershipList = roleMembershipList;
} }
public List<LogEntry> getLogEntryList() { public List<LogEntry> getLogEntryList() {
return logEntryList; return logEntryList;
} }
public void setLogEntryList(List<LogEntry> logEntryList) { public void setLogEntryList(List<LogEntry> logEntryList) {
this.logEntryList = logEntryList; this.logEntryList = logEntryList;
} }
public List<UserImage> getUserImageList() { public List<UserImage> getUserImageList() {
return userImageList; return userImageList;
} }
public void setUserImageList(List<UserImage> userImageList) { public void setUserImageList(List<UserImage> userImageList) {
this.userImageList = userImageList; this.userImageList = userImageList;
} }
public List<CompoEntryParticipant> getCompoEntryParticipantList() { public List<CompoEntryParticipant> getCompoEntryParticipantList() {
return compoEntryParticipantList; return compoEntryParticipantList;
} }
public void setCompoEntryParticipantList( public void setCompoEntryParticipantList(List<CompoEntryParticipant> compoEntryParticipantList) {
List<CompoEntryParticipant> compoEntryParticipantList) { this.compoEntryParticipantList = compoEntryParticipantList;
this.compoEntryParticipantList = compoEntryParticipantList;
} }
public List<CompoEntry> getCompoEntryList() { public List<CompoEntry> getCompoEntryList() {
return compoEntryList; return compoEntryList;
} }
public void setCompoEntryList(List<CompoEntry> compoEntryList) { public void setCompoEntryList(List<CompoEntry> compoEntryList) {
this.compoEntryList = compoEntryList; this.compoEntryList = compoEntryList;
} }
public List<PlaceGroup> getPlaceGroupList() { public List<PlaceGroup> getPlaceGroupList() {
return placeGroupList; return placeGroupList;
} }
public void setPlaceGroupList(List<PlaceGroup> placeGroupList) { public void setPlaceGroupList(List<PlaceGroup> placeGroupList) {
this.placeGroupList = placeGroupList; this.placeGroupList = placeGroupList;
} }
public List<GroupMembership> getGroupMembershipList() { public List<GroupMembership> getGroupMembershipList() {
return groupMembershipList; return groupMembershipList;
} }
public void setGroupMembershipList(List<GroupMembership> groupMembershipList) { public void setGroupMembershipList(List<GroupMembership> groupMembershipList) {
this.groupMembershipList = groupMembershipList; this.groupMembershipList = groupMembershipList;
} }
public List<Place> getPlaceList() { public List<Place> getPlaceList() {
return placeList; return placeList;
} }
public void setPlaceList(List<Place> placeList) { public void setPlaceList(List<Place> placeList) {
this.placeList = placeList; this.placeList = placeList;
} }
public List<PrintedCard> getPrintedCardList() { public List<PrintedCard> getPrintedCardList() {
return printedCardList; return printedCardList;
} }
public void setPrintedCardList(List<PrintedCard> printedCardList) { public void setPrintedCardList(List<PrintedCard> printedCardList) {
this.printedCardList = printedCardList; this.printedCardList = printedCardList;
} }
public List<AccountEvent> getAccountEventList() { public List<AccountEvent> getAccountEventList() {
return accountEventList; return accountEventList;
} }
public void setAccountEventList(List<AccountEvent> accountEventList) { public void setAccountEventList(List<AccountEvent> accountEventList) {
this.accountEventList = accountEventList; this.accountEventList = accountEventList;
} }
public List<DiscountInstance> getDiscountInstanceList() { public List<DiscountInstance> getDiscountInstanceList() {
return discountInstanceList; return discountInstanceList;
} }
public void setDiscountInstanceList( public void setDiscountInstanceList(List<DiscountInstance> discountInstanceList) {
List<DiscountInstance> discountInstanceList) { this.discountInstanceList = discountInstanceList;
this.discountInstanceList = discountInstanceList;
} }
public List<Bill> getBillList() { public List<Bill> getBillList() {
return billList; return billList;
} }
public void setBillList(List<Bill> billList) { public void setBillList(List<Bill> billList) {
this.billList = billList; this.billList = billList;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (usersId != null ? usersId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 User)) {
if (!(object instanceof User)) { return false;
return false; }
} User other = (User) object;
User other = (User) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.usersId == null && other.usersId != null) return false;
|| (this.usersId != null && !this.usersId.equals(other.usersId))) { }
return false; return true;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.User[usersId=" + usersId + "]"; return "fi.insomnia.bortal.model.User[usersId=" + getId() + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Basic;
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,29 +16,32 @@ import javax.persistence.ManyToOne; ...@@ -16,29 +16,32 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Version;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "user_images") @Table(name = "user_images")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "UserImage.findAll", query = "SELECT u FROM UserImage u"), @NamedQuery(name = "UserImage.findAll", query = "SELECT u FROM UserImage u"),
@NamedQuery(name = "UserImage.findByUserImagesId", query = "SELECT u FROM UserImage u WHERE u.userImagesId = :userImagesId"), @NamedQuery(name = "UserImage.findByUserImagesId", query = "SELECT u FROM UserImage u WHERE u.userImagesId = :userImagesId"),
@NamedQuery(name = "UserImage.findByName", query = "SELECT u FROM UserImage u WHERE u.name = :name"), @NamedQuery(name = "UserImage.findByName", query = "SELECT u FROM UserImage u WHERE u.name = :name"),
@NamedQuery(name = "UserImage.findByDescription", query = "SELECT u FROM UserImage u WHERE u.description = :description"), @NamedQuery(name = "UserImage.findByDescription", query = "SELECT u FROM UserImage u WHERE u.description = :description"),
@NamedQuery(name = "UserImage.findByMimeType", query = "SELECT u FROM UserImage u WHERE u.mimeType = :mimeType") }) @NamedQuery(name = "UserImage.findByMimeType", query = "SELECT u FROM UserImage u WHERE u.mimeType = :mimeType")})
public class UserImage implements Serializable { public class UserImage implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "user_images_id", nullable = false) @Column(name = "user_images_id", nullable = false)
private Integer userImagesId; private Integer id;
@Column(name = "name") @Column(name = "name", length = 2147483647)
private String name; private String name;
@Column(name = "description") @Column(name = "description", length = 2147483647)
private String description; private String description;
@Column(name = "mime_type") @Column(name = "mime_type", length = 2147483647)
private String mimeType; private String mimeType;
@Lob @Lob
@Column(name = "image_data") @Column(name = "image_data")
...@@ -46,89 +49,107 @@ public class UserImage implements Serializable { ...@@ -46,89 +49,107 @@ public class UserImage implements Serializable {
@JoinColumn(name = "users_id", referencedColumnName = "users_id") @JoinColumn(name = "users_id", referencedColumnName = "users_id")
@ManyToOne @ManyToOne
private User usersId; private User usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public UserImage() { public UserImage() {
} }
public UserImage(Integer userImagesId) { public UserImage(Integer userImagesId) {
this.userImagesId = userImagesId; this.id = userImagesId;
}
public Integer getUserImagesId() {
return userImagesId;
}
public void setUserImagesId(Integer userImagesId) {
this.userImagesId = userImagesId;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
public String getMimeType() { public String getMimeType() {
return mimeType; return mimeType;
} }
public void setMimeType(String mimeType) { public void setMimeType(String mimeType) {
this.mimeType = mimeType; this.mimeType = mimeType;
} }
public byte[] getImageData() { public byte[] getImageData() {
return imageData; return imageData;
} }
public void setImageData(byte[] imageData) { public void setImageData(byte[] imageData) {
this.imageData = imageData; this.imageData = imageData;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (userImagesId != null ? userImagesId.hashCode() : 0); hash += (getId() != null ? getId().hashCode() : 0);
return hash; return hash;
} }
@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 UserImage)) {
if (!(object instanceof UserImage)) { return false;
return false; }
} UserImage other = (UserImage) object;
UserImage other = (UserImage) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
if ((this.userImagesId == null && other.userImagesId != null) return false;
|| (this.userImagesId != null && !this.userImagesId }
.equals(other.userImagesId))) { return true;
return false;
}
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.UserImage[userImagesId=" return "fi.insomnia.bortal.model.UserImage[userImagesId=" + getId() + "]";
+ userImagesId + "]";
} }
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -19,25 +19,30 @@ import javax.persistence.Table; ...@@ -19,25 +19,30 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
/** /**
* A vote for a compo entry * A vote for a compo entry
*/ */
@Entity @Entity
@Table(name = "votes", uniqueConstraints = { @UniqueConstraint(columnNames = { @Table(name = "votes", uniqueConstraints = {
"entries_id", "users_id" }) }) @UniqueConstraint(columnNames = {
@NamedQueries( { "entries_id", "users_id"})})
@NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"), @NamedQueries({
@NamedQuery(name = "Vote.findById", query = "SELECT v FROM Vote v WHERE v.id = :id"), @NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"),
@NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"), @NamedQuery(name = "Vote.findByVotesId", query = "SELECT v FROM Vote v WHERE v.votesId = :votesId"),
@NamedQuery(name = "Vote.findByVoteTime", query = "SELECT v FROM Vote v WHERE v.voteTime = :voteTime") }) @NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"),
public class Vote implements Serializable { @NamedQuery(name = "Vote.findByVoteTime", query = "SELECT v FROM Vote v WHERE v.voteTime = :voteTime")})
public class Vote implements ModelInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Basic(optional = false)
@Column(name = "votes_id", nullable = false) @Column(name = "votes_id", nullable = false)
private Integer id; private Integer id;
@Column(name = "score") @Column(name = "score")
private Integer score; private Integer score;
@Basic(optional = false)
@Column(name = "vote_time", nullable = false) @Column(name = "vote_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date voteTime; private Date voteTime;
...@@ -47,84 +52,100 @@ public class Vote implements Serializable { ...@@ -47,84 +52,100 @@ public class Vote implements Serializable {
@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 usersId;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Vote() { public Vote() {
} }
public Vote(Integer votesId) { public Vote(Integer votesId) {
this.id = votesId; this.id = votesId;
} }
public Vote(Integer votesId, Date voteTime) { public Vote(Integer votesId, Date voteTime) {
this.id = votesId; this.id = votesId;
this.voteTime = voteTime; this.voteTime = voteTime;
} }
public Integer getVotesId() { public Integer getId() {
return id; return id;
} }
public void setVotesId(Integer votesId) { public void setId(Integer votesId) {
this.id = votesId; this.id = votesId;
} }
public Integer getScore() { public Integer getScore() {
return score; return score;
} }
public void setScore(Integer score) { public void setScore(Integer score) {
this.score = score; this.score = score;
} }
public Date getVoteTime() { public Date getVoteTime() {
return voteTime; return voteTime;
} }
public void setVoteTime(Date voteTime) { public void setVoteTime(Date voteTime) {
this.voteTime = voteTime; this.voteTime = voteTime;
} }
public CompoEntry getEntriesId() { public CompoEntry getEntriesId() {
return entriesId; return entriesId;
} }
public void setEntriesId(CompoEntry entriesId) { public void setEntriesId(CompoEntry entriesId) {
this.entriesId = entriesId; this.entriesId = entriesId;
} }
public User getUsersId() { public User getUsersId() {
return usersId; return usersId;
} }
public void setUsersId(User usersId) { public void setUsersId(User usersId) {
this.usersId = usersId; this.usersId = usersId;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
hash += (id != null ? id.hashCode() : 0); hash += (id != null ? id.hashCode() : 0);
return hash; return hash;
} }
@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 Vote)) { if (!(object instanceof Vote)) {
return false; return false;
} }
Vote other = (Vote) object; Vote other = (Vote) object;
if ((this.id == null && other.id != null) if ((this.id == null && other.id != null)
|| (this.id != null && !this.id.equals(other.id))) { || (this.id != null && !this.id.equals(other.id))) {
return false; return false;
} }
return true; return true;
} }
@Override @Override
public String toString() { public String toString() {
return "fi.insomnia.bortal.model.Vote[id=" + id + "]"; return "fi.insomnia.bortal.model.Vote[votesId=" + id + "]";
} }
/**
* @return the jpaVersionField
*/
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @param jpaVersionField the jpaVersionField to set
*/
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!