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.kew.api.document.search;
17
18 import java.util.List;
19
20 /**
21 * Defines the contract for results returned from a document search. A document search returns multiple results, each
22 * one representing a document and it's document attributes. The results additional include information about the
23 * criteria that was used to execute the search, as well as whether or not it was modified after it was submitted for
24 * execution of the document search.
25 *
26 * <p>Additionally, results from the document search might be filtered for a particular principal for security purposes.
27 * In these cases, the document search results include information on the number of results that were filtered out
28 * because the principal executing the search did not have permission to view them.</p>
29 *
30 * @author Kuali Rice Team (rice.collab@kuali.org)
31 */
32 public interface DocumentSearchResultsContract {
33
34 /**
35 * Returns the unmodifiable list of search results. Each of these result objects represents a document returned
36 * from the search.
37 *
38 * @return an unmodifiable list of search results, will never be null but may be null
39 */
40 List<? extends DocumentSearchResultContract> getSearchResults();
41
42 /**
43 * Returns the criteria that was used to execute the search. This may not be the same criteria that was submitted
44 * to the document search api since it is possible for criteria to be modified by backend processing of the
45 * submitted criteria. See {@link #isCriteriaModified()} for more information.
46 *
47 * @return the criteria used to execute this search, will never be null
48 */
49 DocumentSearchCriteriaContract getCriteria();
50
51 /**
52 * Returns true if the criteria on this search result was modified from the original criteria submitted by the
53 * executor of the document search. This may happen in cases where the document search implementation modifies the
54 * given criteria. This may be possible through document search customization hooks, or may happen as part of a
55 * process of "defaulting" certain portions of the criteria.
56 *
57 * @return a boolean indicating whether or not the criteria was modified from it's original form prior to search
58 * execution
59 */
60 boolean isCriteriaModified();
61
62 /**
63 * Returns true if the results of the search returned more rows then the document search framework is allowed to
64 * return back to the caller of the api. The implementation of the document search is permitted to cap the number
65 * of results returned and a result cap can also be specified on the criteria itself.
66 *
67 * @return true if there are more results available for the requested search then can be included in the list of
68 * results
69 */
70 boolean isOverThreshold();
71
72 /**
73 * Return the number of results that matched the criteria but are not included on this results instance because they
74 * principal executing the document search did not have permissions to view them.
75 *
76 * @return the number of results that were filtered for security reasons
77 */
78 int getNumberOfSecurityFilteredResults();
79
80 }