1 /*
2 * Copyright 2008 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
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.PreEncumbranceDocument;
22 import org.kuali.ole.sys.document.service.AccountingDocumentRuleHelperService;
23 import org.kuali.ole.sys.document.validation.GenericValidation;
24 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
25
26 /**
27 * Validates that an accounting line does not have a capital object object code
28 */
29 public class PreEncumbranceReversalDateValidation extends GenericValidation {
30 private AccountingDocumentRuleHelperService accountingDocumentRuleHelperService;
31 private PreEncumbranceDocument accountingDocumentForValidation;
32
33 /**
34 * Validates that an accounting line does not have a capital object object code
35 * <strong>Expects an accounting line as the first a parameter</strong>
36 * @see org.kuali.ole.sys.document.validation.Validation#validate(java.lang.Object[])
37 */
38 public boolean validate(AttributedDocumentEvent event) {
39 java.sql.Date reversalDate = getAccountingDocumentForValidation().getReversalDate();
40 // AccountingDocumentRuleHelperService accountingDocumentRuleUtil = getAccountingLineRuleHelperService();
41 return accountingDocumentRuleHelperService.isValidReversalDate(reversalDate, DOCUMENT_ERROR_PREFIX + REVERSAL_DATE);
42 }
43
44 /**
45 * Gets the accountingDocumentRuleHelperService attribute.
46 * @return Returns the accountingDocumentRuleHelperService.
47 */
48 public AccountingDocumentRuleHelperService getAccountingDocumentRuleHelperService() {
49 return accountingDocumentRuleHelperService;
50 }
51
52 /**
53 * Sets the accountingDocumentRuleHelperService attribute value.
54 * @param accountingDocumentRuleHelperService The accountingDocumentRuleHelperService to set.
55 */
56 public void setAccountingDocumentRuleHelperService(AccountingDocumentRuleHelperService accountingDocumentRuleHelperService) {
57 this.accountingDocumentRuleHelperService = accountingDocumentRuleHelperService;
58 }
59
60 /**
61 * Gets the accountingDocumentForValidation attribute.
62 * @return Returns the accountingDocumentForValidation.
63 */
64 public PreEncumbranceDocument getAccountingDocumentForValidation() {
65 return accountingDocumentForValidation;
66 }
67
68 /**
69 * Sets the accountingDocumentForValidation attribute value.
70 * @param accountingDocumentForValidation The accountingDocumentForValidation to set.
71 */
72 public void setAccountingDocumentForValidation(PreEncumbranceDocument accountingDocumentForValidation) {
73 this.accountingDocumentForValidation = accountingDocumentForValidation;
74 }
75
76
77
78 }