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

File SafeRatableExtensionRepository.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart3.png
80% of files have more coverage

Code metrics

0
4
4
1
72
33
4
1
1
4
1

Classes

Class Line # Actions
SafeRatableExtensionRepository 38 4 0% 4 6
0.2525%
 

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.ExtensionId;
24    import org.xwiki.extension.ResolveException;
25    import org.xwiki.extension.rating.ExtensionRating;
26    import org.xwiki.extension.repository.ExtensionRepository;
27    import org.xwiki.extension.repository.rating.Ratable;
28    import org.xwiki.extension.version.Version;
29    import org.xwiki.script.internal.safe.ScriptSafeProvider;
30   
31    /**
32    * Provide a public script access to a ratable extension repository.
33    *
34    * @param <T> the extension type
35    * @version $Id: b5e2375db56a498685ba508e7ee359d060b78fe7 $
36    * @since 6.4M3
37    */
 
38    public class SafeRatableExtensionRepository<T extends ExtensionRepository> extends SafeExtensionRepository<T>
39    implements Ratable
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 SafeRatableExtensionRepository(T repository, ScriptSafeProvider<?> safeProvider, Execution execution,
48    boolean hasProgrammingRight)
49    {
50  97 super(repository, safeProvider, execution, hasProgrammingRight);
51    }
52   
53    // Ratable
54   
 
55  0 toggle @Override
56    public ExtensionRating getRating(ExtensionId extensionId) throws ResolveException
57    {
58  0 return safe(((Ratable) getWrapped()).getRating(extensionId));
59    }
60   
 
61  0 toggle @Override
62    public ExtensionRating getRating(String extensionId, Version extensionVersion) throws ResolveException
63    {
64  0 return safe(((Ratable) getWrapped()).getRating(extensionId, extensionVersion));
65    }
66   
 
67  0 toggle @Override
68    public ExtensionRating getRating(String extensionId, String extensionVersion) throws ResolveException
69    {
70  0 return safe(((Ratable) getWrapped()).getRating(extensionId, extensionVersion));
71    }
72    }