From 6716842df2d88dc87be7ea18f1be152b30aae0ea Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Wed, 9 Jul 2014 13:24:13 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1na=20b=C3=A1zov=C3=A1=20t=C5=99?= =?UTF-8?q?=C3=ADda=20pro=20po=C5=BEadavky.=20T=C5=99=C3=ADda=20LimitVM=20?= =?UTF-8?q?p=C5=99esunuta=20do=20package=20info.bukova.isspst.ui.requireme?= =?UTF-8?q?nt.=20Zm=C4=9Bn=C4=9Bno=20na=C4=8D=C3=ADt=C3=A1n=C3=AD=20ownedB?= =?UTF-8?q?y=20a=20modifiedBy=20ve=20Workgroup=20na=20lazy.=20refs=20#100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../info/bukova/isspst/data/AuthItem.java | 63 +++++++++++++ .../bukova/isspst/data/RequirementBase.java | 92 +++++++++++++++++++ .../bukova/isspst/data/RequirementState.java | 9 ++ .../info/bukova/isspst/data/Workgroup.java | 4 +- .../LimitVM.java | 2 +- src/main/resources/hibernate.cfg.xml | 1 + src/main/webapp/settings/workflow/limit.zul | 2 +- 7 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 src/main/java/info/bukova/isspst/data/AuthItem.java create mode 100644 src/main/java/info/bukova/isspst/data/RequirementBase.java create mode 100644 src/main/java/info/bukova/isspst/data/RequirementState.java rename src/main/java/info/bukova/isspst/ui/{requirements => requirement}/LimitVM.java (93%) 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')">