001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.fp.document.validation.impl;
017
018 import static org.kuali.kfs.sys.KFSPropertyConstants.REVERSAL_DATE;
019 import static org.kuali.kfs.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.ERROR_PATH.DOCUMENT_ERROR_PREFIX;
020
021 import org.kuali.kfs.fp.document.PreEncumbranceDocument;
022 import org.kuali.kfs.sys.document.service.AccountingDocumentRuleHelperService;
023 import org.kuali.kfs.sys.document.validation.GenericValidation;
024 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
025
026 /**
027 * Validates that an accounting line does not have a capital object object code
028 */
029 public class PreEncumbranceReversalDateValidation extends GenericValidation {
030 private AccountingDocumentRuleHelperService accountingDocumentRuleHelperService;
031 private PreEncumbranceDocument accountingDocumentForValidation;
032
033 /**
034 * Validates that an accounting line does not have a capital object object code
035 * <strong>Expects an accounting line as the first a parameter</strong>
036 * @see org.kuali.kfs.sys.document.validation.Validation#validate(java.lang.Object[])
037 */
038 public boolean validate(AttributedDocumentEvent event) {
039 java.sql.Date reversalDate = getAccountingDocumentForValidation().getReversalDate();
040 // AccountingDocumentRuleHelperService accountingDocumentRuleUtil = getAccountingLineRuleHelperService();
041 return accountingDocumentRuleHelperService.isValidReversalDate(reversalDate, DOCUMENT_ERROR_PREFIX + REVERSAL_DATE);
042 }
043
044 /**
045 * Gets the accountingDocumentRuleHelperService attribute.
046 * @return Returns the accountingDocumentRuleHelperService.
047 */
048 public AccountingDocumentRuleHelperService getAccountingDocumentRuleHelperService() {
049 return accountingDocumentRuleHelperService;
050 }
051
052 /**
053 * Sets the accountingDocumentRuleHelperService attribute value.
054 * @param accountingDocumentRuleHelperService The accountingDocumentRuleHelperService to set.
055 */
056 public void setAccountingDocumentRuleHelperService(AccountingDocumentRuleHelperService accountingDocumentRuleHelperService) {
057 this.accountingDocumentRuleHelperService = accountingDocumentRuleHelperService;
058 }
059
060 /**
061 * Gets the accountingDocumentForValidation attribute.
062 * @return Returns the accountingDocumentForValidation.
063 */
064 public PreEncumbranceDocument getAccountingDocumentForValidation() {
065 return accountingDocumentForValidation;
066 }
067
068 /**
069 * Sets the accountingDocumentForValidation attribute value.
070 * @param accountingDocumentForValidation The accountingDocumentForValidation to set.
071 */
072 public void setAccountingDocumentForValidation(PreEncumbranceDocument accountingDocumentForValidation) {
073 this.accountingDocumentForValidation = accountingDocumentForValidation;
074 }
075
076
077
078 }