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.ProcurementCardDocument;
19 import org.kuali.ole.sys.OLEPropertyConstants;
20 import org.kuali.ole.sys.businessobject.AccountingLine;
21 import org.kuali.ole.sys.document.validation.GenericValidation;
22 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
23 import org.kuali.rice.krad.util.GlobalVariables;
24 import org.kuali.rice.krad.util.MessageMap;
25 import org.kuali.rice.krad.util.ObjectUtils;
26
27
28
29
30 public class ProcurementCardAccountNumberValidation extends GenericValidation {
31 private AccountingLine accountingLineForValidation;
32
33
34
35
36
37
38 public boolean validate(AttributedDocumentEvent event) {
39 ProcurementCardDocument pcDocument = (ProcurementCardDocument) event.getDocument();
40 AccountingLine accountingLine = getAccountingLineForValidation();
41 MessageMap errors = GlobalVariables.getMessageMap();
42
43 String errorKey = OLEPropertyConstants.ACCOUNT_NUMBER;
44 boolean accountNumberAllowed = true;
45
46
47 if (ObjectUtils.isNull(accountingLine.getAccount()) || ObjectUtils.isNull(accountingLine.getObjectCode())) {
48 return false;
49 }
50
51 return accountNumberAllowed;
52 }
53
54
55
56
57
58
59 public AccountingLine getAccountingLineForValidation() {
60 return accountingLineForValidation;
61 }
62
63
64
65
66
67 public void setAccountingLineForValidation(AccountingLine accountingLineForValidation) {
68 this.accountingLineForValidation = accountingLineForValidation;
69 }
70 }