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.sys.service;
017
018 import org.kuali.kfs.fp.businessobject.OffsetAccount;
019 import org.kuali.kfs.gl.businessobject.FlexibleAccountUpdateable;
020
021 /**
022 *
023 * This interface defines methods that a FlexibleOffsetAccount Service must provide.
024 *
025 */
026 public interface FlexibleOffsetAccountService {
027
028 /**
029 * Retrieves the OffsetAccount by its composite primary key (all passed in as parameters) if the SYSTEM parameter
030 * FLEXIBLE_OFFSET_ENABLED_FLAG is true.
031 *
032 * @param chartOfAccountsCode The chart code of the account to be retrieved.
033 * @param accountNumber The account number of the account to be retrieved.
034 * @param financialOffsetObjectCode Offset object code used to retrieve the OffsetAccount.
035 * @return An OffsetAccount object instance. Returns null if there is none with the given key, or if the SYSTEM parameter
036 * FLEXIBLE_OFFSET_ENABLED_FLAG is false.
037 */
038 public OffsetAccount getByPrimaryIdIfEnabled(String chartOfAccountsCode, String accountNumber, String financialOffsetObjectCode);
039
040 /**
041 * Retrieves whether the SYSTEM parameter FLEXIBLE_OFFSET_ENABLED_FLAG is true.
042 *
043 * @return Whether the SYSTEM parameter FLEXIBLE_OFFSET_ENABLED_FLAG is true.
044 */
045 public boolean getEnabled();
046
047 /**
048 * This method will apply the flexible offset account if necessary. It will only change the chart, account, sub account and sub
049 * object on the transaction. If the flexible offset isn't enabled or valid for this transaction, it will be unchanged.
050 *
051 * It throws an InvalidFlexibleOffsetException if the flexible offset account associated with the transaction
052 * is invalid, closed or expired or if the object code is invalid for the flexible offset.
053 *
054 * @param transaction The OriginEntryFull object to be updated.
055 * @return True if transaction was changed, false if not.
056 */
057 public boolean updateOffset(FlexibleAccountUpdateable transaction);
058 }