1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.script; |
21 |
|
|
22 |
|
import java.util.Collection; |
23 |
|
import java.util.Map; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Singleton; |
28 |
|
|
29 |
|
import org.xwiki.component.annotation.Component; |
30 |
|
import org.xwiki.extension.ExtensionId; |
31 |
|
import org.xwiki.extension.InstalledExtension; |
32 |
|
import org.xwiki.extension.repository.InstalledExtensionRepository; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@Component |
41 |
|
@Named(ExtensionManagerScriptService.ROLEHINT + '.' + InstalledExtensionScriptService.ID) |
42 |
|
@Singleton |
|
|
| 33.3% |
Uncovered Elements: 22 (33) |
Complexity: 10 |
Complexity Density: 0.42 |
|
43 |
|
public class InstalledExtensionScriptService extends AbstractExtensionScriptService |
44 |
|
{ |
45 |
|
|
46 |
|
@link |
47 |
|
|
48 |
|
public static final String ID = "installed"; |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
@Inject |
54 |
|
private InstalledExtensionRepository installedExtensionRepository; |
55 |
|
|
56 |
|
|
57 |
|
@return |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
8 |
public InstalledExtensionRepository getRepository()... |
60 |
|
{ |
61 |
8 |
return safe(this.installedExtensionRepository); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@return |
69 |
|
|
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
9 |
public Collection<InstalledExtension> getInstalledExtensions()... |
72 |
|
{ |
73 |
9 |
return safe(this.installedExtensionRepository.getInstalledExtensions()); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
@param |
83 |
|
@return |
84 |
|
|
85 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
0 |
public Collection<InstalledExtension> getInstalledExtensions(String namespace)... |
87 |
|
{ |
88 |
0 |
return safe(this.installedExtensionRepository.getInstalledExtensions(namespace)); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
@param |
99 |
|
@param |
100 |
|
@return |
101 |
|
|
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
396 |
public InstalledExtension getInstalledExtension(String feature, String namespace)... |
104 |
|
{ |
105 |
396 |
return safe(this.installedExtensionRepository.getInstalledExtension(feature, namespace)); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
@param |
113 |
|
@return |
114 |
|
@link |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
116 |
0 |
public Map<String, Collection<InstalledExtension>> getBackwardDependencies(String feature)... |
117 |
|
{ |
118 |
0 |
InstalledExtension installedExtension = this.installedExtensionRepository.getInstalledExtension(feature, null); |
119 |
|
|
120 |
0 |
Map<String, Collection<InstalledExtension>> extensions; |
121 |
|
|
122 |
0 |
if (installedExtension != null) { |
123 |
0 |
extensions = getBackwardDependencies(installedExtension.getId()); |
124 |
|
} else { |
125 |
0 |
extensions = null; |
126 |
|
} |
127 |
|
|
128 |
0 |
return extensions; |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
@param |
135 |
|
@return |
136 |
|
@link |
137 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
138 |
0 |
public Map<String, Collection<InstalledExtension>> getBackwardDependencies(ExtensionId extensionId)... |
139 |
|
{ |
140 |
0 |
Map<String, Collection<InstalledExtension>> extensions; |
141 |
|
|
142 |
0 |
setError(null); |
143 |
|
|
144 |
0 |
try { |
145 |
0 |
return safe(this.installedExtensionRepository.getBackwardDependencies(extensionId)); |
146 |
|
} catch (Exception e) { |
147 |
0 |
setError(e); |
148 |
|
|
149 |
0 |
extensions = null; |
150 |
|
} |
151 |
|
|
152 |
0 |
return extensions; |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
@link |
160 |
|
|
161 |
|
@param |
162 |
|
@param |
163 |
|
@return |
164 |
|
@link |
165 |
|
|
|
|
| 57.1% |
Uncovered Elements: 3 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
166 |
29 |
public Collection<InstalledExtension> getBackwardDependencies(String feature, String namespace)... |
167 |
|
{ |
168 |
29 |
Collection<InstalledExtension> extensions; |
169 |
|
|
170 |
29 |
setError(null); |
171 |
|
|
172 |
29 |
try { |
173 |
29 |
return safe(this.installedExtensionRepository.getBackwardDependencies(feature, namespace)); |
174 |
|
} catch (Exception e) { |
175 |
0 |
setError(e); |
176 |
|
|
177 |
0 |
extensions = null; |
178 |
|
} |
179 |
|
|
180 |
0 |
return extensions; |
181 |
|
} |
182 |
|
} |