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.module.templating.setup;
35
36 import info.magnolia.cms.beans.config.ContentRepository;
37 import info.magnolia.cms.core.ItemType;
38 import info.magnolia.module.DefaultModuleVersionHandler;
39 import info.magnolia.module.InstallContext;
40 import info.magnolia.module.delta.BootstrapSingleModuleResource;
41 import info.magnolia.module.delta.BootstrapSingleResource;
42 import info.magnolia.module.delta.BootstrapSingleResourceAndOrderBefore;
43 import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
44 import info.magnolia.module.delta.DeltaBuilder;
45 import info.magnolia.module.delta.OrderNodeBeforeTask;
46 import info.magnolia.module.delta.Task;
47 import info.magnolia.module.templating.setup.for3_5.IntroduceParagraphRenderers;
48 import info.magnolia.module.templating.setup.for4_0.DeprecateDialogPathAllModules;
49 import info.magnolia.module.templating.setup.for4_0.FixTemplatePathTask;
50 import info.magnolia.module.templating.setup.for4_0.RenamePropertyAllModulesNodeTask;
51 import info.magnolia.module.templating.setup.for4_0.NestPropertiesAllModulesNodeTask;
52
53 import java.util.ArrayList;
54 import java.util.Arrays;
55 import java.util.List;
56
57
58
59
60
61
62 public class TemplatingModuleVersionHandler extends DefaultModuleVersionHandler {
63
64 private OrderNodeBeforeTask orderBackwardCompatibilityFilter = new OrderNodeBeforeTask("Move backward compatiblity filter", "", ContentRepository.CONFIG, "/server/filters/cms/backwardCompatibility", "rendering");
65
66 public TemplatingModuleVersionHandler() {
67 register(DeltaBuilder.update("3.5", "")
68 .addTask(new IntroduceParagraphRenderers())
69 .addTask(new BootstrapSingleResourceAndOrderBefore(
70 "Compatibility Filter",
71 "${actpage} is deprecated. Adds a compatibility filter still supporting it but writing warn messages to the log.",
72 "/mgnl-bootstrap/templating/config.server.filters.cms.backwardCompatibility.xml",
73 "rendering"))
74 );
75
76
77
78 register(DeltaBuilder.update("3.5.4", "")
79 .addTask(orderBackwardCompatibilityFilter)
80 );
81
82 register(DeltaBuilder.update("4.0", "")
83 .addTask(new BootstrapSingleResource("Freemarker Template Renderer", "Adds Freemarker template renderer configuration.", "/mgnl-bootstrap/templating/config.modules.templating.template-renderers.freemarker.xml"))
84 .addTask(new CheckAndModifyPropertyValueTask("Rendering filter", "The rendering filter is now part of the templating module.", ContentRepository.CONFIG, "/server/filters/cms/rendering", "class", "info.magnolia.cms.filters.RenderingFilter", "info.magnolia.module.templating.RenderingFilter"))
85 .addTask(new BootstrapSingleResource("Freemarker Model for RenderableDefinition", "Plugs in a specific Freemarker model for RenderableDefinition implementations.", "/mgnl-bootstrap/templating/config.server.rendering.freemarker.modelFactories.renderable.xml"))
86 .addTask(new RenamePropertyAllModulesNodeTask("Templates configuration", "Property path is now templatePath.", "templates", "path", "templatePath"))
87 .addTask(new NestPropertiesAllModulesNodeTask("Templates configuration", "Property path is now templatePath.", "templates",
88 Arrays.asList(new String[]{"name", "type", "templatePath", "title", "description", "i18nBasename", "visible", "class"}), "parameters", ItemType.CONTENTNODE.getSystemName()))
89 .addTask(new RenamePropertyAllModulesNodeTask("Paragraphs configuration", "Property templateType is now type.", "paragraphs", "templateType", "type"))
90 .addTask(new DeprecateDialogPathAllModules("Paragraphs configuration", "Property dialogPath changed to dialog."))
91 );
92
93
94
95
96
97
98
99
100
101
102 register(DeltaBuilder.update("4.0.3", "")
103 .addTask(new FixTemplatePathTask("Fix templatePath property", "Moves templatePath property if is not set correct."))
104 );
105
106
107
108 register(DeltaBuilder.update("4.1.1", "")
109 .addTask(new FixTemplatePathTask("Fix templatePath property", "Moves templatePath property if is not set correct."))
110 );
111
112 register(DeltaBuilder.update("4.3", "")
113 .addTask(new BootstrapSingleModuleResource("Rendering Engine", "Add configuration for the new rendering engine", "config.server.rendering.engine.xml"))
114 );
115 }
116
117 protected List<Task> getExtraInstallTasks(InstallContext installContext) {
118 final ArrayList<Task> tasks = new ArrayList<Task>();
119 tasks.add(orderBackwardCompatibilityFilter);
120
121 return tasks;
122 }
123
124 }