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.service;
017    
018    import java.util.List;
019    
020    import org.kuali.kfs.coa.businessobject.Organization;
021    
022    /**
023     * This interface defines methods that an Org Service must provide.
024     */
025    public interface OrganizationService {
026        /**
027         * This method retrieves an organization instance by its composite primary keys (parameters passed in).
028         * 
029         * @param chartOfAccountsCode
030         * @param organizationCode
031         * @return An Org instance.
032         */
033        public Organization getByPrimaryId(String chartOfAccountsCode, String organizationCode);
034    
035        /**
036         * Method is used by KualiOrgReviewAttribute to enable caching of orgs for routing.
037         * 
038         * @see org.kuali.kfs.coa.service.OrganizationService#getByPrimaryId(java.lang.String, java.lang.String)
039         */
040        public Organization getByPrimaryIdWithCaching(String chartOfAccountsCode, String organizationCode);
041    
042        /**
043         * Retrieves a List of Accounts that are active, and are tied to this Org. If there are no Accounts that meet this criteria, an
044         * empty list will be returned.
045         * 
046         * @param chartOfAccountsCode - chartCode for the Org you want Accounts for
047         * @param organizationCode - orgCode for the Org you want Accounts for
048         * @return A List of Accounts that are active, and tied to this Org
049         */
050        public List getActiveAccountsByOrg(String chartOfAccountsCode, String organizationCode);
051    
052        /**
053         * Retrieves a List of Orgs that are active, and that ReportTo this Org If there are no Orgs that meet this criteria, an empty
054         * list will be returned.
055         * 
056         * @param chartOfAccountsCode - chartCode for the Org you want Child Orgs for
057         * @param organizationCode - orgCode for the Org you want Child Orgs for
058         * @return A List of Orgs that are active, and report to this Org
059         */
060        public List getActiveChildOrgs(String chartOfAccountsCode, String organizationCode);
061        
062        /**
063         * Returns a list of active organizations with the given organization type code.
064         * 
065         * @param organizationTypeCode
066         * @return
067         */
068        public List<Organization> getActiveOrgsByType(String organizationTypeCode);
069    
070        
071        /**
072         * Returns a list of active financial processing organizations.
073         * 
074         * @return A List of Orgs that are active and financial processing.
075         */
076        public List<Organization> getActiveFinancialOrgs();
077        
078        /**
079         * returns the chart and organization of the ACTIVE root-level organization
080         */
081        public String[] getRootOrganizationCode();
082        
083        /**
084         * This method traverses the hierarchy to see if the organization represented by the potentialChildChartCode and potentialChildOrganizationCode 
085         * reports to the organization represented by the potentialParentChartCode and potentialParentOrganizationCode
086         * 
087         * @param potentialChildChartCode
088         * @param potentialChildOrganizationCode
089         * @param potentialParentChartCode
090         * @param potentialParentOrganizationCode
091         * @return boolean indicating whether the organization represented by the first two parameters reports to one represented by the last two parameters
092         */
093        public boolean isParentOrganization(String potentialChildChartCode, String potentialChildOrganizationCode, String potentialParentChartCode, String potentialParentOrganizationCode);
094    }