1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.wrap; |
21 |
|
|
22 |
|
import java.util.Collection; |
23 |
|
import java.util.HashMap; |
24 |
|
import java.util.Map; |
25 |
|
|
26 |
|
import org.xwiki.extension.Extension; |
27 |
|
import org.xwiki.extension.ExtensionAuthor; |
28 |
|
import org.xwiki.extension.ExtensionDependency; |
29 |
|
import org.xwiki.extension.ExtensionFile; |
30 |
|
import org.xwiki.extension.ExtensionId; |
31 |
|
import org.xwiki.extension.ExtensionIssueManagement; |
32 |
|
import org.xwiki.extension.ExtensionLicense; |
33 |
|
import org.xwiki.extension.ExtensionScm; |
34 |
|
import org.xwiki.extension.internal.converter.ExtensionIdConverter; |
35 |
|
import org.xwiki.extension.repository.ExtensionRepository; |
36 |
|
import org.xwiki.extension.repository.ExtensionRepositoryDescriptor; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
@param |
42 |
|
@version |
43 |
|
@since |
44 |
|
|
|
|
| 53.8% |
Uncovered Elements: 60 (130) |
Complexity: 46 |
Complexity Density: 0.71 |
|
45 |
|
public class WrappingExtension<E extends Extension> extends AbstractWrappingObject<E> implements Extension |
46 |
|
{ |
47 |
|
protected Map<String, Object> overwrites = new HashMap<>(); |
48 |
|
|
49 |
|
|
50 |
|
@param |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
6658 |
public WrappingExtension(E extension)... |
53 |
|
{ |
54 |
6658 |
super(extension); |
55 |
|
} |
56 |
|
|
57 |
|
|
58 |
|
@param@link |
59 |
|
@param |
60 |
|
@since |
61 |
|
@since |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
1 |
public void setOverwrite(String key, Object value)... |
64 |
|
{ |
65 |
1 |
this.overwrites.put(key, value); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
70 |
448 |
@Override... |
71 |
|
public <T> T get(String fieldName) |
72 |
|
{ |
73 |
447 |
if (this.overwrites.containsKey(fieldName)) { |
74 |
0 |
return (T) this.overwrites.get(fieldName); |
75 |
|
} |
76 |
|
|
77 |
448 |
return getWrapped().get(fieldName); |
78 |
|
} |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
8121 |
@Override... |
81 |
|
public ExtensionId getId() |
82 |
|
{ |
83 |
8121 |
return getWrapped().getId(); |
84 |
|
} |
85 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
111 |
@Override... |
87 |
|
@Deprecated |
88 |
|
public Collection<String> getFeatures() |
89 |
|
{ |
90 |
111 |
return ExtensionIdConverter.toStringList(getExtensionFeatures()); |
91 |
|
} |
92 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
93 |
502 |
@Override... |
94 |
|
public Collection<ExtensionId> getExtensionFeatures() |
95 |
|
{ |
96 |
502 |
if (this.overwrites.containsKey(Extension.FIELD_EXTENSIONFEATURES)) { |
97 |
0 |
return (Collection<ExtensionId>) this.overwrites.get(Extension.FIELD_EXTENSIONFEATURES); |
98 |
|
} |
99 |
|
|
100 |
502 |
return getWrapped().getExtensionFeatures(); |
101 |
|
} |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
8 |
@Override... |
104 |
|
public ExtensionId getExtensionFeature(String featureId) |
105 |
|
{ |
106 |
8 |
return getWrapped().getExtensionFeature(featureId); |
107 |
|
} |
108 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
109 |
88 |
@Override... |
110 |
|
public String getType() |
111 |
|
{ |
112 |
88 |
if (this.overwrites.containsKey(Extension.FIELD_TYPE)) { |
113 |
0 |
return (String) this.overwrites.get(Extension.FIELD_TYPE); |
114 |
|
} |
115 |
|
|
116 |
88 |
return getWrapped().getType(); |
117 |
|
} |
118 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
119 |
771 |
@Override... |
120 |
|
public String getName() |
121 |
|
{ |
122 |
771 |
if (this.overwrites.containsKey(Extension.FIELD_NAME)) { |
123 |
0 |
return (String) this.overwrites.get(Extension.FIELD_NAME); |
124 |
|
} |
125 |
|
|
126 |
771 |
return getWrapped().getName(); |
127 |
|
} |
128 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
129 |
124 |
@Override... |
130 |
|
public Collection<ExtensionLicense> getLicenses() |
131 |
|
{ |
132 |
124 |
if (this.overwrites.containsKey(Extension.FIELD_LICENSES)) { |
133 |
0 |
return (Collection<ExtensionLicense>) this.overwrites.get(Extension.FIELD_LICENSES); |
134 |
|
} |
135 |
|
|
136 |
124 |
return getWrapped().getLicenses(); |
137 |
|
} |
138 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
139 |
558 |
@Override... |
140 |
|
public String getSummary() |
141 |
|
{ |
142 |
558 |
if (this.overwrites.containsKey(Extension.FIELD_SUMMARY)) { |
143 |
0 |
return (String) this.overwrites.get(Extension.FIELD_SUMMARY); |
144 |
|
} |
145 |
|
|
146 |
558 |
return getWrapped().getSummary(); |
147 |
|
} |
148 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
149 |
4 |
@Override... |
150 |
|
public String getDescription() |
151 |
|
{ |
152 |
4 |
if (this.overwrites.containsKey(Extension.FIELD_DESCRIPTION)) { |
153 |
0 |
return (String) this.overwrites.get(Extension.FIELD_DESCRIPTION); |
154 |
|
} |
155 |
|
|
156 |
4 |
return getWrapped().getDescription(); |
157 |
|
} |
158 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
159 |
165 |
@Override... |
160 |
|
public String getWebSite() |
161 |
|
{ |
162 |
165 |
if (this.overwrites.containsKey(Extension.FIELD_WEBSITE)) { |
163 |
0 |
return (String) this.overwrites.get(Extension.FIELD_WEBSITE); |
164 |
|
} |
165 |
|
|
166 |
165 |
return getWrapped().getWebSite(); |
167 |
|
} |
168 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
169 |
500 |
@Override... |
170 |
|
public Collection<ExtensionAuthor> getAuthors() |
171 |
|
{ |
172 |
500 |
if (this.overwrites.containsKey(Extension.FIELD_AUTHORS)) { |
173 |
0 |
return (Collection<ExtensionAuthor>) this.overwrites.get(Extension.FIELD_AUTHORS); |
174 |
|
} |
175 |
|
|
176 |
500 |
return getWrapped().getAuthors(); |
177 |
|
} |
178 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
179 |
38 |
@Override... |
180 |
|
public Collection<String> getAllowedNamespaces() |
181 |
|
{ |
182 |
38 |
if (this.overwrites.containsKey(Extension.FIELD_ALLOWEDNAMESPACES)) { |
183 |
2 |
return (Collection<String>) this.overwrites.get(Extension.FIELD_ALLOWEDNAMESPACES); |
184 |
|
} |
185 |
|
|
186 |
36 |
return getWrapped().getAllowedNamespaces(); |
187 |
|
} |
188 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
189 |
157 |
@Override... |
190 |
|
public Collection<ExtensionDependency> getDependencies() |
191 |
|
{ |
192 |
157 |
if (this.overwrites.containsKey(Extension.FIELD_DEPENDENCIES)) { |
193 |
0 |
return (Collection<ExtensionDependency>) this.overwrites.get(Extension.FIELD_DEPENDENCIES); |
194 |
|
} |
195 |
|
|
196 |
157 |
return getWrapped().getDependencies(); |
197 |
|
} |
198 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
199 |
0 |
@Override... |
200 |
|
public Collection<ExtensionDependency> getManagedDependencies() |
201 |
|
{ |
202 |
0 |
if (this.overwrites.containsKey(Extension.FIELD_MANAGEDDEPENDENCIES)) { |
203 |
0 |
return (Collection<ExtensionDependency>) this.overwrites.get(Extension.FIELD_MANAGEDDEPENDENCIES); |
204 |
|
} |
205 |
|
|
206 |
0 |
return getWrapped().getManagedDependencies(); |
207 |
|
} |
208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
209 |
111 |
@Override... |
210 |
|
public ExtensionFile getFile() |
211 |
|
{ |
212 |
111 |
return getWrapped().getFile(); |
213 |
|
} |
214 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
215 |
469 |
@Override... |
216 |
|
public ExtensionRepository getRepository() |
217 |
|
{ |
218 |
469 |
return getWrapped().getRepository(); |
219 |
|
} |
220 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
221 |
172 |
@Override... |
222 |
|
public ExtensionScm getScm() |
223 |
|
{ |
224 |
172 |
if (this.overwrites.containsKey(Extension.FIELD_SCM)) { |
225 |
0 |
return (ExtensionScm) this.overwrites.get(Extension.FIELD_SCM); |
226 |
|
} |
227 |
|
|
228 |
172 |
return getWrapped().getScm(); |
229 |
|
} |
230 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
231 |
55 |
@Override... |
232 |
|
public ExtensionIssueManagement getIssueManagement() |
233 |
|
{ |
234 |
55 |
if (this.overwrites.containsKey(Extension.FIELD_ISSUEMANAGEMENT)) { |
235 |
0 |
return (ExtensionIssueManagement) this.overwrites.get(Extension.FIELD_ISSUEMANAGEMENT); |
236 |
|
} |
237 |
|
|
238 |
55 |
return getWrapped().getIssueManagement(); |
239 |
|
} |
240 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
241 |
0 |
@Override... |
242 |
|
public String getCategory() |
243 |
|
{ |
244 |
0 |
if (this.overwrites.containsKey(Extension.FIELD_CATEGORY)) { |
245 |
0 |
return (String) this.overwrites.get(Extension.FIELD_CATEGORY); |
246 |
|
} |
247 |
|
|
248 |
0 |
return getWrapped().getCategory(); |
249 |
|
} |
250 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
251 |
0 |
@Override... |
252 |
|
public Collection<ExtensionRepositoryDescriptor> getRepositories() |
253 |
|
{ |
254 |
0 |
if (this.overwrites.containsKey(Extension.FIELD_REPOSITORIES)) { |
255 |
0 |
return (Collection<ExtensionRepositoryDescriptor>) this.overwrites.get(Extension.FIELD_REPOSITORIES); |
256 |
|
} |
257 |
|
|
258 |
0 |
return getWrapped().getRepositories(); |
259 |
|
} |
260 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
261 |
0 |
@Override... |
262 |
|
public Map<String, Object> getProperties() |
263 |
|
{ |
264 |
0 |
if (this.overwrites.containsKey(Extension.FIELD_PROPERTIES)) { |
265 |
0 |
return (Map<String, Object>) this.overwrites.get(Extension.FIELD_PROPERTIES); |
266 |
|
} |
267 |
|
|
268 |
0 |
return getWrapped().getProperties(); |
269 |
|
} |
270 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
271 |
0 |
@Override... |
272 |
|
public <T> T getProperty(String key) |
273 |
|
{ |
274 |
0 |
if (this.overwrites.containsKey(Extension.FIELD_PROPERTIES + '_' + key)) { |
275 |
0 |
return (T) this.overwrites.get(Extension.FIELD_PROPERTIES + '_' + key); |
276 |
|
} |
277 |
|
|
278 |
0 |
return getWrapped().getProperty(key); |
279 |
|
} |
280 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
281 |
0 |
@Override... |
282 |
|
public <T> T getProperty(String key, T def) |
283 |
|
{ |
284 |
0 |
if (this.overwrites.containsKey(Extension.FIELD_PROPERTIES + '_' + key)) { |
285 |
0 |
return (T) this.overwrites.get(Extension.FIELD_PROPERTIES + '_' + key); |
286 |
|
} |
287 |
|
|
288 |
0 |
return getWrapped().getProperty(key, def); |
289 |
|
} |
290 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
291 |
6 |
@Override... |
292 |
|
public int compareTo(Extension o) |
293 |
|
{ |
294 |
6 |
return getWrapped().compareTo(o); |
295 |
|
} |
296 |
|
} |