public ReplaceInplaceTemplatingLegacyAppTask() { super("Replace legacy Templates app", "Replaces legacy UI pages tree, dialogs and app launcher configuration with a Magnolia 5 app.", new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/inplace-templating/pages"), new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/inplace-templating/trees"), new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/inplace-templating/dialogs/templatesEdit"), new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/templatesApp"), new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/templatesApp"), new BootstrapSingleResource("", "", "/mgnl-bootstrap/inplace-templating/config.modules.inplace-templating.apps.xml"), new BootstrapSingleResource("", "", "/mgnl-bootstrap/inplace-templating/config.modules.inplace-templating.dialogs.renameTemplate.xml")); }
@Override protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException { final Session session = ctx.getConfigJCRSession(); if (session.nodeExists(PATH_TO_SITE_IN_SITE_MODULE)) { final Node siteNode = session.getNode(PATH_TO_SITE_IN_SITE_MODULE); if (siteNode.hasProperty("class") && Site.class.getName().equals(PropertyUtil.getString(siteNode, "class")) && "pop".equals(PropertyUtil.getString(siteNode, "theme/name")) && "standard-templating-kit:pages/stkHome".equals(PropertyUtil.getString(siteNode, "templates/availability/templates/stkHome/id"))) { super.doExecute(ctx); } } }
@Test public void testExecute() throws RepositoryException, TaskExecutionException { // GIVEN RemoveNodeTask task = new RemoveNodeTask("name", "description", RepositoryConstants.WEBSITE, valideNodePath1); // WHEN task.execute(ctx); // THEN assertFalse("Node should have been removed", websiteSession.nodeExists(valideNodePath1)); assertTrue("Parent node should exist", websiteSession.nodeExists("/demo-project/about/subsection-articles")); }
@Override protected List<Task> getBasicInstallTasks(InstallContext installContext) { final List<Task> installTasks = new ArrayList<Task>(); // Remove RelatedCategories if needed. This will be bootstrap later on. installTasks.add(new NodeExistsDelegateTask("STK RelatedCategories Link List removal", "Remove the STK Related Categories Link List if it exists. The new definition will then be bootstrapped.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/paragraphs/features/stkRelatedCategoriesLinkList", new RemoveNodeTask("Remove RelatedCategories", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/paragraphs/features/stkRelatedCategoriesLinkList"), null)); installTasks.addAll(super.getBasicInstallTasks(installContext)); return installTasks; }
public SamplesVersionHandler() { register(DeltaBuilder.update("5.4.1", "") .addTask(new ArrayDelegateTask("Remove samples configuration from JCR", new NodeExistsDelegateTask("", "/modules/samples/dialogs", new RemoveNodeTask("", "/modules/samples/dialogs")), new NodeExistsDelegateTask("", "/modules/samples/templates", new RemoveNodeTask("", "/modules/samples/templates")), new NodeExistsDelegateTask("", "/modules/samples/virtualURIMapping", new RemoveNodeTask("", "/modules/samples/virtualURIMapping")))) .addTasks(getCommonTasks())); register(DeltaBuilder.update("6.0", "") .addTask(new RemoveNodeTask("Remove JSP sample site", "Magnolia Templating JSP is deprecated as of 6.0.", WEBSITE, "/jsp-sample-site"))); }
public ReplaceIfExistsTask(String name, String description, String warningMessageIfNotExisting, String workspaceName, String pathToCheck, String bootstrapFile) { super(name, description, workspaceName, pathToCheck, new ArrayDelegateTask("", new RemoveNodeTask("", "", workspaceName, pathToCheck), new BootstrapSingleResource(name, description, bootstrapFile) ), new WarnTask(name, warningMessageIfNotExisting)); } }
new RemoveNodeTask("", "/" + OLD_RENDERING_LISTENERS_LOCATION));
private Task getRemoveLegacyAppsTask(String name, String description) { ArrayDelegateTask removeLegacyAppsTask = new ArrayDelegateTask(name, description); try { Node appsNode = SessionUtil.getNode(RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps"); if (appsNode != null) { NodeIterator nodeIterator = appsNode.getNodes(); while (nodeIterator.hasNext()) { String appName = ((Node) nodeIterator.next()).getName(); removeLegacyAppsTask.addTask(new RemoveNodeTask("Remove data legacy app " + appName, "This removes configuration for the data legacy app " + appName, RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/" + appName)); removeLegacyAppsTask.addTask(new RemoveNodeTask("Remove " + appName + " launcher", "This task removes the applauncher configuration for the data legacy app " + appName, RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps/" + appName)); } } } catch (RepositoryException e) { log.warn("Couldn't fetch data app configuration in appLauncherLayout", e); } return removeLegacyAppsTask; }
public DamTemplatingVersionHandler() { register(DeltaBuilder.update("2.0", "") .addTask(new NodeExistsDelegateTask("Remove AssetMapModel declaration from freemarker modelFactory. With DAM 2.0 this is replaced by a normal Map", "/server/rendering/freemarker/modelFactories/damModelFactory", new RemoveNodeTask("", "/server/rendering/freemarker/modelFactories/damModelFactory")))); register(DeltaBuilder.update("2.1", "") .addTask(new InstallRendererContextAttributeTask("rendering", "freemarker", "damfn", DamTemplatingFunctions.class.getName()))); }
@Test public void testAutogeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new RemoveNodeTask("name", "/pathToRemove1"); // THEN assertEquals("Remove node 'config:/pathToRemove1'.", task.getDescription()); } }
public SiteModuleVersionHandler() { register(DeltaBuilder.update("1.0.1", "") .addTask(updateI18nContentSupport)); register(DeltaBuilder.update("1.0.3", "") .addTask(new NodeExistsDelegateTask("Create empty site definition node if it does not exist", "/modules/site/config/site", null, new BootstrapSingleModuleResource("config.modules.site.config.site.xml")))); register(DeltaBuilder.update("1.0.5", "") .addTask(new BootstrapConditionally("Add site-aware JSP renderer if it does not exist", "/mgnl-bootstrap/site/config.modules.site.renderers.site-jsp.xml")) .addTask(new PropertyValueDelegateTask("Reconfigure site renderer to delegate to freemarker renderer", "/modules/site/renderers/site", "class", SiteAwareFreemarkerRenderer.class.getName(), true, new ArrayDelegateTask("", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/renderers/site", "wrappedRendererType", "freemarker"), new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/renderers/site", "class", SiteAwareRendererWrapper.class.getName()), new RemoveNodeTask("", "/modules/site/renderers/site/contextAttributes"), new RemovePropertyTask("", "/modules/site/renderers/site/", "type")))) .addTask(orderSiteMergeFilter) //fix incorrect order of siteMerge filter after update from M5.3 which is before multiSite filter ); register(DeltaBuilder.update("1.1", "") .addTask(new NodeExistsDelegateTask("Remove themes folder if empty", "Location /modules/site/config/themes is deprecated but still supported", RepositoryConstants.CONFIG, "/modules/site/config/themes", new RemoveNodeWithoutChildren("/modules/site/config/themes")))); }
new PartialBootstrapTask("Bootstrap app", "Bootstrap activation monitor app", "/mgnl-bootstrap/activation/config.modules.activation.apps.xml", "/apps/activationMonitor"), new NodeExistsDelegateTask("Remove Activation tools from dev group of appLauncher", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/dev/apps/activation", new RemoveNodeTask("Remove Activation tools from dev group of appLauncher", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/dev/apps/activation")) ), new BootstrapSingleModuleResource("Bootstrap app", "Bootstrap activation apps.", "config.modules.activation.apps.xml") new MoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/activation/apps/activationMonitor/subApps/main", "/modules/activation/apps/activation/subApps/monitor", false)), new NodeExistsDelegateTask("Delete activationMonitor App from tools", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/tools/apps/activationMonitor", new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/tools/apps/activationMonitor")), new NodeExistsDelegateTask("Delete activationMonitor App from tools", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/tools/apps/activationMonitor", new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/tools/apps/activationMonitor")),
public TemplatingModuleVersionHandler() { .addTask(new RemoveNodeTask("Remove backwards compatibility filter", "", RepositoryConstants.CONFIG, "/server/filters/cms/backwardCompatibility")) .addTask(new RemoveNodeTask("Remove template-renderers", "", RepositoryConstants.CONFIG, "/modules/templating/template-renderers")) .addTask(new RemoveNodeTask("Remove paragraph-renderers", "", RepositoryConstants.CONFIG, "/modules/templating/paragraph-renderers")) .addTask(new RenamePropertyAllModulesNodeTask("Templates configuration", "templatePath is now templateScript.", "templates", "templatePath", "templateScript")) .addTask(new RenamePropertyAllModulesNodeTask("Paragraphs configuration", "templatePath is now templateScript.", "paragraphs", "templatePath", "templateScript"))
public RenderingModuleVersionHandler() { register(DeltaBuilder.update("4.5", "") .addTask(new BootstrapSingleResource( "Register FTL Context Attribute", "Add cms and cmsfn context Attribute", "/mgnl-bootstrap/rendering/config.modules.rendering.renderers.freemarker.contextAttributes.xml"))); register(DeltaBuilder.update("4.5.3", "") .addTask(transformSubTemplatesToVariations)); register(DeltaBuilder.update("4.5.4", "") .addTask(correctVariations)); register(DeltaBuilder.update("5.4", "") .addTask(new MigrateRenderingListenersTask()) ); register(DeltaBuilder.update("5.5.1", "") .addTask(new RemovePropertiesTask("Remove obsolete type property from renderers", RepositoryConstants.CONFIG, Arrays.asList("/modules/rendering/renderers/freemarker/type", "/modules/rendering/renderers/jsp/type"), false)) ); register(DeltaBuilder.update("6.0", "") .addTask(new RemoveNodeTask("Remove JSP renderer configuration.", "/modules/rendering/renderers/jsp")) ); } }
new BootstrapSingleResource("Bootstrap Commands configuration", "", "/mgnl-bootstrap/resources/commands/config.modules.resources.commands.xml"))) .addTask(new NodeExistsDelegateTask("Remove version command if existing", "", RepositoryConstants.CONFIG, "/modules/resources/commands/resources/versionResources/version", new RemoveNodeTask("Remove version command", "", RepositoryConstants.CONFIG, "/modules/resources/commands/resources/versionResources/version")))); .addTask(new RemoveNodeTask("Remove obsolete command", "Remove obsolete version command configuration", RepositoryConstants.CONFIG, "/modules/resources/commands/resources/versionResources/version"))); .addTask(new RemoveNodeTask("Removes ClasspathSpool servlet", "Removes ClasspathSpool servlet for URL mapping '/.resources'.", RepositoryConstants.CONFIG, "/server/filters/servlets/ClasspathSpoolServlet")) .addTask(addResourcesServletMapping()) ); new SetPropertyTask("config", "/modules/resources/templates/processedJs", "contentType", "application/javascript")))) .addTask(new TemplateMigrationTask(new NodeExistsDelegateTask("Remove app launcher configuration for inplace templating", INPLACE_TEMPLATING_APP_LAUNCHER_CONFIG, new RemoveNodeTask("", INPLACE_TEMPLATING_APP_LAUNCHER_CONFIG)))) ); new RemoveNodeTask("Remove legacy yaml template", "/modules/resources/templates/yaml"))) .addTask(new ArrayDelegateTask("Remove adminInterface-legacy unused ACLs for resources-base", new RemovePermissionTask("", RESOURCES_BASE_ROLE, ACL_CONFIG, "/modules/adminInterface/config/menu/templating-kit/resources", Permission.READ),
new LoginFormPropertyMovedToFilter(), new MoveAndRenamePropertyTask("unsecuredPath is now handled by the bypass mechanism.", "/server/login", "UnsecuredPath", "/server/filters/uriSecurity/bypasses/login", "pattern"), new RemoveNodeTask("Login configuration changed", "Removes /server/login as it is not used anymore.", "config", "/server/login") )),
new RemoveNodeTask("Remove obsolete compressible configuration.", "/" + OBSOLETE_COMPRESSIBLE_CONFIGURATION_PATH), new MoveNodeTask("", OBSOLETE_DEFAULT_CONFIGURATION_PATH + "cachePolicy/voters", OBSOLETE_DEFAULT_CONFIGURATION_PATH + "cachePolicy/shouldBypassVoters", false), new RemoveNodesTask("Remove deprecated cacheable voters", new RemoveNodeTask("", "/modules/ui-admincentral/apps/cacheTools"))) .addTask(new NodeExistsDelegateTask("Remove cache tools page", "/modules/cache/pages/cachePage", new RemoveNodeTask("", "/modules/cache/pages/cachePage"))) .addTask(new RemoveNodeWoChildren("Remove pages node if there are no pages registered.", "/modules/cache/pages")) .addTask(new RemoveVirtualUriMappingTask()) register(DeltaBuilder.update("5.5.2", "") .addTask(new ArrayDelegateTask("Disable browser cache only when magnolia.develop=true", new RemoveNodeTask("", "/modules/cache/config/contentCaching/defaultPageCache/browserCachePolicy/policies/never"), new PartialBootstrapTask("", "/mgnl-bootstrap/cache/config.modules.cache.config.contentCaching.defaultPageCache.xml", "/defaultPageCache/browserCachePolicy/policies/disableBrowserCacheInDevelopMode"), new OrderNodeToFirstPositionTask("", "modules/cache/config/contentCaching/defaultPageCache/browserCachePolicy/policies/disableBrowserCacheInDevelopMode")
.addTask(new NodeExistsDelegateTask("Delete old app from app launcher if exists", "Delete old app from app launcher if exists", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps/RssAggregatorApp", new RemoveNodeTask("Delete old app from app launcher", "Delete old app from app launcher", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data/apps/RssAggregatorApp")))); .addTask(new PartialBootstrapTask("Bootstrap schedule tab", "Updates app with tab enabling RSS scheduling", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)) .addTask(new PartialBootstrapTask("Bootstrap command", "Bootstraps default rss import command", "/mgnl-bootstrap/rssaggregator/config/commands/config.modules.rssaggregator.commands.xml", "/commands/rss", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)) .addTask(new RemoveNodeTask("Remove config", "Remove old configuration app co the new one can be bootstrapen", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config")) .addTask(new PartialBootstrapTask("Bootstrap new config", "Bootstraps new configuration sub-app", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/config", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)) .addTask(new PartialBootstrapTask("Bootstrap action", "Bootstraps import action", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/browser/actions/runImport", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)) .addTask(new NodeExistsDelegateTask("Change save action", "Replace form save action with RSS specific one.", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/actions/commit", new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/actions/commit", "implementationClass", "info.magnolia.module.rssaggregator.action.SaveRSSAction"))) .addTask(new NodeExistsDelegateTask("Add transformer", "Add proper transformer class for name field.", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/name", new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/detail/editor/form/tabs/mainTab/fields/name", "transformerClass", "info.magnolia.module.rssaggregator.action.RSSBasicTransformer"))) .addTask(new NodeExistsDelegateTask("JCR agnostic remove node", "Remove nodeTypes node.", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actions/editRSSAggregator/availability/nodeTypes", new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/browser/actions/editRSSAggregator/availability/nodeTypes"))) .addTask(new RenameFilterFieldsPropertiesTask())); .addTask(new ArrayDelegateTask("Change config subApp and feed import settings tab.", new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/automatedImport", new RemoveNodeTask("Remove old automatedImport field from config.", "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/automatedImport")), new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/cron", new RemoveNodeTask("Remove old cron field from config.","/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields/cron")), new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/rssaggregator/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields", new PartialBootstrapTask("Add new switchable field to config.", "", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/config/formDefinitions/main/tabs/main/fields")), .addTask(new SetImportTimingSetterPropertyInitialValue("")) .addTask(new NodeExistsDelegateTask("Remove rssaggregator from '/modules/data/config/importers/rssaggregator'", "", RepositoryConstants.CONFIG, "/modules/data/config/importers/rssaggregator", new RemoveNodeTask("Remove rssaggregator from '/modules/data/config/importers/rssaggregator'", "/modules/data/config/importers/rssaggregator"))) .addTask(new ArrayDelegateTask("Set property fetcherClass according to /modules/rssaggregator/config/fetcher@class or to default value 'info.magnolia.module.rssaggregator.importhandler.FastRSSFeedFetcher' and remove /modules/rssaggregator/config/fetcher node.", new PropertyExistsDelegateTask("Set property fetcherClass according to /modules/rssaggregator/config/fetcher@class", "/modules/rssaggregator/config/fetcher", "class",
new RemoveNodeTask("Remove dialog links Node", "Remove dialog definition in contacts/dialogs/links", RepositoryConstants.CONFIG, "/modules/contacts/dialogs/link"))) .addTask(new NodeExistsDelegateTask("Remove dialog folder Node", "Remove dialog definition in contacts/dialogs/folder", RepositoryConstants.CONFIG, "/modules/contacts/dialogs/folder", new RemoveNodeTask("Remove dialog folder Node", "Remove dialog definition in contacts/dialogs/folder", RepositoryConstants.CONFIG, "/modules/contacts/dialogs/folder"))) .addTask(new NodeExistsDelegateTask("Change folder action to reference ui-framework", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/editFolder", new CheckAndModifyPartOfPropertyValueTask("Change rename-folder dialog reference", "Change rename-folder action to reference 'ui-framework:folder'", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/editFolder", "dialogName", "contacts:folder", "ui-framework:folder"))) new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/deleteFolder"))) new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/delete/availability"))) .addTask(new PropertyExistsDelegateTask("Remove label for delete action", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/delete", "label", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/delete", "label")))
.addTask(new BootstrapConditionally("Samples user", "Adds user if does not exist", "/mgnl-bootstrap-samples/samples/users.admin.patrick.xml")) .addTask(new RemoveNodeTask("Remove menu items", "Removes the samples menu config item sample templates.", ContentRepository.CONFIG, "/modules/adminInterface/config/menu/config/sample-templates")) .addTask(new RemoveNodeTask("Remove menu items", "Removes the samples menu config item sample paragraphs.", ContentRepository.CONFIG, "/modules/adminInterface/config/menu/config/sample-paragraphs")) .addTask(new RemoveNodeTask("Remove menu items", "Removes the samples menu config item sample dialogs.", ContentRepository.CONFIG, "/modules/adminInterface/config/menu/config/sample-dialogs"))