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.module.bc.document.dataaccess;
017
018 import java.util.Collection;
019 import java.util.List;
020
021 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountOrganizationHierarchy;
022 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountReports;
023 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionFundingLock;
024 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionHeader;
025 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrganizationReports;
026 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPosition;
027 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPullup;
028 import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionAppointmentFunding;
029 import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionGeneralLedger;
030 import org.kuali.kfs.module.bc.document.BudgetConstructionDocument;
031 import org.kuali.rice.kns.util.KualiInteger;
032
033
034 /**
035 * This interface defines the methods that a BudgetConstructionDao must provide.
036 */
037 public interface BudgetConstructionDao {
038
039 /**
040 * This gets a BudgetConstructionHeader using the candidate key chart, account, subaccount, fiscalyear
041 *
042 * @param chartOfAccountsCode
043 * @param accountNumber
044 * @param subAccountNumber
045 * @param fiscalYear
046 * @return BudgetConstructionHeader
047 */
048 public BudgetConstructionHeader getByCandidateKey(String chartOfAccountsCode, String accountNumber, String subAccountNumber, Integer fiscalYear);
049
050 /**
051 * This saves a BudgetConstructionHeader object to the database
052 *
053 * @param bcHeader
054 */
055 public void saveBudgetConstructionHeader(BudgetConstructionHeader bcHeader);
056
057 /**
058 * Save a BudgetConstructionDocument object to the database
059 *
060 * @param bcDocument
061 */
062 public void saveBudgetConstructionDocument(BudgetConstructionDocument bcDocument);
063
064
065 /**
066 * This gets a BudgetConstructionFundingLock using the primary key chart, account, subaccount, fiscalyear, pUId
067 *
068 * @param chartOfAccountsCode
069 * @param accountNumber
070 * @param subAccountNumber
071 * @param fiscalYear
072 * @param principalId
073 * @return BudgetConstructionFundingLock
074 */
075 public BudgetConstructionFundingLock getByPrimaryId(String chartOfAccountsCode, String accountNumber, String subAccountNumber, Integer fiscalYear, String principalId);
076
077 /**
078 * This saves a BudgetConstructionFundingLock to the database
079 *
080 * @param budgetConstructionFundingLock
081 */
082 public void saveBudgetConstructionFundingLock(BudgetConstructionFundingLock budgetConstructionFundingLock);
083
084 /**
085 * This deletes a BudgetConstructionFundingLock from the database
086 *
087 * @param budgetConstructionFundingLock
088 */
089 public void deleteBudgetConstructionFundingLock(BudgetConstructionFundingLock budgetConstructionFundingLock);
090
091 /**
092 * This gets the set of BudgetConstructionFundingLocks asssociated with a BC EDoc (account). Each BudgetConstructionFundingLock
093 * has the positionNumber dummy attribute set to the associated Position that is locked. A positionNumber value of "NotFnd"
094 * indicates the BudgetConstructionFundingLock is an orphan.
095 *
096 * @param chartOfAccountsCode
097 * @param accountNumber
098 * @param subAccountNumber
099 * @param fiscalYear
100 * @return Collection<BudgetConstructionFundingLock>
101 */
102 public Collection<BudgetConstructionFundingLock> getFlocksForAccount(String chartOfAccountsCode, String accountNumber, String subAccountNumber, Integer fiscalYear);
103
104 /**
105 * Returns the position number associated with a funding lock or the not found string if the lock is an orphan.
106 *
107 * @param budgetConstructionFundingLock - funding lock to get position for
108 * @return position number associated with lock
109 */
110 public String getPositionAssociatedWithFundingLock(BudgetConstructionFundingLock budgetConstructionFundingLock);
111
112 /**
113 * Gets a BudgetConstructionPosition from the database by the primary key positionNumber, fiscalYear
114 *
115 * @param positionNumber
116 * @param fiscalYear
117 * @return BudgetConstructionPosition
118 */
119 public BudgetConstructionPosition getByPrimaryId(String positionNumber, Integer fiscalYear);
120
121 /**
122 * Saves a BudgetConstructionPosition to the database
123 *
124 * @param bcPosition
125 */
126 public void saveBudgetConstructionPosition(BudgetConstructionPosition bcPosition);
127
128 /**
129 * This method deletes all BudgetConstructionPullup rows associated with a user.
130 *
131 * @param principalName
132 */
133 public void deleteBudgetConstructionPullupByUserId(String principalName);
134
135 /**
136 * This method returns a list of BudgetConstructionPullup objects (organizations) ownded by the user that have the pullflag set
137 *
138 * @param principalName
139 * @return
140 */
141 public List<BudgetConstructionPullup> getBudgetConstructionPullupFlagSetByUserId(String principalName);
142
143 /**
144 * This returns a list of BudgetConstructionPullup objects (organizations) that are children to the passed in organization for
145 * the user
146 *
147 * @param principalId
148 * @param chartOfAccountsCode
149 * @param organizationCode
150 * @return
151 */
152 public List<BudgetConstructionPullup> getBudgetConstructionPullupChildOrgs(String principalId, String chartOfAccountsCode, String organizationCode);
153
154 /**
155 * Returns the sum of the salary detail request amounts for an accounting line
156 *
157 * @param salaryDetailLine
158 * @return
159 */
160 public KualiInteger getPendingBudgetConstructionAppointmentFundingRequestSum(PendingBudgetConstructionGeneralLedger salaryDetailLine);
161
162 /**
163 * returns a list of fringe benefit accounting lines for a document
164 *
165 * @param documentNumber
166 * @param fringeObjects
167 * @return
168 */
169 public List getDocumentPBGLFringeLines(String documentNumber, List fringeObjects);
170
171 /**
172 * Determines is a user is an active Budget Construction document delegate approver for the Budget Construction document type or
173 * the 'ALL' document type
174 *
175 * @param chartCd
176 * @param accountNbr
177 * @param principalId
178 * @return
179 */
180 public boolean isDelegate(String chartCd, String accountNbr, String principalId);
181
182 /**
183 * Returns a list of account organization hierarchy levels for an account
184 *
185 * @param chartOfAccountsCode
186 * @param accountNumber
187 * @param universityFiscalYear
188 * @return
189 */
190 public List<BudgetConstructionAccountOrganizationHierarchy> getAccountOrgHierForAccount(String chartOfAccountsCode, String accountNumber, Integer universityFiscalYear);
191
192 /**
193 * Returns a list of labor objects that are Salary Setting detail related
194 *
195 * @param universityFiscalYear
196 * @param chartOfAccountsCode
197 * @return
198 */
199 public List<String> getDetailSalarySettingLaborObjects(Integer universityFiscalYear, String chartOfAccountsCode);
200
201 /**
202 * Returns a list of Pending Budget GL rows that are Salary Setting detail related, based on the set of salarySettingObjects
203 * passed in
204 *
205 * @param documentNumber
206 * @param salarySettingObjects
207 * @return
208 */
209 public List getPBGLSalarySettingRows(String documentNumber, List salarySettingObjects);
210
211 /**
212 * Retrieves all <code>PendingBudgetConstructionAppointmentFunding</code> records for the given position key.
213 *
214 * @param universityFiscalYear budget fiscal year, primary key field for position record
215 * @param positionNumber position number, primary key field for position record
216 * @return List of PendingBudgetConstructionAppointmentFunding objects
217 */
218 public List<PendingBudgetConstructionAppointmentFunding> getAllFundingForPosition(Integer universityFiscalYear, String positionNumber);
219
220 /**
221 * Returns a <code>BudgetConstructionAccountReports</code> object for the given key.
222 *
223 * @param chartOfAccountsCode
224 * @param accountNumber
225 * @return
226 */
227 public BudgetConstructionAccountReports getAccountReports(String chartOfAccountsCode, String accountNumber);
228
229 /**
230 * Returns a <code>BudgetConstructionOrganizationReports</code> object for the given key.
231 *
232 * @param chartOfAccountsCode
233 * @param organizationCode
234 * @return
235 */
236 public BudgetConstructionOrganizationReports getOrganizationReports(String chartOfAccountsCode, String organizationCode);
237
238 /**
239 * Builds an Account Organization Hierarchy by recursively calling itself inserting each Hierarchy row (<code>BudgetConstructionAccountOrganizationHierarchy</code>)
240 * while walking the organization reports to structure (<code>BudgetConstructionOrganizationReports</code>) stopping at the
241 * root of the organization tree or overflow value, whatever comes first.
242 *
243 * @param rootChart
244 * @param rootOrganization
245 * @param universityFiscalYear
246 * @param chartOfAccountsCode
247 * @param accountNumber
248 * @param currentLevel
249 * @param organizationChartOfAccountsCode
250 * @param organizationCode
251 * @return
252 */
253 public boolean insertAccountIntoAccountOrganizationHierarchy(String rootChart, String rootOrganization, Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, Integer currentLevel, String organizationChartOfAccountsCode, String organizationCode);
254
255 /**
256 * deletes an existing set of Account Organization Hierarchy objects from the DB for the account key passed in
257 *
258 * @param universityFiscalYear
259 * @param chartOfAccountsCode
260 * @param accountNumber
261 */
262 public void deleteExistingAccountOrganizationHierarchy(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber);
263 }
264