View Javadoc

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.assignment.service;
17  
18  import org.kuali.hr.time.assignment.Assignment;
19  import org.kuali.hr.time.assignment.AssignmentDescriptionKey;
20  import org.kuali.hr.time.calendar.CalendarEntries;
21  import org.kuali.hr.time.timesheet.TimesheetDocument;
22  import org.springframework.cache.annotation.Cacheable;
23  
24  import java.sql.Date;
25  import java.util.List;
26  import java.util.Map;
27  
28  public interface AssignmentService {
29  	/**
30  	 * Fetches a list of Assignments for a given principal Id as of a particular date
31  	 * @param principalId
32  	 * @param asOfDate
33  	 * @return
34  	 */
35      @Cacheable(value= Assignment.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
36      public List<Assignment> getAssignments(String principalId, Date asOfDate);
37      /**
38       * Reverse lookup of an assignment based on the assignment key and the document
39       * @param timesheetDocument
40       * @param assignmentKey
41       * @return
42       */
43      public Assignment getAssignment(TimesheetDocument timesheetDocument, String assignmentKey);
44      /**
45       * Reverse lookup of an assignment based on the assignment id
46       * @param tkAssignmentId
47       * @return
48       */
49      @Cacheable(value= Assignment.CACHE_NAME, key="'tkAssignmentId=' + #p0")
50      public Assignment getAssignment(String tkAssignmentId);
51      /**
52       * Get Assignment Description key based off of description
53       * @param assignmentDesc
54       * @return
55       */
56      public AssignmentDescriptionKey getAssignmentDescriptionKey(String assignmentDesc);
57      /**
58       * Get all assignment descriptions for a document
59       * @param td
60       * @param clockOnlyAssignments
61       * @return
62       */
63      public Map<String,String> getAssignmentDescriptions(TimesheetDocument td, boolean clockOnlyAssignments);
64      /**
65       * Get all assignment descriptions for an assignment
66       * @param assignment
67       * @return
68       */
69  	public Map<String,String> getAssignmentDescriptions(Assignment assignment);
70  	/**
71  	 * Get all active assignments for a work area
72  	 * @param workArea
73  	 * @param asOfDate
74  	 * @return
75  	 */
76      @Cacheable(value= Assignment.CACHE_NAME, key="'workArea=' + #p0 + '|' + 'asOfDate=' + #p1")
77  	public List<Assignment> getActiveAssignmentsForWorkArea(Long workArea, Date asOfDate);
78  
79  	/**
80  	 * Get active assignments for all users for the current date
81  	 * CAUTION this method will return a lot of data in a normal production env
82  	 * It is intended to only be used in a batch setting
83  	 * @param asOfDate
84  	 * @return
85  	 */
86      @Cacheable(value= Assignment.CACHE_NAME, key="'asOfDate=' + #p0")
87  	public List<Assignment> getActiveAssignments(Date asOfDate);
88  
89  
90      /**
91       * For a given AssignmentDescriptionKey return the matching assignment.
92       * @param key
93       * @return
94       */
95      public Assignment getAssignment(AssignmentDescriptionKey key, Date asOfDate);
96  
97      
98      /**
99       * Fetch principal id and key as of a particular date
100      * @param principalId
101      * @param key
102      * @param asOfDate
103      * @return
104      */
105     public Assignment getAssignment(String principalId, AssignmentDescriptionKey key, Date asOfDate);
106     
107     /**
108      * Get assignments by pay calendar entry
109      * @param principalId
110      * @param payCalendarEntry
111      * @return
112      */
113     public List<Assignment> getAssignmentsByPayEntry(String principalId, CalendarEntries payCalendarEntry);
114     
115     /**
116 	 * KPME-1129 Kagata
117 	 * Get a list of active assignments based on principalId and jobNumber as of a particular date 
118 	 * @param principalId
119 	 * @param jobNumber
120 	 * @param asOfDate
121 	 * @return
122 	 */
123     @Cacheable(value= Assignment.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'jobNumber=' + #p1 + '|' + 'asOfDate=' + #p2")
124     public List<Assignment> getActiveAssignmentsForJob(String principalId, Long jobNumber, Date asOfDate);
125 
126     List<Assignment> searchAssignments(Date fromEffdt, Date toEffdt, String principalId, String jobNumber,
127                                     String dept, String workArea, String active, String showHistory);
128 
129     public Assignment getMaxTimestampAssignment(String principalId);
130 }