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.sys.OLEConstants;
19 import org.kuali.ole.sys.businessobject.AccountingLine;
20 import org.kuali.ole.sys.document.validation.GenericValidation;
21 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
22 import org.kuali.rice.krad.util.GlobalVariables;
23
24 import static org.kuali.ole.sys.OLEConstants.AMOUNT_PROPERTY_NAME;
25
26
27
28
29 public class OleAccountingLineAmountValidation extends GenericValidation {
30 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OleAccountingLineAmountValidation.class);
31
32 private AccountingLine accountingLineForValidation;
33
34
35
36
37
38
39
40
41 @Override
42 public boolean validate(AttributedDocumentEvent event) {
43 LOG.debug("Validation started");
44 boolean isValid = true;
45 if (accountingLineForValidation.getAmount() == null) {
46 GlobalVariables.getMessageMap().putError(AMOUNT_PROPERTY_NAME, OLEConstants.ERROR_AMOUNT, "");
47 isValid = false;
48 }
49 return isValid;
50 }
51
52
53
54
55
56
57 public AccountingLine getAccountingLineForValidation() {
58 return accountingLineForValidation;
59 }
60
61
62
63
64
65
66 public void setAccountingLineForValidation(AccountingLine accountingLineForValidation) {
67 this.accountingLineForValidation = accountingLineForValidation;
68 }
69 }