| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.extension; |
| 21 |
|
|
| 22 |
|
import java.util.ArrayList; |
| 23 |
|
import java.util.Collection; |
| 24 |
|
import java.util.Collections; |
| 25 |
|
import java.util.LinkedHashMap; |
| 26 |
|
import java.util.LinkedHashSet; |
| 27 |
|
import java.util.List; |
| 28 |
|
import java.util.Map; |
| 29 |
|
import java.util.Set; |
| 30 |
|
import java.util.concurrent.locks.ReentrantLock; |
| 31 |
|
|
| 32 |
|
import org.apache.commons.lang3.ObjectUtils; |
| 33 |
|
import org.xwiki.extension.internal.converter.ExtensionIdConverter; |
| 34 |
|
import org.xwiki.extension.repository.ExtensionRepository; |
| 35 |
|
import org.xwiki.extension.repository.ExtensionRepositoryDescriptor; |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
@link |
| 39 |
|
|
| 40 |
|
@version |
| 41 |
|
@since |
| 42 |
|
|
| |
|
| 87.1% |
Uncovered Elements: 36 (280) |
Complexity: 109 |
Complexity Density: 0.63 |
|
| 43 |
|
public abstract class AbstractExtension implements MutableExtension |
| 44 |
|
{ |
| 45 |
|
|
| 46 |
|
@see |
| 47 |
|
|
| 48 |
|
protected ExtensionId id; |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@see |
| 52 |
|
@deprecated@link |
| 53 |
|
|
| 54 |
|
@Deprecated |
| 55 |
|
protected Set<String> features; |
| 56 |
|
|
| 57 |
|
|
| 58 |
|
@see |
| 59 |
|
|
| 60 |
|
protected Map<String, ExtensionId> featuresMap; |
| 61 |
|
|
| 62 |
|
|
| 63 |
|
@see |
| 64 |
|
|
| 65 |
|
protected String type; |
| 66 |
|
|
| 67 |
|
|
| 68 |
|
@see |
| 69 |
|
|
| 70 |
|
protected String name; |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
@see |
| 74 |
|
|
| 75 |
|
protected List<ExtensionLicense> licenses; |
| 76 |
|
|
| 77 |
|
|
| 78 |
|
@see |
| 79 |
|
|
| 80 |
|
protected String summary; |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
@see |
| 84 |
|
|
| 85 |
|
protected String description; |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
@see |
| 89 |
|
|
| 90 |
|
protected List<ExtensionAuthor> authors; |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
@see |
| 94 |
|
|
| 95 |
|
protected String website; |
| 96 |
|
|
| 97 |
|
|
| 98 |
|
@see |
| 99 |
|
|
| 100 |
|
protected Set<String> allowedNamespaces; |
| 101 |
|
|
| 102 |
|
|
| 103 |
|
@see |
| 104 |
|
|
| 105 |
|
protected ExtensionRepository repository; |
| 106 |
|
|
| 107 |
|
|
| 108 |
|
@see |
| 109 |
|
|
| 110 |
|
protected Map<String, Object> properties; |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
| 115 |
|
protected ReentrantLock propertiesLock = new ReentrantLock(); |
| 116 |
|
|
| 117 |
|
|
| 118 |
|
@see |
| 119 |
|
|
| 120 |
|
protected List<ExtensionDependency> dependencies; |
| 121 |
|
|
| 122 |
|
|
| 123 |
|
@see |
| 124 |
|
@since |
| 125 |
|
|
| 126 |
|
protected List<ExtensionDependency> managedDependencies; |
| 127 |
|
|
| 128 |
|
|
| 129 |
|
@see |
| 130 |
|
|
| 131 |
|
protected ExtensionScm scm; |
| 132 |
|
|
| 133 |
|
|
| 134 |
|
@see |
| 135 |
|
|
| 136 |
|
protected ExtensionIssueManagement issueManagement; |
| 137 |
|
|
| 138 |
|
|
| 139 |
|
@see |
| 140 |
|
|
| 141 |
|
protected String category; |
| 142 |
|
|
| 143 |
|
|
| 144 |
|
@see |
| 145 |
|
|
| 146 |
|
protected List<ExtensionRepositoryDescriptor> repositories; |
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
protected ExtensionFile file; |
| 152 |
|
|
| 153 |
|
|
| 154 |
|
@param |
| 155 |
|
@param |
| 156 |
|
@param |
| 157 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 158 |
52825 |
public AbstractExtension(ExtensionRepository repository, ExtensionId id, String type)... |
| 159 |
|
{ |
| 160 |
52825 |
this.repository = repository; |
| 161 |
|
|
| 162 |
52825 |
this.id = id; |
| 163 |
52825 |
this.type = type; |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
|
| 167 |
|
|
| 168 |
|
|
| 169 |
|
@param |
| 170 |
|
@param |
| 171 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 172 |
12803 |
public AbstractExtension(ExtensionRepository repository, Extension extension)... |
| 173 |
|
{ |
| 174 |
12803 |
this(repository, extension.getId(), extension.getType()); |
| 175 |
|
|
| 176 |
12803 |
set(extension); |
| 177 |
|
} |
| 178 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
|
| 179 |
12822 |
@Override... |
| 180 |
|
public void set(Extension extension) |
| 181 |
|
{ |
| 182 |
12822 |
setName(extension.getName()); |
| 183 |
12822 |
setDescription(extension.getDescription()); |
| 184 |
12822 |
setAuthors(extension.getAuthors()); |
| 185 |
12822 |
setWebsite(extension.getWebSite()); |
| 186 |
12822 |
setLicenses(extension.getLicenses()); |
| 187 |
12822 |
setSummary(extension.getSummary()); |
| 188 |
12822 |
setIssueManagement(extension.getIssueManagement()); |
| 189 |
12822 |
setScm(extension.getScm()); |
| 190 |
12822 |
setCategory(extension.getCategory()); |
| 191 |
12822 |
setExtensionFeatures(extension.getExtensionFeatures()); |
| 192 |
12822 |
setAllowedNamespaces(extension.getAllowedNamespaces()); |
| 193 |
|
|
| 194 |
12822 |
setDependencies(extension.getDependencies()); |
| 195 |
12822 |
setManagedDependencies(extension.getManagedDependencies()); |
| 196 |
|
|
| 197 |
12822 |
setProperties(extension.getProperties()); |
| 198 |
|
} |
| 199 |
|
|
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| 203 |
|
@param |
| 204 |
|
@return |
| 205 |
|
|
| |
|
| 34.9% |
Uncovered Elements: 28 (43) |
Complexity: 24 |
Complexity Density: 0.56 |
|
| 206 |
541 |
@Override... |
| 207 |
|
public <T> T get(String fieldName) |
| 208 |
|
{ |
| 209 |
541 |
switch (fieldName.toLowerCase()) { |
| 210 |
1 |
case FIELD_REPOSITORY: |
| 211 |
1 |
return (T) getRepository(); |
| 212 |
58 |
case FIELD_ID: |
| 213 |
58 |
return (T) getId().getId(); |
| 214 |
1 |
case FIELD_VERSION: |
| 215 |
1 |
return (T) getId().getVersion(); |
| 216 |
0 |
case FIELD_FEATURE: |
| 217 |
0 |
case FIELD_FEATURES: |
| 218 |
0 |
return (T) ExtensionIdConverter.toStringList(getExtensionFeatures()); |
| 219 |
0 |
case FIELD_EXTENSIONFEATURE: |
| 220 |
0 |
case FIELD_EXTENSIONFEATURES: |
| 221 |
0 |
return (T) getExtensionFeatures(); |
| 222 |
0 |
case FIELD_SUMMARY: |
| 223 |
0 |
return (T) getSummary(); |
| 224 |
0 |
case FIELD_DESCRIPTION: |
| 225 |
0 |
return (T) getDescription(); |
| 226 |
0 |
case FIELD_AUTHOR: |
| 227 |
0 |
case FIELD_AUTHORS: |
| 228 |
0 |
return (T) getAuthors(); |
| 229 |
15 |
case FIELD_CATEGORY: |
| 230 |
15 |
return (T) getCategory(); |
| 231 |
0 |
case FIELD_LICENSE: |
| 232 |
0 |
case FIELD_LICENSES: |
| 233 |
0 |
return (T) getLicenses(); |
| 234 |
0 |
case FIELD_NAME: |
| 235 |
0 |
return (T) getName(); |
| 236 |
1 |
case FIELD_TYPE: |
| 237 |
1 |
return (T) getType(); |
| 238 |
444 |
case FIELD_WEBSITE: |
| 239 |
444 |
return (T) getWebSite(); |
| 240 |
0 |
case FIELD_NAMESPACES: |
| 241 |
0 |
case FIELD_ALLOWEDNAMESPACE: |
| 242 |
0 |
case FIELD_ALLOWEDNAMESPACES: |
| 243 |
0 |
return (T) getAllowedNamespaces(); |
| 244 |
0 |
case FIELD_SCM: |
| 245 |
0 |
return (T) getScm(); |
| 246 |
0 |
case FIELD_REPOSITORIES: |
| 247 |
0 |
return (T) getRepositories(); |
| 248 |
0 |
case FIELD_PROPERTIES: |
| 249 |
0 |
return (T) getProperties(); |
| 250 |
|
|
| 251 |
21 |
default: |
| 252 |
|
|
| 253 |
21 |
return getProperty(fieldName); |
| 254 |
|
} |
| 255 |
|
} |
| 256 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 257 |
192890 |
@Override... |
| 258 |
|
public ExtensionId getId() |
| 259 |
|
{ |
| 260 |
192890 |
return this.id; |
| 261 |
|
} |
| 262 |
|
|
| 263 |
|
|
| 264 |
|
@param |
| 265 |
|
@see |
| 266 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 267 |
51 |
protected void setId(ExtensionId id)... |
| 268 |
|
{ |
| 269 |
51 |
this.id = id; |
| 270 |
|
} |
| 271 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 272 |
15810 |
@Override... |
| 273 |
|
@Deprecated |
| 274 |
|
public Collection<String> getFeatures() |
| 275 |
|
{ |
| 276 |
15810 |
return this.features != null ? this.features : Collections.<String>emptyList(); |
| 277 |
|
} |
| 278 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 279 |
370 |
@Override... |
| 280 |
|
@Deprecated |
| 281 |
|
public void setFeatures(Collection<String> features) |
| 282 |
|
{ |
| 283 |
370 |
List<ExtensionId> extensionFeatures = new ArrayList<ExtensionId>(features.size()); |
| 284 |
370 |
for (String feature : features) { |
| 285 |
371 |
extensionFeatures.add(new ExtensionId(feature, getId().getVersion())); |
| 286 |
|
} |
| 287 |
|
|
| 288 |
370 |
setExtensionFeatures(extensionFeatures); |
| 289 |
|
} |
| 290 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 291 |
2 |
@Override... |
| 292 |
|
@Deprecated |
| 293 |
|
public void addFeature(String feature) |
| 294 |
|
{ |
| 295 |
2 |
addExtensionFeature(new ExtensionId(feature, getId().getVersion())); |
| 296 |
|
} |
| 297 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 298 |
61262 |
@Override... |
| 299 |
|
public Collection<ExtensionId> getExtensionFeatures() |
| 300 |
|
{ |
| 301 |
61262 |
return this.featuresMap != null ? this.featuresMap.values() : Collections.<ExtensionId>emptyList(); |
| 302 |
|
} |
| 303 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 304 |
1357 |
@Override... |
| 305 |
|
public ExtensionId getExtensionFeature(String featureId) |
| 306 |
|
{ |
| 307 |
1357 |
ExtensionId feature = null; |
| 308 |
|
|
| 309 |
|
|
| 310 |
1357 |
if (this.featuresMap != null) { |
| 311 |
1327 |
feature = this.featuresMap.get(featureId); |
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
|
| 315 |
1357 |
if (feature == null && featureId.equals(getId().getId())) { |
| 316 |
1209 |
feature = getId(); |
| 317 |
|
} |
| 318 |
|
|
| 319 |
1357 |
return feature; |
| 320 |
|
} |
| 321 |
|
|
| 322 |
|
|
| 323 |
|
@since |
| 324 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 325 |
14182 |
@Override... |
| 326 |
|
public void setExtensionFeatures(Collection<ExtensionId> features) |
| 327 |
|
{ |
| 328 |
14182 |
Map<String, ExtensionId> map = new LinkedHashMap<>(); |
| 329 |
14182 |
for (ExtensionId feature : features) { |
| 330 |
2470 |
map.put(feature.getId(), feature); |
| 331 |
|
} |
| 332 |
|
|
| 333 |
14182 |
setFeatureMap(map); |
| 334 |
|
} |
| 335 |
|
|
| 336 |
|
|
| 337 |
|
@since |
| 338 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 339 |
496 |
@Override... |
| 340 |
|
public void addExtensionFeature(ExtensionId feature) |
| 341 |
|
{ |
| 342 |
496 |
Map<String, ExtensionId> map = this.featuresMap != null |
| 343 |
|
? new LinkedHashMap<String, ExtensionId>(this.featuresMap) : new LinkedHashMap<String, ExtensionId>(); |
| 344 |
496 |
map.put(feature.getId(), feature); |
| 345 |
|
|
| 346 |
496 |
setFeatureMap(map); |
| 347 |
|
} |
| 348 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 349 |
14678 |
private void setFeatureMap(Map<String, ExtensionId> map)... |
| 350 |
|
{ |
| 351 |
14678 |
this.featuresMap = Collections.unmodifiableMap(map); |
| 352 |
|
|
| 353 |
|
|
| 354 |
14678 |
Set<String> list = new LinkedHashSet<String>(this.featuresMap.size()); |
| 355 |
14678 |
for (ExtensionId extensionId : this.featuresMap.values()) { |
| 356 |
3007 |
list.add(extensionId.getId()); |
| 357 |
|
} |
| 358 |
14678 |
this.features = Collections.unmodifiableSet(list); |
| 359 |
|
} |
| 360 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 361 |
31696 |
@Override... |
| 362 |
|
public String getType() |
| 363 |
|
{ |
| 364 |
31696 |
return this.type; |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
|
| 368 |
|
@param |
| 369 |
|
@see |
| 370 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 371 |
51 |
protected void setType(String type)... |
| 372 |
|
{ |
| 373 |
51 |
this.type = type; |
| 374 |
|
} |
| 375 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 376 |
30952 |
@Override... |
| 377 |
|
public String getName() |
| 378 |
|
{ |
| 379 |
30952 |
return this.name; |
| 380 |
|
} |
| 381 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 382 |
48902 |
@Override... |
| 383 |
|
public void setName(String name) |
| 384 |
|
{ |
| 385 |
48902 |
this.name = name; |
| 386 |
|
} |
| 387 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 388 |
83239 |
@Override... |
| 389 |
|
public Collection<ExtensionLicense> getLicenses() |
| 390 |
|
{ |
| 391 |
83239 |
return this.licenses != null ? this.licenses : Collections.<ExtensionLicense>emptyList(); |
| 392 |
|
} |
| 393 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 394 |
12822 |
@Override... |
| 395 |
|
public void setLicenses(Collection<ExtensionLicense> licenses) |
| 396 |
|
{ |
| 397 |
12822 |
this.licenses = Collections.unmodifiableList(new ArrayList<ExtensionLicense>(licenses)); |
| 398 |
|
} |
| 399 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 400 |
28591 |
@Override... |
| 401 |
|
public void addLicense(ExtensionLicense license) |
| 402 |
|
{ |
| 403 |
28591 |
List<ExtensionLicense> newLicenses = new ArrayList<ExtensionLicense>(getLicenses()); |
| 404 |
28591 |
newLicenses.add(license); |
| 405 |
|
|
| 406 |
28591 |
this.licenses = Collections.unmodifiableList(newLicenses); |
| 407 |
|
} |
| 408 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 409 |
30611 |
@Override... |
| 410 |
|
public String getSummary() |
| 411 |
|
{ |
| 412 |
30612 |
return this.summary; |
| 413 |
|
} |
| 414 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 415 |
48249 |
@Override... |
| 416 |
|
public void setSummary(String summary) |
| 417 |
|
{ |
| 418 |
48249 |
this.summary = summary; |
| 419 |
|
} |
| 420 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 421 |
29954 |
@Override... |
| 422 |
|
public String getDescription() |
| 423 |
|
{ |
| 424 |
29954 |
return this.description; |
| 425 |
|
} |
| 426 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 427 |
13092 |
@Override... |
| 428 |
|
public void setDescription(String description) |
| 429 |
|
{ |
| 430 |
13092 |
this.description = description; |
| 431 |
|
} |
| 432 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 433 |
129249 |
@Override... |
| 434 |
|
public List<ExtensionAuthor> getAuthors() |
| 435 |
|
{ |
| 436 |
129249 |
return this.authors != null ? this.authors : Collections.<ExtensionAuthor>emptyList(); |
| 437 |
|
} |
| 438 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 439 |
12822 |
@Override... |
| 440 |
|
public void setAuthors(Collection<? extends ExtensionAuthor> authors) |
| 441 |
|
{ |
| 442 |
12822 |
this.authors = Collections.unmodifiableList(new ArrayList<ExtensionAuthor>(authors)); |
| 443 |
|
} |
| 444 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 445 |
101716 |
@Override... |
| 446 |
|
public void addAuthor(ExtensionAuthor author) |
| 447 |
|
{ |
| 448 |
101716 |
List<ExtensionAuthor> newAuthors = new ArrayList<ExtensionAuthor>(getAuthors()); |
| 449 |
101716 |
newAuthors.add(author); |
| 450 |
|
|
| 451 |
101716 |
this.authors = Collections.unmodifiableList(newAuthors); |
| 452 |
|
} |
| 453 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 454 |
27699 |
@Override... |
| 455 |
|
public String getWebSite() |
| 456 |
|
{ |
| 457 |
27699 |
return this.website; |
| 458 |
|
} |
| 459 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 460 |
49076 |
@Override... |
| 461 |
|
public void setWebsite(String website) |
| 462 |
|
{ |
| 463 |
49076 |
this.website = website; |
| 464 |
|
} |
| 465 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 466 |
27396 |
@Override... |
| 467 |
|
public Collection<String> getAllowedNamespaces() |
| 468 |
|
{ |
| 469 |
27397 |
return this.allowedNamespaces; |
| 470 |
|
} |
| 471 |
|
|
| 472 |
|
|
| 473 |
|
@since |
| 474 |
|
|
| |
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 475 |
1 |
@Override... |
| 476 |
|
public void addAllowedNamespace(String namespace) |
| 477 |
|
{ |
| 478 |
1 |
Set<String> newNamespaces = this.allowedNamespaces != null ? new LinkedHashSet<String>(this.allowedNamespaces) |
| 479 |
|
: new LinkedHashSet<String>(); |
| 480 |
1 |
newNamespaces.add(namespace); |
| 481 |
|
|
| 482 |
1 |
this.allowedNamespaces = Collections.unmodifiableSet(newNamespaces); |
| 483 |
|
} |
| 484 |
|
|
| 485 |
|
|
| 486 |
|
@since |
| 487 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 488 |
1985 |
@Override... |
| 489 |
|
public void setAllowedNamespaces(Collection<String> namespaces) |
| 490 |
|
{ |
| 491 |
1986 |
this.allowedNamespaces = |
| 492 |
1986 |
namespaces != null ? Collections.unmodifiableSet(new LinkedHashSet<>(namespaces)) : null; |
| 493 |
|
} |
| 494 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 495 |
71930 |
@Override... |
| 496 |
|
public void addDependency(ExtensionDependency dependency) |
| 497 |
|
{ |
| 498 |
71930 |
List<ExtensionDependency> newDependencies = new ArrayList<ExtensionDependency>(getDependencies()); |
| 499 |
71930 |
newDependencies.add(dependency); |
| 500 |
|
|
| 501 |
71930 |
this.dependencies = Collections.unmodifiableList(newDependencies); |
| 502 |
|
} |
| 503 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 504 |
127580 |
@Override... |
| 505 |
|
public List<ExtensionDependency> getDependencies() |
| 506 |
|
{ |
| 507 |
127580 |
return this.dependencies != null ? this.dependencies : Collections.<ExtensionDependency>emptyList(); |
| 508 |
|
} |
| 509 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 510 |
26253 |
@Override... |
| 511 |
|
public void setDependencies(Collection<? extends ExtensionDependency> dependencies) |
| 512 |
|
{ |
| 513 |
26253 |
this.dependencies = dependencies != null |
| 514 |
|
? Collections.unmodifiableList(new ArrayList<ExtensionDependency>(dependencies)) : null; |
| 515 |
|
} |
| 516 |
|
|
| 517 |
|
|
| 518 |
|
@since |
| 519 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 520 |
650501 |
@Override... |
| 521 |
|
public void addManagedDependency(ExtensionDependency managedDependency) |
| 522 |
|
{ |
| 523 |
650501 |
List<ExtensionDependency> newManagedDependencies = new ArrayList<ExtensionDependency>(getManagedDependencies()); |
| 524 |
650501 |
newManagedDependencies.add(managedDependency); |
| 525 |
|
|
| 526 |
650501 |
this.managedDependencies = Collections.unmodifiableList(newManagedDependencies); |
| 527 |
|
} |
| 528 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 529 |
678665 |
@Override... |
| 530 |
|
public List<ExtensionDependency> getManagedDependencies() |
| 531 |
|
{ |
| 532 |
678665 |
return this.managedDependencies != null ? this.managedDependencies |
| 533 |
|
: Collections.<ExtensionDependency>emptyList(); |
| 534 |
|
} |
| 535 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 536 |
3557 |
@Override... |
| 537 |
|
public void setManagedDependencies(Collection<? extends ExtensionDependency> managedDependencies) |
| 538 |
|
{ |
| 539 |
3557 |
this.managedDependencies = managedDependencies != null |
| 540 |
|
? Collections.unmodifiableList(new ArrayList<ExtensionDependency>(managedDependencies)) : null; |
| 541 |
|
} |
| 542 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 543 |
689 |
@Override... |
| 544 |
|
public ExtensionRepository getRepository() |
| 545 |
|
{ |
| 546 |
689 |
return this.repository; |
| 547 |
|
} |
| 548 |
|
|
| 549 |
|
|
| 550 |
|
@param |
| 551 |
|
@see |
| 552 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 553 |
0 |
protected void setRepository(ExtensionRepository repository)... |
| 554 |
|
{ |
| 555 |
0 |
this.repository = repository; |
| 556 |
|
} |
| 557 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 558 |
27202 |
@Override... |
| 559 |
|
public ExtensionScm getScm() |
| 560 |
|
{ |
| 561 |
27202 |
return this.scm; |
| 562 |
|
} |
| 563 |
|
|
| 564 |
|
|
| 565 |
|
@since |
| 566 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 567 |
41825 |
@Override... |
| 568 |
|
public void setScm(ExtensionScm scm) |
| 569 |
|
{ |
| 570 |
41825 |
this.scm = scm; |
| 571 |
|
} |
| 572 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 573 |
27066 |
@Override... |
| 574 |
|
public ExtensionIssueManagement getIssueManagement() |
| 575 |
|
{ |
| 576 |
27066 |
return this.issueManagement; |
| 577 |
|
} |
| 578 |
|
|
| 579 |
|
|
| 580 |
|
@since |
| 581 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 582 |
37468 |
@Override... |
| 583 |
|
public void setIssueManagement(ExtensionIssueManagement issueManagement) |
| 584 |
|
{ |
| 585 |
37468 |
this.issueManagement = issueManagement; |
| 586 |
|
} |
| 587 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 588 |
2360 |
@Override... |
| 589 |
|
public ExtensionFile getFile() |
| 590 |
|
{ |
| 591 |
2360 |
return this.file; |
| 592 |
|
} |
| 593 |
|
|
| 594 |
|
|
| 595 |
|
@param |
| 596 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 597 |
37580 |
protected void setFile(ExtensionFile file)... |
| 598 |
|
{ |
| 599 |
37580 |
this.file = file; |
| 600 |
|
} |
| 601 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 602 |
27027 |
@Override... |
| 603 |
|
public String getCategory() |
| 604 |
|
{ |
| 605 |
27027 |
return this.category; |
| 606 |
|
} |
| 607 |
|
|
| 608 |
|
|
| 609 |
|
@since |
| 610 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 611 |
12903 |
@Override... |
| 612 |
|
public void setCategory(String categrory) |
| 613 |
|
{ |
| 614 |
12903 |
this.category = categrory; |
| 615 |
|
} |
| 616 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 617 |
192 |
@Override... |
| 618 |
|
public Collection<ExtensionRepositoryDescriptor> getRepositories() |
| 619 |
|
{ |
| 620 |
192 |
return this.repositories != null ? this.repositories : Collections.<ExtensionRepositoryDescriptor>emptyList(); |
| 621 |
|
} |
| 622 |
|
|
| 623 |
|
|
| 624 |
|
@since |
| 625 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 626 |
24457 |
@Override... |
| 627 |
|
public void setRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories) |
| 628 |
|
{ |
| 629 |
24457 |
this.repositories = repositories != null ? Collections.unmodifiableList(new ArrayList<>(repositories)) : null; |
| 630 |
|
} |
| 631 |
|
|
| 632 |
|
|
| 633 |
|
@since |
| 634 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 635 |
67 |
@Override... |
| 636 |
|
public void addRepository(ExtensionRepositoryDescriptor repository) |
| 637 |
|
{ |
| 638 |
67 |
List<ExtensionRepositoryDescriptor> newrepositories = |
| 639 |
|
new ArrayList<ExtensionRepositoryDescriptor>(getRepositories()); |
| 640 |
67 |
newrepositories.add(repository); |
| 641 |
|
|
| 642 |
67 |
this.repositories = Collections.unmodifiableList(newrepositories); |
| 643 |
|
} |
| 644 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 645 |
252969 |
@Override... |
| 646 |
|
public Map<String, Object> getProperties() |
| 647 |
|
{ |
| 648 |
252969 |
return this.properties != null ? this.properties : Collections.<String, Object>emptyMap(); |
| 649 |
|
} |
| 650 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 651 |
27299 |
@Override... |
| 652 |
|
public <T> T getProperty(String key) |
| 653 |
|
{ |
| 654 |
27299 |
return (T) getProperties().get(key); |
| 655 |
|
} |
| 656 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 657 |
34932 |
@Override... |
| 658 |
|
public <T> T getProperty(String key, T def) |
| 659 |
|
{ |
| 660 |
34932 |
return getProperties().containsKey(key) ? (T) getProperties().get(key) : def; |
| 661 |
|
} |
| 662 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 663 |
151388 |
@Override... |
| 664 |
|
public void putProperty(String key, Object value) |
| 665 |
|
{ |
| 666 |
151388 |
synchronized (this.propertiesLock) { |
| 667 |
151388 |
Map<String, Object> newProperties = new LinkedHashMap<String, Object>(getProperties()); |
| 668 |
151388 |
newProperties.put(key, value); |
| 669 |
|
|
| 670 |
151388 |
this.properties = Collections.unmodifiableMap(newProperties); |
| 671 |
|
} |
| 672 |
|
} |
| 673 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 674 |
26025 |
@Override... |
| 675 |
|
public void setProperties(Map<String, Object> properties) |
| 676 |
|
{ |
| 677 |
26025 |
this.properties = Collections.unmodifiableMap(new LinkedHashMap<String, Object>(properties)); |
| 678 |
|
} |
| 679 |
|
|
| 680 |
|
|
| 681 |
|
@since |
| 682 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 683 |
267 |
@Override... |
| 684 |
|
public <T> T removeProperty(String key) |
| 685 |
|
{ |
| 686 |
268 |
T previous; |
| 687 |
|
|
| 688 |
268 |
synchronized (this.propertiesLock) { |
| 689 |
268 |
Map<String, Object> newProperties = new LinkedHashMap<String, Object>(getProperties()); |
| 690 |
267 |
previous = (T) newProperties.remove(key); |
| 691 |
|
|
| 692 |
268 |
this.properties = Collections.unmodifiableMap(newProperties); |
| 693 |
|
} |
| 694 |
|
|
| 695 |
267 |
return previous; |
| 696 |
|
} |
| 697 |
|
|
| 698 |
|
|
| 699 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 700 |
1855 |
@Override... |
| 701 |
|
public String toString() |
| 702 |
|
{ |
| 703 |
1855 |
return getId().toString(); |
| 704 |
|
} |
| 705 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 706 |
250 |
@Override... |
| 707 |
|
public boolean equals(Object obj) |
| 708 |
|
{ |
| 709 |
250 |
return this == obj || (obj instanceof Extension && getId().equals(((Extension) obj).getId())); |
| 710 |
|
} |
| 711 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 712 |
10484 |
@Override... |
| 713 |
|
public int hashCode() |
| 714 |
|
{ |
| 715 |
10484 |
return getId().hashCode(); |
| 716 |
|
} |
| 717 |
|
|
| |
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
| 718 |
51 |
@Override... |
| 719 |
|
public int compareTo(Extension o) |
| 720 |
|
{ |
| 721 |
51 |
if (o == null) { |
| 722 |
1 |
return -1; |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
|
| 726 |
50 |
Integer comparizon = compareTo(this, o); |
| 727 |
50 |
if (comparizon != null) { |
| 728 |
49 |
return comparizon; |
| 729 |
|
} |
| 730 |
|
|
| 731 |
|
|
| 732 |
1 |
comparizon = compareTo(o, this); |
| 733 |
1 |
if (comparizon != null) { |
| 734 |
0 |
return comparizon; |
| 735 |
|
} |
| 736 |
|
|
| 737 |
1 |
return ObjectUtils.compare(getId(), o.getId()); |
| 738 |
|
} |
| 739 |
|
|
| |
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
| 740 |
51 |
private static Integer compareTo(Extension e1, Extension e2)... |
| 741 |
|
{ |
| 742 |
|
|
| 743 |
51 |
ExtensionId feature = e2.getExtensionFeature(e1.getId().getId()); |
| 744 |
51 |
if (feature != null) { |
| 745 |
42 |
return ObjectUtils.compare(e1.getId().getVersion(), feature.getVersion()); |
| 746 |
|
} |
| 747 |
|
|
| 748 |
|
|
| 749 |
9 |
for (ExtensionId feature1 : e1.getExtensionFeatures()) { |
| 750 |
7 |
feature = e2.getExtensionFeature(feature1.getId()); |
| 751 |
7 |
if (feature != null) { |
| 752 |
7 |
return ObjectUtils.compare(feature1.getVersion(), feature.getVersion()); |
| 753 |
|
} |
| 754 |
|
} |
| 755 |
|
|
| 756 |
2 |
return null; |
| 757 |
|
} |
| 758 |
|
} |