001    /**
002     * Copyright 2004-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.job.service;
017    
018    import org.kuali.hr.job.Job;
019    import org.springframework.cache.annotation.CacheEvict;
020    import org.springframework.cache.annotation.Cacheable;
021    
022    import java.math.BigDecimal;
023    import java.util.Date;
024    import java.util.List;
025    
026    public interface JobService {
027    
028            /**
029             * Updates or saves a job
030             * @param job
031             */
032        @CacheEvict(value={Job.CACHE_NAME}, allEntries = true)
033            public void saveOrUpdate(Job job);
034            
035            /**
036             * Updates or saves a list of jobs
037             * @param jobList
038             */
039        @CacheEvict(value={Job.CACHE_NAME}, allEntries = true)
040            public void saveOrUpdate(List<Job> jobList);
041            
042            /**
043             * Provides a list of current jobs that are valid relative to the provided effective date.  
044             * Timestamp of row creation is taken into account when two rows with the same job number
045             * have the same effective date.
046             * 
047             * Assignments are NOT populated on this object.  We may want to consider removing 
048             * getAssignments().
049             * 
050             * @param principalId
051             * @param asOfDate
052             * @return
053             */
054        @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
055            public List<Job> getJobs(String principalId, Date asOfDate);
056            
057            /**
058             * Provides a job by specific job number, principal ID and as of Date combination. 
059             */
060        @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'jobNumber=' + #p1 + '|' + 'asOfDate=' + #p2")
061            public Job getJob(String principalId, Long jobNumber, Date asOfDate);
062            
063            /**
064             * Provides a job by specific job number, principal ID and as of Date combination, and check details will throw error if required. 
065             */
066        @Cacheable(value= Job.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'jobNumber=' + #p1 + '|' + 'asOfDate=' + #p2 + '|' + 'chkDetails=' + #p3")
067            public Job getJob(String principalId, Long jobNumber, Date asOfDate, boolean chkDetails);
068            
069            /**
070             * For a given principal ID, the job that is marked "primary" is returned 
071             * here.
072             * 
073             * @param principalId The principal under investigation
074             * @param asOfDate Run the request as of this date. 
075             * @return
076             */
077        @Cacheable(value= Job.CACHE_NAME, key="'{getPrimaryJob}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
078            public Job getPrimaryJob(String principalId, Date asOfDate);
079            
080            /**
081             * 
082             * @param positionNbr
083             * @param asOfDate
084             * @return
085             */
086        @Cacheable(value= Job.CACHE_NAME, key="'positionNbr=' + #p0 + '|' + 'asOfDate=' + #p1")
087            public List<Job> getActiveJobsForPosition(String positionNbr, Date asOfDate);
088            
089            /**
090             * 
091             * @param hrPayType
092             * @param asOfDate
093             * @return
094             */
095        @Cacheable(value= Job.CACHE_NAME, key="'hrPayType=' + #p0 + '|' + 'asOfDate=' + #p1")
096            public List<Job> getActiveJobsForPayType(String hrPayType, Date asOfDate);
097            
098            /**
099             * 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    }