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.businessobject.BudgetAdjustmentAccountingLine;
19 import org.kuali.ole.sys.OLEKeyConstants;
20 import org.kuali.ole.sys.OLEPropertyConstants;
21 import org.kuali.ole.sys.document.validation.GenericValidation;
22 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
23 import org.kuali.rice.core.api.util.type.KualiDecimal;
24 import org.kuali.rice.krad.util.GlobalVariables;
25
26
27
28
29 public class BudgetAdjustmentAccountingLineMonthlyLinesValidation extends GenericValidation {
30 private BudgetAdjustmentAccountingLine accountingLineForValidation;
31
32
33
34
35
36
37
38 public boolean validate(AttributedDocumentEvent event) {
39 boolean validMonthlyLines = true;
40
41 KualiDecimal monthlyTotal = getAccountingLineForValidation().getMonthlyLinesTotal();
42 if (monthlyTotal.isNonZero() && monthlyTotal.compareTo(getAccountingLineForValidation().getCurrentBudgetAdjustmentAmount()) != 0) {
43 GlobalVariables.getMessageMap().putError(OLEPropertyConstants.CURRENT_BUDGET_ADJUSTMENT_AMOUNT, OLEKeyConstants.ERROR_DOCUMENT_BA_MONTH_TOTAL_NOT_EQUAL_CURRENT);
44 validMonthlyLines = false;
45 }
46
47 return validMonthlyLines;
48 }
49
50
51
52
53
54 public BudgetAdjustmentAccountingLine getAccountingLineForValidation() {
55 return accountingLineForValidation;
56 }
57
58
59
60
61
62 public void setAccountingLineForValidation(BudgetAdjustmentAccountingLine accountingLineForValidation) {
63 this.accountingLineForValidation = accountingLineForValidation;
64 }
65 }