1 /*
2 * Copyright 2009 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.gl.batch.service;
17
18 import java.sql.Date;
19
20 import org.kuali.ole.gl.batch.service.impl.OriginEntryOffsetPair;
21 import org.kuali.ole.gl.batch.service.impl.exception.FatalErrorException;
22 import org.kuali.ole.gl.businessobject.Encumbrance;
23 import org.kuali.ole.gl.businessobject.OriginEntryFull;
24
25 /**
26 * Service which generates encumbrance closing origin entries
27 */
28 public interface EncumbranceClosingOriginEntryGenerationService {
29 /**
30 * Create a pair of cost share entries, one explicit and one offset to carry forward an encumbrance after validating the
31 * encumbrance.
32 *
33 * @param encumbrance the encumbrance to create origin entry and offset for
34 * @param transactionDate the date all origin entries should have as their transaction date
35 * @return a cost share entry/offset pair to carry forward the given encumbrance.
36 */
37 public abstract OriginEntryOffsetPair createCostShareBeginningBalanceEntryOffsetPair(Encumbrance encumbrance, Date transactionDate);
38
39 /**
40 * Create a pair of OriginEntries, one explicit and one offset to carry forward an encumbrance.
41 *
42 * @param encumbrance the encumbrance to create origin entries for
43 * @param closingFiscalYear the fiscal year that's closing
44 * @param transactionDate the transaction date these entries should have
45 * @return a entry/offset pair for the given encumbrance
46 */
47 public abstract OriginEntryOffsetPair createBeginningBalanceEntryOffsetPair(Encumbrance encumbrance, Integer closingFiscalYear, Date transactionDate);
48
49 /**
50 * Determine whether or not an encumbrance should be carried forward from one fiscal year to the next.
51 *
52 * @param encumbrance the encumbrance to qualify
53 * @return true if the encumbrance should be rolled forward from the closing fiscal year to the opening fiscal year.
54 */
55 public abstract boolean shouldForwardEncumbrance(Encumbrance encumbrance);
56
57 /**
58 * Do some validation and make sure that the encumbrance A21SubAccount is a cost share sub-account.
59 *
60 * @param entry not used in this implementation
61 * @param offset not used in this implementation
62 * @param encumbrance the encumbrance whose A21SubAccount must be qualified
63 * @param objectTypeCode the object type code of the generated entries
64 * @return true if the encumbrance is eligible for cost share.
65 * @throws FatalErrorException thrown if a given A21SubAccount, SubFundGroup, or PriorYearAccount record is not found in the database
66 */
67 public abstract boolean shouldForwardCostShareForEncumbrance(OriginEntryFull entry, OriginEntryFull offset, Encumbrance encumbrance, String objectTypeCode) throws FatalErrorException;
68
69 /**
70 * Determine whether or not the encumbrance has been fully relieved.
71 *
72 * @param encumbrance the encumbrance to qualify
73 * @return true if the amount closed on the encumbrance is NOT equal to the amount of the encumbrance itself, e.g. if the
74 * encumbrance has not yet been paid off.
75 */
76 public abstract boolean isEncumbranceClosed(Encumbrance encumbrance);
77 }