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 static org.kuali.ole.sys.OLEPropertyConstants.REVERSAL_DATE;
19 import static org.kuali.ole.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.ERROR_PATH.DOCUMENT_ERROR_PREFIX;
20
21 import org.kuali.ole.fp.document.JournalVoucherDocument;
22 import org.kuali.ole.sys.OLEKeyConstants;
23 import org.kuali.ole.sys.context.SpringContext;
24 import org.kuali.ole.sys.document.validation.GenericValidation;
25 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
26 import org.kuali.rice.core.api.datetime.DateTimeService;
27 import org.kuali.rice.krad.util.GlobalVariables;
28
29
30
31
32 public class JournalVoucherReversalDateValidation extends GenericValidation {
33 private JournalVoucherDocument journalVoucherForValidation;
34
35
36
37
38
39 public boolean validate(AttributedDocumentEvent event) {
40 java.sql.Date today = SpringContext.getBean(DateTimeService.class).getCurrentSqlDateMidnight();
41 if (null != getJournalVoucherForValidation().getReversalDate() && getJournalVoucherForValidation().getReversalDate().before(today)) {
42 GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + REVERSAL_DATE, OLEKeyConstants.ERROR_DOCUMENT_INCORRECT_REVERSAL_DATE);
43 return false;
44 }
45 return true;
46 }
47
48
49
50
51
52 public JournalVoucherDocument getJournalVoucherForValidation() {
53 return journalVoucherForValidation;
54 }
55
56
57
58
59
60 public void setJournalVoucherForValidation(JournalVoucherDocument journalVoucherForDocument) {
61 this.journalVoucherForValidation = journalVoucherForDocument;
62 }
63 }