001/**
002 * Copyright 2005-2016 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 */
016package org.kuali.rice.krad.service;
017
018import org.kuali.rice.krad.bo.InactivatableFromTo;
019
020import java.util.Date;
021import java.util.List;
022import java.util.Map;
023
024
025/**
026 * Provides methods for retrieval of business objects implementing InactivateableFromTo and needing effective dating logic
027 * 
028 * @see org.kuali.rice.kns.bo.InactivateableFromTo
029 */
030public interface InactivateableFromToService {
031
032        /**
033         * Performs search on given class and criteria and returns only results that active based on the active to/from dates and the current
034         * date
035         * 
036         * @param clazz
037         *            - InactivateableFromTo class to search
038         * @param fieldValues
039         *            - Search key values
040         * @return List of InactivateableFromTo instances that match search criteria and are active
041         */
042        public List<InactivatableFromTo> findMatchingActive(Class<? extends InactivatableFromTo> clazz, Map fieldValues);
043
044        /**
045         * Performs search on given class and criteria and returns only results that active based on the active to/from dates and the given
046         * active as of date
047         * 
048         * @param clazz
049         *            - InactivateableFromTo class to search
050         * @param fieldValues
051         *            - Search key values
052         * @param activeAsOfDate
053         *            - Date to compare to for determining active status
054         * @return List of InactivateableFromTo instances that match search criteria and are active as of the given date
055         */
056        public List<InactivatableFromTo> findMatchingActiveAsOfDate(Class<? extends InactivatableFromTo> clazz,
057                        Map fieldValues, Date activeAsOfDate);
058
059        /**
060         * Removes instances from the given list that are inactive based on the current date
061         * 
062         * @param filterList
063         *            - List of InactivateableFromTo instances to filter
064         * @return List of InactivateableFromTo instances from the given list that are active as of the current date
065         */
066        public List<InactivatableFromTo> filterOutNonActive(List<InactivatableFromTo> filterList);
067
068        /**
069         * Removes instances from the given list that are inactive based on the given date
070         * 
071         * @param filterList
072         *            - List of InactivateableFromTo instances to filter
073         * @param activeAsOfDate
074         *            - Date to compare to for determining active status
075         * @return List of InactivateableFromTo instances from the given list that are active as of the given date
076         */
077        public List<InactivatableFromTo> filterOutNonActive(List<InactivatableFromTo> filterList, Date activeAsOfDate);
078
079        /**
080         * Performs search on given class and criteria and returns that are active and most current. That is if two records are active the more
081         * current one will be the one with a later active begin date
082         * 
083         * @param clazz
084         *            - InactivateableFromTo class to search
085         * @param fieldValues
086         *            - Search key values
087         * @return List of InactivateableFromTo instances that match search criteria and are current
088         */
089        public List<InactivatableFromTo> findMatchingCurrent(Class<? extends InactivatableFromTo> clazz,
090                        Map fieldValues);
091
092        /**
093         * Performs search on given class and criteria and returns that are active and most current based on the given date. That is if two
094         * records are active the more current one will be the one with a later active begin date
095         * 
096         * @param clazz
097         *            - InactivateableFromTo class to search
098         * @param fieldValues
099         *            - Search key values
100         * @param currentAsOfDate
101         *            - Date to compare to for determining active and current status
102         * @return List of InactivateableFromTo instances that match search criteria and are current
103         */
104        public List<InactivatableFromTo> findMatchingCurrent(Class<? extends InactivatableFromTo> clazz,
105                        Map fieldValues, Date currentAsOfDate);
106
107        /**
108         * Removes instances from the given list that are not current based on the current date
109         * 
110         * @param filterList
111         *            - List of InactivateableFromTo instances to filter
112         * @return List of InactivateableFromTo instances from the given list that are current as of the current date
113         */
114        public List<InactivatableFromTo> filterOutNonCurrent(List<InactivatableFromTo> filterList);
115
116        /**
117         * Removes instances from the given list that are not current based on the given date
118         * 
119         * @param filterList
120         *            - List of InactivateableFromTo instances to filter
121         * @param currentAsOfDate
122         *            - Date to compare to for determining active and current status
123         * @return List of InactivateableFromTo instances from the given list that are current as of the given date
124         */
125        public List<InactivatableFromTo> filterOutNonCurrent(List<InactivatableFromTo> filterList, Date currentAsOfDate);
126
127}