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.module.purap.document.validation.impl;
017
018 import static org.kuali.kfs.sys.KFSConstants.ACCOUNTING_LINE_ERRORS;
019 import static org.kuali.kfs.sys.KFSKeyConstants.ERROR_DOCUMENT_PC_TRANSACTION_TOTAL_ACCTING_LINE_TOTAL_NOT_EQUAL;
020
021 import java.util.List;
022
023 import org.kuali.kfs.fp.businessobject.ProcurementCardTargetAccountingLine;
024 import org.kuali.kfs.fp.businessobject.ProcurementCardTransactionDetail;
025 import org.kuali.kfs.fp.document.ProcurementCardDocument;
026 import org.kuali.kfs.sys.businessobject.AccountingLine;
027 import org.kuali.kfs.sys.businessobject.TargetAccountingLine;
028 import org.kuali.kfs.sys.document.AccountingDocument;
029 import org.kuali.kfs.sys.document.validation.GenericValidation;
030 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
031 import org.kuali.rice.kns.util.GlobalVariables;
032 import org.kuali.rice.kns.util.KualiDecimal;
033
034 /**
035 * Fixes the error path in GlobalVariables before other accounting line validation occurs
036 */
037 public class PurchasingAccountsPayableFixErrorPathValidation extends GenericValidation {
038 private AccountingLine accountingLineForValidation;
039 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PurchasingAccountsPayableFixErrorPathValidation.class);
040
041 /**
042 * @see org.kuali.kfs.sys.document.validation.Validation#validate(java.lang.Object[])
043 */
044 public boolean validate(AttributedDocumentEvent event) {
045 PurchasingAccountsPayableErrorPathUtil.fixErrorPath((AccountingDocument) event.getDocument(), accountingLineForValidation);
046 GlobalVariables.getMessageMap().clearErrorPath();
047 return true;
048 }
049
050 /**
051 * Gets the accountingLineForValidation attribute.
052 *
053 * @return Returns the accountingLineForValidation.
054 */
055 public AccountingLine getAccountingLineForValidation() {
056 return accountingLineForValidation;
057 }
058
059 /**
060 * Sets the accountingLineForValidation attribute value.
061 *
062 * @param accountingLineForValidation The accountingLineForValidation to set.
063 */
064 public void setAccountingLineForValidation(AccountingLine accountingLineForValidation) {
065 this.accountingLineForValidation = accountingLineForValidation;
066 }
067
068
069 }