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.fp.document.BudgetAdjustmentDocument;
20 import org.kuali.ole.fp.service.FiscalYearFunctionControlService;
21 import org.kuali.ole.sys.OLEKeyConstants;
22 import org.kuali.ole.sys.OLEPropertyConstants;
23 import org.kuali.ole.sys.document.validation.GenericValidation;
24 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
25 import org.kuali.rice.krad.util.GlobalVariables;
26
27
28
29
30 public class BudgetAdjustmentAccountingLineBaseAmountValidation extends GenericValidation {
31 private BudgetAdjustmentDocument accountingDocumentForValidation;
32 private BudgetAdjustmentAccountingLine accountingLineForValidation;
33 private FiscalYearFunctionControlService fiscalYearFunctionControlService;
34
35
36
37
38
39 public boolean validate(AttributedDocumentEvent event) {
40 boolean allow = true;
41 if (getAccountingLineForValidation().getBaseBudgetAdjustmentAmount().isNonZero() && !fiscalYearFunctionControlService.isBaseAmountChangeAllowed(getAccountingDocumentForValidation().getPostingYear())) {
42 GlobalVariables.getMessageMap().putError(OLEPropertyConstants.BASE_BUDGET_ADJUSTMENT_AMOUNT, OLEKeyConstants.ERROR_DOCUMENT_BA_BASE_AMOUNT_CHANGE_NOT_ALLOWED);
43 allow = false;
44 }
45 return allow;
46 }
47
48
49
50
51
52 public BudgetAdjustmentAccountingLine getAccountingLineForValidation() {
53 return accountingLineForValidation;
54 }
55
56
57
58
59
60 public void setAccountingLineForValidation(BudgetAdjustmentAccountingLine accountingLineForValidation) {
61 this.accountingLineForValidation = accountingLineForValidation;
62 }
63
64
65
66
67
68 public FiscalYearFunctionControlService getFiscalYearFunctionControlService() {
69 return fiscalYearFunctionControlService;
70 }
71
72
73
74
75
76 public void setFiscalYearFunctionControlService(FiscalYearFunctionControlService fiscalYearFunctionControlService) {
77 this.fiscalYearFunctionControlService = fiscalYearFunctionControlService;
78 }
79
80
81
82
83
84 public BudgetAdjustmentDocument getAccountingDocumentForValidation() {
85 return accountingDocumentForValidation;
86 }
87
88
89
90
91
92 public void setAccountingDocumentForValidation(BudgetAdjustmentDocument accountingDocumentForValidation) {
93 this.accountingDocumentForValidation = accountingDocumentForValidation;
94 }
95 }