1 /*
2 * Copyright 2005 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.coa.service;
17
18 import java.util.Collection;
19 import java.util.Iterator;
20 import java.util.List;
21
22 import org.kuali.ole.coa.businessobject.Account;
23 import org.kuali.ole.coa.businessobject.AccountDelegate;
24 import org.kuali.ole.sys.businessobject.AccountingLine;
25 import org.kuali.rice.kim.api.identity.Person;
26
27
28 /**
29 * This interface defines methods that an Account Service must provide
30 */
31 public interface AccountService {
32 /**
33 * Retrieves an Account object based on primary key.
34 *
35 * @param chartOfAccountsCode - Chart of Accounts Code
36 * @param accountNumber - Account Number
37 * @return Account
38 */
39 public Account getByPrimaryId(String chartOfAccountsCode, String accountNumber);
40
41 /**
42 * Method is used by KualiAccountAttribute to enable caching of orgs for routing.
43 *
44 * @see org.kuali.ole.coa.service.AccountService#getByPrimaryId(java.lang.String, java.lang.String)
45 */
46 public Account getByPrimaryIdWithCaching(String chartOfAccountsCode, String accountNumber);
47
48 /**
49 * This method retrieves the fiscal officers primary delegate based on the chart, account, and document type specified on the
50 * example, along with the total dollar amount
51 *
52 * @param delegateExample The object that contains the chart, account, and document type that should be used to query the
53 * account delegate table
54 * @param totalDollarAmount The amount that should be compared to the from and to amount on the account delegate table
55 * @return The primary delegate for this account, document type, and amount
56 */
57 public AccountDelegate getPrimaryDelegationByExample(AccountDelegate delegateExample, String totalDollarAmount);
58
59 /**
60 * This method retrieves the fiscal officers secondary delegates based on the chart, account, and document type specified on the
61 * example, along with the total dollar amount
62 *
63 * @param delegateExample The object that contains the chart, account, and document type that should be used to query the
64 * account delegate table
65 * @param totalDollarAmount The amount that should be compared to the from and to amount on the account delegate table
66 * @return The primary delegate for this account, document type, and amount
67 */
68 public List getSecondaryDelegationsByExample(AccountDelegate delegateExample, String totalDollarAmount);
69
70 /**
71 * Fetches the accounts that the user is either the fiscal officer or fiscal officer delegate for.
72 *
73 * @param kualiUser
74 * @return a list of Accounts that the user has responsibility for
75 */
76 public List getAccountsThatUserIsResponsibleFor(Person kualiUser);
77
78 /**
79 * Does the given user have responsibilities on the given account?
80 *
81 * @param kualiUser the universal user to check responsibilities for
82 * @param account the account to check responsibilities on
83 * @return true if user does have responsibilities, false if otherwise
84 */
85 public boolean hasResponsibilityOnAccount(Person kualiUser, Account account);
86
87 /**
88 * get all accounts in the system. This is needed by a sufficient funds rebuilder job
89 *
90 * @return iterator of all accounts
91 */
92 public Iterator getAllAccounts();
93
94 /**
95 * Retrieves all active accounts from the database where the given principal is the fiscal officer
96 *
97 * @param principalId the principal id of the fiscal officer
98 * @return an Iterator of active Accounts
99 */
100 public abstract Iterator<Account> getActiveAccountsForFiscalOfficer(String principalId);
101
102 /**
103 * Retrieves all expired accounts from the database where the given principal is the fiscal officer
104 *
105 * @param principalId the principal id of the fiscal officer
106 * @return an Iterator of expired Accounts
107 */
108 public abstract Iterator<Account> getExpiredAccountsForFiscalOfficer(String principalId);
109
110 /**
111 * Retrieves all active accounts from the database where the given principal is the account supervisor
112 *
113 * @param principalId the principal id of the account supervisor
114 * @return an Iterator of active Accounts
115 */
116 public abstract Iterator<Account> getActiveAccountsForAccountSupervisor(String principalId);
117
118 /**
119 * Retrieves all active accounts from the database where the given principal is the account supervisor
120 *
121 * @param principalId the principal id of the account supervisor
122 * @return an Iterator of expired Accounts
123 */
124 public abstract Iterator<Account> getExpiredAccountsForAccountSupervisor(String principalId);
125
126 /**
127 * Determines if the given principal is the fiscal officer of any non-closed account
128 *
129 * @param principalId the principal to check for the fiscal officer role
130 * @return true if the principal is a fiscal officer for any non-closed account, false otherwise
131 */
132 public abstract boolean isPrincipalInAnyWayShapeOrFormFiscalOfficer(String principalId);
133
134 /**
135 * Determines if the given principal is the account supervisor of any non-closed account
136 *
137 * @param principalId the principal to check for the account supervisor role
138 * @return true if the principal is a account supervisor for any non-closed account, false otherwise
139 */
140 public abstract boolean isPrincipalInAnyWayShapeOrFormAccountSupervisor(String principalId);
141
142 /**
143 * Determines if the given principal is the account manager of any non-closed account
144 *
145 * @param principalId the principal to check for the account manager role
146 * @return true if the principal is a account manager for any non-closed account, false otherwise
147 */
148 public abstract boolean isPrincipalInAnyWayShapeOrFormAccountManager(String principalId);
149
150 /**
151 * Returns the accounts associated with a given account number
152 *
153 * @param accountNumber the account number
154 * @return a list of accounts associated with that account number
155 */
156 public abstract Collection<Account> getAccountsForAccountNumber(String accountNumber);
157
158 /**
159 * Retrieves the default labor benefit rate category code based on account type code.
160 *
161 * @param accountTypeCode - The Account Type Code to find the default value for
162 * @return String - the default labor benefit rate category code for given account type code
163 */
164 public String getDefaultLaborBenefitRateCategoryCodeForAccountType(String accountTypeCode);
165
166 /**
167 * Retrieve the from the parameter if ENABLE_FRINGE_BENEFIT_CALC_BY_BENEFIT_RATE_CATEGORY_IND
168 * is enabled
169 *
170 * Default to Boolean.FALSE if it cannot be evaluated or parameter is not defined
171 *
172 * @return
173 */
174 public Boolean isFridgeBenefitCalculationEnable();
175
176 /**
177 * Returns the unique account associated with a given account number. This method only applies when parameter
178 * ACCOUNTS_CAN_CROSS_CHARTS_IND is set to "N".
179 *
180 * @param accountNumber the account number
181 * @return the unique account associated with that account number
182 */
183 public Account getUniqueAccountForAccountNumber(String accountNumber);
184
185 /**
186 * Returns true if parameter ACCOUNTS_CAN_CROSS_CHARTS_IND is set to "Y"; otherwise false.
187 */
188 public boolean accountsCanCrossCharts();
189
190 /*
191 * Populate chart code if it's null, according to the account number in the specified accounting line. This only happens when
192 * parameter ACCOUNTS_CAN_CROSS_CHARTS_IND is set to "N", and Javascript is turned off.
193 * @param the new source accounting line
194 */
195 public void populateAccountingLineChartIfNeeded(AccountingLine line);
196 }
197