1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.data.jpa.testbo;
17
18 import java.io.Serializable;
19 import java.util.Date;
20 import java.util.List;
21
22 import javax.persistence.CascadeType;
23 import javax.persistence.Column;
24 import javax.persistence.Convert;
25 import javax.persistence.Entity;
26 import javax.persistence.FetchType;
27 import javax.persistence.Id;
28 import javax.persistence.JoinColumn;
29 import javax.persistence.JoinColumns;
30 import javax.persistence.JoinTable;
31 import javax.persistence.ManyToMany;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.OneToMany;
34 import javax.persistence.OneToOne;
35 import javax.persistence.OrderBy;
36 import javax.persistence.PrimaryKeyJoinColumn;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40 import javax.persistence.Transient;
41 import javax.validation.constraints.DecimalMin;
42 import javax.validation.constraints.Digits;
43 import javax.validation.constraints.NotNull;
44
45 import org.eclipse.persistence.annotations.JoinFetch;
46 import org.eclipse.persistence.annotations.JoinFetchType;
47 import org.kuali.rice.core.api.util.type.KualiDecimal;
48 import org.kuali.rice.krad.data.jpa.converters.EncryptionConverter;
49 import org.kuali.rice.krad.data.provider.annotation.AttributeRelationship;
50 import org.kuali.rice.krad.data.provider.annotation.CollectionRelationship;
51 import org.kuali.rice.krad.data.provider.annotation.ForceUppercase;
52 import org.kuali.rice.krad.data.provider.annotation.InheritProperties;
53 import org.kuali.rice.krad.data.provider.annotation.InheritProperty;
54 import org.kuali.rice.krad.data.provider.annotation.Label;
55 import org.kuali.rice.krad.data.provider.annotation.NonPersistentProperty;
56 import org.kuali.rice.krad.data.provider.annotation.ReadOnly;
57
58 @Entity
59 @Table(name = "KRTST_TEST_TABLE_T")
60 @Label("Label From Annotation")
61 public class TestDataObject implements Serializable {
62 private static final long serialVersionUID = 1L;
63
64 @Id
65 @Column(name = "PK_PROP")
66 @ForceUppercase
67 String primaryKeyProperty;
68
69 @Column(name = "STR_PROP", length = 40)
70 @Label("Attribute Label From Annotation")
71 @NotNull
72 String stringProperty;
73
74 @Column(name = "LONG_STR_PROP", length = 200)
75 String longStringProperty;
76
77 @Temporal(TemporalType.DATE)
78 @Column(name = "DATE_PROP")
79 Date dateProperty;
80 @Column(name = "CURR_PROP")
81 @Digits(
82 integer = 10,
83 fraction = 2)
84 @DecimalMin(
85 value = "0.00",
86 message = "The currency amount may not be less than zero.")
87 KualiDecimal currencyProperty;
88 @Column(name = "NON_STANDARD")
89
90
91 NonStandardDataType nonStandardDataType;
92
93
94 @ManyToOne(
95 fetch = FetchType.LAZY,
96 cascade = CascadeType.REFRESH)
97 @JoinColumn(
98 name = "STR_PROP",
99 insertable = false,
100 updatable = false)
101 @InheritProperty(
102 name = "someOtherStringProperty")
103 ReferencedDataObject referencedObject;
104
105 @Column(name="BOOL_PROP")
106
107 Boolean booleanProperty;
108
109 @Transient
110 String nonPersistedProperty;
111
112 @Convert(
113 converter = EncryptionConverter.class)
114 @Column(
115 name = "ENCR_PROP")
116 String encryptedProperty;
117
118 @Column(
119 name = "RO_PROP")
120 @ReadOnly
121 String readOnlyProperty;
122
123 @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
124 @OrderBy("collectionKeyProperty ASC")
125 @JoinColumn(
126 name = "PK_PROP",
127 referencedColumnName = "STR_PROP")
128 List<CollectionDataObject> collectionProperty;
129
130 @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
131 @OrderBy("collectionKeyProperty ASC")
132 @JoinColumn(
133 name = "PK_PROP",
134 referencedColumnName = "STR_PROP")
135 List<CollectionDataObjectTwo> collectionPropertyTwo;
136
137 @OneToMany(cascade = CascadeType.ALL, mappedBy = "testDataObject")
138 List<CollectionDataObjectThree> collectionPropertyThree;
139
140 @CollectionRelationship(
141 attributeRelationships = @AttributeRelationship(
142 parentAttributeName = "dateProperty",
143 childAttributeName = "collectionDateProperty"))
144 List<SomeOtherCollection> someOtherCollection;
145
146 @ManyToMany
147 @JoinTable(
148 name = "KRDATA_TEST_INDIR_LINK_T",
149 joinColumns = @JoinColumn(
150 name = "PK_PROP",
151 referencedColumnName = "COLL_PK_PROP"),
152 inverseJoinColumns = @JoinColumn(
153 name = "COLL_PK_PROP",
154 referencedColumnName = "PK_PROP"))
155 List<IndirectlyLinkedCollectionDataObject> indirectCollection;
156
157 @ManyToOne(
158 fetch = FetchType.EAGER,
159 cascade = CascadeType.REFRESH)
160 @JoinColumns({ @JoinColumn(
161 name = "STR_PROP",
162 referencedColumnName = "STR_PROP",
163 insertable = false,
164 updatable = false), @JoinColumn(
165 name = "DATE_PROP",
166 referencedColumnName = "DATE_PROP",
167 insertable = false,
168 updatable = false) })
169 @InheritProperties({ @InheritProperty(
170 name = "someOtherStringProperty",
171 label = @Label("Overridden Inherited Property Label")) })
172 AnotherReferencedDataObject anotherReferencedObject;
173
174 @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
175 @JoinFetch(JoinFetchType.OUTER)
176 @PrimaryKeyJoinColumn
177 YetAnotherReferencedDataObject yetAnotherReferencedObject;
178
179 @Transient
180 Object extension;
181
182 @NonPersistentProperty
183 @Label("Test Data Object")
184 public String getKeyAndString() {
185 return primaryKeyProperty + "-" + stringProperty;
186 }
187
188 public List<CollectionDataObject> getCollectionProperty() {
189 return collectionProperty;
190 }
191
192 public void setCollectionProperty(List<CollectionDataObject> collectionProperty) {
193 this.collectionProperty = collectionProperty;
194 }
195
196 public String getStringProperty() {
197 return stringProperty;
198 }
199
200 public void setStringProperty(String stringProperty) {
201 this.stringProperty = stringProperty;
202 }
203
204 public String getPrimaryKeyProperty() {
205 return primaryKeyProperty;
206 }
207
208 public void setPrimaryKeyProperty(String primaryKeyProperty) {
209 this.primaryKeyProperty = primaryKeyProperty;
210 }
211
212 public Date getDateProperty() {
213 return dateProperty;
214 }
215
216 public void setDateProperty(Date dateProperty) {
217 this.dateProperty = dateProperty;
218 }
219
220 public KualiDecimal getCurrencyProperty() {
221 return currencyProperty;
222 }
223
224 public void setCurrencyProperty(KualiDecimal currencyProperty) {
225 this.currencyProperty = currencyProperty;
226 }
227
228 public List<CollectionDataObjectTwo> getCollectionPropertyTwo() {
229 return collectionPropertyTwo;
230 }
231
232 public void setCollectionPropertyTwo(List<CollectionDataObjectTwo> collectionPropertyTwo) {
233 this.collectionPropertyTwo = collectionPropertyTwo;
234 }
235
236 public ReferencedDataObject getReferencedObject() {
237 return referencedObject;
238 }
239
240 public void setReferencedObject(ReferencedDataObject referencedObject) {
241 this.referencedObject = referencedObject;
242 }
243
244 public NonStandardDataType getNonStandardDataType() {
245 return nonStandardDataType;
246 }
247
248 public void setNonStandardDataType(NonStandardDataType nonStandardDataType) {
249 this.nonStandardDataType = nonStandardDataType;
250 }
251
252 public List<IndirectlyLinkedCollectionDataObject> getIndirectCollection() {
253 return indirectCollection;
254 }
255
256 public void setIndirectCollection(List<IndirectlyLinkedCollectionDataObject> indirectCollection) {
257 this.indirectCollection = indirectCollection;
258 }
259
260 public String getNonPersistedProperty() {
261 return nonPersistedProperty;
262 }
263
264 public void setNonPersistedProperty(String nonPersistedProperty) {
265 this.nonPersistedProperty = nonPersistedProperty;
266 }
267
268 public AnotherReferencedDataObject getAnotherReferencedObject() {
269 return anotherReferencedObject;
270 }
271
272 public void setAnotherReferencedObject(AnotherReferencedDataObject anotherReferencedObject) {
273 this.anotherReferencedObject = anotherReferencedObject;
274 }
275
276 public YetAnotherReferencedDataObject getYetAnotherReferencedObject() {
277 return yetAnotherReferencedObject;
278 }
279
280 public void setYetAnotherReferencedObject(YetAnotherReferencedDataObject yetAnotherReferencedObject) {
281 this.yetAnotherReferencedObject = yetAnotherReferencedObject;
282 }
283
284 public String getLongStringProperty() {
285 return longStringProperty;
286 }
287
288 public void setLongStringProperty(String longStringProperty) {
289 this.longStringProperty = longStringProperty;
290 }
291
292 public boolean isBooleanProperty() {
293 return booleanProperty;
294 }
295
296 public void setBooleanProperty(boolean booleanProperty) {
297 this.booleanProperty = booleanProperty;
298 }
299
300 public String getEncryptedProperty() {
301 return encryptedProperty;
302 }
303
304 public void setEncryptedProperty(String encryptedProperty) {
305 this.encryptedProperty = encryptedProperty;
306 }
307
308 public String getReadOnlyProperty() {
309 return readOnlyProperty;
310 }
311
312 public void setReadOnlyProperty(String readOnlyProperty) {
313 this.readOnlyProperty = readOnlyProperty;
314 }
315
316 public List<SomeOtherCollection> getSomeOtherCollection() {
317 return someOtherCollection;
318 }
319
320 public void setSomeOtherCollection(List<SomeOtherCollection> someOtherCollection) {
321 this.someOtherCollection = someOtherCollection;
322 }
323
324 public List<CollectionDataObjectThree> getCollectionPropertyThree() {
325 return collectionPropertyThree;
326 }
327
328 public void setCollectionPropertyThree(List<CollectionDataObjectThree> collectionPropertyThree) {
329 this.collectionPropertyThree = collectionPropertyThree;
330 }
331
332 public Object getExtension() {
333 return extension;
334 }
335
336 public void setExtension(Object extension) {
337 this.extension = extension;
338 }
339
340 }