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 java.util.List;
19
20 import org.kuali.ole.fp.businessobject.DisbursementVoucherNonResidentAlienTax;
21 import org.kuali.ole.fp.document.DisbursementVoucherDocument;
22 import org.kuali.ole.fp.document.service.DisbursementVoucherTaxService;
23 import org.kuali.ole.sys.context.SpringContext;
24 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
25 import org.kuali.ole.sys.document.validation.impl.AccountingLineAmountPositiveValidation;
26
27 public class DisbursementVoucherAccountingLineAmountPositiveValidation extends AccountingLineAmountPositiveValidation {
28 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DisbursementVoucherAccountingLineAmountPositiveValidation.class);
29
30
31
32
33 @Override
34 public boolean validate(AttributedDocumentEvent event) {
35 LOG.debug("validate start");
36 boolean isValid = true;
37
38 DisbursementVoucherDocument document = (DisbursementVoucherDocument) this.getAccountingDocumentForValidation();
39 DisbursementVoucherNonResidentAlienTax nonResidentAlienTax = document.getDvNonResidentAlienTax();
40
41
42 if (nonResidentAlienTax != null) {
43 List<String> taxLineNumbers = SpringContext.getBean(DisbursementVoucherTaxService.class).getNRATaxLineNumbers(nonResidentAlienTax.getFinancialDocumentAccountingLineText());
44
45 if (taxLineNumbers.contains(this.getAccountingLineForValidation().getSequenceNumber())) {
46 return true;
47 }
48 }
49
50 isValid = super.validate(event);
51
52 return isValid;
53 }
54 }