Přidána bázová třída pro požadavky. Třída LimitVM přesunuta do package

info.bukova.isspst.ui.requirement. Změněno načítání ownedBy a modifiedBy
ve Workgroup na lazy.
refs #100
multitenant
Josef Rokos 11 years ago
parent 51a0de2d53
commit 6716842df2

@ -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;
}
}

@ -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<AuthItem> authorization;
@Column(name = "STATE")
@Enumerated(EnumType.ORDINAL)
private RequirementState state;
public RequirementBase() {
authorization = new ArrayList<AuthItem>();
}
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<AuthItem> getAuthorization() {
return authorization;
}
public void setAuthorization(List<AuthItem> authorization) {
this.authorization = authorization;
}
public RequirementState getState() {
return state;
}
public void setState(RequirementState state) {
this.state = state;
}
}

@ -0,0 +1,9 @@
package info.bukova.isspst.data;
public enum RequirementState {
NEW,
PARTIALLY,
APPROVED
}

@ -32,10 +32,10 @@ public class Workgroup extends Member implements OwnedDataModel {
@Column(name = "CENTRE") @Column(name = "CENTRE")
private boolean centre; private boolean centre;
//BaseData //BaseData
@ManyToOne(fetch=FetchType.EAGER) @ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="OWNED_BY_ID") @JoinColumn(name="OWNED_BY_ID")
private User ownedBy; private User ownedBy;
@ManyToOne(fetch=FetchType.EAGER) @ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="MODIFIED_BY_ID") @JoinColumn(name="MODIFIED_BY_ID")
private User modifiedBy; private User modifiedBy;
@Transient @Transient

@ -1,4 +1,4 @@
package info.bukova.isspst.ui.requirements; package info.bukova.isspst.ui.requirement;
import info.bukova.isspst.data.Workflow; import info.bukova.isspst.data.Workflow;

@ -20,6 +20,7 @@
<mapping class="info.bukova.isspst.data.NumberSeries"></mapping> <mapping class="info.bukova.isspst.data.NumberSeries"></mapping>
<mapping class="info.bukova.isspst.data.Requirement"></mapping> <mapping class="info.bukova.isspst.data.Requirement"></mapping>
<mapping class="info.bukova.isspst.data.RequirementItem"></mapping> <mapping class="info.bukova.isspst.data.RequirementItem"></mapping>
<mapping class="info.bukova.isspst.data.AuthItem"></mapping>
<mapping class="info.bukova.isspst.data.Workflow"></mapping> <mapping class="info.bukova.isspst.data.Workflow"></mapping>
<mapping class="info.bukova.isspst.data.RequirementType"></mapping> <mapping class="info.bukova.isspst.data.RequirementType"></mapping>
<mapping class="info.bukova.isspst.data.ServiceItem"></mapping> <mapping class="info.bukova.isspst.data.ServiceItem"></mapping>

@ -1,7 +1,7 @@
<?page title="Limit" contentType="text/html;charset=UTF-8"?> <?page title="Limit" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer" <window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirements.LimitVM')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.LimitVM')">
<caption zclass="form-caption" label="${labels.LimitFormTitle}" /> <caption zclass="form-caption" label="${labels.LimitFormTitle}" />
<vbox> <vbox>
<hbox> <hbox>

Loading…
Cancel
Save