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

File AbstractRemoteExtension.java

 

Coverage histogram

../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
9
5
1
86
36
6
0.67
1.8
5
1.2

Classes

Class Line # Actions
AbstractRemoteExtension 33 9 0% 6 4
0.7142857371.4%
 

Contributing tests

This file is covered by 12 tests. .

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;
21   
22    import org.xwiki.extension.rating.RatingExtension;
23    import org.xwiki.extension.repository.ExtensionRepository;
24    import org.xwiki.stability.Unstable;
25   
26    /**
27    * Base class for {@link RatingExtension} implementations.
28    *
29    * @version $Id: 599e70c80fbfe6514e8fc7d1aa8e6a56d614b42b $
30    * @since 8.3RC1
31    */
32    @Unstable
 
33    public abstract class AbstractRemoteExtension extends AbstractExtension implements RemoteExtension
34    {
35    /**
36    * @see #isRecommended()
37    */
38    protected boolean recommended;
39   
40    /**
41    * @param repository the repository where this extension comes from
42    * @param id the extension identifier
43    * @param type the extension type
44    */
 
45  91 toggle public AbstractRemoteExtension(ExtensionRepository repository, ExtensionId id, String type)
46    {
47  91 super(repository, id, type);
48    }
49   
50    /**
51    * Create new extension descriptor by copying provided one.
52    *
53    * @param repository the repository where this extension comes from
54    * @param extension the extension to copy
55    */
 
56  0 toggle public AbstractRemoteExtension(ExtensionRepository repository, Extension extension)
57    {
58  0 super(repository, extension);
59    }
60   
 
61  45 toggle @Override
62    public boolean isRecommended()
63    {
64  45 return this.recommended;
65    }
66   
67    /**
68    * @param recommended true if the extension is recommended
69    * @see #isRecommended()
70    */
 
71  59 toggle public void setRecommended(boolean recommended)
72    {
73  59 this.recommended = recommended;
74    }
75   
 
76  11 toggle @Override
77    public <T> T get(String fieldName)
78    {
79  11 switch (fieldName.toLowerCase()) {
80  0 case FIELD_RECOMMENDED:
81  0 return (T) (Boolean) isRecommended();
82  11 default:
83  11 return super.get(fieldName);
84    }
85    }
86    }