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.sys.document.service; 17 18 import org.kuali.ole.coa.businessobject.AccountingPeriod; 19 import org.kuali.ole.coa.businessobject.BalanceType; 20 import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntrySourceDetail; 21 22 /** 23 * A collection of methods that assist in rule validation for accounting documents 24 */ 25 public interface AccountingDocumentRuleHelperService { 26 /** 27 * This method checks for the existence of the provided balance type, in the system and also checks to see if it is active. 28 * 29 * @param balanceType 30 * @param errorPropertyName also used as the BalanceTyp DD attribute name 31 * @return True if the balance type is valid, false otherwise. 32 */ 33 public abstract boolean isValidBalanceType(BalanceType balanceType, String errorPropertyName); 34 35 /** 36 * This method checks for the existence of the provided balance type, in the system and also checks to see if it is active. 37 * 38 * @param balanceType 39 * @param entryClass the Class of the DataDictionary entry containing the attribute with the label for the error message 40 * @param attributeName the name of the attribute in the DataDictionary entry 41 * @param errorPropertyName 42 * @return True if the balance type is valid, false otherwise. 43 */ 44 public abstract boolean isValidBalanceType(BalanceType balanceType, Class entryClass, String attributeName, String errorPropertyName); 45 46 /** 47 * This method checks for the existence of the accounting period in the system and also makes sure that the accounting period is 48 * open for posting. 49 * 50 * @param accountingPeriod 51 * @param entryClass 52 * @param attribueName 53 * @param errorPropertyName 54 * @return True if the accounting period exists in the system and is open for posting, false otherwise. 55 */ 56 public abstract boolean isValidOpenAccountingPeriod(AccountingPeriod accountingPeriod, Class entryClass, String attribueName, String errorPropertyName); 57 58 /** 59 * Some documents have reversal dates. This method represents the common implementation that transactional documents follow for 60 * reversal dates - that they must not be before the current date. 61 * 62 * @param reversalDate 63 * @param errorPropertyName 64 * @return boolean True if the reversal date is not earlier than the current date, false otherwise. 65 */ 66 public abstract boolean isValidReversalDate(java.sql.Date reversalDate, String errorPropertyName); 67 68 /** 69 * Determines whether an accounting line is an income line or not. This goes agains the configurable object type code list in 70 * the ApplicationParameter mechanism. This list can be configured externally. 71 * 72 * @param accountingLine 73 * @return boolean True if the line is an income line. 74 */ 75 public abstract boolean isIncome(GeneralLedgerPendingEntrySourceDetail postable); 76 77 /** 78 * Check object code type to determine whether the accounting line is expense. 79 * 80 * @param accountingLine 81 * @return boolean True if the line is an expense line. 82 */ 83 public abstract boolean isExpense(GeneralLedgerPendingEntrySourceDetail postable); 84 85 /** 86 * Makes sure that the objectCode attribute is fully populated b/c we are using proxying in our persistence layer. 87 * 88 * @param accountingLine 89 * @return the object type code of the object code of the given accounting line 90 */ 91 public abstract String getObjectCodeTypeCodeWithoutSideEffects(GeneralLedgerPendingEntrySourceDetail postable); 92 93 /** 94 * Gets the named property from ConfigurationService (i.e., from ApplicationResources.properties) and formats it with the 95 * given arguments (if any). 96 * 97 * @param propertyName 98 * @param arguments 99 * @return the formatted property (i.e., message), with any {@code {0}} replaced with the first argument, {@code {1}} with the 100 * second argument, etc. 101 */ 102 public abstract String formatProperty(String propertyName, Object... arguments); 103 }