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 org.kuali.ole.fp.document.CreditCardReceiptDocument;
19 import org.kuali.ole.sys.OLEKeyConstants;
20 import org.kuali.ole.sys.OLEPropertyConstants;
21 import org.kuali.ole.sys.document.AccountingDocument;
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 CreditCardReceiptMinimumCreditCardReceiptValidation extends GenericValidation {
30 private AccountingDocument accountingDocumentForValidation;
31 private int requiredMinimumCount;
32
33
34
35 public boolean validate(AttributedDocumentEvent event) {
36 CreditCardReceiptDocument ccr = (CreditCardReceiptDocument)getAccountingDocumentForValidation();
37 if (ccr.getCreditCardReceipts().size() < requiredMinimumCount) {
38 GlobalVariables.getMessageMap().putError(OLEPropertyConstants.NEW_CREDIT_CARD_RECEIPT, OLEKeyConstants.CreditCardReceipt.ERROR_DOCUMENT_CREDIT_CARD_RECEIPT_REQ_NUMBER_RECEIPTS_NOT_MET);
39 return false;
40 }
41 return true;
42 }
43
44
45
46
47
48 public AccountingDocument getAccountingDocumentForValidation() {
49 return accountingDocumentForValidation;
50 }
51
52
53
54
55
56 public void setAccountingDocumentForValidation(AccountingDocument accountingDocumentForValidation) {
57 this.accountingDocumentForValidation = accountingDocumentForValidation;
58 }
59
60
61
62
63
64 public int getRequiredMinimumCount() {
65 return requiredMinimumCount;
66 }
67
68
69
70
71 public void setRequiredMinimumCount(int requiredMinimumCount) {
72 this.requiredMinimumCount = requiredMinimumCount;
73 }
74
75 }