diff --git a/src/main/java/info/bukova/isspst/data/AuthItem.java b/src/main/java/info/bukova/isspst/data/AuthItem.java new file mode 100644 index 00000000..0ef6753a --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/AuthItem.java @@ -0,0 +1,63 @@ +package info.bukova.isspst.data; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "AUTHITEM") +public class AuthItem { + + @Id + @Column(name = "ID") + @GeneratedValue + private int id; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "ROLE_ID") + private Role role; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "APPROVER_USER_ID") + private User approver; + @Column(name = "AUTH_DATE") + private Date authDate; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } + + public User getApprover() { + return approver; + } + + public void setApprover(User approver) { + this.approver = approver; + } + + public Date getAuthDate() { + return authDate; + } + + public void setAuthDate(Date authDate) { + this.authDate = authDate; + } + +} diff --git a/src/main/java/info/bukova/isspst/data/RequirementBase.java b/src/main/java/info/bukova/isspst/data/RequirementBase.java new file mode 100644 index 00000000..31677374 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/RequirementBase.java @@ -0,0 +1,92 @@ +package info.bukova.isspst.data; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.MappedSuperclass; +import javax.persistence.OneToMany; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +@MappedSuperclass +public class RequirementBase extends BaseData { + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "TYPE_ID") + private RequirementType type; + @Column(name = "NUMSER", unique = true) + private String numser; + @Column(name = "REQ_DATE") + private Date reqDate; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "WORKGROUP_ID") + private Workgroup workgroup; + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) + @LazyCollection(LazyCollectionOption.FALSE) + private List authorization; + @Column(name = "STATE") + @Enumerated(EnumType.ORDINAL) + private RequirementState state; + + public RequirementBase() { + authorization = new ArrayList(); + } + + public RequirementType getType() { + return type; + } + + public void setType(RequirementType type) { + this.type = type; + } + + public String getNumser() { + return numser; + } + + public void setNumser(String number) { + this.numser = number; + } + + public Date getReqDate() { + return reqDate; + } + + public void setReqDate(Date reqDate) { + this.reqDate = reqDate; + } + + public Workgroup getWorkgroup() { + return workgroup; + } + + public void setWorkgroup(Workgroup workgroup) { + this.workgroup = workgroup; + } + + public List getAuthorization() { + return authorization; + } + + public void setAuthorization(List authorization) { + this.authorization = authorization; + } + + public RequirementState getState() { + return state; + } + + public void setState(RequirementState state) { + this.state = state; + } + +} diff --git a/src/main/java/info/bukova/isspst/data/RequirementState.java b/src/main/java/info/bukova/isspst/data/RequirementState.java new file mode 100644 index 00000000..c6fb3f0f --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/RequirementState.java @@ -0,0 +1,9 @@ +package info.bukova.isspst.data; + +public enum RequirementState { + + NEW, + PARTIALLY, + APPROVED + +} diff --git a/src/main/java/info/bukova/isspst/data/Workgroup.java b/src/main/java/info/bukova/isspst/data/Workgroup.java index 92f73686..210e6837 100644 --- a/src/main/java/info/bukova/isspst/data/Workgroup.java +++ b/src/main/java/info/bukova/isspst/data/Workgroup.java @@ -32,10 +32,10 @@ public class Workgroup extends Member implements OwnedDataModel { @Column(name = "CENTRE") private boolean centre; //BaseData - @ManyToOne(fetch=FetchType.EAGER) + @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="OWNED_BY_ID") private User ownedBy; - @ManyToOne(fetch=FetchType.EAGER) + @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="MODIFIED_BY_ID") private User modifiedBy; @Transient diff --git a/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java b/src/main/java/info/bukova/isspst/ui/requirement/LimitVM.java similarity index 93% rename from src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java rename to src/main/java/info/bukova/isspst/ui/requirement/LimitVM.java index 45597f4c..84994981 100644 --- a/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/LimitVM.java @@ -1,4 +1,4 @@ -package info.bukova.isspst.ui.requirements; +package info.bukova.isspst.ui.requirement; import info.bukova.isspst.data.Workflow; diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index 513fe31e..aa541823 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -20,6 +20,7 @@ + diff --git a/src/main/webapp/settings/workflow/limit.zul b/src/main/webapp/settings/workflow/limit.zul index 1a2b8990..8cc02bd0 100644 --- a/src/main/webapp/settings/workflow/limit.zul +++ b/src/main/webapp/settings/workflow/limit.zul @@ -1,7 +1,7 @@ +viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.LimitVM')">