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.workarea.service;
17
18 import org.kuali.hr.time.workarea.WorkArea;
19 import org.springframework.cache.annotation.CacheEvict;
20 import org.springframework.cache.annotation.Cacheable;
21
22 import java.sql.Date;
23 import java.util.List;
24
25 public interface WorkAreaService {
26 /**
27 * Fetch WorkArea as of a particular date
28 * @param workArea
29 * @param asOfDate
30 * @return
31 */
32 @Cacheable(value= WorkArea.CACHE_NAME, key="'workArea=' + #p0 + '|' + 'asOfDate=' + #p1")
33 public WorkArea getWorkArea(Long workArea, Date asOfDate);
34
35 /**
36 * Fetch a List of WorkArea objects for a given department as of the
37 * indicated date.
38 *
39 * @param department The department we want to use.
40 * @param asOfDate An effective date.
41 * @return A List<WorkArea> that matches the provided params.
42 */
43 @Cacheable(value= WorkArea.CACHE_NAME, key="'department=' + #p0 + '|' + 'asOfDate=' + #p1")
44 public List<WorkArea> getWorkAreas(String department, Date asOfDate);
45
46 /**
47 * Save or Update given work area
48 * @param workArea
49 */
50 @CacheEvict(value={WorkArea.CACHE_NAME}, allEntries = true)
51 public void saveOrUpdate(WorkArea workArea);
52
53 /**
54 * A helper method to populate the roles for the given WorkArea. This
55 * method will be called automatically when calls to getWorkArea() are
56 * made. Functionality is exposed here to allow the Kuali Lookup / Maint
57 * pages to completely populate WorkArea objects.
58 *
59 * @param workArea The WorkArea for which we need roles populated.
60 */
61 public void populateWorkAreaRoles(WorkArea workArea);
62
63 @Cacheable(value= WorkArea.CACHE_NAME, key="'tkWorkAreaId=' + #p0")
64 public WorkArea getWorkArea(String tkWorkAreaId);
65
66 public Long getNextWorkAreaKey();
67
68 public List<WorkArea> getWorkAreas(String dept, String workArea, String workAreaDescr, Date fromEffdt, Date toEffdt,
69 String active, String showHistory);
70
71 /**
72 * Fetch the count of the work areas with the given department and workarea
73 * @param dept
74 * @param workArea
75 * @return count count of the work areas with the given department and workarea
76 */
77 public int getWorkAreaCount(String dept, Long workArea);
78 }