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