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
63 public class TemplatingModuleVersionHandler extends DefaultModuleVersionHandler {
64
65 private OrderNodeBeforeTask orderBackwardCompatibilityFilter = new OrderNodeBeforeTask("Move backward compatibility filter", "", ContentRepository.CONFIG, "/server/filters/cms/backwardCompatibility", "rendering");
66
67 public TemplatingModuleVersionHandler() {
68 register(DeltaBuilder.update("3.5", "")
69 .addTask(new IntroduceParagraphRenderers())
70 .addTask(new BootstrapSingleResourceAndOrderBefore(
71 "Compatibility Filter",
72 "${actpage} is deprecated. Adds a compatibility filter still supporting it but writing warn messages to the log.",
73 "/mgnl-bootstrap/templating/config.server.filters.cms.backwardCompatibility.xml",
74 "rendering"))
75 );
76
77
78
79 register(DeltaBuilder.update("3.5.4", "")
80 .addTask(orderBackwardCompatibilityFilter)
81 );
82
83 register(DeltaBuilder.update("4.0", "")
84 .addTask(new BootstrapSingleResource("Freemarker Template Renderer", "Adds Freemarker template renderer configuration.", "/mgnl-bootstrap/templating/config.modules.templating.template-renderers.freemarker.xml"))
85 .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"))
86 .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"))
87 .addTask(new RenamePropertyAllModulesNodeTask("Templates configuration", "Property path is now templatePath.", "templates", "path", "templatePath"))
88 .addTask(new NestPropertiesAllModulesNodeTask("Templates configuration", "Property path is now templatePath.", "templates",
89 Arrays.asList(new String[]{"name", "type", "templatePath", "title", "description", "i18nBasename", "visible", "class"}), "parameters", ItemType.CONTENTNODE.getSystemName()))
90 .addTask(new RenamePropertyAllModulesNodeTask("Paragraphs configuration", "Property templateType is now type.", "paragraphs", "templateType", "type"))
91 .addTask(new DeprecateDialogPathAllModules("Paragraphs configuration", "Property dialogPath changed to dialog."))
92 );
93
94
95
96
97
98
99
100
101
102
103 register(DeltaBuilder.update("4.0.3", "")
104 .addTask(new FixTemplatePathTask("Fix templatePath property", "Moves templatePath property if is not set correct."))
105 );
106
107
108
109 register(DeltaBuilder.update("4.1.1", "")
110 .addTask(new FixTemplatePathTask("Fix templatePath property", "Moves templatePath property if is not set correct."))
111 );
112
113 register(DeltaBuilder.update("4.3", "")
114 .addTask(new BootstrapSingleModuleResource("Rendering Engine", "Add configuration for the new rendering engine.", "config.server.rendering.engine.xml"))
115 );
116
117 register(DeltaBuilder.update("4.4", "")
118 .addTask(new BootstrapSingleResourceAndOrderBefore(
119 "Model Execution Filter",
120 "Add Model Execution Filter",
121 "/mgnl-bootstrap/templating/config.server.filters.cms.modelExecution.xml",
122 "backwardCompatibility"))
123 );
124 }
125
126 protected List<Task> getExtraInstallTasks(InstallContext installContext) {
127 final ArrayList<Task> tasks = new ArrayList<Task>();
128 tasks.add(orderBackwardCompatibilityFilter);
129 tasks.add(new OrderNodeBeforeTask("Order model execution filter", "", ContentRepository.CONFIG, "/server/filters/cms/modelExecution", "backwardCompatibility"));
130
131 return tasks;
132 }
133 }