1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.distribution.internal.job; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Named; |
26 |
|
|
27 |
|
import org.xwiki.component.annotation.Component; |
28 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
29 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
30 |
|
import org.xwiki.component.manager.ComponentLookupException; |
31 |
|
import org.xwiki.extension.ExtensionId; |
32 |
|
import org.xwiki.extension.distribution.internal.job.step.DefaultUIDistributionStep; |
33 |
|
import org.xwiki.extension.distribution.internal.job.step.DistributionStep; |
34 |
|
import org.xwiki.extension.distribution.internal.job.step.FlavorDistributionStep; |
35 |
|
import org.xwiki.extension.distribution.internal.job.step.OutdatedExtensionsDistributionStep; |
36 |
|
import org.xwiki.text.StringUtils; |
37 |
|
|
38 |
|
|
39 |
|
@version |
40 |
|
@since |
41 |
|
|
42 |
|
@Component |
43 |
|
@Named("wikidistribution") |
44 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
|
|
| 72.7% |
Uncovered Elements: 6 (22) |
Complexity: 9 |
Complexity Density: 0.56 |
|
45 |
|
public class WikiDistributionJob extends AbstractDistributionJob<DistributionRequest, WikiDistributionJobStatus> |
46 |
|
{ |
|
|
| 60% |
Uncovered Elements: 6 (15) |
Complexity: 6 |
Complexity Density: 0.46 |
|
47 |
3 |
@Override... |
48 |
|
protected List<DistributionStep> createSteps() |
49 |
|
{ |
50 |
3 |
List<DistributionStep> steps = new ArrayList<DistributionStep>(3); |
51 |
|
|
52 |
|
|
53 |
3 |
ExtensionId wikiUI = this.distributionManager.getWikiUIExtensionId(); |
54 |
3 |
if (wikiUI != null && StringUtils.isNotBlank(wikiUI.getId())) { |
55 |
|
|
56 |
3 |
try { |
57 |
3 |
steps.add(this.componentManager.<DistributionStep>getInstance(DistributionStep.class, |
58 |
|
DefaultUIDistributionStep.ID)); |
59 |
|
} catch (ComponentLookupException e) { |
60 |
0 |
this.logger.error("Failed to get default UI step instance", e); |
61 |
|
} |
62 |
|
} else { |
63 |
|
|
64 |
0 |
try { |
65 |
0 |
steps.add(this.componentManager.<DistributionStep>getInstance(DistributionStep.class, |
66 |
|
FlavorDistributionStep.ID)); |
67 |
|
} catch (ComponentLookupException e) { |
68 |
0 |
this.logger.error("Failed to get the flavor step instance", e); |
69 |
|
} |
70 |
|
} |
71 |
|
|
72 |
|
|
73 |
3 |
try { |
74 |
3 |
steps.add(this.componentManager.<DistributionStep>getInstance(DistributionStep.class, |
75 |
|
OutdatedExtensionsDistributionStep.ID)); |
76 |
|
} catch (ComponentLookupException e) { |
77 |
0 |
this.logger.error("Failed to get outdated extensions step instance", e); |
78 |
|
} |
79 |
|
|
80 |
3 |
return steps; |
81 |
|
} |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
15 |
@Override... |
84 |
|
public DistributionJobStatus<?> getPreviousStatus() |
85 |
|
{ |
86 |
15 |
return this.distributionManager.getPreviousWikiJobStatus(getRequest().getWiki()); |
87 |
|
} |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
3 |
@Override... |
90 |
|
public ExtensionId getUIExtensionId() |
91 |
|
{ |
92 |
3 |
return this.distributionManager.getWikiUIExtensionId(); |
93 |
|
} |
94 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
3 |
@Override... |
96 |
|
protected WikiDistributionJobStatus createNewDistributionStatus(DistributionRequest request, |
97 |
|
List<DistributionStep> steps) |
98 |
|
{ |
99 |
3 |
return new WikiDistributionJobStatus(request, this.observationManager, this.loggerManager, steps); |
100 |
|
} |
101 |
|
} |