001/*
002 * Copyright 2005-2006 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 */
016package org.kuali.ole.coa.dataaccess;
017
018import java.sql.Date;
019import java.util.Collection;
020import java.util.Iterator;
021import java.util.List;
022
023import org.kuali.ole.coa.businessobject.Account;
024import org.kuali.ole.coa.businessobject.AccountDelegate;
025import org.kuali.rice.kim.api.identity.Person;
026
027
028/**
029 * This interface defines what methods of data retrieval should be allowed for {@link org.kuali.ole.coa.businessobject.Account}, and
030 * {@link org.kuali.ole.coa.businessobject.AccountDelegate}. It also defines a method for checking if a given User is responsible
031 * for an Account
032 */
033public interface AccountDao {
034
035    /**
036     * @see org.kuali.ole.coa.service.AccountService#getPrimaryDelegationByExample(org.kuali.ole.coa.businessobject.AccountDelegate,
037     *      java.lang.String)
038     */
039    public List getPrimaryDelegationByExample(AccountDelegate delegateExample, Date currentSqlDate, String totalDollarAmount);
040
041    /**
042     * @see org.kuali.ole.coa.service.AccountService#getSecondaryDelegationsByExample(org.kuali.ole.coa.businessobject.AccountDelegate,
043     *      java.lang.String)
044     */
045    public List getSecondaryDelegationsByExample(AccountDelegate delegateExample, Date currentSqlDate, String totalDollarAmount);
046
047    /**
048     * fetch the AccountResponsibility objects that the user has associated with them
049     * 
050     * @param kualiUser
051     * @param currentDate current date
052     * @return a list of AccountResponsibility objects
053     */
054    public List getAccountsThatUserIsResponsibleFor(Person kualiUser, java.util.Date currentDate);
055
056    /**
057     * This method should determine if the given user has any responsibilities on the given account
058     * 
059     * @param person the user to check responsibilities for
060     * @param account the account to check responsibilities on
061     * @param currentSqlDate current Sql date
062     * @return true if user is somehow responsible for account, false if otherwise
063     */
064    public boolean determineUserResponsibilityOnAccount(Person person, Account account, Date currentSqlDate);
065
066    /**
067     * get all accounts in the system. This is needed by a sufficient funds rebuilder job
068     * 
069     * @return iterator of all accounts
070     */
071    public Iterator getAllAccounts();
072
073    /**
074     * Retrieves all active accounts from the database where the given principal is the fiscal officer
075     * 
076     * @param principalId the principal id of the fiscal officer
077     * @param currentSqlDate current sql date
078     * @return an Iterator of active Accounts
079     */
080    public abstract Iterator<Account> getActiveAccountsForFiscalOfficer(String principalId, Date currentSqlDate);
081
082    /**
083     * Retrieves all expired accounts from the database where the given principal is the fiscal officer
084     * 
085     * @param principalId the principal id of the fiscal officer
086     * @param currentSqlDate current Sql Date
087     * @return an Iterator of expired Accounts
088     */
089    public abstract Iterator<Account> getExpiredAccountsForFiscalOfficer(String principalId, Date currentSqlDate);
090
091    /**
092     * Retrieves all active accounts from the database where the given principal is the account supervisor
093     * 
094     * @param principalId the principal id of the account supervisor
095     * @param currentSalDate
096     * @return an Iterator of active Accounts
097     */
098    public abstract Iterator<Account> getActiveAccountsForAccountSupervisor(String principalId, Date currentSalDate);
099
100    /**
101     * Retrieves all active accounts from the database where the given principal is the account supervisor
102     * 
103     * @param principalId the principal id of the account supervisor
104     * @param currentSqlDate current Sql Date
105     * @return an Iterator of expired Accounts
106     */
107    public abstract Iterator<Account> getExpiredAccountsForAccountSupervisor(String principalId, Date currentSqlDate);
108
109    /**
110     * Determines if the given principal is the fiscal officer of any non-closed account
111     * 
112     * @param principalId the principal to check for the fiscal officer role
113     * @return true if the principal is a fiscal officer for any non-closed account, false otherwise
114     */
115    public abstract boolean isPrincipalInAnyWayShapeOrFormFiscalOfficer(String principalId);
116
117    /**
118     * Determines if the given principal is the account supervisor of any non-closed account
119     * 
120     * @param principalId the principal to check for the account supervisor role
121     * @return true if the principal is a account supervisor for any non-closed account, false otherwise
122     */
123    public abstract boolean isPrincipalInAnyWayShapeOrFormAccountSupervisor(String principalId);
124
125    /**
126     * Determines if the given principal is the account manager of any non-closed account
127     * 
128     * @param principalId the principal to check for the account manager role
129     * @return true if the principal is a account manager for any non-closed account, false otherwise
130     */
131    public abstract boolean isPrincipalInAnyWayShapeOrFormAccountManager(String principalId);
132
133    public Collection<Account> getAccountsForAccountNumber(String accountNumber);
134}