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 javax.persistence.Column; |
20 | |
import javax.persistence.Entity; |
21 | |
import javax.persistence.FetchType; |
22 | |
import javax.persistence.GeneratedValue; |
23 | |
import javax.persistence.Id; |
24 | |
import javax.persistence.JoinColumn; |
25 | |
import javax.persistence.ManyToOne; |
26 | |
import javax.persistence.PrePersist; |
27 | |
import javax.persistence.SequenceGenerator; |
28 | |
import javax.persistence.Table; |
29 | |
import javax.persistence.Transient; |
30 | |
|
31 | |
import org.kuali.rice.core.jpa.annotations.Sequence; |
32 | |
import org.kuali.rice.core.util.OrmUtils; |
33 | |
import org.kuali.rice.kew.bo.WorkflowPersistable; |
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 | |
@Sequence(name="KREW_DOC_TYP_ATTR_S", property="documentTypeAttributeId") |
49 | |
@Table(name="KREW_DOC_TYP_ATTR_T") |
50 | 0 | public class DocumentTypeAttribute implements WorkflowPersistable, Comparable { |
51 | |
|
52 | |
private static final long serialVersionUID = -4429421648373903566L; |
53 | |
|
54 | |
@Id |
55 | |
@Column(name="DOC_TYP_ATTRIB_ID") |
56 | |
private Long documentTypeAttributeId; |
57 | |
@Column(name="RULE_ATTR_ID",insertable=false, updatable=false) |
58 | |
private Long ruleAttributeId; |
59 | |
@ManyToOne(fetch=FetchType.EAGER) |
60 | |
@JoinColumn(name="RULE_ATTR_ID") |
61 | |
private RuleAttribute ruleAttribute; |
62 | |
@Column(name="DOC_TYP_ID",insertable=false, updatable=false) |
63 | |
private Long documentTypeId; |
64 | |
@ManyToOne(fetch=FetchType.EAGER) |
65 | |
@JoinColumn(name="DOC_TYP_ID") |
66 | |
private DocumentType documentType; |
67 | |
@Column(name="ORD_INDX") |
68 | |
private int orderIndex; |
69 | |
@Transient |
70 | |
private Integer lockVerNbr; |
71 | |
|
72 | |
@PrePersist |
73 | |
public void beforeInsert(){ |
74 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
75 | 0 | } |
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
public void setDocumentTypeAttributeId(Long documentTypeAttributeId) { |
81 | 0 | this.documentTypeAttributeId = documentTypeAttributeId; |
82 | 0 | } |
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public Long getDocumentTypeAttributeId() { |
88 | 0 | return documentTypeAttributeId; |
89 | |
} |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
public void setDocumentTypeId(Long documentTypeId) { |
95 | 0 | this.documentTypeId = documentTypeId; |
96 | 0 | } |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public Long getDocumentTypeId() { |
102 | 0 | return documentTypeId; |
103 | |
} |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
public void setRuleAttributeId(Long ruleAttributeId) { |
109 | 0 | this.ruleAttributeId = ruleAttributeId; |
110 | 0 | if (ruleAttributeId == null) { |
111 | 0 | ruleAttribute = null; |
112 | |
} else { |
113 | 0 | ruleAttribute = getRuleAttributeService().findByRuleAttributeId(ruleAttributeId); |
114 | |
} |
115 | 0 | } |
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
public Long getRuleAttributeId() { |
121 | 0 | return ruleAttributeId; |
122 | |
} |
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
public void setRuleAttribute(RuleAttribute ruleAttribute) { |
128 | 0 | this.ruleAttribute = ruleAttribute; |
129 | 0 | } |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
public RuleAttribute getRuleAttribute() { |
135 | 0 | return ruleAttribute; |
136 | |
} |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
public Object copy(boolean preserveKeys) { |
142 | 0 | return null; |
143 | |
} |
144 | |
|
145 | |
private RuleAttributeService getRuleAttributeService() { |
146 | 0 | return (RuleAttributeService) KEWServiceLocator.getService(KEWServiceLocator.RULE_ATTRIBUTE_SERVICE); |
147 | |
} |
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
public int compareTo(Object o) { |
153 | 0 | if (o instanceof DocumentTypeAttribute) { |
154 | 0 | return this.getRuleAttribute().getName().compareTo(((DocumentTypeAttribute) o).getRuleAttribute().getName()); |
155 | |
} |
156 | 0 | return 0; |
157 | |
} |
158 | |
|
159 | |
public DocumentType getDocumentType() { |
160 | 0 | return documentType; |
161 | |
} |
162 | |
|
163 | |
public void setDocumentType(DocumentType documentType) { |
164 | 0 | this.documentType = documentType; |
165 | 0 | } |
166 | |
|
167 | |
public int getOrderIndex() { |
168 | 0 | return orderIndex; |
169 | |
} |
170 | |
|
171 | |
public void setOrderIndex(int orderIndex) { |
172 | 0 | this.orderIndex = orderIndex; |
173 | 0 | } |
174 | |
|
175 | |
public Integer getLockVerNbr() { |
176 | 0 | return lockVerNbr; |
177 | |
} |
178 | |
|
179 | |
public void setLockVerNbr(Integer lockVerNbr) { |
180 | 0 | this.lockVerNbr = lockVerNbr; |
181 | 0 | } |
182 | |
|
183 | |
} |
184 | |
|