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