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     /**
122      * Get sum of standard hours of given jobs
123      * @param jobs
124      * @return
125      */
126     public BigDecimal getStandardHoursSumForJobs(List<Job> jobs);
127 
128 
129 }