1 /** 2 * Copyright 2004-2012 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.hr.time.department.service; 17 18 import org.kuali.hr.time.department.Department; 19 import org.springframework.cache.annotation.Cacheable; 20 21 import java.sql.Date; 22 import java.util.List; 23 24 public interface DepartmentService { 25 /** 26 * Get Department as of a particular date passed in 27 * @param department 28 * @param asOfDate 29 * @return 30 */ 31 @Cacheable(value= Department.CACHE_NAME, key="'department=' + #p0 + '|' + 'asOfDate=' + #p1") 32 public Department getDepartment(String department, Date asOfDate); 33 34 /** 35 * Fetches a list of Department objects as of the specified date all of which 36 * belong to the indicated chart. 37 * 38 * @param chart The search criteria 39 * @param asOfDate Effective date 40 * @return A List<Department> object. 41 */ 42 @Cacheable(value= Department.CACHE_NAME, key="'chart=' + #p0 + '|' + 'asOfDate=' + #p1") 43 public List<Department> getDepartments(String chart, Date asOfDate); 44 45 /** 46 * A helper method to populate the roles for the given department. This 47 * method will be called automatically when calls to getDepartment() are 48 * made. Functionality is exposed here to allow the Kuali Lookup / Maint 49 * pages to completely populate Department objects. 50 * 51 * @param department The department for which we need roles populated. 52 */ 53 public void populateDepartmentRoles(Department department); 54 55 /** 56 * Fetch department by id 57 * @param hrDeptId 58 * @return 59 */ 60 @Cacheable(value= Department.CACHE_NAME, key="'hrDeptId=' + #p0") 61 public Department getDepartment(String hrDeptId); 62 /** 63 * Fetch department by location 64 * @param location 65 * @return 66 */ 67 @Cacheable(value= Department.CACHE_NAME, key="'location=' + #p0") 68 public List<Department> getDepartmentByLocation(String location); 69 /** 70 * get count of department with given department 71 * @param department 72 * @return int 73 */ 74 public int getDepartmentCount(String department); 75 }