1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21
22 package org.opencastproject.list.api;
23
24 import java.util.List;
25 import java.util.Optional;
26
27 /**
28 * Query for the resource list
29 */
30 public interface ResourceListQuery {
31
32 /**
33 * Returns all the {@link ResourceListFilter} set for the query.
34 *
35 * @return all the query filters
36 */
37 List<ResourceListFilter<?>> getFilters();
38
39 /**
40 * Returns all the available {@link ResourceListFilter} filters with this query. The objects returned in the list are
41 * simple instance without any filter value set.
42 *
43 * @return all the available filters
44 */
45 List<ResourceListFilter<?>> getAvailableFilters();
46
47 /**
48 * Returns the filter with the given name
49 *
50 * @param name
51 *
52 * @return the query filter or null if the filter does not exist
53 */
54 ResourceListFilter<?> getFilter(String name);
55
56 /**
57 * Returns the limit for the resource query
58 *
59 * @return the list limit
60 */
61 Optional<Integer> getLimit();
62
63 /**
64 * Returns the offset for the resource query
65 *
66 * @return the list offset
67 */
68 Optional<Integer> getOffset();
69
70 /**
71 * Returns the name of the field by which the list should be sorted
72 *
73 * @return the name of the field to use to sort the list
74 */
75 Optional<String> getSortBy();
76
77 /**
78 * Returns if the given filter is or not set
79 *
80 * @param name
81 * the filter name
82 * @return true if set
83 */
84 Boolean hasFilter(String name);
85
86 }