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.templatingkit.setup;
35
36 import static info.magnolia.jcr.nodebuilder.Ops.*;
37 import static info.magnolia.module.templatingkit.setup.InstallSTKResourcesTask.*;
38
39 import info.magnolia.cms.core.Content;
40 import info.magnolia.cms.util.ContentUtil;
41 import info.magnolia.context.MgnlContext;
42 import info.magnolia.dam.jcr.JcrAssetProvider;
43 import info.magnolia.dam.templating.functions.DamTemplatingFunctions;
44 import info.magnolia.jcr.nodebuilder.task.ErrorHandling;
45 import info.magnolia.jcr.nodebuilder.task.NodeBuilderTask;
46 import info.magnolia.jcr.util.NodeTypes;
47 import info.magnolia.module.DefaultModuleVersionHandler;
48 import info.magnolia.module.InstallContext;
49 import info.magnolia.module.delta.AbstractRepositoryTask;
50 import info.magnolia.module.delta.ArrayDelegateTask;
51 import info.magnolia.module.delta.BootstrapSingleModuleResource;
52 import info.magnolia.module.delta.BootstrapSingleResource;
53 import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
54 import info.magnolia.module.delta.CheckOrCreatePropertyTask;
55 import info.magnolia.module.delta.CopyNodeTask;
56 import info.magnolia.module.delta.CreateNodePathTask;
57 import info.magnolia.module.delta.CreateNodeTask;
58 import info.magnolia.module.delta.DeltaBuilder;
59 import info.magnolia.module.delta.IsModuleInstalledOrRegistered;
60 import info.magnolia.module.delta.ModuleDependencyBootstrapTask;
61 import info.magnolia.module.delta.MoveNodeTask;
62 import info.magnolia.module.delta.NewPropertyTask;
63 import info.magnolia.module.delta.NodeExistsDelegateTask;
64 import info.magnolia.module.delta.OrderNodeAfterTask;
65 import info.magnolia.module.delta.PartialBootstrapTask;
66 import info.magnolia.module.delta.PathExistenceDelegateTask;
67 import info.magnolia.module.delta.PropertyExistsDelegateTask;
68 import info.magnolia.module.delta.RemoveNodeTask;
69 import info.magnolia.module.delta.RemovePropertyTask;
70 import info.magnolia.module.delta.SetPropertyTask;
71 import info.magnolia.module.delta.Task;
72 import info.magnolia.module.delta.TaskExecutionException;
73 import info.magnolia.module.delta.WarnTask;
74 import info.magnolia.module.form.setup.ChangeValidationToMultiValuedPropertyTask;
75 import info.magnolia.module.form.setup.migration.AddMissingDefaultValuesToFieldsTask;
76 import info.magnolia.module.model.Version;
77 import info.magnolia.module.resources.ResourceTypes;
78 import info.magnolia.module.resources.setup.InstallBinaryResourceTask;
79 import info.magnolia.module.resources.setup.InstallResourcesTask;
80 import info.magnolia.module.resources.setup.InstallTextResourceTask;
81 import info.magnolia.module.resources.setup.ResourceCleanUpTask;
82 import info.magnolia.module.resources.setup.UpdateResourceReferencesTask;
83 import info.magnolia.module.site.setup.DefaultSiteExistsDelegateTask;
84 import info.magnolia.module.templatingkit.dam.STKAssetRenderer;
85 import info.magnolia.module.templatingkit.setup.for2_7.MigrationTasks;
86 import info.magnolia.module.templatingkit.setup.for2_7.ReorderSTKAppsTask;
87 import info.magnolia.module.templatingkit.setup.for2_9.MigrateTemplateTypesTask;
88 import info.magnolia.module.templatingkit.setup.for2_9.RemoveTreeTemplatesTask;
89 import info.magnolia.repository.RepositoryConstants;
90 import info.magnolia.resourceloader.jcr.JcrResourceOrigin;
91 import info.magnolia.ui.admincentral.setup.ConvertListAclToAppPermissionsTask;
92 import info.magnolia.ui.dialog.setup.DialogMigrationTask;
93 import info.magnolia.ui.form.field.definition.LinkFieldDefinition;
94 import info.magnolia.ui.form.field.definition.TextFieldDefinition;
95
96 import java.util.ArrayList;
97 import java.util.Arrays;
98 import java.util.HashMap;
99 import java.util.List;
100 import java.util.Map;
101 import java.util.Set;
102 import java.util.regex.Pattern;
103
104 import javax.jcr.ImportUUIDBehavior;
105 import javax.jcr.Node;
106 import javax.jcr.RepositoryException;
107 import javax.jcr.Session;
108 import javax.jcr.ValueFormatException;
109
110 import com.google.gwt.thirdparty.guava.common.base.Function;
111 import com.google.gwt.thirdparty.guava.common.collect.Lists;
112 import com.google.gwt.thirdparty.guava.common.collect.Sets;
113
114
115
116
117 public class STKModuleVersionHandler extends DefaultModuleVersionHandler {
118
119 protected static final String STK_TEASER_OPENER = "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserOpener";
120 protected static final String STK_LOGOUT_TEXT_FIELD = "/modules/standard-templating-kit/dialogs/components/pur/stkPURLink/form/tabs/tabPURLink/fields/logoutText";
121 private static final String I18N_BASENAME = "info.magnolia.module.templatingkit.messages";
122 private static final String AREAS_PROTOTYPE_PATH = "/modules/standard-templating-kit/config/site/templates/prototype/areas/";
123 final Task changeMaxImagesPropertyTypeToLong = new AbstractRepositoryTask("Set right maxImages property type", "Change maxImages property type of stkImageGallery template to Long .") {
124
125 final String path = "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main/areas/content/autoGeneration/content/singleton";
126 final String property = "maxImages";
127
128 @Override
129 protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
130 Session session = MgnlContext.getJCRSession(RepositoryConstants.CONFIG);
131 if (session.nodeExists(path)) {
132 Node node = session.getNode(path);
133 if (node.hasProperty(property)) {
134 Long valueNewType;
135 try {
136 valueNewType = node.getProperty(property).getLong();
137 } catch (ValueFormatException e) {
138
139 valueNewType = 9L;
140 }
141 node.setProperty(property, valueNewType);
142 }
143 }
144 }
145 };
146 private final String contactField = "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserContact/form/tabs/tabTeaser/fields/contact";
147 private final Task fixContactField = new NodeExistsDelegateTask("Fix 'stkTeaserContact' field", String.format("Fix '%s' field", contactField),
148 RepositoryConstants.CONFIG, contactField, new ArrayDelegateTask("",
149 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, contactField, "appName", "pages", "contacts"),
150 new SetPropertyTask(RepositoryConstants.CONFIG, contactField, "tree", "Contact"))
151 );
152 private final Task reconfigureLogoutTextField = new NodeExistsDelegateTask("Change class and delete properties", STK_LOGOUT_TEXT_FIELD, new ArrayDelegateTask("",
153 new CheckAndModifyPropertyValueTask(STK_LOGOUT_TEXT_FIELD, "class", LinkFieldDefinition.class.getName(), TextFieldDefinition.class.getName()),
154 new RemovePropertyTask("", STK_LOGOUT_TEXT_FIELD, "appName"),
155 new RemovePropertyTask("", STK_LOGOUT_TEXT_FIELD, "targetWorkspace"),
156 new RemoveNodeTask("", STK_LOGOUT_TEXT_FIELD + "/identifierToPathConverter")));
157
158 private final Task setStkSiteAsActiveInSiteModule = new NodeExistsDelegateTask("Set STK site as an active site if possible", "/modules/standard-templating-kit/config/site",
159 new ArrayDelegateTask("",
160 new NodeExistsDelegateTask("Check if any site already exists", "/modules/site/config/site",
161 new PropertyExistsDelegateTask("Check extends property and update or create it", "/modules/site/config/site", "extends",
162 new CheckAndModifyPropertyValueTask("/modules/site/config/site", "extends", "/modules/travel-demo/config/travel", "/modules/standard-templating-kit/config/site"),
163 new DefaultSiteExistsDelegateTask("", "",
164 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/config/site", "extends", "/modules/standard-templating-kit/config/site"))),
165 new ArrayDelegateTask("",
166 new CreateNodeTask("Create site node", "/modules/site/config", "site", NodeTypes.ContentNode.NAME),
167 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/config/site", "extends", "/modules/standard-templating-kit/config/site"))),
168 new CheckOrCreatePropertyTask("Set correct site class for stk site", "/modules/standard-templating-kit/config/site", "class", "info.magnolia.module.templatingkit.sites.Site"),
169 new CheckOrCreatePropertyTask("Set correct class for stk prototype", "/modules/standard-templating-kit/config/site/templates/prototype", "class", "info.magnolia.module.templatingkit.templates.pages.STKPage")));
170
171 private final Task stkForumMigrationTask = new PathExistenceDelegateTask("Migrate 'stkForum' template if necessary", "If required this task will migrate 'stkForum' to the default site definition of MultiSite",
172 new String[]{"/modules/multisite/config/sites/default/templates/availability/templates/stkForum"},
173 new String[]{"/modules/standard-templating-kit/config/site/templates/availability/templates/stkForum", "/modules/multisite/config/sites/default/templates/availability/templates"},
174 new CopyNodeTask("", "/modules/standard-templating-kit/config/site/templates/availability/templates/stkForum",
175 "/modules/multisite/config/sites/default/templates/availability/templates/stkForum", false)
176 );
177
178 public STKModuleVersionHandler() {
179
180 register(DeltaBuilder.checkPrecondition("2.0", "2.5"));
181
182 register(DeltaBuilder.update("2.0.1", "")
183 .addTask(new NodeBuilderTask("Add editable property to stkSection page", "Adds and sets editable property to true for sectionHeader area on stkSection pages.", ErrorHandling.logging, RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkSection/areas",
184 getNode("sectionHeader").then(
185 addProperty("editable", Boolean.TRUE.toString())
186 )
187 ))
188 .addTask(new NodeBuilderTask("Add editable property to areas", "Adds and sets editable property to false on sectionHeader, footer and metaNavigation.", ErrorHandling.logging, RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/site/templates/prototype/areas",
189 getNode("sectionHeader").then(
190 addProperty("editable", Boolean.FALSE.toString())
191 )
192 ))
193 );
194
195 register(DeltaBuilder.update("2.0.2", "")
196 .addTask(new IsModuleInstalledOrRegistered("Use of commenting module", "Use of commenting module by default in STK", "commenting",
197 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/site/templates/prototype/areas/main/areas/comments/availableComponents/stkComments", "id", "standard-templating-kit:components/features/stkComments", "commenting:components/comments")))
198 );
199
200 register(DeltaBuilder.update("2.0.3", "")
201 .addTask(changeMaxImagesPropertyTypeToLong)
202 );
203
204 register(DeltaBuilder.update("2.0.4", "")
205 .addTask(new NodeExistsDelegateTask("Check and used correct templateScript for stkFAQ", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main",
206 new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main", "templateScript", null,
207 new CheckOrCreatePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main", "templateScript", "/templating-kit/pages/content/mainArea.ftl"))))
208 .addTask(new NodeExistsDelegateTask("Check and used correct templateScript for stkImageGallery", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main",
209 new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main", "templateScript", null,
210 new CheckOrCreatePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main", "templateScript", "/templating-kit/pages/content/mainArea.ftl"))))
211 );
212
213 register(DeltaBuilder.update("2.0.7", "")
214 .addTask(new ArrayDelegateTask("New PUR demo component", "Hides input field while logged in",
215 new BootstrapSingleModuleResource("Component definition", "", "templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPUREdit.xml"),
216 new PartialBootstrapTask("Register the component to fields set", "Makes the component available while authoring", "/mgnl-bootstrap/standard-templating-kit/templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.groupFields.xml", "/groupFields/areas/fields/availableComponents/stkPUREdit", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
217 )
218 .addTask(new RemoveNodeTask("Remove old flowplayer from resources", "Remove flowplayer version 3.2.7 from resources", "resources", "/templating-kit/js/mediaplayer/flowplayer-3-2-7"))
219 .addTask(new RemoveNodeTask("Remove old flowplayer controls from resources", "Remove flowplayer controls version 3.2.5 from resources", "resources", "/templating-kit/js/mediaplayer/flowplayer.controls-3-2-5"))
220 .addTask(new InstallResourcesTask("/templating-kit/js/mediaplayer/.*.swf", "resources:binary", true))
221 .addTask(new RemoveNodeTask("Remove FlashCanvasPro from resources", "Remove FlashCanvasPro from resources", "resources", "/templating-kit/js/shims/FlashCanvasPro/"))
222 .addTask(new InstallResourcesTask("/templating-kit/js/.*.", "resources:js", false, true))
223 .addTask(new InstallResourcesTask("/templating-kit/js/shims/swf/JarisFLVPlayer.swf", "resources:binary", true))
224 );
225
226 register(DeltaBuilder.update("2.0.9", "")
227 .addTask(new FixAggregatedJavascriptsTask())
228 .addTask(new InstallResourcesTask("/templating-kit/js/shims/swf/JarisFLVPlayer.swf", "resources:binary", true))
229 );
230
231 register(DeltaBuilder.update("2.0.11", "")
232 .addTask(new NodeExistsDelegateTask("Move node", "Move contentFeeds node to stk module under virtualURIMapping", "config", "/modules/standard-templating-kit/virtualURIMapping",
233 new MoveNodeTask("Move contentFeeds node.", "Move contentFeeds node to stk module", "config", "/modules/adminInterface/virtualURIMapping/contentFeeds", "/modules/standard-templating-kit/virtualURIMapping/contentFeeds", false),
234 new ArrayDelegateTask("Move contentFeeds node.", "Move contentFeeds node to stk module",
235 new CreateNodeTask("Create node", "Create virtualURIMapping node in stk module", "config", "/modules/standard-templating-kit", "virtualURIMapping", NodeTypes.Content.NAME),
236 new MoveNodeTask("Move contentFeeds node.", "Move contentFeeds node to stk module", "config", "/modules/adminInterface/virtualURIMapping/contentFeeds", "/modules/standard-templating-kit/virtualURIMapping/contentFeeds", false))))
237 );
238
239 register(DeltaBuilder.update("2.5", "")
240 .addTask(new DialogMigrationTask("standard-templating-kit"))
241
242 .addTask(new NodeExistsDelegateTask("Remove damSupport", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/damSupport",
243 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/damSupport")))
244
245 .addTask(new NodeExistsDelegateTask("Remove old DMS controls", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/controls",
246 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/controls")))
247
248 .addTask(new BootstrapSingleResource("Config", "Add contextAttribute damfn", "/mgnl-bootstrap/standard-templating-kit/config.modules.standard-templating-kit.renderers.stk.contextAttributes.damfn.xml"))
249
250 .addTask(new STKLegacyUiToMagnolia5AppProviderTask("Provide STK with a Magnolia 5 UI", "Turns most of the legacy UI into a Magnolia 5 browser app. Wraps the remaining old UI as Magnolia 5 legacy apps. Legacy apps will be soon replaced with actual M5 apps."))
251
252 .addTask(new NodeExistsDelegateTask("Install STK asset renderer", "/modules/dam/config/mediaTypes/image",
253 new CheckAndModifyPropertyValueTask("Install STK asset renderer", "Installs STKAssetRenderer", RepositoryConstants.CONFIG, "/modules/dam/config/mediaTypes/image",
254 "rendererClass", "info.magnolia.dam.providers.jcr.JcrAssetRenderer", STKAssetRenderer.class.getName())))
255 .addTask(new BootstrapSingleModuleResource("STK add DamTemplatingFunction.", "Renderers are now defined in the renderer folder.",
256 "config.modules.standard-templating-kit.renderers.stk.contextAttributes.damfn.xml"))
257 .addTask(new ConvertListAclToAppPermissionsTask("Convert permissions for 'ui-admincentral' apps", "Convert ACL permissions to old menus to new admincentral apps permission", this.getAclsToAppsPermissionsMap(), true))
258 );
259
260 register(DeltaBuilder.update("2.5.1", "")
261 .addTask(new NodeExistsDelegateTask("Update stkContact", "Update stkContact content component definition", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact",
262 new ArrayDelegateTask("", "",
263 new RemovePropertyTask("Remove templateScript property of stkContact", "Remove templateScript of stkContact component as it should use/inherit the standard template of features", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact", "templateScript"),
264 new ArrayDelegateTask("Update stkContact component definition", "Update parameters of stkContact content component definition",
265 new CheckOrCreatePropertyTask("Add new divIDPrefix property to parameters", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact/parameters", "divIDPrefix", "content"),
266 new CheckAndModifyPropertyValueTask("Update divClass property of parameters", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact/parameters", "divClass", "text-section", "text-section box vcard")))))
267 );
268
269 register(DeltaBuilder.update("2.5.2", "")
270 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro",
271 new CheckOrCreatePropertyTask("Set property", "Disable intro area in stkPublicUserRegistration page", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro", "enabled", "false")))
272 .addTask(new BootstrapSingleModuleResource("Password change form", "Add new password change component", "templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPURPasswordChangeForm.xml"))
273 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents",
274 new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURPasswordChangeForm", null, new CreateNodeTask("Add pass form", "Add new password change form to allowed componets list", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents", "stkPURPasswordChangeForm", NodeTypes.ContentNode.NAME))))
275 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURPasswordChangeForm", new NewPropertyTask("Add form id", "Set ID for newly added form", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURPasswordChangeForm", "id", "standard-templating-kit:components/pur/stkPURPasswordChangeForm")))
276 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro", new CheckOrCreatePropertyTask("Set property", "Disable intro area in stkPublicUserRegistration page", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro", "enabled", "false")))
277 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkGlossary/areas/main/areas/content", new CheckOrCreatePropertyTask("Set property", "Set type of main area of stkGlossary to single", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkGlossary/areas/main/areas/content", "type", "single")))
278 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoExtras/areas/promos", new RemoveNodeTask("Remove node", "Remove idle node promos in stkSectionNoExtras. Area is inherited.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoExtras/areas/promos")))
279 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas", new RemoveNodeTask("Remove node", "Remove idle extras area in stkSectionWithTwoExtras. Area is inherited.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoExtras/areas/extras/areas")))
280 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/largeArticle/stkLargeArticleIntro/tabMain/abstract", new CheckAndModifyPropertyValueTask("Set property", "Change property value from 'flase' to 'false' in stkLargeArticleIntro dialog.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/largeArticle/stkLargeArticleIntro/tabMain/abstract", "required", "flase", "false")))
281 );
282
283 register(DeltaBuilder.update("2.5.4", "")
284 .addTask(new NodeExistsDelegateTask("Remove obsolete component", "Remove stkFooter component", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/footer/stkFooter",
285 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/footer/stkFooter")))
286 );
287
288 register(DeltaBuilder.update("2.6.2", "")
289 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK app group on the app launcher", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "label"))
290 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Site app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkSiteApp", "label"))
291 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Site app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkSiteApp", "icon"))
292 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Themes app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkThemesApp", "label"))
293 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Themes app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkThemesApp", "icon"))
294 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Dialogs app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkDialogsApp", "label"))
295 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Dialogs app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkDialogsApp", "icon"))
296 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Channels app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkChannelsApp", "label"))
297 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Channels app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkChannelsApp", "icon"))
298 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Template Def app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkTemplateDefsApp", "label"))
299 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Template Def app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkTemplateDefsApp", "icon"))
300 );
301
302 register(DeltaBuilder.update("2.7", "")
303 .addTask(new MigrationTasks("STK Migration", "A collection of update tasks to help migrating to STK 2.7."))
304 .addTask(new NodeExistsDelegateTask("Check applauncher layout group order", "Checks whether manage group is already installed, so that we insert stk group right after it.", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/manage",
305 new OrderNodeAfterTask("STK AppLauncher group ordering", "Moves the stk app group as first closable group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "manage")))
306 .addTask(new ReorderSTKAppsTask())
307 );
308
309 register(DeltaBuilder.update("2.7.1", "")
310 .addTask(new RemoveNodeTask("Remove obsolete tab", "Remove obsolete 'dependencies' tab", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/generic/pages/tabDependencies"))
311 .addTask(new RemoveNodeTask("Remove redundant form configuration", "Remove redundant form configuration", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/article/stkArticleProperties/form"))
312 .addTask(new NodeExistsDelegateTask("Set property value", "Set property [type] to value [String] in the stkDownloadList dialog.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList/form/tabs/tabQuery/fields/link",
313 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList/form/tabs/tabQuery/fields/link", "type", "String")))
314 );
315
316 register(DeltaBuilder.update("2.7.2", "")
317 .addTask(new NodeExistsDelegateTask("Remove redundant extras areas if exist", "Remove redundant extras areas if exist", RepositoryConstants.CONFIG,
318 "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas",
319 new RemoveNodeTask("Remove redundant extras areas", "Remove redundant extras areas", RepositoryConstants.CONFIG,
320 "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas")))
321 .addTask(new NodeExistsDelegateTask("Remove obsolete stkFooter component if exists", "Remove obsolete stkFooter component if exists", RepositoryConstants.CONFIG,
322 "/modules/standard-templating-kit/templates/components/footer/stkFooter",
323 new RemoveNodeTask("Remove obsolete stkFooter component", "Remove obsolete stkFooter component", RepositoryConstants.CONFIG,
324 "/modules/standard-templating-kit/templates/components/footer/stkFooter")))
325 );
326
327 register(DeltaBuilder.update("2.7.3", "")
328
329 .addTask(new BootstrapSingleModuleResource("Bootstrap the forum page-template.", "Bootstraping the forum page-template.", "templates/pages/config.modules.standard-templating-kit.templates.pages.stkForum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
330 .addTask(new BootstrapSingleModuleResource("Bootstrap the forum login-component.", "Bootstraping the forum login-component.", "templates/components/forum/config.modules.standard-templating-kit.templates.components.forum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
331 .addTask(new BootstrapSingleModuleResource("Bootstrap the availability of the forum-page-template.", "Bootstraping the availability of the forum-page-template.", "config/site/config.modules.standard-templating-kit.config.site.templates.availability.templates.stkForum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
332 .addTask(new BootstrapSingleModuleResource("Bootstrap a folder node for the dialogs of the forum template.", "Bootstraping a folder node for the dialogs of the forum template.", "dialogs/pages/forum/config.modules.standard-templating-kit.dialogs.pages.forum.xml", ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW))
333 .addTask(new BootstrapSingleModuleResource("Bootstrap page-properties dialog for the forum-template.", "Bootstraping page-properties dialog for the forum-template.", "dialogs/pages/forum/config.modules.standard-templating-kit.dialogs.pages.forum.stkForumProperties.xml", ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW))
334 .addTask(new BootstrapSingleModuleResource("Bootstrap the dialog for the header of the forum-template.", "Bootstraping the dialog for the header of the forum-template.", "dialogs/pages/forum/config.modules.standard-templating-kit.dialogs.pages.forum.stkForumHeader.xml", ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW))
335
336 .addTask(new AddMissingDefaultValuesToFieldsTask(Arrays.asList(
337 "/modules/standard-templating-kit/dialogs/components/features/stkEventsOverview/form/tabs/tabTeaser/fields/showAbstract",
338 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/showSiteMapRoot",
339 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserEventsList/form/tabs/tabTeaser/fields/showAbstract",
340 "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/hideInNav"
341 ), "defaultValue", "true"))
342
343 .addTask(new AddMissingDefaultValuesToFieldsTask(Arrays.asList(
344 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/useIndex",
345 "/modules/standard-templating-kit/dialogs/components/features/stkNewsOverview/form/tabs/tabTeaser/fields/hideTeaserImage",
346 "/modules/standard-templating-kit/dialogs/components/pur/stkPURLoginForm/form/tabs/tabTitleText/fields/showInfoText",
347 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserNewsList/form/tabs/tabTeaser/fields/hideTeaserImage",
348 "/modules/standard-templating-kit/dialogs/generic/controls/hideInNav",
349 "/modules/standard-templating-kit/dialogs/generic/controls/inheritable",
350 "/modules/standard-templating-kit/dialogs/generic/teasers/hideTeaserImage",
351 "/modules/standard-templating-kit/dialogs/generic/teasers/highlighted"
352 ), "defaultValue", "false"))
353
354 .addTask(fixContactField)
355 );
356
357 register(DeltaBuilder.update("2.7.4", "")
358 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to htmlHeader area", AREAS_PROTOTYPE_PATH + "htmlHeader",
359 new SetPropertyTask("Add createAreaNode property with value false to htmlHeader area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "htmlHeader", "createAreaNode", false)))
360 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to main area", AREAS_PROTOTYPE_PATH + "main",
361 new SetPropertyTask("Add createAreaNode property with value false to main area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main", "createAreaNode", false)))
362 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to intro area", AREAS_PROTOTYPE_PATH + "main/areas/intro",
363 new SetPropertyTask("Add createAreaNode property with value false to intro area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/intro", "createAreaNode", false)))
364 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to infoBlock area", AREAS_PROTOTYPE_PATH + "main/areas/intro/areas/infoBlock",
365 new SetPropertyTask("Add createAreaNode property with value false to infoBlock area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/intro/areas/infoBlock", "createAreaNode", false)))
366 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to breadcrumb area", AREAS_PROTOTYPE_PATH + "main/areas/breadcrumb",
367 new SetPropertyTask("Add createAreaNode property with value false to breadcrumb area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/breadcrumb", "createAreaNode", false)))
368 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to contentNavigation area", AREAS_PROTOTYPE_PATH + "main/areas/contentNavigation",
369 new SetPropertyTask("Add createAreaNode property with value false to contentNavigation area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/contentNavigation", "createAreaNode", false)))
370 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to branding area", AREAS_PROTOTYPE_PATH + "branding",
371 new SetPropertyTask("Add createAreaNode property with value false to branding area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding", "createAreaNode", false)))
372 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to logo area", AREAS_PROTOTYPE_PATH + "branding/areas/logo",
373 new SetPropertyTask("Add createAreaNode property with value false to logo area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding/areas/logo", "createAreaNode", false)))
374 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to search area", AREAS_PROTOTYPE_PATH + "branding/areas/search",
375 new SetPropertyTask("Add createAreaNode property with value false to search area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding/areas/search", "createAreaNode", false)))
376 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to sectionHeader area", AREAS_PROTOTYPE_PATH + "sectionHeader",
377 new SetPropertyTask("Add createAreaNode property with value false to sectionHeader area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "sectionHeader", "createAreaNode", false)))
378 );
379
380 register(DeltaBuilder.update("2.8", "")
381 .addTask(new NodeExistsDelegateTask("Change the path of DamTemplatingFunctions", "/modules/standard-templating-kit/renderers/stk/contextAttributes/damfn",
382 new CheckAndModifyPropertyValueTask("/modules/standard-templating-kit/renderers/stk/contextAttributes/damfn", "componentClass", "info.magnolia.dam.asset.functions.DamTemplatingFunctions", DamTemplatingFunctions.class.getName())))
383 .addTask(new NodeExistsDelegateTask("STK applauncher group", "This task updates ordering and color of the STK group in the applauncher.", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk",
384 new ArrayDelegateTask("",
385 new OrderNodeAfterTask("STK applauncher group ordering", "Moves the stk app group after the tools group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "tools"),
386 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "color", "#ccd882"))))
387 .addTask(new ArrayDelegateTask("Modify prototype to include areas to insert scripts", "Modify prototype to include areas to insert scripts such as marketing tags",
388 new BootstrapSingleResource("Add area to contain scripts in prototype", "Add area to contain scripts in prototype, specifically in the header", "/mgnl-bootstrap/standard-templating-kit/config/site/config.modules.standard-templating-kit.config.site.templates.prototype.areas.headerScripts.xml"),
389 new BootstrapSingleResource("Add area to contain scripts in prototype", "Add area to contain scripts in prototype, specifically at the beginning of the body", "/mgnl-bootstrap/standard-templating-kit/config/site/config.modules.standard-templating-kit.config.site.templates.prototype.areas.bodyBeginScripts.xml"),
390 new BootstrapSingleResource("Add area to contain scripts in prototype", "Add area to contain scripts in prototype, specifically at the end of the body", "/mgnl-bootstrap/standard-templating-kit/config/site/config.modules.standard-templating-kit.config.site.templates.prototype.areas.bodyEndScripts.xml")))
391 .addTask(reconfigureLogoutTextField)
392 .addTask(new NodeExistsDelegateTask("Create new property i18nBasename at /modules/standard-templating-kit/dialogs/components/teasers/stkTeaserOpener with value info.magnolia.module.templatingkit.messages", STK_TEASER_OPENER,
393 new CheckOrCreatePropertyTask("Create new property i18nBasename at /modules/standard-templating-kit/dialogs/components/teasers/stkTeaserOpener with value info.magnolia.module.templatingkit.messages", STK_TEASER_OPENER, "i18nBasename", "info.magnolia.module.templatingkit.messages")))
394
395 .addTask(new NodeExistsDelegateTask("Remove the preview component of the Image gallery link field definition", "/modules/standard-templating-kit/dialogs/components/features/stkImageGallery/form/tabs/tabMain/fields/link/contentPreviewDefinition",
396 new RemoveNodeTask("", "/modules/standard-templating-kit/dialogs/components/features/stkImageGallery/form/tabs/tabMain/fields/link/contentPreviewDefinition")))
397 );
398
399 register(DeltaBuilder.update("2.8.2", "")
400 .addTask(new MoveIntenseDebateIdTask())
401 );
402
403 register(DeltaBuilder.update("2.8.3", "")
404 .addTask(new PartialBootstrapTask("Makes the stkPURAuthSubmit component available in groupFields", "Makes the stkPURAuthSubmit component which allows updating of a logged in user's profile available in groupFields", "/mgnl-bootstrap/standard-templating-kit/templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.groupFields.xml", "/groupFields/areas/fields/availableComponents/stkPURAuthSubmit", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
405 .addTask(new ChangeValidationToMultiValuedPropertyTask("Change validation fields of form field 'stkPUREdit' to multi-valued property", Arrays.asList("standard-templating-kit:components/pur/stkPUREdit")))
406 );
407
408 register(DeltaBuilder.update("2.8.6", "")
409 .addTask(new PartialBootstrapTask("Create a new field (form/tabs/tabQuery/fields/excludeDescendants)", "Creates a new field (form/tabs/tabQuery/fields/excludeDescendants) in stkDownloadList dialog.", "/mgnl-bootstrap/standard-templating-kit/dialogs/components/content/config.modules.standard-templating-kit.dialogs.components.content.stkDownloadList.xml", "/stkDownloadList/form/tabs/tabQuery/fields/excludeDescendants"))
410 .addTask(new NewPropertyTask("Create an i18nBasename property", "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList", "i18nBasename", "info.magnolia.module.templatingkit.messages"))
411 );
412
413 register(DeltaBuilder.update("2.8.9", "")
414 .addTask(new NodeExistsDelegateTask("Add a validator to the field 'path' for the stkRedirect dialog.", "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path",
415 new ArrayDelegateTask("", "",
416 new NodeExistsDelegateTask("", "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path/validators", null,
417 new NodeBuilderTask("", "", ErrorHandling.logging, RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path",
418 addNode("validators", NodeTypes.ContentNode.NAME))
419 ),
420 new NodeExistsDelegateTask("", "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path/validators/redirectTargetValidator", null,
421 new PartialBootstrapTask("", "/mgnl-bootstrap/standard-templating-kit/dialogs/functional/config.modules.standard-templating-kit.dialogs.functional.stkRedirect.xml", "/stkRedirect/form/tabs/tabRedirect/fields/path/validators/redirectTargetValidator")
422 )
423 )))
424 );
425
426 register(DeltaBuilder.update("2.9", "")
427 .addTask(new PropertyExistsDelegateTask("Remove deprecated AutoGeneratedExtrasArea from templates", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkEventsOverview/areas/extras", "class",
428 new RemovePropertyTask("Remove deprecated AutoGeneratedExtrasArea from templates", "/modules/standard-templating-kit/templates/pages/stkEventsOverview/areas/extras", "class")))
429 .addTask(new NodeExistsDelegateTask("Remove deprecated stkSectionNoIntroWithHeader from demo-features templates", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoIntroWithHeader",
430 new RemoveNodeTask("Remove deprecated stkSectionNoIntroWithHeader from demo-features templates", "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoIntroWithHeader")))
431 .addTask(new RemoveTreeTemplatesTask())
432 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkCategoryOverview component if it exists", "/modules/standard-templating-kit/templates/components/features/stkCategoryOverview",
433 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.templates.components.features.stkCategoryOverview.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
434 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkRelatedCategoriesLinkList component if it exists", "/modules/standard-templating-kit/templates/components/features/stkRelatedCategoriesLinkList",
435 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.templates.components.features.stkRelatedCategoriesLinkList.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
436 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkCategoryOverview page if it exists", "/modules/standard-templating-kit/templates/pages/stkCategoryOverview",
437 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.templates.pages.stkCategoryOverview.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
438 .addTask(new NodeExistsDelegateTask("Bootstrap stkTemplateContent feed generator if it doesn't exists", "/modules/rssaggregator/config/feedGenerators/stkTemplateContent", null,
439 new BootstrapSingleResource("", "", "/mgnl-bootstrap/standard-templating-kit/config.modules.rssaggregator.config.feedGenerators.stkTemplateContent.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)))
440 .addTask(new MigrateTemplateTypesTask())
441 .addTask(new NodeExistsDelegateTask("Remove stkCategoryOverview dialog", "/modules/standard-templating-kit/dialogs/components/features/stkCategoryOverview",
442 new RemoveNodeTask("", "/modules/standard-templating-kit/dialogs/components/features/stkCategoryOverview")))
443 .addTask(new NodeExistsDelegateTask("Remove stkRelatedCategoriesLinkList dialog", "/modules/standard-templating-kit/dialogs/components/features/stkRelatedCategoriesLinkList",
444 new RemoveNodeTask("", "/modules/standard-templating-kit/dialogs/components/features/stkRelatedCategoriesLinkList")))
445 .addTask(new NodeExistsDelegateTask("Remove relatedCategoriesLinkList template", "Removes relatedCategoriesLinkList template from templates workspace", "templates", "/templating-kit/components/features/relatedCategoriesLinkList",
446 new RemoveNodeTask("", "", "templates", "/templating-kit/components/features/relatedCategoriesLinkList")))
447 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkCategoryOverviewProperties", "/modules/standard-templating-kit/dialogs/pages/categoryOverview/stkCategoryOverviewProperties",
448 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.dialogs.pages.categoryOverview.stkCategoryOverviewProperties.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
449 .addTask(setStkSiteAsActiveInSiteModule)
450 .addTask(new NodeExistsDelegateTask("Re-Configure asset provider from DAM", "", RepositoryConstants.CONFIG, "/modules/dam/config/providers/jcrProvider",
451 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, "/modules/dam/config/providers/jcrProvider", "class", "info.magnolia.module.templatingkit.dam.RenditionAwareJcrAssetProvider", JcrAssetProvider.class.getName())))
452 .addTask(new NodeExistsDelegateTask("Remove STKAssetRenderer", "", RepositoryConstants.CONFIG, "/modules/dam/config/renderers/stkJcrRenderer",
453 new RemoveNodeTask("", "/modules/dam/config/renderers/stkJcrRenderer")))
454 .addTask(new NodeExistsDelegateTask("Remove migrated STKAssetRenderer", "When dam-imaging is installed stkJcrRenderer is not required anymore",
455 RepositoryConstants.CONFIG, "/modules/dam/config/providers/jcrProvider/renderers/stkJcrRenderer",
456 new IsModuleInstalledOrRegistered("", "dam-imaging", new RemoveNodeTask("", "/modules/dam/config/providers/jcrProvider/renderers/stkJcrRenderer"))))
457 .addTask(new MigrateResourcesTask(
458 "/modules/standard-templating-kit/config/site/templates/prototype/jsFiles",
459 "/modules/standard-templating-kit/config/site/templates/prototype/cssFiles",
460 "/modules/standard-templating-kit/templates/pages/stkForum/cssFiles"))
461 );
462
463 register(DeltaBuilder.update("2.9.1", "")
464 .addTask(new AddSTKRolesToRelevantAppsTask())
465 .addTask(new NodeExistsDelegateTask("Bootstrap i18n configuration", "/modules/standard-templating-kit/config/site/i18n", null,
466 new BootstrapSingleModuleResource("config/site/config.modules.standard-templating-kit.config.site.i18n.xml")))
467 .addTask(new IsModuleInstalledOrRegistered("Set STK as a fallback site if possible", "multisite",
468 new ArrayDelegateTask("",
469 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/default",
470 new ArrayDelegateTask("",
471 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/fallback",
472 new PropertyExistsDelegateTask("name", "/modules/multisite/config/sites/fallback", "extends",
473 new CheckAndModifyPropertyValueTask("/modules/multisite/config/sites/fallback", "extends", "../travel", "../default"),
474 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/multisite/config/sites/fallback", "extends", "../default"))),
475 new CheckOrCreatePropertyTask("", "/modules/multisite/config/sites/default/templates/prototype", "class", "info.magnolia.module.templatingkit.templates.pages.STKPage"),
476 new CheckOrCreatePropertyTask("", "/modules/multisite/config/sites/default", "class", "info.magnolia.module.templatingkit.sites.Site"))),
477 new CheckAndModifyPropertyValueTask("/modules/ui-admincentral/apps/stkSiteApp/subApps/browser/contentConnector", "rootPath", "/modules/standard-templating-kit/config/site", "/modules/multisite/config/sites"),
478 stkForumMigrationTask)))
479 );
480
481 register(DeltaBuilder.update("2.9.2", "")
482 .addTask(new CheckOrCreatePropertyTask("Set class property for prototype in stk site", "/modules/standard-templating-kit/config/site/templates/prototype", "class", "info.magnolia.module.templatingkit.templates.pages.STKPage"))
483 .addTask(new CheckOrCreatePropertyTask("Set class property for site in stk", "/modules/standard-templating-kit/config/site", "class", "info.magnolia.module.templatingkit.sites.Site"))
484 .addTask(new RemoveSTKSiteFromSiteModule())
485 .addTask(new NodeExistsDelegateTask("Only set the extends property for the site when it was previously removed", "/modules/site/config/site", null,
486 new ArrayDelegateTask("",
487 new CreateNodeTask("", "/modules/site/config", "site", NodeTypes.ContentNode.NAME),
488 new CheckOrCreatePropertyTask("", "/modules/site/config/site", "extends", "/modules/standard-templating-kit/config/site"))))
489 );
490
491 register(DeltaBuilder.update("2.9.3", "")
492 .addTask(new ArrayDelegateTask("Fix mismatches in FlashCanvas resources",
493 new NodeExistsDelegateTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/flashcanvas",
494 new ArrayDelegateTask("",
495 new RemoveNodeTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/flashcanvas"),
496 new InstallBinaryResourceTask("/templating-kit/js/shims/FlashCanvas/flashcanvas.swf", null, null, null, false, false),
497 new InstallTextResourceTask("/templating-kit/js/shims/FlashCanvas/flashcanvas.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, false, false)
498 )),
499 new NodeExistsDelegateTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/canvas2png",
500 new ArrayDelegateTask("",
501 new RemoveNodeTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/canvas2png"),
502 new InstallTextResourceTask("/templating-kit/js/shims/FlashCanvas/canvas2png.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, false, false)
503 ))
504 ))
505 .addTask(new ArrayDelegateTask("Restore extensions for STK resources",
506 new ResourceCleanUpTask("", "/templating-kit/js/*.swf", Pattern.compile(DEFAULT_JS_PATH + SWF_PATTERN), new UpdateResourceReferencesTask("")),
507 new ResourceCleanUpTask("", "/templating-kit/js/*.js", Pattern.compile(DEFAULT_JS_PATH + JS_PATTERN), new UpdateResourceReferencesTask("")),
508 new ResourceCleanUpTask("", "InstallSTKResourcesTask#specialResources", getFullSpecialResourcesPaths(), new UpdateResourceReferencesTask("")),
509 new ResourceCleanUpTask("", "InstallSTKResourcesTask#processedScripts", getFullProcessedScriptsPaths(), new UpdateResourceReferencesTask(""))
510 )
511 )
512 .addTask(new IsModuleInstalledOrRegistered("Check site app module has been installed", "site-app",
513 new NodeExistsDelegateTask("Check if site app has been configured in launcher", "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/site",
514 new ArrayDelegateTask("Remove legacy theme app and site definition app from launcher",
515 new RemoveNodeTask("Remove stkSiteApp out of launcher", "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/stkSiteApp"),
516 new RemoveNodeTask("Remove stkThemesApp out of launcher", "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/stkThemesApp")))))
517 );
518 }
519
520 private Map<String, String[]> getAclsToAppsPermissionsMap() {
521 Map<String, String[]> permissionsMap = new HashMap<String, String[]>();
522
523 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/etkSites", new String[]{"/modules/ui-admincentral/apps/stkSiteApp"});
524 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkThemes", new String[]{"/modules/ui-admincentral/apps/stkThemesApp"});
525 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkDialogs", new String[]{"/modules/ui-admincentral/apps/dialogs"});
526 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkChannels", new String[]{"/modules/ui-admincentral/apps/channels"});
527 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkTemplateDefs", new String[]{"/modules/ui-admincentral/apps/stkTemplateDefsApp"});
528
529 return permissionsMap;
530 }
531
532 @Override
533 protected List<Task> getExtraInstallTasks(InstallContext ctx) {
534 final List<Task> tasks = new ArrayList<Task>();
535 tasks.addAll(super.getExtraInstallTasks(ctx));
536 tasks.add(new InstallSTKResourcesTask());
537
538
539 tasks.add(new AbstractRepositoryTask("Order templates", "") {
540 @Override
541 protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException {
542 Content templatesNodes = ctx.getConfigHierarchyManager().getContent("/modules/standard-templating-kit/templates/pages");
543 ContentUtil.orderNodes(templatesNodes, new String[]{"stkHome", "stkSection", "stkArticle", "stkLargeArticle", "stkNews", "stkEvent", "stkImageGallery", "stkFAQ", "stkForm", "stkSearchResult", "stkSiteMap", "stkRedirect"});
544 }
545 });
546
547 tasks.add(new RemoveETKParagraphs());
548
549 tasks.add(new WarnTask("SMTP Configuration", "Please set the config: /modules/mail/config/smtp to a valid smtp configuration"));
550 tasks.add(new IsModuleInstalledOrRegistered("Use of commenting module", "Use of commenting module by default in STK", "commenting",
551 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/site/templates/prototype/areas/main/areas/comments/availableComponents/stkComments", "id", "standard-templating-kit:components/features/stkComments", "commenting:components/comments")));
552 tasks.add(new STKLegacyUiToMagnolia5AppProviderTask("Provide STK with a Magnolia 5 UI", "Turns legacy UI into a Magnolia 5 browser app."));
553 tasks.add(new OrderNodeAfterTask("STK AppLauncher group ordering", "Moves the stk app group after the tools group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "tools"));
554 tasks.add(new ReorderSTKAppsTask());
555 tasks.add(new ModuleDependencyBootstrapTask("contacts"));
556 tasks.add(new ModuleDependencyBootstrapTask("categorization"));
557 tasks.add(setStkSiteAsActiveInSiteModule);
558 tasks.add(new IsModuleInstalledOrRegistered("Configure STK site for multisite", "multisite",
559 new NodeExistsDelegateTask("Check if stk can be moved to the multisite", "/modules/standard-templating-kit/config/site",
560 new ArrayDelegateTask("", "",
561 new NodeExistsDelegateTask("Check for default site", "Check whether default site already exists or not - if no, site from stk will be copied to multisite", RepositoryConstants.CONFIG, "/modules/multisite/config/sites/default",
562 new WarnTask("Default already site exists", "Default site already exists. No actions will be taken."),
563 new ArrayDelegateTask("", "",
564 new CreateNodePathTask("", "/modules/multisite/config/sites/", NodeTypes.ContentNode.NAME),
565 new CopyNodeTask("Default site configuration", "Copy the configuration of the STK site", "config", "/modules/standard-templating-kit/config/site", "/modules/multisite/config/sites/default", false),
566 new ModuleDependencyBootstrapTask("multisite"),
567 new CheckOrCreatePropertyTask("Add class property to legacy site", "/modules/multisite/config/sites/default", "class", "info.magnolia.module.templatingkit.sites.Site"),
568 new SetPropertyTask("config", "/modules/multisite/config/sites/default", "label", "Default"))),
569 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/fallback",
570 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/default",
571 new PropertyExistsDelegateTask("name", "/modules/multisite/config/sites/fallback", "extends",
572 new CheckAndModifyPropertyValueTask("/modules/multisite/config/sites/fallback", "extends", "../travel", "../default"),
573 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/multisite/config/sites/fallback", "extends", "../default"))))))));
574 tasks.add(new AddSTKRolesToRelevantAppsTask());
575 return tasks;
576 }
577
578 @Override
579 protected List<Task> getDefaultUpdateTasks(Version forVersion) {
580 final List<Task> tasks = new ArrayList<Task>();
581 tasks.addAll(super.getDefaultUpdateTasks(forVersion));
582 return tasks;
583 }
584
585 private Set<String> getFullSpecialResourcesPaths() {
586 List<String> keys = Lists.transform(Arrays.asList(InstallSTKResourcesTask.specialResources), new Function<String[], String>() {
587 @Override
588 public String apply(String[] input) {
589 return DEFAULT_JS_PATH + input[0];
590 }
591 });
592 return Sets.newHashSet(keys);
593 }
594
595 private Set<String> getFullProcessedScriptsPaths() {
596 List<String> keys = Lists.transform(Arrays.asList(InstallSTKResourcesTask.processedScripts), new Function<String, String>() {
597 @Override
598 public String apply(String input) {
599 return DEFAULT_JS_PATH + input;
600 }
601 });
602 return Sets.newHashSet(keys);
603 }
604 }