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.Account;
19 import org.kuali.ole.coa.businessobject.Chart;
20 import org.kuali.ole.coa.businessobject.ObjectCode;
21 import org.kuali.ole.coa.businessobject.ObjectType;
22 import org.kuali.ole.coa.businessobject.ProjectCode;
23 import org.kuali.ole.coa.businessobject.SubAccount;
24 import org.kuali.ole.coa.businessobject.SubObjectCode;
25 import org.kuali.ole.sys.businessobject.AccountingLine;
26 import org.kuali.rice.krad.datadictionary.DataDictionary;
27
28 public interface AccountingLineRuleHelperService {
29 /**
30 * This method validates that an accounting line object contains values that actually exist in the DB. SubAccount and SubObject
31 * are only checked if there are values in them. The others throw errors if they area null.
32 *
33 * @param accountingLine
34 * @parm accountingLineByPosition
35 * @return success or failure of validating the AccountingLine
36 * @throws IllegalStateException
37 */
38 public abstract boolean validateAccountingLine(AccountingLine accountingLine);
39
40 /**
41 * This method validates that the chart is active for use in the system.
42 *
43 * @param chart
44 * @param accountIdentifyingPropertyName
45 * @param dataDictionary
46 * @return boolean True if the Chart is valid.
47 */
48 public abstract boolean isValidChart(String accountIdentifyingPropertyName, Chart chart, DataDictionary dataDictionary);
49
50 /**
51 * This method validates that the chart is active for use in the system.
52 *
53 * @param chart
54 * @param dataDictionary
55 * @param accountIdentifyingPropertyName
56 * @param errorPropertyName
57 * @return boolean True if the Chart is valid.
58 */
59 public abstract boolean isValidChart(Chart chart, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
60
61 /**
62 * This method validates that the account is active for use in the system.
63 *
64 * @param accountIdentifyingPropertyName
65 * @param account
66 * @param dataDictionary
67 * @return boolean True if it is valid.
68 */
69 public abstract boolean isValidAccount(String accountIdentifyingPropertyName, Account account, DataDictionary dataDictionary);
70
71 /**
72 * This method validates that the account is active for use in the system.
73 *
74 * @param account
75 * @param dataDictionary
76 * @param accountIdentifyingPropertyName
77 * @param errorPropertyName
78 * @return boolean True if it is valid.
79 */
80 public abstract boolean isValidAccount(Account account, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
81
82 /**
83 * Checks that the given overrideCode is sufficient for the given BO, adding errors to the global map if not.
84 *
85 * @param line
86 * @param overrideCode
87 * @return whether the given overrideCode is sufficient for the given BO.
88 */
89 public abstract boolean hasRequiredOverrides(AccountingLine line, String overrideCode);
90
91 /**
92 * This method validates that a sub account is active.
93 *
94 * @param accountIdentifyingPropertyName
95 * @param subAccount
96 * @param dataDictionary
97 * @return true if it exists
98 */
99 public abstract boolean isValidSubAccount(String accountIdentifyingPropertyName, SubAccount subAccount, DataDictionary dataDictionary);
100
101 /**
102 * This method validates that a sub account is active.
103 *
104 * @param subAccount
105 * @param dataDictionary
106 * @param accountIdentifyingPropertyName
107 * @param errorPropertyName
108 * @return true if it exists
109 */
110 public abstract boolean isValidSubAccount(SubAccount subAccount, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
111
112 /**
113 * This method validates that an object code is active.
114 *
115 * @param accountIdentifyingPropertyName
116 * @param objectCode
117 * @param dataDictionary
118 * @return boolean True if the object code is valid.
119 */
120 public abstract boolean isValidObjectCode(String accountIdentifyingPropertyName, ObjectCode objectCode, DataDictionary dataDictionary);
121
122 /**
123 * This method validates that an object code is active.
124 *
125 * @param objectCode
126 * @param dataDictionary
127 * @param accountIdentifyingPropertyName
128 * @param errorPropertyName
129 * @return boolean True if the object code is valid.
130 */
131 public abstract boolean isValidObjectCode(ObjectCode objectCode, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
132
133 /**
134 * This method validates that a sub object code is active.
135 *
136 * @param accountIdentifyingPropertyName
137 * @param subObjectCode
138 * @param dataDictionary
139 * @return boolean True if it is valid.
140 */
141 public abstract boolean isValidSubObjectCode(String accountIdentifyingPropertyName, SubObjectCode subObjectCode, DataDictionary dataDictionary);
142
143 /**
144 * This method validates that a sub object code is active.
145 *
146 * @param subObjectCode
147 * @param dataDictionary
148 * @param errorPropertyName
149 * @return boolean True if it is valid.
150 */
151 public abstract boolean isValidSubObjectCode(SubObjectCode subObjectCode, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
152
153 /**
154 * This method validates that a project code is active.
155 *
156 * @param accountIdentifyingPropertyName
157 * @param projectCode
158 * @param dataDictionary
159 * @return boolean True if it is valid.
160 */
161 public abstract boolean isValidProjectCode(String accountIdentifyingPropertyName, ProjectCode projectCode, DataDictionary dataDictionary);
162
163 /**
164 * This method validates that a project code is active.
165 *
166 * @param projectCode
167 * @param dataDictionary
168 * @param errorPropertyName
169 * @param accountIdentifyingPropertyName
170 * @return boolean True if it is valid.
171 */
172 public abstract boolean isValidProjectCode(ProjectCode projectCode, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
173
174 /**
175 * For the most part, object type codes aren't required on an accounting line; however, in some situations (e.g. Journal
176 * Voucher) they are entered directly into the accounting line and must be validated. In those cases, they must be validated for
177 * activeness.
178 *
179 * @param accountIdentifyingPropertyName
180 * @param objectTypeCode
181 * @param dataDictionary
182 * @return boolean True if the object type code is valid, false otherwise.
183 */
184 public abstract boolean isValidObjectTypeCode(String accountIdentifyingPropertyName, ObjectType objectTypeCode, DataDictionary dataDictionary);
185
186 /**
187 * For the most part, object type codes aren't required on an accounting line; however, in some situations (e.g. Journal
188 * Voucher) they are entered directly into the accounting line and must be validated. In those cases, they must be validated for
189 * activeness.
190 *
191 * @param objectTypeCode
192 * @param dataDictionary
193 * @param accountIdentifyingPropertyName
194 * @param errorPropertyName
195 * @return boolean True if the object type code is valid, false otherwise.
196 */
197 public abstract boolean isValidObjectTypeCode(ObjectType objectTypeCode, DataDictionary dataDictionary, String errorPropertyName, String accountIdentifyingPropertyName);
198
199 /**
200 * @return short label for chart code defined in data dictionary
201 */
202 public abstract String getChartLabel();
203
204 /**
205 * @return short label for account number defined in data dictionary
206 */
207 public abstract String getAccountLabel();
208
209 /**
210 * @return short label for sub account number defined in data dictionary
211 */
212 public abstract String getSubAccountLabel();
213
214 /**
215 * @return short label for object code defined in data dictionary
216 */
217 public abstract String getObjectCodeLabel();
218
219 /**
220 * @return short label for sub object code defined in data dictionary
221 */
222 public abstract String getSubObjectCodeLabel();
223
224 /**
225 * @return short label for project code defined in data dictionary
226 */
227 public abstract String getProjectCodeLabel();
228
229 /**
230 * @return short label for object type code defined in data dictionary
231 */
232 public abstract String getObjectTypeCodeLabel();
233
234 /**
235 * @return short label for object sub type code defined in data dictionary
236 */
237 public abstract String getObjectSubTypeCodeLabel();
238
239 /**
240 * @return short label for organization code defined in data dictionary
241 */
242 public abstract String getOrganizationCodeLabel();
243
244 /**
245 * @return short label for fund group code defined in data dictionary
246 */
247 public abstract String getFundGroupCodeLabel();
248
249 /**
250 * @return short label for sub fund group code defined in data dictionary
251 */
252 public abstract String getSubFundGroupCodeLabel();
253 }