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.sys.OLEKeyConstants;
19 import org.kuali.ole.sys.document.service.DebitDeterminerService;
20 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
21 import org.kuali.ole.sys.document.validation.impl.AccountingLineValueAllowedValidation;
22 import org.kuali.rice.krad.util.GlobalVariables;
23
24
25
26
27 public class TransferOfFundsObjectCodeValueAllowedValidation extends AccountingLineValueAllowedValidation {
28 private DebitDeterminerService debitDeterminerService;
29
30
31
32
33
34 @Override
35 public boolean validate(AttributedDocumentEvent event) {
36
37 boolean isObjectCodeAllowed = super.validate(event);
38
39 if (!debitDeterminerService.isIncome(getAccountingLineForValidation()) && !debitDeterminerService.isExpense(getAccountingLineForValidation())) {
40 GlobalVariables.getMessageMap().putError("financialObjectCode", OLEKeyConstants.ERROR_DOCUMENT_TOF_INVALID_OBJECT_TYPE_CODES, new String[] { getAccountingLineForValidation().getObjectCode().getFinancialObjectTypeCode(), getAccountingLineForValidation().getObjectCode().getFinancialObjectSubTypeCode() });
41 isObjectCodeAllowed = false;
42 }
43
44 return isObjectCodeAllowed;
45 }
46
47
48
49
50
51 public DebitDeterminerService getDebitDeterminerService() {
52 return debitDeterminerService;
53 }
54
55
56
57
58
59 public void setDebitDeterminerService(DebitDeterminerService debitDeterminerService) {
60 this.debitDeterminerService = debitDeterminerService;
61 }
62 }