1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.doctype; |
18 | |
|
19 | |
import java.io.Serializable; |
20 | |
|
21 | |
import javax.persistence.Column; |
22 | |
import javax.persistence.Entity; |
23 | |
import javax.persistence.FetchType; |
24 | |
import javax.persistence.GeneratedValue; |
25 | |
import javax.persistence.Id; |
26 | |
import javax.persistence.JoinColumn; |
27 | |
import javax.persistence.ManyToOne; |
28 | |
import javax.persistence.Table; |
29 | |
import javax.persistence.Transient; |
30 | |
|
31 | |
import org.hibernate.annotations.GenericGenerator; |
32 | |
import org.hibernate.annotations.Parameter; |
33 | |
import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; |
34 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
35 | |
import org.kuali.rice.kew.rule.bo.RuleAttribute; |
36 | |
import org.kuali.rice.kew.rule.service.RuleAttributeService; |
37 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@Entity |
48 | |
|
49 | |
@Table(name="KREW_DOC_TYP_ATTR_T") |
50 | 0 | public class DocumentTypeAttribute implements Comparable, Serializable { |
51 | |
|
52 | |
private static final long serialVersionUID = -4429421648373903566L; |
53 | |
|
54 | |
@Id |
55 | |
@GeneratedValue(generator="KREW_DOC_TYP_ATTR_S") |
56 | |
@GenericGenerator(name="KREW_DOC_TYP_ATTR_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
57 | |
@Parameter(name="sequence_name",value="KREW_DOC_TYP_ATTR_S"), |
58 | |
@Parameter(name="value_column",value="id") |
59 | |
}) |
60 | |
@Column(name="DOC_TYP_ATTRIB_ID") |
61 | |
private String documentTypeAttributeId; |
62 | |
@Column(name="RULE_ATTR_ID",insertable=false, updatable=false) |
63 | |
private String ruleAttributeId; |
64 | |
@ManyToOne(fetch=FetchType.EAGER) |
65 | |
@JoinColumn(name="RULE_ATTR_ID") |
66 | |
private RuleAttribute ruleAttribute; |
67 | |
@Column(name="DOC_TYP_ID",insertable=false, updatable=false) |
68 | |
private String documentTypeId; |
69 | |
@ManyToOne(fetch=FetchType.EAGER) |
70 | |
@JoinColumn(name="DOC_TYP_ID") |
71 | |
private DocumentType documentType; |
72 | |
@Column(name="ORD_INDX") |
73 | |
private int orderIndex; |
74 | |
@Transient |
75 | |
private Integer lockVerNbr; |
76 | |
|
77 | |
|
78 | |
public void beforeInsert(){ |
79 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
80 | 0 | } |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
public void setDocumentTypeAttributeId(String documentTypeAttributeId) { |
86 | 0 | this.documentTypeAttributeId = documentTypeAttributeId; |
87 | 0 | } |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
public String getDocumentTypeAttributeId() { |
93 | 0 | return documentTypeAttributeId; |
94 | |
} |
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
public void setDocumentTypeId(String documentTypeId) { |
100 | 0 | this.documentTypeId = documentTypeId; |
101 | 0 | } |
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
public String getDocumentTypeId() { |
107 | 0 | return documentTypeId; |
108 | |
} |
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
public void setRuleAttributeId(String ruleAttributeId) { |
114 | 0 | this.ruleAttributeId = ruleAttributeId; |
115 | 0 | if (ruleAttributeId == null) { |
116 | 0 | ruleAttribute = null; |
117 | |
} else { |
118 | 0 | ruleAttribute = getRuleAttributeService().findByRuleAttributeId(ruleAttributeId); |
119 | |
} |
120 | 0 | } |
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
public String getRuleAttributeId() { |
126 | 0 | return ruleAttributeId; |
127 | |
} |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
public void setRuleAttribute(RuleAttribute ruleAttribute) { |
133 | 0 | this.ruleAttribute = ruleAttribute; |
134 | 0 | } |
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
public RuleAttribute getRuleAttribute() { |
140 | 0 | return ruleAttribute; |
141 | |
} |
142 | |
|
143 | |
private RuleAttributeService getRuleAttributeService() { |
144 | 0 | return (RuleAttributeService) KEWServiceLocator.getService(KEWServiceLocator.RULE_ATTRIBUTE_SERVICE); |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
public int compareTo(Object o) { |
151 | 0 | if (o instanceof DocumentTypeAttribute) { |
152 | 0 | return this.getRuleAttribute().getName().compareTo(((DocumentTypeAttribute) o).getRuleAttribute().getName()); |
153 | |
} |
154 | 0 | return 0; |
155 | |
} |
156 | |
|
157 | |
public DocumentType getDocumentType() { |
158 | 0 | return documentType; |
159 | |
} |
160 | |
|
161 | |
public void setDocumentType(DocumentType documentType) { |
162 | 0 | this.documentType = documentType; |
163 | 0 | } |
164 | |
|
165 | |
public int getOrderIndex() { |
166 | 0 | return orderIndex; |
167 | |
} |
168 | |
|
169 | |
public void setOrderIndex(int orderIndex) { |
170 | 0 | this.orderIndex = orderIndex; |
171 | 0 | } |
172 | |
|
173 | |
public Integer getLockVerNbr() { |
174 | 0 | return lockVerNbr; |
175 | |
} |
176 | |
|
177 | |
public void setLockVerNbr(Integer lockVerNbr) { |
178 | 0 | this.lockVerNbr = lockVerNbr; |
179 | 0 | } |
180 | |
|
181 | |
} |
182 | |
|