View Javadoc

1   /**
2    * Copyright 2004-2013 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.job.service;
17  
18  import org.kuali.hr.job.Job;
19  import org.springframework.cache.annotation.CacheEvict;
20  import org.springframework.cache.annotation.Cacheable;
21  
22  import java.math.BigDecimal;
23  import java.util.Date;
24  import java.util.List;
25  
26  public interface JobService {
27  
28  	/**
29  	 * Updates or saves a job
30  	 * @param job
31  	 */
32      @CacheEvict(value={Job.CACHE_NAME}, allEntries = true)
33  	public void saveOrUpdate(Job job);
34  	
35  	/**
36  	 * Updates or saves a list of jobs
37  	 * @param jobList
38  	 */
39      @CacheEvict(value={Job.CACHE_NAME}, allEntries = true)
40  	public void saveOrUpdate(List<Job> jobList);
41  	
42  	/**
43  	 * Provides a list of current jobs that are valid relative to the provided effective date.  
44  	 * Timestamp of row creation is taken into account when two rows with the same job number
45  	 * have the same effective date.
46  	 * 
47  	 * Assignments are NOT populated on this object.  We may want to consider removing 
48  	 * getAssignments().
49  	 * 
50  	 * @param principalId
51  	 * @param asOfDate
52  	 * @return
53  	 */
54      @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
55  	public List<Job> getJobs(String principalId, Date asOfDate);
56  	
57  	/**
58  	 * Provides a job by specific job number, principal ID and as of Date combination. 
59  	 */
60      @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'jobNumber=' + #p1 + '|' + 'asOfDate=' + #p2")
61  	public Job getJob(String principalId, Long jobNumber, Date asOfDate);
62  	
63  	/**
64  	 * Provides a job by specific job number, principal ID and as of Date combination, and check details will throw error if required. 
65  	 */
66      @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'jobNumber=' + #p1 + '|' + 'asOfDate=' + #p2 + '|' + 'chkDetails=' + #p3")
67  	public Job getJob(String principalId, Long jobNumber, Date asOfDate, boolean chkDetails);
68  	
69  	/**
70  	 * For a given principal ID, the job that is marked "primary" is returned 
71  	 * here.
72  	 * 
73  	 * @param principalId The principal under investigation
74  	 * @param asOfDate Run the request as of this date. 
75  	 * @return
76  	 */
77      @Cacheable(value= Job.CACHE_NAME, key="'{getPrimaryJob}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
78  	public Job getPrimaryJob(String principalId, Date asOfDate);
79  	
80  	/**
81  	 * 
82  	 * @param positionNbr
83  	 * @param asOfDate
84  	 * @return
85  	 */
86      @Cacheable(value= Job.CACHE_NAME, key="'positionNbr=' + #p0 + '|' + 'asOfDate=' + #p1")
87  	public List<Job> getActiveJobsForPosition(String positionNbr, Date asOfDate);
88  	
89  	/**
90  	 * 
91  	 * @param hrPayType
92  	 * @param asOfDate
93  	 * @return
94  	 */
95      @Cacheable(value= Job.CACHE_NAME, key="'hrPayType=' + #p0 + '|' + 'asOfDate=' + #p1")
96  	public List<Job> getActiveJobsForPayType(String hrPayType, Date asOfDate);
97  	
98  	/**
99  	 * Get job by the unique id
100 	 * @param hrJobId
101 	 * @return
102 	 */
103     @Cacheable(value= Job.CACHE_NAME, key="'hrJobId=' + #p0")
104 	public Job getJob(String hrJobId);
105 	
106 	/**
107 	 * Get the max jobnumber job for this principal
108 	 * @param principalId
109 	 * @return
110 	 */
111     @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0")
112 	public Job getMaxJob(String principalId);
113 
114     List<Job> getJobs(String principalId, String firstName, String lastName, String jobNumber,
115                       String dept, String positionNbr, String payType,
116                       java.sql.Date fromEffdt, java.sql.Date toEffdt, String active, String showHistory);
117     
118     public int getJobCount(String principalId, Long jobNumber, String dept);
119     
120 	/**
121 	 * Get list of active jobs eligible for leave for given principal and date
122 	 * @param principalId
123 	 * @param asOfDate
124 	 * @return
125 	 */
126     public List<Job> getActiveLeaveJobs(String principalId, Date asOfDate);
127     
128     /**
129 	 * Get sum of fte of given jobs
130 	 * @param jobs
131 	 * @return
132 	 */
133     public BigDecimal getFteSumForJobs(List<Job> jobs);
134     
135     /**
136      * Returns FTE for all active LM eligible jobs.
137      * @param PrincipalId
138      * @return
139      */
140     public BigDecimal getFteSumForAllActiveLeaveEligibleJobs(String PrincipalId, Date asOfDate);
141     /**
142 	 * Get sum of standard hours of given jobs
143 	 * @param jobs
144 	 * @return
145 	 */
146     public BigDecimal getStandardHoursSumForJobs(List<Job> jobs);
147     
148     /**
149 	 * Get list of all active jobs eligible for leave for given principal and date range
150 	 * @param principalId
151 	 * @param asOfDate
152 	 * @return
153 	 */
154     public List<Job> getAllActiveLeaveJobs(String principalId, Date asOfDate);
155     
156     public List<Job> getInactiveLeaveJobs(Long jobNumber, Date startDate, Date endDate);
157     
158     public List<Job> getAllInActiveLeaveJobsInRange(String principalId, Date startDate, Date endDate);
159     
160     /*
161      * Get the job entry with the max timestamp for given pricipalId
162      */
163     public Job getMaxTimestampJob(String principalId);
164     
165 }