1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.document.validation.impl;
17
18 import static org.kuali.ole.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.ERROR_PATH.DOCUMENT_ERROR_PREFIX;
19
20 import org.kuali.ole.fp.document.AdvanceDepositDocument;
21 import org.kuali.ole.sys.OLEKeyConstants;
22 import org.kuali.ole.sys.document.validation.GenericValidation;
23 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
24 import org.kuali.rice.krad.util.GlobalVariables;
25
26
27
28
29 public class AdvanceDepositMinimumAdvanceDepositValidation extends GenericValidation {
30 private AdvanceDepositDocument accountingDocumentForValidation;
31 private int requiredMinimumCount;
32
33
34
35 public boolean validate(AttributedDocumentEvent event) {
36 AdvanceDepositDocument ad = getAccountingDocumentForValidation();
37 if (ad.getAdvanceDeposits().size() < requiredMinimumCount) {
38 GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX, OLEKeyConstants.AdvanceDeposit.ERROR_DOCUMENT_ADVANCE_DEPOSIT_REQ_NUMBER_DEPOSITS_NOT_MET);
39 return false;
40 }
41 return true;
42 }
43
44
45
46
47 public AdvanceDepositDocument getAccountingDocumentForValidation() {
48 return accountingDocumentForValidation;
49 }
50
51
52
53
54 public void setAccountingDocumentForValidation(AdvanceDepositDocument accountingDocumentForValidation) {
55 this.accountingDocumentForValidation = accountingDocumentForValidation;
56 }
57
58
59
60
61 public int getRequiredMinimumCount() {
62 return requiredMinimumCount;
63 }
64
65
66
67
68 public void setRequiredMinimumCount(int requiredMinimumCount) {
69 this.requiredMinimumCount = requiredMinimumCount;
70 }
71
72 }