001    /**
002     * Copyright 2004-2013 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.hr.time.department.service;
017    
018    import org.kuali.hr.time.department.Department;
019    import org.springframework.cache.annotation.Cacheable;
020    
021    import java.sql.Date;
022    import java.util.List;
023    
024    public interface DepartmentService {
025            /**
026             * Get Department as of a particular date passed in
027             * @param department
028             * @param asOfDate
029             * @return
030             */
031        @Cacheable(value= Department.CACHE_NAME, key="'department=' + #p0 + '|' + 'asOfDate=' + #p1")
032            public Department getDepartment(String department, Date asOfDate);
033    
034        /**
035         * Fetches a list of Department objects as of the specified date all of which
036         * belong to the indicated chart.
037         *
038         * @param chart The search criteria
039         * @param asOfDate Effective date
040         * @return A List<Department> object.
041         */
042        @Cacheable(value= Department.CACHE_NAME, key="'chart=' + #p0 + '|' + 'asOfDate=' + #p1")
043        public List<Department> getDepartments(String chart, Date asOfDate);
044    
045        /**
046         * A helper method to populate the roles for the given department. This
047         * method will be called automatically when calls to getDepartment() are
048         * made. Functionality is exposed here to allow the Kuali Lookup / Maint
049         * pages to completely populate Department objects.
050         *
051         * @param department The department for which we need roles populated.
052         */
053        public void populateDepartmentRoles(Department department);
054        
055        /**
056         * Fetch department by id
057         * @param hrDeptId
058         * @return
059         */
060        @Cacheable(value= Department.CACHE_NAME, key="'hrDeptId=' + #p0")
061        public Department getDepartment(String hrDeptId);
062        /**
063         * Fetch department by location
064         * @param location
065         * @return
066         */
067        @Cacheable(value= Department.CACHE_NAME, key="'location=' + #p0")
068        public List<Department> getDepartmentByLocation(String location);
069        /**
070             * get count of department with given department
071             * @param department
072             * @return int
073             */
074            public int getDepartmentCount(String department);
075    
076        List<Department> getDepartments(String department, String location, String descr, String active);
077    }