1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.query

File QueryFilter.java

 

Coverage histogram

../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
1
1
1
76
12
1
1
1
1
1

Classes

Class Line # Actions
QueryFilter 42 1 0% 1 0
1.0100%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.query;
21   
22    import java.util.List;
23   
24    import org.xwiki.component.annotation.Role;
25   
26    /**
27    * Query Filter interface. A filter can be added to a query through {@link Query#addFilter(QueryFilter)}, it will be
28    * called by the {@link QueryExecutor} before the query is executed. Queries can be filtered during 2 stages:
29    * <ul>
30    * <li>Before the execution, by modifying the statement</li>
31    * <li>After the execution, by modifying list of results</li>
32    * </ul>
33    *
34    * An example of this is the {@link org.xwiki.query.internal.UniqueDocumentFilter} which transform statements in order
35    * to make them return distinct documents names and which also filters query results in order to return only those
36    * names.
37    *
38    * @version $Id: 2c801342044078fc8caab1fb94bbe93d6abf69f2 $
39    * @since 4.0RC1
40    */
41    @Role
 
42    public interface QueryFilter
43    {
44    /**
45    * Transform a query statement. The statement can be returned without modification.
46    *
47    * @param statement the query statement to transform.
48    * @param language the language of the query statement.
49    * @return the transformed statement.
50    */
51    String filterStatement(String statement, String language);
52   
53    /**
54    * Filter a list of query results. The result list can be returned without modification.
55    *
56    * @param results the original result list.
57    * @return a filtered result list.
58    */
59    List filterResults(List results);
60   
61    /**
62    * Transforms a query. The query can be returned without modification. This allows for example to also transform
63    * parameters.
64    * <p>
65    * Note: executes before {@link #filterStatement(String, String)}.
66    *
67    * @param query the query to transform
68    * @return the transformed query
69    *
70    * @since 8.4.5
71    * @since 9.3RC1
72    */
 
73  64580 toggle default Query filterQuery(Query query) {
74  64580 return query;
75    }
76    }