1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.script.internal.safe

File SafeAdvancedSearchableRatableExtensionRepository.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart2.png
81% of files have more coverage

Code metrics

0
8
4
1
80
39
5
0.62
2
4
1.25

Classes

Class Line # Actions
SafeAdvancedSearchableRatableExtensionRepository 38 8 0% 5 10
0.1666666716.7%
 

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.extension.script.internal.safe;
21   
22    import org.xwiki.context.Execution;
23    import org.xwiki.extension.Extension;
24    import org.xwiki.extension.repository.ExtensionRepository;
25    import org.xwiki.extension.repository.result.IterableResult;
26    import org.xwiki.extension.repository.search.AdvancedSearchable;
27    import org.xwiki.extension.repository.search.ExtensionQuery;
28    import org.xwiki.extension.repository.search.SearchException;
29    import org.xwiki.script.internal.safe.ScriptSafeProvider;
30   
31    /**
32    * Provide a public script access to a {@link AdvancedSearchable} ratable extension repository.
33    *
34    * @param <T>
35    * @version $Id: abd47b2aa6a2f12a0c54d58a4248a616f9ad7257 $
36    * @since 7.0M2
37    */
 
38    public class SafeAdvancedSearchableRatableExtensionRepository<T extends ExtensionRepository> extends
39    SafeSearchableRatableExtensionRepository<T> implements AdvancedSearchable
40    {
41    /**
42    * @param repository wrapped repository
43    * @param safeProvider the provider of instances safe for public scripts
44    * @param execution provide access to the current context
45    * @param hasProgrammingRight does the caller script has programming right
46    */
 
47  97 toggle public SafeAdvancedSearchableRatableExtensionRepository(T repository, ScriptSafeProvider<?> safeProvider,
48    Execution execution, boolean hasProgrammingRight)
49    {
50  97 super(repository, safeProvider, execution, hasProgrammingRight);
51    }
52   
53    // AdvancedSearchable
54   
 
55  0 toggle @Override
56    public boolean isFilterable()
57    {
58  0 return ((AdvancedSearchable) getWrapped()).isFilterable();
59    }
60   
 
61  0 toggle @Override
62    public boolean isSortable()
63    {
64  0 return ((AdvancedSearchable) getWrapped()).isSortable();
65    }
66   
 
67  0 toggle @Override
68    public IterableResult<Extension> search(ExtensionQuery query) throws SearchException
69    {
70  0 setError(null);
71   
72  0 try {
73  0 return safe(((AdvancedSearchable) getWrapped()).search(query));
74    } catch (Exception e) {
75  0 setError(e);
76    }
77   
78  0 return null;
79    }
80    }