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.document.service;
017
018 import org.kuali.kfs.coa.businessobject.Account;
019 import org.kuali.kfs.coa.businessobject.Chart;
020 import org.kuali.kfs.coa.businessobject.ObjectCode;
021 import org.kuali.kfs.coa.businessobject.ObjectType;
022 import org.kuali.kfs.coa.businessobject.ProjectCode;
023 import org.kuali.kfs.coa.businessobject.SubAccount;
024 import org.kuali.kfs.coa.businessobject.SubObjectCode;
025 import org.kuali.kfs.sys.businessobject.AccountingLine;
026 import org.kuali.rice.kns.datadictionary.DataDictionary;
027
028 public interface AccountingLineRuleHelperService {
029 /**
030 * This method validates that an accounting line object contains values that actually exist in the DB. SubAccount and SubObject
031 * are only checked if there are values in them. The others throw errors if they area null.
032 *
033 * @param accountingLine
034 * @return success or failure of validating the AccountingLine
035 * @throws IllegalStateException
036 */
037 public abstract boolean validateAccountingLine(AccountingLine accountingLine);
038
039 /**
040 * This method validates that the chart is active for use in the system.
041 *
042 * @param chart
043 * @param dataDictionary
044 * @return boolean True if the Chart is valid.
045 */
046 public abstract boolean isValidChart(Chart chart, DataDictionary dataDictionary);
047
048 /**
049 * This method validates that the chart is active for use in the system.
050 *
051 * @param chart
052 * @param dataDictionary
053 * @param errorPropertyName
054 * @return boolean True if the Chart is valid.
055 */
056 public abstract boolean isValidChart(Chart chart, DataDictionary dataDictionary, String errorPropertyName);
057
058 /**
059 * This method validates that the account is active for use in the system.
060 *
061 * @param account
062 * @param dataDictionary
063 * @return boolean True if it is valid.
064 */
065 public abstract boolean isValidAccount(Account account, DataDictionary dataDictionary);
066
067 /**
068 * This method validates that the account is active for use in the system.
069 *
070 * @param account
071 * @param dataDictionary
072 * @param errorPropertyName
073 * @return boolean True if it is valid.
074 */
075 public abstract boolean isValidAccount(Account account, DataDictionary dataDictionary, String errorPropertyName);
076
077 /**
078 * Checks that the given overrideCode is sufficient for the given BO, adding errors to the global map if not.
079 *
080 * @param line
081 * @param overrideCode
082 * @return whether the given overrideCode is sufficient for the given BO.
083 */
084 public abstract boolean hasRequiredOverrides(AccountingLine line, String overrideCode);
085
086 /**
087 * This method validates that a sub account is active.
088 *
089 * @param subAccount
090 * @param dataDictionary
091 * @return true if it exists
092 */
093 public abstract boolean isValidSubAccount(SubAccount subAccount, DataDictionary dataDictionary);
094
095 /**
096 * This method validates that a sub account is active.
097 *
098 * @param subAccount
099 * @param dataDictionary
100 * @param errorPropertyName
101 * @return true if it exists
102 */
103 public abstract boolean isValidSubAccount(SubAccount subAccount, DataDictionary dataDictionary, String errorPropertyName);
104
105 /**
106 * This method validates that an object code is active.
107 *
108 * @param objectCode
109 * @param dataDictionary
110 * @return boolean True if the object code is valid.
111 */
112 public abstract boolean isValidObjectCode(ObjectCode objectCode, DataDictionary dataDictionary);
113
114 /**
115 * This method validates that an object code is active.
116 *
117 * @param objectCode
118 * @param dataDictionary
119 * @param errorPropertyName
120 * @return boolean True if the object code is valid.
121 */
122 public abstract boolean isValidObjectCode(ObjectCode objectCode, DataDictionary dataDictionary, String errorPropertyName);
123
124 /**
125 * This method validates that a sub object code is active.
126 *
127 * @param subObjectCode
128 * @param dataDictionary
129 * @return boolean True if it is valid.
130 */
131 public abstract boolean isValidSubObjectCode(SubObjectCode subObjectCode, DataDictionary dataDictionary);
132
133 /**
134 * This method validates that a sub object code is active.
135 *
136 * @param subObjectCode
137 * @param dataDictionary
138 * @param errorPropertyName
139 * @return boolean True if it is valid.
140 */
141 public abstract boolean isValidSubObjectCode(SubObjectCode subObjectCode, DataDictionary dataDictionary, String errorPropertyName);
142
143 /**
144 * This method validates that a project code is active.
145 *
146 * @param projectCode
147 * @param dataDictionary
148 * @return boolean True if it is valid.
149 */
150 public abstract boolean isValidProjectCode(ProjectCode projectCode, DataDictionary dataDictionary);
151
152 /**
153 * This method validates that a project code is active.
154 *
155 * @param projectCode
156 * @param dataDictionary
157 * @param errorPropertyName
158 * @return boolean True if it is valid.
159 */
160 public abstract boolean isValidProjectCode(ProjectCode projectCode, DataDictionary dataDictionary, String errorPropertyName);
161
162 /**
163 * For the most part, object type codes aren't required on an accounting line; however, in some situations (e.g. Journal
164 * Voucher) they are entered directly into the accounting line and must be validated. In those cases, they must be validated for
165 * activeness.
166 *
167 * @param objectTypeCode
168 * @param dataDictionary
169 * @return boolean True if the object type code is valid, false otherwise.
170 */
171 public abstract boolean isValidObjectTypeCode(ObjectType objectTypeCode, DataDictionary dataDictionary);
172
173 /**
174 * For the most part, object type codes aren't required on an accounting line; however, in some situations (e.g. Journal
175 * Voucher) they are entered directly into the accounting line and must be validated. In those cases, they must be validated for
176 * activeness.
177 *
178 * @param objectTypeCode
179 * @param dataDictionary
180 * @param errorPropertyName
181 * @return boolean True if the object type code is valid, false otherwise.
182 */
183 public abstract boolean isValidObjectTypeCode(ObjectType objectTypeCode, DataDictionary dataDictionary, String errorPropertyName);
184
185 /**
186 * @return short label for chart code defined in data dictionary
187 */
188 public abstract String getChartLabel();
189
190 /**
191 * @return short label for account number defined in data dictionary
192 */
193 public abstract String getAccountLabel();
194
195 /**
196 * @return short label for sub account number defined in data dictionary
197 */
198 public abstract String getSubAccountLabel();
199
200 /**
201 * @return short label for object code defined in data dictionary
202 */
203 public abstract String getObjectCodeLabel();
204
205 /**
206 * @return short label for sub object code defined in data dictionary
207 */
208 public abstract String getSubObjectCodeLabel();
209
210 /**
211 * @return short label for project code defined in data dictionary
212 */
213 public abstract String getProjectCodeLabel();
214
215 /**
216 * @return short label for object type code defined in data dictionary
217 */
218 public abstract String getObjectTypeCodeLabel();
219
220 /**
221 * @return short label for object sub type code defined in data dictionary
222 */
223 public abstract String getObjectSubTypeCodeLabel();
224
225 /**
226 * @return short label for organization code defined in data dictionary
227 */
228 public abstract String getOrganizationCodeLabel();
229
230 /**
231 * @return short label for fund group code defined in data dictionary
232 */
233 public abstract String getFundGroupCodeLabel();
234
235 /**
236 * @return short label for sub fund group code defined in data dictionary
237 */
238 public abstract String getSubFundGroupCodeLabel();
239 }