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