001    /**
002     * Copyright 2004-2013 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.time.assignment.dao;
017    
018    import org.kuali.hr.time.assignment.Assignment;
019    
020    import java.sql.Date;
021    import java.util.List;
022    
023    public interface AssignmentDao {
024    
025            /**
026             * Returns all assignments for the provided principalId that are valid as of
027             * the specified payPeriodEndDate.
028             *
029             * @param principalId
030             * @param payPeriodEndDate
031             * @return
032             */
033            public List<Assignment> findAssignments(String principalId, Date asOfDate);
034            /**
035             * Save or update the given assignment
036             * @param assignment
037             */
038            public void saveOrUpdate(Assignment assignment);
039            /**
040             * Save of update the given list of assignments
041             * @param assignments
042             */
043            public void saveOrUpdate(List<Assignment> assignments);
044    
045            /**
046             * Delete an assignment
047             * @param assignment
048             */
049            public void delete(Assignment assignment);
050    
051            /**
052             * Get list of active assignments in a given work area as of a particular date
053             * @param workArea
054             * @param asOfDate
055             * @return
056             */
057            public List<Assignment> getActiveAssignmentsInWorkArea(Long workArea, Date asOfDate);
058    
059            public Assignment getAssignment(String tkAssignmentId);
060    
061        public Assignment getAssignment(Long job, Long workArea, Long task, Date asOfDate);
062    
063            public List<Assignment> getActiveAssignments(Date asOfDate);
064            
065            public Assignment getAssignment(String principalId, Long jobNumber, Long workArea, Long task, Date asOfDate);
066            
067            /**
068             * KPME-1129
069             * Get a list of active assignments based on principalId and jobNumber as of a particular date 
070             * @param principalId
071             * @param jobNumber
072             * @param asOfDate
073             * @return
074             */
075            public List<Assignment> getActiveAssignmentsForJob(String principalId, Long jobNumber, Date asOfDate);
076    
077        List<Assignment> findAssignmentsWithinPeriod(String principalId, Date startDate, Date endDate);
078    
079        List<Assignment> searchAssignments(Date fromEffdt, Date toEffdt, String principalId, String jobNumber,
080                                        String dept, String workArea, String active, String showHistory);
081        
082        public Assignment getMaxTimestampAssignment(String principalId);
083        
084        public List<String> getPrincipalIds(List<String> workAreaList, Date effdt, Date startDate, Date endDate);
085        
086        public List<Assignment> getAssignments(List<String> workAreaList, Date effdt, Date startDate, Date endDate);
087    }