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.cms.security.Permission; |
37 |
|
import info.magnolia.imaging.functions.ImagingTemplatingFunctions; |
38 |
|
import info.magnolia.module.DefaultModuleVersionHandler; |
39 |
|
import info.magnolia.module.InstallContext; |
40 |
|
import info.magnolia.module.delta.AddPermissionTask; |
41 |
|
import info.magnolia.module.delta.AddRoleToUserTask; |
42 |
|
import info.magnolia.module.delta.ArrayDelegateTask; |
43 |
|
import info.magnolia.module.delta.BootstrapSingleResource; |
44 |
|
import info.magnolia.module.delta.DeltaBuilder; |
45 |
|
import info.magnolia.module.delta.NodeExistsDelegateTask; |
46 |
|
import info.magnolia.module.delta.RemovePermissionTask; |
47 |
|
import info.magnolia.module.delta.Task; |
48 |
|
import info.magnolia.rendering.module.setup.InstallRendererContextAttributeTask; |
49 |
|
import info.magnolia.repository.RepositoryConstants; |
50 |
|
|
51 |
|
import java.util.ArrayList; |
52 |
|
import java.util.List; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@link |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
58 |
|
public class ImagingModuleVersionHandler extends DefaultModuleVersionHandler { |
59 |
|
|
60 |
|
private final Task excludeImagingWorkspaceFromFlushCachePolicy = new ExcludeWorkspacesFromFlushCachePolicy("imaging"); |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
62 |
8 |
public ImagingModuleVersionHandler() {... |
63 |
8 |
super(); |
64 |
|
|
65 |
8 |
register(DeltaBuilder.checkPrecondition("2.1.1", "2.2")); |
66 |
|
|
67 |
8 |
register(DeltaBuilder.update("2.2.3", "") |
68 |
|
.addTask(new ArrayDelegateTask("Update simaging-base role", "Change permission for imaging repo from Write-Read into Read only", |
69 |
|
new RemovePermissionTask("", "", "imaging-base", "imaging", "/", Permission.WRITE), |
70 |
|
new AddPermissionTask("", "", "imaging-base", "imaging", "/", Permission.READ, true)))); |
71 |
|
|
72 |
8 |
register(DeltaBuilder.update("3.1.1", "") |
73 |
|
.addTask(new AddPermissionTask("Update imaging-base role", "Add read permissions for imaging-base role", "imaging-base", RepositoryConstants.USER_ROLES, "/imaging-base", Permission.READ, false))); |
74 |
|
|
75 |
8 |
register(DeltaBuilder.update("3.2", "") |
76 |
|
.addTask(new NodeExistsDelegateTask("Bootstrap default image generator if it does not exist", "/modules/imaging/config/generators/default", null, |
77 |
|
new BootstrapSingleResource("Bootstrap default image generator", "", "/mgnl-bootstrap/imaging/config.modules.imaging.config.generators.default.xml"))) |
78 |
|
.addTask(new InstallRendererContextAttributeTask("rendering", "freemarker", "imgfn", ImagingTemplatingFunctions.class.getName())) |
79 |
|
.addTask(new InstallRendererContextAttributeTask("site", "site", "imgfn", ImagingTemplatingFunctions.class.getName())) |
80 |
|
.addTask(excludeImagingWorkspaceFromFlushCachePolicy) |
81 |
|
); |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
84 |
3 |
@Override... |
85 |
|
protected List getExtraInstallTasks(InstallContext installContext) { |
86 |
3 |
List<Task> tasks = new ArrayList<Task>(); |
87 |
3 |
tasks.add(new AddRoleToUserTask("Add the base role to the anonymous user", "anonymous", "imaging-base")); |
88 |
3 |
tasks.add(new InstallRendererContextAttributeTask("rendering", "freemarker", "imgfn", ImagingTemplatingFunctions.class.getName())); |
89 |
3 |
tasks.add(excludeImagingWorkspaceFromFlushCachePolicy); |
90 |
3 |
return tasks; |
91 |
|
} |
92 |
|
|
93 |
|
} |