1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.businessobject;
17
18 import java.io.Serializable;
19 import java.util.LinkedHashMap;
20 import javax.persistence.CascadeType;
21 import javax.persistence.Column;
22 import javax.persistence.Convert;
23 import javax.persistence.Entity;
24 import javax.persistence.FetchType;
25 import javax.persistence.Id;
26 import javax.persistence.IdClass;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.JoinColumns;
29 import javax.persistence.ManyToOne;
30 import javax.persistence.OneToOne;
31 import javax.persistence.PrimaryKeyJoinColumn;
32 import javax.persistence.PrimaryKeyJoinColumns;
33 import javax.persistence.Table;
34 import javax.persistence.Transient;
35 import org.apache.commons.lang.builder.CompareToBuilder;
36 import org.apache.commons.lang.builder.EqualsBuilder;
37 import org.apache.commons.lang.builder.HashCodeBuilder;
38 import org.apache.commons.lang.builder.ToStringBuilder;
39 import org.kuali.ole.coa.businessobject.A21SubAccount;
40 import org.kuali.ole.coa.businessobject.Account;
41 import org.kuali.ole.coa.businessobject.Chart;
42 import org.kuali.ole.coa.businessobject.Organization;
43 import org.kuali.ole.coa.businessobject.ReportingCode;
44 import org.kuali.ole.sys.OLEConstants;
45 import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
46 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
47 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
48
49
50
51
52 @Entity
53 @Table(name = "CA_SUB_ACCT_T")
54 @IdClass(SubAccount.SubAccountId.class)
55 public class SubAccount extends PersistableBusinessObjectBase implements MutableInactivatable {
56
57 private static final long serialVersionUID = 6853259976912014273L;
58
59 public static final String CACHE_NAME = OLEConstants.APPLICATION_NAMESPACE_CODE + "/" + "SubAccount";
60
61 @Id
62 @Column(name = "FIN_COA_CD")
63 private String chartOfAccountsCode;
64
65 @Id
66 @Column(name = "ACCOUNT_NBR")
67 private String accountNumber;
68
69 @Id
70 @Column(name = "SUB_ACCT_NBR")
71 private String subAccountNumber;
72
73 @Column(name = "SUB_ACCT_NM")
74 private String subAccountName;
75
76 @Column(name = "SUB_ACCT_ACTV_CD")
77 @Convert(converter = BooleanYNConverter.class)
78 private boolean active;
79
80 @Column(name = "FIN_RPT_CHRT_CD")
81 private String financialReportChartCode;
82
83 @Column(name = "FIN_RPT_ORG_CD")
84 private String finReportOrganizationCode;
85
86 @Column(name = "FIN_RPT_CD")
87 private String financialReportingCode;
88
89
90
91
92
93
94
95
96 @OneToOne(targetEntity = A21SubAccount.class, fetch = FetchType.LAZY, orphanRemoval = true, cascade = { CascadeType.REFRESH, CascadeType.REMOVE, CascadeType.PERSIST })
97
98
99
100
101 @PrimaryKeyJoinColumns({ @PrimaryKeyJoinColumn(name = "FIN_COA_CD", referencedColumnName = "FIN_COA_CD"), @PrimaryKeyJoinColumn(name = "ACCOUNT_NBR", referencedColumnName = "ACCOUNT_NBR"), @PrimaryKeyJoinColumn(name = "SUB_ACCT_NBR", referencedColumnName = "SUB_ACCT_NBR") })
102 private A21SubAccount a21SubAccount;
103
104 @ManyToOne(targetEntity = Account.class, fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
105
106
107
108
109 @JoinColumns({ @JoinColumn(name = "FIN_COA_CD", referencedColumnName = "FIN_COA_CD", insertable = false, updatable = false), @JoinColumn(name = "ACCOUNT_NBR", referencedColumnName = "ACCOUNT_NBR", insertable = false, updatable = false) })
110 private Account account;
111
112 @ManyToOne(targetEntity = ReportingCode.class, fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
113
114
115
116
117 @JoinColumns({ @JoinColumn(name = "FIN_RPT_CHRT_CD", referencedColumnName = "FIN_RPT_CHRT_CD", insertable = false, updatable = false), @JoinColumn(name = "FIN_RPT_ORG_CD", referencedColumnName = "FIN_RPT_ORG_CD", insertable = false, updatable = false), @JoinColumn(name = "FIN_RPT_CD", referencedColumnName = "FIN_RPT_CD", insertable = false, updatable = false) })
118 private ReportingCode reportingCode;
119
120 @ManyToOne(targetEntity = Chart.class, fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
121 @JoinColumn(name = "FIN_COA_CD", referencedColumnName = "FIN_COA_CD", insertable = false, updatable = false)
122 private Chart chart;
123
124 @ManyToOne(targetEntity = Organization.class, fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
125
126
127
128
129 @JoinColumns({ @JoinColumn(name = "FIN_RPT_CHRT_CD", referencedColumnName = "FIN_COA_CD", insertable = false, updatable = false), @JoinColumn(name = "FIN_RPT_ORG_CD", referencedColumnName = "ORG_CD", insertable = false, updatable = false) })
130 private Organization org;
131
132 @ManyToOne(targetEntity = Chart.class, fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
133 @JoinColumn(name = "FIN_RPT_CHRT_CD", referencedColumnName = "FIN_COA_CD", insertable = false, updatable = false)
134 private Chart financialReportChart;
135
136
137 @Transient
138 private String financialReportingCodeSectionBlank;
139
140 @Transient
141 private String financialReportingCodeSection;
142
143 @Transient
144 private String cgCostSharingSectionBlank;
145
146 @Transient
147 private String cgCostSharingSection;
148
149 @Transient
150 private String cgICRSectionBlank;
151
152 @Transient
153 private String cgICRSection;
154
155
156
157
158 public SubAccount() {
159 }
160
161
162
163
164
165
166 public String getAccountNumber() {
167 return accountNumber;
168 }
169
170
171
172
173 public void setAccountNumber(String accountNumber) {
174 this.accountNumber = accountNumber;
175 }
176
177
178
179
180
181
182 public String getChartOfAccountsCode() {
183 return chartOfAccountsCode;
184 }
185
186
187
188
189
190
191 public void setChartOfAccountsCode(String chartOfAccountsCode) {
192 this.chartOfAccountsCode = chartOfAccountsCode;
193 }
194
195
196
197
198
199
200
201 public void setReportingCode(ReportingCode reportingCode) {
202 this.reportingCode = reportingCode;
203 }
204
205
206
207
208
209
210 public String getSubAccountName() {
211 return subAccountName;
212 }
213
214
215
216
217
218
219 public void setSubAccountName(String subAccountName) {
220 this.subAccountName = subAccountName;
221 }
222
223
224
225
226
227
228 public boolean isActive() {
229 return active;
230 }
231
232
233
234
235
236
237 public void setActive(boolean active) {
238 this.active = active;
239 }
240
241
242
243
244
245
246 public Account getAccount() {
247 return account;
248 }
249
250
251
252
253
254
255 public void setAccount(Account account) {
256 this.account = account;
257 }
258
259
260
261
262
263
264 public String getSubAccountNumber() {
265 return subAccountNumber;
266 }
267
268
269
270
271
272
273 public void setSubAccountNumber(String subAccountNumber) {
274 this.subAccountNumber = subAccountNumber;
275 }
276
277
278
279
280
281
282 public ReportingCode getReportingCode() {
283 return reportingCode;
284 }
285
286
287
288
289
290 public String getFinancialReportChartCode() {
291 return financialReportChartCode;
292 }
293
294
295
296
297 public void setFinancialReportChartCode(String financialReportChartCode) {
298 this.financialReportChartCode = financialReportChartCode;
299 }
300
301
302
303
304 public String getFinancialReportingCode() {
305 return financialReportingCode;
306 }
307
308
309
310
311 public void setFinancialReportingCode(String financialReportingCode) {
312 this.financialReportingCode = financialReportingCode;
313 }
314
315
316
317
318 public String getFinReportOrganizationCode() {
319 return finReportOrganizationCode;
320 }
321
322
323
324
325 public void setFinReportOrganizationCode(String finReportOrganizationCode) {
326 this.finReportOrganizationCode = finReportOrganizationCode;
327 }
328
329
330
331
332
333
334 public A21SubAccount getA21SubAccount() {
335 return a21SubAccount;
336 }
337
338
339
340
341
342
343 public void setA21SubAccount(A21SubAccount subAccount) {
344 a21SubAccount = subAccount;
345 }
346
347
348
349
350 public Chart getChart() {
351 return chart;
352 }
353
354
355
356
357
358 public void setChart(Chart chart) {
359 this.chart = chart;
360 }
361
362
363
364
365 public Chart getFinancialReportChart() {
366 return financialReportChart;
367 }
368
369
370
371
372
373 public void setFinancialReportChart(Chart financialReportChart) {
374 this.financialReportChart = financialReportChart;
375 }
376
377
378
379
380 public Organization getOrg() {
381 return org;
382 }
383
384
385
386
387
388 public void setOrg(Organization org) {
389 this.org = org;
390 }
391
392
393
394
395 protected LinkedHashMap toStringMapper() {
396 LinkedHashMap m = new LinkedHashMap();
397 m.put("chartCode", this.chartOfAccountsCode);
398 m.put("account", this.accountNumber);
399 m.put("subAccountNumber", this.subAccountNumber);
400 return m;
401 }
402
403
404
405
406
407
408 public String getCgCostSharingSectionBlank() {
409 return cgCostSharingSectionBlank;
410 }
411
412
413
414
415
416
417 public String getCgICRSectionBlank() {
418 return cgICRSectionBlank;
419 }
420
421
422
423
424
425
426 public String getFinancialReportingCodeSectionBlank() {
427 return financialReportingCodeSectionBlank;
428 }
429
430
431
432
433
434
435 public String getCgCostSharingSection() {
436 return cgCostSharingSection;
437 }
438
439
440
441
442
443
444 public String getCgICRSection() {
445 return cgICRSection;
446 }
447
448
449
450
451
452
453 public String getFinancialReportingCodeSection() {
454 return financialReportingCodeSection;
455 }
456
457 public static final class SubAccountId implements Serializable, Comparable<SubAccountId> {
458
459 private String chartOfAccountsCode;
460
461 private String accountNumber;
462
463 private String subAccountNumber;
464
465 public String getChartOfAccountsCode() {
466 return this.chartOfAccountsCode;
467 }
468
469 public void setChartOfAccountsCode(String chartOfAccountsCode) {
470 this.chartOfAccountsCode = chartOfAccountsCode;
471 }
472
473 public String getAccountNumber() {
474 return this.accountNumber;
475 }
476
477 public void setAccountNumber(String accountNumber) {
478 this.accountNumber = accountNumber;
479 }
480
481 public String getSubAccountNumber() {
482 return this.subAccountNumber;
483 }
484
485 public void setSubAccountNumber(String subAccountNumber) {
486 this.subAccountNumber = subAccountNumber;
487 }
488
489 @Override
490 public String toString() {
491 return new ToStringBuilder(this).append("chartOfAccountsCode", this.chartOfAccountsCode).append("accountNumber", this.accountNumber).append("subAccountNumber", this.subAccountNumber).toString();
492 }
493
494 @Override
495 public boolean equals(Object other) {
496 if (other == null)
497 return false;
498 if (other == this)
499 return true;
500 if (other.getClass() != this.getClass())
501 return false;
502 final SubAccountId rhs = (SubAccountId) other;
503 return new EqualsBuilder().append(this.chartOfAccountsCode, rhs.chartOfAccountsCode).append(this.accountNumber, rhs.accountNumber).append(this.subAccountNumber, rhs.subAccountNumber).isEquals();
504 }
505
506 @Override
507 public int hashCode() {
508 return new HashCodeBuilder(17, 37).append(this.chartOfAccountsCode).append(this.accountNumber).append(this.subAccountNumber).toHashCode();
509 }
510
511 @Override
512 public int compareTo(SubAccountId other) {
513 return new CompareToBuilder().append(this.chartOfAccountsCode, other.chartOfAccountsCode).append(this.accountNumber, other.accountNumber).append(this.subAccountNumber, other.subAccountNumber).toComparison();
514 }
515 }
516 }