001/*
002 * Copyright 2009 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.Iterator;
020
021import org.kuali.ole.coa.businessobject.AccountDelegate;
022
023
024public interface AccountDelegateDao {
025
026    /**
027     * Retrieves the Document Number of any AccountDelegate locking this record.
028     * 
029     * @param lockingRepresentation String representation of the MaintanceLock to check against.
030     * @param documentNumber the document number being checked against.
031     * @return the document number of the Document locking this record.
032     */
033
034    public String getLockingDocumentNumber(String lockingRepresentation, String documentNumber);
035
036    /**
037     * Retrieves all active account delegates which reference the given user
038     * 
039     * @param principalId a principal ID of the person to find account delegations for
040     * @param primary whether the account delegates returned should be primary or not
041     * @return a Collection, presumably of AccountDelegates
042     */
043    public abstract Iterator<AccountDelegate> getAccountDelegationsForPerson(String principalId, boolean primary);
044
045    /**
046     * Determines if the given principal is an active delegate for any non-closed account
047     * 
048     * @param principalId the principal ID to check primary account delegations for
049     * @param currentSqlDate
050     * @return true if the principal is a primary account delegate, false otherwise
051     */
052    public abstract boolean isPrincipalInAnyWayShapeOrFormPrimaryAccountDelegate(String principalId, Date currentSqlDate);
053
054    /**
055     * Determines if the given principal is an active delegate for any non-closed account
056     * 
057     * @param principalId the principal ID to check secondary account delegations for
058     * @param currentSqlDate current Sql date
059     * @return true if the principal is a secondary account delegate, false otherwise
060     */
061    public abstract boolean isPrincipalInAnyWayShapeOrFormSecondaryAccountDelegate(String principalId, Date currentSqlDate);
062}