View Javadoc
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 org.opencastproject.util.data.Option;
25  
26  import java.util.List;
27  
28  /**
29   * Query for the resource list
30   */
31  public interface ResourceListQuery {
32  
33    /**
34     * Returns all the {@link ResourceListFilter} set for the query.
35     * 
36     * @return all the query filters
37     */
38    List<ResourceListFilter<?>> getFilters();
39  
40    /**
41     * Returns all the available {@link ResourceListFilter} filters with this query. The objects returned in the list are
42     * simple instance without any filter value set.
43     * 
44     * @return all the available filters
45     */
46    List<ResourceListFilter<?>> getAvailableFilters();
47  
48    /**
49     * Returns the filter with the given name
50     *
51     * @param name
52     *
53     * @return the query filter or null if the filter does not exist
54     */
55    ResourceListFilter<?> getFilter(String name);
56  
57    /**
58     * Returns the limit for the resource query
59     * 
60     * @return the list limit
61     */
62    Option<Integer> getLimit();
63  
64    /**
65     * Returns the offset for the resource query
66     * 
67     * @return the list offset
68     */
69    Option<Integer> getOffset();
70  
71    /**
72     * Returns the name of the field by which the list should be sorted
73     * 
74     * @return the name of the field to use to sort the list
75     */
76    Option<String> getSortBy();
77  
78    /**
79     * Returns if the given filter is or not set
80     * 
81     * @param name
82     *          the filter name
83     * @return true if set
84     */
85    Boolean hasFilter(String name);
86  
87  }