View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.cam.document.service;
20  
21  import java.lang.reflect.InvocationTargetException;
22  
23  import org.kuali.kfs.module.cam.businessobject.Asset;
24  import org.kuali.kfs.module.cam.businessobject.AssetGlobal;
25  import org.kuali.kfs.module.cam.businessobject.AssetPayment;
26  import org.kuali.kfs.module.cam.businessobject.AssetPaymentAllocationType;
27  import org.kuali.kfs.module.cam.businessobject.AssetPaymentDetail;
28  import org.kuali.kfs.module.cam.document.AssetPaymentDocument;
29  
30  public interface AssetPaymentService {
31  
32  	/**
33  	 * Finds out the maximum value of payment sequence for an asset
34  	 * 
35  	 * @param assetPayment
36  	 *            Asset Payment
37  	 * @return Maximum sequence value of asset payment within an asset
38  	 */
39  	Integer getMaxSequenceNumber(Long capitalAssetNumber);
40  
41  	/**
42  	 * Checks if asset payment is federally funder or not
43  	 * 
44  	 * @param assetPayment
45  	 *            Payment record
46  	 * @return True if financial object sub type code indicates federal
47  	 *         contribution
48  	 */
49  	boolean isPaymentFederalOwned(AssetPayment assetPayment);
50  
51  	/**
52  	 * Checks active status of financial object of the payment
53  	 * 
54  	 * @param assetPayment
55  	 *            Payment record
56  	 * @return True if object is active
57  	 */
58  	boolean isPaymentFinancialObjectActive(AssetPayment assetPayment);
59  
60  	/**
61  	 * Stores the approved asset payment detail records in the asset payment
62  	 * table, and updates the total cost of the asset in the asset table
63  	 * 
64  	 * @param assetPaymentDetail
65  	 */
66  	void processApprovedAssetPayment(AssetPaymentDocument assetPaymentDocument);
67  
68  	/**
69  	 * This method uses reflection and performs below steps on all Amount fields
70  	 * <li>If it is a depreciation field, then reset the value to null, so that
71  	 * they don't get copied to offset payments</li> <li>If it is an amount
72  	 * field, then reverse the amount by multiplying with -1</li>
73  	 * 
74  	 * @param offsetPayment
75  	 *            Offset payment
76  	 * @param reverseAmount
77  	 *            true if amounts needs to be multiplied with -1
78  	 * @param nullPeriodDepreciation
79  	 *            true if depreciation period amount needs to be null
80  	 * @throws NoSuchMethodException
81  	 * @throws IllegalAccessException
82  	 * @throws InvocationTargetException
83  	 */
84  	void adjustPaymentAmounts(AssetPayment assetPayment, boolean reverseAmount, boolean nullPeriodDepreciation) throws IllegalAccessException, InvocationTargetException;
85  
86  	/**
87  	 * Checks if payment is eligible for GL posting
88  	 * 
89  	 * @param assetPayment
90  	 *            AssetPayment
91  	 * @return true if elgible for GL posting
92  	 */
93  	boolean isPaymentEligibleForGLPosting(AssetPayment assetPayment);
94  
95  	/**
96  	 * Checks if object sub type is non depreciable federally owned
97  	 * 
98  	 * @param string
99  	 *            objectSubType
100 	 * @return true if is NON_DEPRECIABLE_FEDERALLY_OWNED_OBJECT_SUB_TYPES
101 	 */
102 	boolean isNonDepreciableFederallyOwnedObjSubType(String objectSubType);
103 
104 	/**
105 	 * sets in an assetPaymentDetail BO the posting year and posting period that
106 	 * is retrived from the university date table using the asset payment posted
107 	 * date as a key.
108 	 * 
109 	 * @param assetPaymentDetail
110 	 * @return boolean
111 	 */
112 	boolean extractPostedDatePeriod(AssetPaymentDetail assetPaymentDetail);
113 
114 	/**
115 	 * Returns asset payment details quantity
116 	 * 
117 	 * @param assetGlobal
118 	 * @return Integer
119 	 */
120 	Integer getAssetPaymentDetailQuantity(AssetGlobal assetGlobal);
121 
122 	/**
123 	 * Validates the assets inputed in the asset payment document
124 	 * 
125 	 * @param errorPath
126 	 * @param asset
127 	 * @return
128 	 */
129 	boolean validateAssets(String errorPath, Asset asset);
130 
131 	/**
132 	 * This method determines whether or not an asset has different object sub
133 	 * type codes in its documents.
134 	 * 
135 	 * @return true when the asset has payments with object codes that point to
136 	 *         different object sub type codes
137 	 */
138 	boolean hasDifferentObjectSubTypes(AssetPaymentDocument document);
139 
140 	/**
141 	 * Check if payment is eligible for CAPITALIZATION GL posting.
142 	 * 
143 	 * @param assetPayment
144 	 * @return
145 	 */
146 	boolean isPaymentEligibleForCapitalizationGLPosting(AssetPayment assetPayment);
147 
148 	/**
149 	 * Check if payment is eligible for ACCUMMULATE_DEPRECIATION GL posting.
150 	 * 
151 	 * @param assetPayment
152 	 * @return
153 	 */
154 	boolean isPaymentEligibleForAccumDeprGLPosting(AssetPayment assetPayment);
155 
156 	/**
157 	 * Check if payment is eligible for OFFSET_AMOUNT GL posting.
158 	 * 
159 	 * @param assetPayment
160 	 * @return
161 	 */
162 	boolean isPaymentEligibleForOffsetGLPosting(AssetPayment assetPayment);
163 
164 	/**
165 	 * Return the AssetPaymentDistributionType associated with the provided
166 	 * code.
167 	 * 
168 	 * 
169 	 * @param distributionCode
170 	 * @return AssetPaymentDistributionType
171 	 */
172 	AssetPaymentAllocationType getAssetDistributionType(String distributionCode);
173 }