1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.imaging.setup; |
35 |
|
|
36 |
|
import info.magnolia.jcr.util.NodeTypes; |
37 |
|
import info.magnolia.jcr.util.NodeUtil; |
38 |
|
import info.magnolia.module.InstallContext; |
39 |
|
import info.magnolia.module.delta.AbstractRepositoryTask; |
40 |
|
import info.magnolia.module.delta.TaskExecutionException; |
41 |
|
|
42 |
|
import java.util.Collection; |
43 |
|
|
44 |
|
import javax.jcr.Node; |
45 |
|
import javax.jcr.RepositoryException; |
46 |
|
import javax.jcr.Session; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
51 |
|
public abstract class UpdateImagingGenerators extends AbstractRepositoryTask { |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
0 |
public UpdateImagingGenerators(String name, String description) {... |
54 |
0 |
super(name, description); |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
57 |
0 |
@Override... |
58 |
|
protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException { |
59 |
0 |
Session configJCRSession = ctx.getConfigJCRSession(); |
60 |
0 |
Node modulesNode = configJCRSession.getNode("/modules"); |
61 |
|
|
62 |
0 |
if (modulesNode.hasNode("imaging")) { |
63 |
0 |
Node generators = modulesNode.getNode("imaging/config/generators"); |
64 |
0 |
Collection<Node> generatorsDefinitions = NodeUtil.getCollectionFromNodeIterator(generators.getNodes(NodeTypes.ContentNode.NAME)); |
65 |
|
|
66 |
0 |
for (Node imagingDefinition : generatorsDefinitions) { |
67 |
0 |
updateImagingDefinition(ctx, imagingDefinition); |
68 |
|
} |
69 |
|
} |
70 |
|
} |
71 |
|
|
72 |
|
protected abstract void updateImagingDefinition(InstallContext ctx, Node imagingDefinition) throws RepositoryException, TaskExecutionException; |
73 |
|
|
74 |
|
} |