Commit ee7c91cf by Tuomas Riihimäki

Siirretty käyttämään EntityPk luokkaa composite keynä

1 parent c0697f82
Showing with 255 additions and 298 deletions
...@@ -43,13 +43,12 @@ public class SessionHandlerBean implements SessionHandlerBeanLocal { ...@@ -43,13 +43,12 @@ public class SessionHandlerBean implements SessionHandlerBeanLocal {
return false; return false;
} }
private static boolean getRights(Role role,String target,RolePermission permission, Set<Role> checkedRoles) { private static boolean getRights(Role role, String target, RolePermission permission, Set<Role> checkedRoles) {
if(checkedRoles.contains(role)) if (checkedRoles.contains(role)) {
{
return false; return false;
} }
for (RoleRight rr : role.getRoleRights()) { for (RoleRight rr : role.getRoleRights()) {
if (rr.getAccessRight().getAccessRight().equals(target)) { if (rr.getAccessRight().getAccessRight().equals(target)) {
switch (permission) { switch (permission) {
...@@ -73,13 +72,12 @@ public class SessionHandlerBean implements SessionHandlerBeanLocal { ...@@ -73,13 +72,12 @@ public class SessionHandlerBean implements SessionHandlerBeanLocal {
checkedRoles.add(role); checkedRoles.add(role);
for (Role r : role.getParents()) { for (Role r : role.getParents()) {
if(getRights(r,target,permission,checkedRoles)) if (getRights(r, target, permission, checkedRoles)) {
{
return true; return true;
} }
} }
return false; return false;
} }
} }
...@@ -28,7 +28,7 @@ import javax.persistence.Version; ...@@ -28,7 +28,7 @@ import javax.persistence.Version;
@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.findByName", query = "SELECT a FROM AccessRight a WHERE a.name = :name") }) @NamedQuery(name = "AccessRight.findByName", query = "SELECT a FROM AccessRight a WHERE a.name = :name") })
public class AccessRight implements ModelInterface { public class AccessRight implements ModelInterface<Integer>{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
......
...@@ -10,6 +10,7 @@ import java.util.Calendar; ...@@ -10,6 +10,7 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -36,13 +37,11 @@ import javax.persistence.Version; ...@@ -36,13 +37,11 @@ import javax.persistence.Version;
@NamedQuery(name = "AccountEvent.findByUnits", query = "SELECT a FROM AccountEvent a WHERE a.units = :units"), @NamedQuery(name = "AccountEvent.findByUnits", query = "SELECT a FROM AccountEvent a WHERE a.units = :units"),
@NamedQuery(name = "AccountEvent.findByEventTime", query = "SELECT a FROM AccountEvent a WHERE a.eventTime = :eventTime"), @NamedQuery(name = "AccountEvent.findByEventTime", query = "SELECT a FROM AccountEvent a WHERE a.eventTime = :eventTime"),
@NamedQuery(name = "AccountEvent.findByDelivered", query = "SELECT a FROM AccountEvent a WHERE a.delivered = :delivered") }) @NamedQuery(name = "AccountEvent.findByDelivered", query = "SELECT a FROM AccountEvent a WHERE a.delivered = :delivered") })
public class AccountEvent implements ModelInterface { public class AccountEvent implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "account_events_id", nullable = false)
private Integer id;
@Column(name = "unit_price", nullable = false, precision = 24, scale = 4) @Column(name = "unit_price", nullable = false, precision = 24, scale = 4)
private BigDecimal unitPrice; private BigDecimal unitPrice;
...@@ -85,12 +84,12 @@ public class AccountEvent implements ModelInterface { ...@@ -85,12 +84,12 @@ public class AccountEvent implements ModelInterface {
private int jpaVersionField; private int jpaVersionField;
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
...@@ -107,11 +106,11 @@ public class AccountEvent implements ModelInterface { ...@@ -107,11 +106,11 @@ public class AccountEvent implements ModelInterface {
public AccountEvent() { public AccountEvent() {
} }
public AccountEvent(Integer accountEventsId) { public AccountEvent(EventPk accountEventsId) {
this.id = accountEventsId; this.id = accountEventsId;
} }
public AccountEvent(Integer accountEventsId, BigDecimal unitPrice, public AccountEvent(EventPk accountEventsId, BigDecimal unitPrice,
BigDecimal unitCount, Calendar eventTime) { BigDecimal unitCount, Calendar eventTime) {
this.id = accountEventsId; this.id = accountEventsId;
this.setUnitPrice(unitPrice); this.setUnitPrice(unitPrice);
......
...@@ -8,6 +8,8 @@ import java.util.Calendar; ...@@ -8,6 +8,8 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -38,14 +40,13 @@ import javax.persistence.Version; ...@@ -38,14 +40,13 @@ import javax.persistence.Version;
@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 ModelInterface { public class Bill implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;;
@Column(name = "bills_id", nullable = false)
private Integer id;
@Column(name = "due_date") @Column(name = "due_date")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -80,12 +81,12 @@ public class Bill implements ModelInterface { ...@@ -80,12 +81,12 @@ public class Bill implements ModelInterface {
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
...@@ -98,7 +99,7 @@ public class Bill implements ModelInterface { ...@@ -98,7 +99,7 @@ public class Bill implements ModelInterface {
public Bill() { public Bill() {
} }
public Bill(Integer billsId) { public Bill(EventPk billsId) {
this.id = billsId; this.id = billsId;
} }
......
...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model; ...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -30,13 +31,11 @@ import javax.persistence.Version; ...@@ -30,13 +31,11 @@ import javax.persistence.Version;
@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 ModelInterface { public class BillLine implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final BigDecimal DEFAULT_VAT = BigDecimal.ZERO; private static final BigDecimal DEFAULT_VAT = BigDecimal.ZERO;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "bill_lines_id", nullable = false)
private Integer id;
@Column(name = "name", nullable = false) @Column(name = "name", nullable = false)
private String name; private String name;
...@@ -61,11 +60,11 @@ public class BillLine implements ModelInterface { ...@@ -61,11 +60,11 @@ public class BillLine implements ModelInterface {
public BillLine() { public BillLine() {
} }
public BillLine(Integer billLinesId) { public BillLine(EventPk billLinesId) {
this.id = billLinesId; this.id = billLinesId;
} }
public BillLine(Integer billLinesId, String product, BigDecimal units, public BillLine(EventPk billLinesId, String product, BigDecimal units,
BigDecimal unitPrice, BigDecimal vat) { BigDecimal unitPrice, BigDecimal vat) {
this.id = billLinesId; this.id = billLinesId;
this.name = product; this.name = product;
...@@ -128,12 +127,12 @@ public class BillLine implements ModelInterface { ...@@ -128,12 +127,12 @@ public class BillLine implements ModelInterface {
} }
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model; ...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -30,12 +31,10 @@ import javax.persistence.Version; ...@@ -30,12 +31,10 @@ import javax.persistence.Version;
@NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"), @NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"),
@NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") }) @NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") })
public class CardTemplate implements ModelInterface { public class CardTemplate implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "card_templates_id", nullable = false)
private Integer id;
@Lob @Lob
@Column(name = "template_image") @Column(name = "template_image")
...@@ -61,11 +60,11 @@ public class CardTemplate implements ModelInterface { ...@@ -61,11 +60,11 @@ public class CardTemplate implements ModelInterface {
public CardTemplate() { public CardTemplate() {
} }
public CardTemplate(Integer cardTemplatesId) { public CardTemplate(EventPk cardTemplatesId) {
this.id = cardTemplatesId; this.id = cardTemplatesId;
} }
public CardTemplate(Integer cardTemplatesId, String templateName) { public CardTemplate(EventPk cardTemplatesId, String templateName) {
this.id = cardTemplatesId; this.id = cardTemplatesId;
this.name = templateName; this.name = templateName;
} }
...@@ -91,12 +90,12 @@ public class CardTemplate implements ModelInterface { ...@@ -91,12 +90,12 @@ public class CardTemplate implements ModelInterface {
} }
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -10,6 +10,7 @@ import java.util.List; ...@@ -10,6 +10,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -41,12 +42,10 @@ import javax.persistence.Version; ...@@ -41,12 +42,10 @@ import javax.persistence.Version;
@NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"), @NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"),
@NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting"), @NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting"),
@NamedQuery(name = "Compo.findByDescription", query = "SELECT c FROM Compo c WHERE c.description = :description") }) @NamedQuery(name = "Compo.findByDescription", query = "SELECT c FROM Compo c WHERE c.description = :description") })
public class Compo implements ModelInterface { public class Compo implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "compos_id", nullable = false)
private Integer id;
@Column(name = "compo_name", nullable = false) @Column(name = "compo_name", nullable = false)
private String name; private String name;
...@@ -94,23 +93,23 @@ public class Compo implements ModelInterface { ...@@ -94,23 +93,23 @@ public class Compo implements ModelInterface {
private int jpaVersionField; private int jpaVersionField;
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
public Compo() { public Compo() {
} }
public Compo(Integer composId) { public Compo(EventPk composId) {
this.id = composId; this.id = composId;
} }
public Compo(Integer composId, String compoName, boolean holdVoting) { public Compo(EventPk composId, String compoName, boolean holdVoting) {
this.id = composId; this.id = composId;
this.name = compoName; this.name = compoName;
this.holdVoting = holdVoting; this.holdVoting = holdVoting;
......
...@@ -10,6 +10,7 @@ import java.util.List; ...@@ -10,6 +10,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -39,12 +40,10 @@ import javax.persistence.Version; ...@@ -39,12 +40,10 @@ import javax.persistence.Version;
@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 ModelInterface { public class CompoEntry implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "entries_id", nullable = false)
private Integer id;
@Column(name = "entry_created", nullable = false) @Column(name = "entry_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -92,23 +91,23 @@ public class CompoEntry implements ModelInterface { ...@@ -92,23 +91,23 @@ public class CompoEntry implements ModelInterface {
private int jpaVersionField; private int jpaVersionField;
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
public CompoEntry() { public CompoEntry() {
} }
public CompoEntry(Integer entriesId) { public CompoEntry(EventPk entriesId) {
this.id = entriesId; this.id = entriesId;
} }
public CompoEntry(Integer entriesId, Calendar entryCreated, String entryName) { public CompoEntry(EventPk entriesId, Calendar entryCreated, String entryName) {
this.id = entriesId; this.id = entriesId;
this.created = entryCreated; this.created = entryCreated;
this.name = entryName; this.name = entryName;
......
...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model; ...@@ -8,6 +8,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -35,12 +36,10 @@ import javax.persistence.Version; ...@@ -35,12 +36,10 @@ import javax.persistence.Version;
@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.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 ModelInterface { public class CompoEntryFile implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "entry_files_id", nullable = false)
private Integer id;
@Column(name = "mime_type") @Column(name = "mime_type")
private String mimeType; private String mimeType;
...@@ -72,23 +71,23 @@ public class CompoEntryFile implements ModelInterface { ...@@ -72,23 +71,23 @@ public class CompoEntryFile implements ModelInterface {
private int jpaVersionField; private int jpaVersionField;
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
public CompoEntryFile() { public CompoEntryFile() {
} }
public CompoEntryFile(Integer entryFilesId) { public CompoEntryFile(EventPk entryFilesId) {
this.id = entryFilesId; this.id = entryFilesId;
} }
public CompoEntryFile(Integer entryFilesId, Calendar uploaded) { public CompoEntryFile(EventPk entryFilesId, Calendar uploaded) {
this.id = entryFilesId; this.id = entryFilesId;
this.uploaded = uploaded; this.uploaded = uploaded;
} }
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -29,13 +30,11 @@ import javax.persistence.Version; ...@@ -29,13 +30,11 @@ import javax.persistence.Version;
@NamedQuery(name = "CompoEntryParticipant.findAll", query = "SELECT c FROM CompoEntryParticipant c"), @NamedQuery(name = "CompoEntryParticipant.findAll", query = "SELECT c FROM CompoEntryParticipant c"),
@NamedQuery(name = "CompoEntryParticipant.findByRole", query = "SELECT c FROM CompoEntryParticipant c WHERE c.role = :role") }) @NamedQuery(name = "CompoEntryParticipant.findByRole", query = "SELECT c FROM CompoEntryParticipant c WHERE c.role = :role") })
public class CompoEntryParticipant implements ModelInterface { public class CompoEntryParticipant implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "entry_participations_id", nullable = false)
private Integer id;
@Column(name = "role") @Column(name = "role")
private String role; private String role;
...@@ -61,12 +60,12 @@ public class CompoEntryParticipant implements ModelInterface { ...@@ -61,12 +60,12 @@ public class CompoEntryParticipant implements ModelInterface {
private int jpaVersionField; private int jpaVersionField;
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
...@@ -89,7 +88,7 @@ public class CompoEntryParticipant implements ModelInterface { ...@@ -89,7 +88,7 @@ public class CompoEntryParticipant implements ModelInterface {
public CompoEntryParticipant() { public CompoEntryParticipant() {
} }
public CompoEntryParticipant(Integer entryParticipationsId) { public CompoEntryParticipant(EventPk entryParticipationsId) {
this.id = entryParticipationsId; this.id = entryParticipationsId;
} }
......
...@@ -9,10 +9,8 @@ import java.util.List; ...@@ -9,10 +9,8 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
...@@ -38,12 +36,10 @@ import javax.persistence.Version; ...@@ -38,12 +36,10 @@ import javax.persistence.Version;
@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 ModelInterface { public class Discount implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "discounts_id", nullable = false)
private Integer id;
@Column(name = "percentage", nullable = false, columnDefinition = "integer default 0") @Column(name = "percentage", nullable = false, columnDefinition = "integer default 0")
private int percentage = 0; private int percentage = 0;
...@@ -88,21 +84,21 @@ public class Discount implements ModelInterface { ...@@ -88,21 +84,21 @@ public class Discount implements ModelInterface {
public Discount() { public Discount() {
} }
public Discount(Integer discountsId) { public Discount(EventPk discountsId) {
this.id = discountsId; this.id = discountsId;
} }
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
public Discount(Integer discountsId, int percentage, int amountMin, public Discount(EventPk discountsId, int percentage, int amountMin,
int amountMax, boolean active, int maxNum, int perUser) { int amountMax, boolean active, int maxNum, int perUser) {
this.id = discountsId; this.id = discountsId;
this.setPercentage(percentage); this.setPercentage(percentage);
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -26,13 +27,11 @@ import javax.persistence.Version; ...@@ -26,13 +27,11 @@ import javax.persistence.Version;
@Entity @Entity
@Table(name = "discount_instances") @Table(name = "discount_instances")
@NamedQueries( { @NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d") }) @NamedQueries( { @NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d") })
public class DiscountInstance implements ModelInterface { public class DiscountInstance implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "discounts_instances_id", nullable = false)
private Integer id;
@Column(name = "create_time", nullable = false) @Column(name = "create_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -57,7 +56,7 @@ public class DiscountInstance implements ModelInterface { ...@@ -57,7 +56,7 @@ public class DiscountInstance implements ModelInterface {
public DiscountInstance() { public DiscountInstance() {
} }
public DiscountInstance(Integer discountsInstancesId) { public DiscountInstance(EventPk discountsInstancesId) {
this.id = discountsInstancesId; this.id = discountsInstancesId;
} }
...@@ -117,7 +116,7 @@ public class DiscountInstance implements ModelInterface { ...@@ -117,7 +116,7 @@ public class DiscountInstance implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -126,7 +125,7 @@ public class DiscountInstance implements ModelInterface { ...@@ -126,7 +125,7 @@ public class DiscountInstance implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -36,7 +36,7 @@ import javax.persistence.Version; ...@@ -36,7 +36,7 @@ import javax.persistence.Version;
@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 ModelInterface { public class Event implements ModelInterface<Integer> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -30,13 +31,11 @@ import javax.persistence.Version; ...@@ -30,13 +31,11 @@ import javax.persistence.Version;
@NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"), @NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"),
@NamedQuery(name = "EventMap.findByName", query = "SELECT e FROM EventMap e WHERE e.name = :name") }) @NamedQuery(name = "EventMap.findByName", query = "SELECT e FROM EventMap e WHERE e.name = :name") })
public class EventMap implements ModelInterface { public class EventMap implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "maps_id", nullable = false)
private Integer id;
@Lob @Lob
@Column(name = "map_data") @Column(name = "map_data")
...@@ -61,7 +60,7 @@ public class EventMap implements ModelInterface { ...@@ -61,7 +60,7 @@ public class EventMap implements ModelInterface {
public EventMap() { public EventMap() {
} }
public EventMap(Integer mapsId) { public EventMap(EventPk mapsId) {
this.id = mapsId; this.id = mapsId;
} }
...@@ -128,7 +127,7 @@ public class EventMap implements ModelInterface { ...@@ -128,7 +127,7 @@ public class EventMap implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -137,7 +136,7 @@ public class EventMap implements ModelInterface { ...@@ -137,7 +136,7 @@ public class EventMap implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -30,13 +31,11 @@ import javax.persistence.Version; ...@@ -30,13 +31,11 @@ import javax.persistence.Version;
@NamedQuery(name = "EventSettings.findByBaseName", query = "SELECT e FROM EventSettings e WHERE e.baseName = :baseName"), @NamedQuery(name = "EventSettings.findByBaseName", query = "SELECT e FROM EventSettings e WHERE e.baseName = :baseName"),
@NamedQuery(name = "EventSettings.findByStyleSheet", query = "SELECT e FROM EventSettings e WHERE e.styleSheet = :styleSheet") }) @NamedQuery(name = "EventSettings.findByStyleSheet", query = "SELECT e FROM EventSettings e WHERE e.styleSheet = :styleSheet") })
public class EventSettings implements ModelInterface { public class EventSettings implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "event_settings_id", nullable = false)
private Integer id;
@Column(name = "organisation") @Column(name = "organisation")
private String organisation; private String organisation;
...@@ -59,7 +58,7 @@ public class EventSettings implements ModelInterface { ...@@ -59,7 +58,7 @@ public class EventSettings implements ModelInterface {
public EventSettings() { public EventSettings() {
} }
public EventSettings(Integer eventSettingsId) { public EventSettings(EventPk eventSettingsId) {
this.id = eventSettingsId; this.id = eventSettingsId;
} }
...@@ -102,7 +101,7 @@ public class EventSettings implements ModelInterface { ...@@ -102,7 +101,7 @@ public class EventSettings implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -111,7 +110,7 @@ public class EventSettings implements ModelInterface { ...@@ -111,7 +110,7 @@ public class EventSettings implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -28,14 +29,12 @@ import javax.persistence.Version; ...@@ -28,14 +29,12 @@ import javax.persistence.Version;
@NamedQuery(name = "EventStatus.findAll", query = "SELECT e FROM EventStatus e"), @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.findByStatusName", query = "SELECT e FROM EventStatus e WHERE e.statusName = :statusName") })
public class EventStatus implements ModelInterface { public class EventStatus implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "event_status_id", nullable = false)
private Integer id;
@Column(name = "status_name", nullable = false) @Column(name = "status_name", nullable = false)
private String statusName; private String statusName;
...@@ -50,11 +49,11 @@ public class EventStatus implements ModelInterface { ...@@ -50,11 +49,11 @@ public class EventStatus implements ModelInterface {
public EventStatus() { public EventStatus() {
} }
public EventStatus(Integer eventStatusId) { public EventStatus(EventPk eventStatusId) {
this.id = eventStatusId; this.id = eventStatusId;
} }
public EventStatus(Integer eventStatusId, String statusName) { public EventStatus(EventPk eventStatusId, String statusName) {
this.id = eventStatusId; this.id = eventStatusId;
this.statusName = statusName; this.statusName = statusName;
} }
...@@ -106,7 +105,7 @@ public class EventStatus implements ModelInterface { ...@@ -106,7 +105,7 @@ public class EventStatus implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -115,7 +114,7 @@ public class EventStatus implements ModelInterface { ...@@ -115,7 +114,7 @@ public class EventStatus implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.Calendar; ...@@ -8,6 +8,7 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -33,13 +34,11 @@ import javax.persistence.Version; ...@@ -33,13 +34,11 @@ import javax.persistence.Version;
@NamedQuery(name = "FoodWave.findByDescription", query = "SELECT f FROM FoodWave f WHERE f.description = :description"), @NamedQuery(name = "FoodWave.findByDescription", query = "SELECT f FROM FoodWave f WHERE f.description = :description"),
@NamedQuery(name = "FoodWave.findByTime", query = "SELECT f FROM FoodWave f WHERE f.time = :time"), @NamedQuery(name = "FoodWave.findByTime", query = "SELECT f FROM FoodWave f WHERE f.time = :time"),
@NamedQuery(name = "FoodWave.findByClosed", query = "SELECT f FROM FoodWave f WHERE f.closed = :closed") }) @NamedQuery(name = "FoodWave.findByClosed", query = "SELECT f FROM FoodWave f WHERE f.closed = :closed") })
public class FoodWave implements ModelInterface { public class FoodWave implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "food_waves_id", nullable = false)
private Integer id;
@Column(name = "wave_name", nullable = false) @Column(name = "wave_name", nullable = false)
private String name; private String name;
...@@ -65,11 +64,11 @@ public class FoodWave implements ModelInterface { ...@@ -65,11 +64,11 @@ public class FoodWave implements ModelInterface {
public FoodWave() { public FoodWave() {
} }
public FoodWave(Integer foodWavesId) { public FoodWave(EventPk foodWavesId) {
this.id = foodWavesId; this.id = foodWavesId;
} }
public FoodWave(Integer foodWavesId, String waveName, boolean waveClosed) { public FoodWave(EventPk foodWavesId, String waveName, boolean waveClosed) {
this.id = foodWavesId; this.id = foodWavesId;
this.name = waveName; this.name = waveName;
this.closed = waveClosed; this.closed = waveClosed;
...@@ -147,7 +146,7 @@ public class FoodWave implements ModelInterface { ...@@ -147,7 +146,7 @@ public class FoodWave implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -156,7 +155,7 @@ public class FoodWave implements ModelInterface { ...@@ -156,7 +155,7 @@ public class FoodWave implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -28,13 +29,11 @@ import javax.persistence.Version; ...@@ -28,13 +29,11 @@ import javax.persistence.Version;
@NamedQuery(name = "FoodWaveTemplate.findByName", query = "SELECT f FROM FoodWaveTemplate f WHERE f.name = :name"), @NamedQuery(name = "FoodWaveTemplate.findByName", query = "SELECT f FROM FoodWaveTemplate f WHERE f.name = :name"),
@NamedQuery(name = "FoodWaveTemplate.findByDescription", query = "SELECT f FROM FoodWaveTemplate f WHERE f.description = :description") }) @NamedQuery(name = "FoodWaveTemplate.findByDescription", query = "SELECT f FROM FoodWaveTemplate f WHERE f.description = :description") })
public class FoodWaveTemplate implements ModelInterface { public class FoodWaveTemplate implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "food_wave_templates_id", nullable = false)
private Integer id;
@Column(name = "template_name", nullable = false) @Column(name = "template_name", nullable = false)
private String name; private String name;
...@@ -53,11 +52,11 @@ public class FoodWaveTemplate implements ModelInterface { ...@@ -53,11 +52,11 @@ public class FoodWaveTemplate implements ModelInterface {
public FoodWaveTemplate() { public FoodWaveTemplate() {
} }
public FoodWaveTemplate(Integer foodWaveTemplatesId) { public FoodWaveTemplate(EventPk foodWaveTemplatesId) {
this.id = foodWaveTemplatesId; this.id = foodWaveTemplatesId;
} }
public FoodWaveTemplate(Integer foodWaveTemplatesId, String templateName) { public FoodWaveTemplate(EventPk foodWaveTemplatesId, String templateName) {
this.id = foodWaveTemplatesId; this.id = foodWaveTemplatesId;
this.name = templateName; this.name = templateName;
} }
...@@ -124,7 +123,7 @@ public class FoodWaveTemplate implements ModelInterface { ...@@ -124,7 +123,7 @@ public class FoodWaveTemplate implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -133,7 +132,7 @@ public class FoodWaveTemplate implements ModelInterface { ...@@ -133,7 +132,7 @@ public class FoodWaveTemplate implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -34,13 +35,11 @@ import javax.persistence.Version; ...@@ -34,13 +35,11 @@ import javax.persistence.Version;
@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 ModelInterface { public class GroupMembership implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "group_memberships_id", nullable = false)
private Integer id;
@Column(name = "invite_accepted") @Column(name = "invite_accepted")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -77,7 +76,7 @@ public class GroupMembership implements ModelInterface { ...@@ -77,7 +76,7 @@ public class GroupMembership implements ModelInterface {
public GroupMembership() { public GroupMembership() {
} }
public GroupMembership(Integer groupMembershipsId) { public GroupMembership(EventPk groupMembershipsId) {
this.id = groupMembershipsId; this.id = groupMembershipsId;
} }
...@@ -160,7 +159,7 @@ public class GroupMembership implements ModelInterface { ...@@ -160,7 +159,7 @@ public class GroupMembership implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -169,7 +168,7 @@ public class GroupMembership implements ModelInterface { ...@@ -169,7 +168,7 @@ public class GroupMembership implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -26,13 +27,11 @@ import javax.persistence.Version; ...@@ -26,13 +27,11 @@ import javax.persistence.Version;
@NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"), @NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
@NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.name = :name") }) @NamedQuery(name = "Location.findByLocationName", query = "SELECT l FROM Location l WHERE l.name = :name") })
public class Location implements ModelInterface { public class Location implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "locations_id", nullable = false)
private Integer id;
@Column(name = "location_name", nullable = false) @Column(name = "location_name", nullable = false)
private String name; private String name;
...@@ -50,11 +49,11 @@ public class Location implements ModelInterface { ...@@ -50,11 +49,11 @@ public class Location implements ModelInterface {
public Location() { public Location() {
} }
public Location(Integer locationsId) { public Location(EventPk locationsId) {
this.id = locationsId; this.id = locationsId;
} }
public Location(Integer locationsId, String locationName) { public Location(EventPk locationsId, String locationName) {
this.id = locationsId; this.id = locationsId;
this.name = locationName; this.name = locationName;
} }
...@@ -114,7 +113,7 @@ public class Location implements ModelInterface { ...@@ -114,7 +113,7 @@ public class Location implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -123,7 +122,7 @@ public class Location implements ModelInterface { ...@@ -123,7 +122,7 @@ public class Location implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -9,6 +9,7 @@ import static javax.persistence.TemporalType.TIMESTAMP; ...@@ -9,6 +9,7 @@ import static javax.persistence.TemporalType.TIMESTAMP;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -31,14 +32,12 @@ import javax.persistence.Version; ...@@ -31,14 +32,12 @@ import javax.persistence.Version;
@NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"), @NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"),
@NamedQuery(name = "LogEntry.findByTime", query = "SELECT l FROM LogEntry l WHERE l.time = :time"), @NamedQuery(name = "LogEntry.findByTime", query = "SELECT l FROM LogEntry l WHERE l.time = :time"),
@NamedQuery(name = "LogEntry.findByDescription", query = "SELECT l FROM LogEntry l WHERE l.description = :description") }) @NamedQuery(name = "LogEntry.findByDescription", query = "SELECT l FROM LogEntry l WHERE l.description = :description") })
public class LogEntry implements ModelInterface { public class LogEntry implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "event_log_id", nullable = false)
private Integer id;
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TIMESTAMP) @Temporal(TIMESTAMP)
...@@ -63,11 +62,11 @@ public class LogEntry implements ModelInterface { ...@@ -63,11 +62,11 @@ public class LogEntry implements ModelInterface {
public LogEntry() { public LogEntry() {
} }
public LogEntry(Integer eventLogId) { public LogEntry(EventPk eventLogId) {
this.id = eventLogId; this.id = eventLogId;
} }
public LogEntry(Integer eventLogId, Calendar eventTime) { public LogEntry(EventPk eventLogId, Calendar eventTime) {
this.id = eventLogId; this.id = eventLogId;
this.time = eventTime; this.time = eventTime;
} }
...@@ -135,7 +134,7 @@ public class LogEntry implements ModelInterface { ...@@ -135,7 +134,7 @@ public class LogEntry implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -144,7 +143,7 @@ public class LogEntry implements ModelInterface { ...@@ -144,7 +143,7 @@ public class LogEntry implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -28,14 +29,12 @@ import javax.persistence.Version; ...@@ -28,14 +29,12 @@ import javax.persistence.Version;
@NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"), @NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"),
@NamedQuery(name = "LogEntryType.findByDescription", query = "SELECT l FROM LogEntryType l WHERE l.description = :description") }) @NamedQuery(name = "LogEntryType.findByDescription", query = "SELECT l FROM LogEntryType l WHERE l.description = :description") })
public class LogEntryType implements ModelInterface { public class LogEntryType implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "event_log_types_id", nullable = false)
private Integer id;
@Lob @Lob
@Column(name = "event_type_description", nullable = false) @Column(name = "event_type_description", nullable = false)
...@@ -51,11 +50,11 @@ public class LogEntryType implements ModelInterface { ...@@ -51,11 +50,11 @@ public class LogEntryType implements ModelInterface {
public LogEntryType() { public LogEntryType() {
} }
public LogEntryType(Integer eventLogTypesId) { public LogEntryType(EventPk eventLogTypesId) {
this.id = eventLogTypesId; this.id = eventLogTypesId;
} }
public LogEntryType(Integer eventLogTypesId, String eventTypeDescription) { public LogEntryType(EventPk eventLogTypesId, String eventTypeDescription) {
this.id = eventLogTypesId; this.id = eventLogTypesId;
this.description = eventTypeDescription; this.description = eventTypeDescription;
} }
...@@ -107,7 +106,7 @@ public class LogEntryType implements ModelInterface { ...@@ -107,7 +106,7 @@ public class LogEntryType implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -116,7 +115,7 @@ public class LogEntryType implements ModelInterface { ...@@ -116,7 +115,7 @@ public class LogEntryType implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.io.Serializable; public interface ModelInterface<T> {
public T getId();
/**
*
* @author tuukka
*/
public interface ModelInterface extends Serializable {
public Integer getId();
public void setId(Integer id); public void setId(T id);
public int getJpaVersionField(); public int getJpaVersionField();
public void setJpaVersionField(int jpaVersionField); public void setJpaVersionField(int jpaVersionField);
} }
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -36,13 +37,11 @@ import javax.persistence.Version; ...@@ -36,13 +37,11 @@ import javax.persistence.Version;
@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 ModelInterface { public class News implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "news_id", nullable = false)
private Integer id;
@Column(name = "title", nullable = false) @Column(name = "title", nullable = false)
private String title; private String title;
...@@ -77,11 +76,11 @@ public class News implements ModelInterface { ...@@ -77,11 +76,11 @@ public class News implements ModelInterface {
public News() { public News() {
} }
public News(Integer newsId) { public News(EventPk newsId) {
this.id = newsId; this.id = newsId;
} }
public News(Integer newsId, String title, int priority) { public News(EventPk newsId, String title, int priority) {
this.id = newsId; this.id = newsId;
this.title = title; this.title = title;
this.priority = priority; this.priority = priority;
...@@ -174,7 +173,7 @@ public class News implements ModelInterface { ...@@ -174,7 +173,7 @@ public class News implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -183,7 +182,7 @@ public class News implements ModelInterface { ...@@ -183,7 +182,7 @@ public class News implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -33,14 +34,12 @@ import javax.persistence.Version; ...@@ -33,14 +34,12 @@ import javax.persistence.Version;
@NamedQuery(name = "NewsGroup.findByName", query = "SELECT n FROM NewsGroup n WHERE n.name = :name"), @NamedQuery(name = "NewsGroup.findByName", query = "SELECT n FROM NewsGroup n WHERE n.name = :name"),
@NamedQuery(name = "NewsGroup.findByDescription", query = "SELECT n FROM NewsGroup n WHERE n.description = :description"), @NamedQuery(name = "NewsGroup.findByDescription", query = "SELECT n FROM NewsGroup n WHERE n.description = :description"),
@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 ModelInterface { public class NewsGroup implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "news_groups_id", nullable = false)
private Integer id;
@Column(name = "group_name", nullable = false) @Column(name = "group_name", nullable = false)
private String name; private String name;
...@@ -66,11 +65,11 @@ public class NewsGroup implements ModelInterface { ...@@ -66,11 +65,11 @@ public class NewsGroup implements ModelInterface {
public NewsGroup() { public NewsGroup() {
} }
public NewsGroup(Integer newsGroupsId) { public NewsGroup(EventPk newsGroupsId) {
this.id = newsGroupsId; this.id = newsGroupsId;
} }
public NewsGroup(Integer newsGroupsId, String groupName, int priority) { public NewsGroup(EventPk newsGroupsId, String groupName, int priority) {
this.id = newsGroupsId; this.id = newsGroupsId;
this.name = groupName; this.name = groupName;
this.priority = priority; this.priority = priority;
...@@ -140,7 +139,7 @@ public class NewsGroup implements ModelInterface { ...@@ -140,7 +139,7 @@ public class NewsGroup implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -149,7 +148,7 @@ public class NewsGroup implements ModelInterface { ...@@ -149,7 +148,7 @@ public class NewsGroup implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -32,13 +33,11 @@ import javax.persistence.Version; ...@@ -32,13 +33,11 @@ import javax.persistence.Version;
@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.findByDetails", query = "SELECT p FROM Place p WHERE p.details = :details"), @NamedQuery(name = "Place.findByDetails", query = "SELECT p FROM Place p WHERE p.details = :details"),
@NamedQuery(name = "Place.findByCode", query = "SELECT p FROM Place p WHERE p.code = :code") }) @NamedQuery(name = "Place.findByCode", query = "SELECT p FROM Place p WHERE p.code = :code") })
public class Place implements ModelInterface { public class Place implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "places_id", nullable = false)
private Integer id;
@Lob @Lob
@Column(name = "place_description") @Column(name = "place_description")
private String description; private String description;
...@@ -90,7 +89,7 @@ public class Place implements ModelInterface { ...@@ -90,7 +89,7 @@ public class Place implements ModelInterface {
public Place() { public Place() {
} }
public Place(Integer placesId) { public Place(EventPk placesId) {
this.id = placesId; this.id = placesId;
} }
...@@ -205,7 +204,7 @@ public class Place implements ModelInterface { ...@@ -205,7 +204,7 @@ public class Place implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -214,7 +213,7 @@ public class Place implements ModelInterface { ...@@ -214,7 +213,7 @@ public class Place implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -38,13 +39,11 @@ import javax.persistence.Version; ...@@ -38,13 +39,11 @@ import javax.persistence.Version;
@NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"), @NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"),
@NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"), @NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"),
@NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") }) @NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") })
public class PlaceGroup implements ModelInterface { public class PlaceGroup implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "groups_id", nullable = false)
private Integer id;
@Column(name = "group_created", nullable = false) @Column(name = "group_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -84,11 +83,11 @@ public class PlaceGroup implements ModelInterface { ...@@ -84,11 +83,11 @@ public class PlaceGroup implements ModelInterface {
public PlaceGroup() { public PlaceGroup() {
} }
public PlaceGroup(Integer groupsId) { public PlaceGroup(EventPk groupsId) {
this.id = groupsId; this.id = groupsId;
} }
public PlaceGroup(Integer groupsId, Calendar groupCreated, Calendar groupEdited, public PlaceGroup(EventPk groupsId, Calendar groupCreated, Calendar groupEdited,
boolean groupActive) { boolean groupActive) {
this.id = groupsId; this.id = groupsId;
this.created = groupCreated; this.created = groupCreated;
...@@ -199,7 +198,7 @@ public class PlaceGroup implements ModelInterface { ...@@ -199,7 +198,7 @@ public class PlaceGroup implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -208,7 +207,7 @@ public class PlaceGroup implements ModelInterface { ...@@ -208,7 +207,7 @@ public class PlaceGroup implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -10,6 +10,7 @@ import java.util.List; ...@@ -10,6 +10,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -36,12 +37,10 @@ import javax.persistence.Version; ...@@ -36,12 +37,10 @@ import javax.persistence.Version;
@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.findByEnabled", query = "SELECT p FROM PrintedCard p WHERE p.enabled = :enabled"), @NamedQuery(name = "PrintedCard.findByEnabled", query = "SELECT p FROM PrintedCard p WHERE p.enabled = :enabled"),
@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 ModelInterface { public class PrintedCard implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "printed_cards_id", nullable = false)
private Integer id;
@Column(name = "print_time", nullable = false) @Column(name = "print_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -79,20 +78,20 @@ public class PrintedCard implements ModelInterface { ...@@ -79,20 +78,20 @@ public class PrintedCard implements ModelInterface {
} }
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
public PrintedCard(Integer printedCardsId) { public PrintedCard(EventPk printedCardsId) {
this.id = printedCardsId; this.id = printedCardsId;
} }
public PrintedCard(Integer printedCardsId, Calendar printTime, public PrintedCard(EventPk printedCardsId, Calendar printTime,
boolean cardEnabled) { boolean cardEnabled) {
this.id = printedCardsId; this.id = printedCardsId;
this.printTime = printTime; this.printTime = printTime;
......
...@@ -9,6 +9,7 @@ import java.util.List; ...@@ -9,6 +9,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -34,14 +35,12 @@ import javax.persistence.Version; ...@@ -34,14 +35,12 @@ import javax.persistence.Version;
@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 ModelInterface { public class Product implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "products_id", nullable = false)
private Integer id;
@Column(name = "product_name") @Column(name = "product_name")
private String name; private String name;
...@@ -75,11 +74,11 @@ public class Product implements ModelInterface { ...@@ -75,11 +74,11 @@ public class Product implements ModelInterface {
public Product() { public Product() {
} }
public Product(Integer productsId) { public Product(EventPk productsId) {
this.id = productsId; this.id = productsId;
} }
public Product(Integer productsId, BigInteger price, int sort) { public Product(EventPk productsId, BigInteger price, int sort) {
this.id = productsId; this.id = productsId;
this.price = price; this.price = price;
this.sort = sort; this.sort = sort;
...@@ -179,7 +178,7 @@ public class Product implements ModelInterface { ...@@ -179,7 +178,7 @@ public class Product implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -188,7 +187,7 @@ public class Product implements ModelInterface { ...@@ -188,7 +187,7 @@ public class Product implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -31,14 +32,12 @@ import javax.persistence.Version; ...@@ -31,14 +32,12 @@ import javax.persistence.Version;
@NamedQuery(name = "Reader.findByIdentification", query = "SELECT r FROM Reader r WHERE r.identification = :identification"), @NamedQuery(name = "Reader.findByIdentification", query = "SELECT r FROM Reader r WHERE r.identification = :identification"),
@NamedQuery(name = "Reader.findByDescription", query = "SELECT r FROM Reader r WHERE r.description = :description") }) @NamedQuery(name = "Reader.findByDescription", query = "SELECT r FROM Reader r WHERE r.description = :description") })
public class Reader implements ModelInterface { public class Reader implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "readers_id", nullable = false)
private Integer id;
@Column(name = "reader_ident") @Column(name = "reader_ident")
private String identification; private String identification;
...@@ -76,7 +75,7 @@ public class Reader implements ModelInterface { ...@@ -76,7 +75,7 @@ public class Reader implements ModelInterface {
public Reader() { public Reader() {
} }
public Reader(Integer readersId) { public Reader(EventPk readersId) {
this.id = readersId; this.id = readersId;
} }
...@@ -143,7 +142,7 @@ public class Reader implements ModelInterface { ...@@ -143,7 +142,7 @@ public class Reader implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -152,7 +151,7 @@ public class Reader implements ModelInterface { ...@@ -152,7 +151,7 @@ public class Reader implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -30,14 +31,12 @@ import javax.persistence.Version; ...@@ -30,14 +31,12 @@ import javax.persistence.Version;
@NamedQuery(name = "ReaderEvent.findByTime", query = "SELECT r FROM ReaderEvent r WHERE r.time = :time"), @NamedQuery(name = "ReaderEvent.findByTime", query = "SELECT r FROM ReaderEvent r WHERE r.time = :time"),
@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 ModelInterface { public class ReaderEvent implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "reader_events_id", nullable = false)
private Integer id;
@Column(name = "event_time", nullable = false) @Column(name = "event_time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
...@@ -61,11 +60,11 @@ public class ReaderEvent implements ModelInterface { ...@@ -61,11 +60,11 @@ public class ReaderEvent implements ModelInterface {
public ReaderEvent() { public ReaderEvent() {
} }
public ReaderEvent(Integer readerEventsId) { public ReaderEvent(EventPk readerEventsId) {
this.id = readerEventsId; this.id = readerEventsId;
} }
public ReaderEvent(Integer readerEventsId, Calendar eventTime) { public ReaderEvent(EventPk readerEventsId, Calendar eventTime) {
this.id = readerEventsId; this.id = readerEventsId;
this.time = eventTime; this.time = eventTime;
} }
...@@ -133,7 +132,7 @@ public class ReaderEvent implements ModelInterface { ...@@ -133,7 +132,7 @@ public class ReaderEvent implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -142,7 +141,7 @@ public class ReaderEvent implements ModelInterface { ...@@ -142,7 +141,7 @@ public class ReaderEvent implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -30,14 +31,13 @@ import javax.persistence.Version; ...@@ -30,14 +31,13 @@ import javax.persistence.Version;
@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.findByRoleName", query = "SELECT r FROM Role r WHERE r.name = :name") }) @NamedQuery(name = "Role.findByRoleName", query = "SELECT r FROM Role r WHERE r.name = :name") })
public class Role implements ModelInterface { public class Role implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @EmbeddedId
@Column(name = "roles_id", nullable = false) private EventPk id;
private Integer id;
@Column(name = "role_name", nullable = false) @Column(name = "role_name", nullable = false)
private String name; private String name;
...@@ -78,11 +78,11 @@ public class Role implements ModelInterface { ...@@ -78,11 +78,11 @@ public class Role implements ModelInterface {
public Role() { public Role() {
} }
public Role(Integer rolesId) { public Role(EventPk rolesId) {
this.id = rolesId; this.id = rolesId;
} }
public Role(Integer rolesId, String roleName) { public Role(EventPk rolesId, String roleName) {
this.id = rolesId; this.id = rolesId;
this.name = roleName; this.name = roleName;
} }
...@@ -150,7 +150,7 @@ public class Role implements ModelInterface { ...@@ -150,7 +150,7 @@ public class Role implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -159,7 +159,7 @@ public class Role implements ModelInterface { ...@@ -159,7 +159,7 @@ public class Role implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -35,13 +36,11 @@ import javax.persistence.Version; ...@@ -35,13 +36,11 @@ import javax.persistence.Version;
* @ NamedQuery ( name = "RoleRight.findByExecute" , query = * @ NamedQuery ( name = "RoleRight.findByExecute" , query =
* "SELECT r FROM RoleRight r WHERE r.execute = :execute" ) * "SELECT r FROM RoleRight r WHERE r.execute = :execute" )
*/}) */})
public class RoleRight implements ModelInterface { public class RoleRight implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "role_rights_id", nullable = false)
private Integer id;
@Column(name = "read_permission", nullable = false) @Column(name = "read_permission", nullable = false)
private boolean read; private boolean read;
...@@ -67,11 +66,11 @@ public class RoleRight implements ModelInterface { ...@@ -67,11 +66,11 @@ public class RoleRight implements ModelInterface {
public RoleRight() { public RoleRight() {
} }
public RoleRight(Integer roleRights) { public RoleRight(EventPk roleRights) {
this.id = roleRights; this.id = roleRights;
} }
public RoleRight(Integer roleRights, boolean read, boolean write) { public RoleRight(EventPk roleRights, boolean read, boolean write) {
this.id = roleRights; this.id = roleRights;
this.read = read; this.read = read;
this.write = write; this.write = write;
...@@ -140,7 +139,7 @@ public class RoleRight implements ModelInterface { ...@@ -140,7 +139,7 @@ public class RoleRight implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -149,7 +148,7 @@ public class RoleRight implements ModelInterface { ...@@ -149,7 +148,7 @@ public class RoleRight implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -46,7 +46,7 @@ import javax.persistence.Version; ...@@ -46,7 +46,7 @@ import javax.persistence.Version;
@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 ModelInterface { public class User implements ModelInterface<Integer>{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -28,14 +29,12 @@ import javax.persistence.Version; ...@@ -28,14 +29,12 @@ import javax.persistence.Version;
@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 ModelInterface { public class UserImage implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "user_images_id", nullable = false)
private Integer id;
@Column(name = "name") @Column(name = "name")
private String name; private String name;
...@@ -62,7 +61,7 @@ public class UserImage implements ModelInterface { ...@@ -62,7 +61,7 @@ public class UserImage implements ModelInterface {
public UserImage() { public UserImage() {
} }
public UserImage(Integer userImagesId) { public UserImage(EventPk userImagesId) {
this.id = userImagesId; this.id = userImagesId;
} }
...@@ -129,7 +128,7 @@ public class UserImage implements ModelInterface { ...@@ -129,7 +128,7 @@ public class UserImage implements ModelInterface {
* @return the id * @return the id
*/ */
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
...@@ -138,7 +137,7 @@ public class UserImage implements ModelInterface { ...@@ -138,7 +137,7 @@ public class UserImage implements ModelInterface {
* the id to set * the id to set
*/ */
@Override @Override
public void setId(Integer id) { public void setId(EventPk id) {
this.id = id; this.id = id;
} }
......
...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model; ...@@ -7,6 +7,7 @@ package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
...@@ -32,13 +33,11 @@ import javax.persistence.Version; ...@@ -32,13 +33,11 @@ import javax.persistence.Version;
@NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"), @NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"),
@NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") }) @NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") })
public class Vote implements ModelInterface { public class Vote implements EventChildInterface{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @EmbeddedId
@GeneratedValue(strategy = GenerationType.IDENTITY) private EventPk id;
@Column(name = "votes_id", nullable = false)
private Integer id;
@Column(name = "score") @Column(name = "score")
private Integer score; private Integer score;
@Column(name = "vote_time", nullable = false) @Column(name = "vote_time", nullable = false)
...@@ -57,22 +56,22 @@ public class Vote implements ModelInterface { ...@@ -57,22 +56,22 @@ public class Vote implements ModelInterface {
public Vote() { public Vote() {
} }
public Vote(Integer votesId) { public Vote(EventPk votesId) {
this.id = votesId; this.id = votesId;
} }
public Vote(Integer votesId, Calendar voteTime) { public Vote(EventPk votesId, Calendar voteTime) {
this.id = votesId; this.id = votesId;
this.time = voteTime; this.time = voteTime;
} }
@Override @Override
public Integer getId() { public EventPk getId() {
return id; return id;
} }
@Override @Override
public void setId(Integer votesId) { public void setId(EventPk votesId) {
this.id = votesId; this.id = votesId;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!