1 /**
2 * Copyright 2005-2012 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.rice.krad.service;
17
18 import org.kuali.rice.krad.bo.BusinessObject;
19
20 import java.util.Collection;
21 import java.util.Map;
22
23
24 /**
25 * This class provides collection retrievals to populate key value pairs of business objects.
26 *
27 *
28 */
29 public interface KeyValuesService {
30
31 /**
32 * Retrieves a collection of business objects populated with data, such that each record in the database populates a new object
33 * instance. This will only retrieve business objects by class type.
34 *
35 * @param clazz
36 * @return
37 */
38 public <T extends BusinessObject> Collection<T> findAll(Class<T> clazz);
39
40 /**
41 * Retrieves a collection of business objects populated with data, such that each record in the database populates a new object
42 * instance. This will only retrieve business objects by class type. Performs a sort on the result collection on the given sort
43 * field.
44 *
45 * @param clazz
46 * @param sortField - name of the field in the class to sort results by
47 * @param sortAscending - boolean indicating whether to sort ascending or descending
48 * @return
49 */
50 public <T extends BusinessObject> Collection<T> findAllOrderBy(Class<T> clazz, String sortField, boolean sortAscending);
51
52 /**
53 * This method retrieves a collection of business objects populated with data, such that each record in the database populates a
54 * new object instance. This will retrieve business objects by class type and also by criteria passed in as key-value pairs,
55 * specifically attribute name and its expected value.
56 *
57 * @param clazz
58 * @param fieldValues
59 * @return
60 */
61 public <T extends BusinessObject> Collection<T> findMatching(Class<T> clazz, Map<String, Object> fieldValues);
62
63 /**
64 * Retrieves a collection of business objects populated with data, such that each record in the database populates a new object
65 * instance. This will only retrieve business objects by class type.
66 *
67 * @param clazz
68 * @return
69 */
70 public <T extends BusinessObject> Collection<T> findAllInactive(Class<T> clazz);
71
72 }