1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.document.validation.impl;
17
18 import org.kuali.ole.module.purap.businessobject.PurApAccountingLine;
19 import org.kuali.ole.module.purap.businessobject.PurApItem;
20 import org.kuali.ole.module.purap.document.validation.impl.*;
21 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
22 import org.kuali.rice.krad.util.ObjectUtils;
23
24 public class OlePurchasingAccountsPayableProcessAccountValidation extends
25 PurchasingAccountsPayableProcessAccountValidation {
26
27 private PurchasingAccountsPayableHasAccountsValidation hasAccountsValidation;
28 private PurchasingAccountsPayableAccountPercentValidation accountPercentValidation;
29 private PurchasingAccountsPayableUniqueAccountingStringsValidation accountingStringsValidation;
30 private PurApItem itemForValidation;
31 private PurchasingAccountsPayableAccountAtleastOneLineHasPercentValidation accountHasAtleastOnePercentValidation;
32 private PurchasingAccountingLineAmountValidation accountLineAmountValidation;
33 private PurchasingAccountsPayableAccountTotalValidation accountTotalValidation;
34
35 @Override
36 public boolean validate(AttributedDocumentEvent event) {
37 boolean valid = true;
38
39 if (ObjectUtils.isNull(itemForValidation)) {
40 return valid;
41 }
42
43 hasAccountsValidation.setItemForValidation(itemForValidation);
44 valid &= hasAccountsValidation.validate(event);
45
46 if (valid) {
47 getAccountHasAtlestOnePercentValidation().setItemForValidation(itemForValidation);
48 valid &= getAccountHasAtlestOnePercentValidation().validate(event);
49 }
50
51 if (valid) {
52 for (PurApAccountingLine account : itemForValidation.getSourceAccountingLines()) {
53 getAccountLineAmountValidation().setUpdatedAccountingLine(account);
54 valid &= getAccountLineAmountValidation().validate(event);
55 if (!valid) {
56 break;
57 }
58 }
59 }
60
61 if (valid) {
62 accountPercentValidation.setItemForValidation(itemForValidation);
63 valid &= accountPercentValidation.validate(event);
64 }
65
66 if (valid) {
67 accountTotalValidation.setItemForValidation(itemForValidation);
68 valid &= accountTotalValidation.validate(event);
69 }
70
71 if (valid) {
72 accountingStringsValidation.setItemForValidation(itemForValidation);
73 valid &= accountingStringsValidation.validate(event);
74 }
75
76 return valid;
77 }
78
79 public PurchasingAccountsPayableHasAccountsValidation getHasAccountsValidation() {
80 return hasAccountsValidation;
81 }
82
83 public void setHasAccountsValidation(PurchasingAccountsPayableHasAccountsValidation hasAccountsValidation) {
84 this.hasAccountsValidation = hasAccountsValidation;
85 }
86
87 public PurchasingAccountsPayableAccountPercentValidation getAccountPercentValidation() {
88 return accountPercentValidation;
89 }
90
91 public void setAccountPercentValidation(PurchasingAccountsPayableAccountPercentValidation accountPercentValidation) {
92 this.accountPercentValidation = accountPercentValidation;
93 }
94
95 public PurchasingAccountsPayableUniqueAccountingStringsValidation getAccountingStringsValidation() {
96 return accountingStringsValidation;
97 }
98
99 public void setAccountingStringsValidation(PurchasingAccountsPayableUniqueAccountingStringsValidation accountingStringsValidation) {
100 this.accountingStringsValidation = accountingStringsValidation;
101 }
102
103 public PurApItem getItemForValidation() {
104 return itemForValidation;
105 }
106
107 public void setItemForValidation(PurApItem itemForValidation) {
108 this.itemForValidation = itemForValidation;
109 }
110
111
112
113
114
115 public PurchasingAccountsPayableAccountAtleastOneLineHasPercentValidation getAccountHasAtlestOnePercentValidation() {
116 return accountHasAtleastOnePercentValidation;
117 }
118
119
120
121
122
123
124
125 public void setAccountHasAtleastOnePercentValidation(PurchasingAccountsPayableAccountAtleastOneLineHasPercentValidation accountHasAtleastOnePercentValidation) {
126 this.accountHasAtleastOnePercentValidation = accountHasAtleastOnePercentValidation;
127 }
128
129
130
131
132
133
134
135 public PurchasingAccountingLineAmountValidation getAccountLineAmountValidation() {
136 return accountLineAmountValidation;
137 }
138
139
140
141
142
143
144 public void setAccountLineAmountValidation(PurchasingAccountingLineAmountValidation accountLineAmountValidation) {
145 this.accountLineAmountValidation = accountLineAmountValidation;
146 }
147
148
149
150
151
152
153
154 public PurchasingAccountsPayableAccountTotalValidation getAccountTotalValidation() {
155 return accountTotalValidation;
156 }
157
158
159
160
161
162
163 public void setAccountTotalValidation(PurchasingAccountsPayableAccountTotalValidation accountTotalValidation) {
164 this.accountTotalValidation = accountTotalValidation;
165 }
166 }