001    /**
002     * Copyright 2005-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.rice.krad.service;
017    
018    import org.kuali.rice.krad.bo.BusinessObject;
019    
020    import java.util.Collection;
021    import java.util.Map;
022    
023    
024    /**
025     * This class provides collection retrievals to populate key value pairs of business objects.
026     * 
027     * 
028     */
029    public interface KeyValuesService {
030    
031        /**
032         * Retrieves a collection of business objects populated with data, such that each record in the database populates a new object
033         * instance. This will only retrieve business objects by class type.
034         * 
035         * @param clazz
036         * @return
037         */
038        public <T extends BusinessObject> Collection<T> findAll(Class<T> clazz);
039    
040        /**
041         * Retrieves a collection of business objects populated with data, such that each record in the database populates a new object
042         * instance. This will only retrieve business objects by class type. Performs a sort on the result collection on the given sort
043         * field.
044         * 
045         * @param clazz
046         * @param sortField - name of the field in the class to sort results by
047         * @param sortAscending - boolean indicating whether to sort ascending or descending
048         * @return
049         */
050        public <T extends BusinessObject> Collection<T> findAllOrderBy(Class<T> clazz, String sortField, boolean sortAscending);
051    
052        /**
053         * This method retrieves a collection of business objects populated with data, such that each record in the database populates a
054         * new object instance. This will retrieve business objects by class type and also by criteria passed in as key-value pairs,
055         * specifically attribute name and its expected value.
056         * 
057         * @param clazz
058         * @param fieldValues
059         * @return
060         */
061        public <T extends BusinessObject> Collection<T> findMatching(Class<T> clazz, Map<String, Object> fieldValues);
062        
063        /**
064         * Retrieves a collection of business objects populated with data, such that each record in the database populates a new object
065         * instance. This will only retrieve business objects by class type.
066         * 
067         * @param clazz
068         * @return
069         */
070        public <T extends BusinessObject> Collection<T> findAllInactive(Class<T> clazz);
071    
072    }