1 /* 2 * Copyright 2012 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.module.purap.document.validation.impl; 17 18 import org.kuali.ole.module.purap.businessobject.PurApAccountingLine; 19 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent; 20 21 /** 22 * Overridden to force an account identifier (thus forcing the validation) into an accounting line when the accounting 23 * line must be checked (basically, once the doc is in route) 24 */ 25 public class InvoiceAccountingLineAccessibleValidation extends PurchasingAccountsPayableAccountingLineAccessibleValidation { 26 27 /** 28 * Overridden to potentially set a dummy account identifier on the accounting line; this will force a KIM check 29 * 30 * @see org.kuali.ole.sys.document.validation.impl.AccountingLineAccessibleValidation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent) 31 */ 32 @Override 33 public boolean validate(AttributedDocumentEvent event) { 34 boolean result = false; 35 boolean setDummyAccountIdentifier = false; 36 37 if (needsDummyAccountIdentifier()) { 38 ((PurApAccountingLine) getAccountingLineForValidation()).setAccountIdentifier(Integer.MAX_VALUE); // avoid conflicts with any accouting identifier on any other accounting lines in the doc because, you know, you never know... 39 setDummyAccountIdentifier = true; 40 } 41 42 result = super.validate(event); 43 44 if (setDummyAccountIdentifier) { 45 ((PurApAccountingLine) getAccountingLineForValidation()).setAccountIdentifier(null); 46 } 47 48 return result; 49 } 50 }