public RemovePropertyIfExists(String taskName, String taskDescription, String workspaceName, String parentPath, String propertyName) { super(taskName, taskDescription, workspaceName, parentPath, propertyName, new RemovePropertyTask(taskName, taskDescription, workspaceName, parentPath, propertyName)); } }
private void addLabelRemovalTasks(DeltaBuilder delta, String dialogName) { delta.addTask(new RemovePropertyTask("Remove commit action label from dialog " + dialogName, "Remove commit action label from dialog " + dialogName, RepositoryConstants.CONFIG, DIALOGS_PATH + dialogName + COMMIT_ACTION, "label")); delta.addTask(new RemovePropertyTask("Remove cancel action label from dialog " + dialogName, "Remove cancel action label from dialog " + dialogName, RepositoryConstants.CONFIG, DIALOGS_PATH + dialogName + CANCEL_ACTION, "label")); } }
public UpdateSendMailOnPagesNotificationTask() { super("Update sendMailOnPageChanges configuration", "Updates sendMailOnPageChanges listener configuration in order to use a freemarker template for sending an email.", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, listenerParams, "from"), new RemovePropertyTask("", "", RepositoryConstants.CONFIG, listenerParams, "subject"), new RemovePropertyTask("", "", RepositoryConstants.CONFIG, listenerParams, "text"), new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, listenerParams, "type", new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, listenerParams, "type", "text", "freemarker")), new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, listenerParams, "mailTemplate", new SetPropertyTask("", RepositoryConstants.CONFIG, listenerParams, "mailTemplate", "pageChangeNotification")), new PartialBootstrapTask("", "", "/mgnl-bootstrap/listenerConfigs/config.modules.observation.config.xml", "/config/listenerConfigurations/sendMailOnPageChanges/listener/params/model")); } }
public MigrateValidationSelectFieldToTwinColSelectFieldTask(String name, String[] fields) { super(name); for (String field : fields) { addTask(new NodeExistsDelegateTask(String.format("Migrate 'validation' field '%s' to multi select field.", field), field, new ArrayDelegateTask("", new RemovePropertyTask(String.format("Remove property 'buttonLabel' for validation field in '%s'", field), field, "buttonLabel"), new RemovePropertyTask(String.format("Remove property 'type' for validation field in '%s'", field), field, "type"), new ValueOfPropertyDelegateTask("", field, "class", "info.magnolia.ui.form.field.definition.SelectFieldDefinition", false, new SetPropertyTask(RepositoryConstants.CONFIG, field, "class", "info.magnolia.ui.form.field.definition.TwinColSelectFieldDefinition")), new SetPropertyTask(RepositoryConstants.CONFIG, field, "leftColumnCaption", "dialog.form.edit.tabMain.validation.leftColumnCaption"), new SetPropertyTask(RepositoryConstants.CONFIG, field, "rightColumnCaption", "dialog.form.edit.tabMain.validation.rightColumnCaption") ), new WarnTask("Unable to migrate validation field", String.format(WARNING_MESSAGE_FORMAT, field))) ); } }
@Test public void testExecute() throws RepositoryException, TaskExecutionException { // GIVEN Property property1 = NodeUtil.createPath(session.getRootNode(), "/demo-project/about/subsection-articles/article", NodeTypes.ContentNode.NAME).setProperty("someProperty", "someValue"); Task task = new RemovePropertyTask("name", property1.getParent().getPath(), "someProperty"); // WHEN task.execute(ctx); // THEN assertFalse("Property should have been removed", session.propertyExists("/demo-project/about/subsection-articles/article/someProperty")); assertEquals("Remove property 'config:/demo-project/about/subsection-articles/article/someProperty'.", 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 RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURAuthSubmit", "modelClass"))) .addTask(new PropertyExistsDelegateTask("Update template 'stkPURNotAuthSubmit'", "/modules/standard-templating-kit/templates/components/pur/stkPURNotAuthSubmit", "modelClass", new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURNotAuthSubmit", "modelClass"))) .addTask(new PropertyExistsDelegateTask("Update template 'stkPURIntranet'", "/modules/standard-templating-kit/templates/components/pur/stkPURIntranet", "modelClass", new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURIntranet", "modelClass"))) new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURLoginForm", "modelClass"))) .addTask(new ArrayDelegateTask("Fix XSS issue in /resources/templating-kit/js/scriptloader-plugin.js", "Fix XSS issue in /resources/templating-kit/js/scriptloader-plugin.js", new InstallTextResourceTask("/templating-kit/js/libs/swfobject.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, true, false), new RemovePropertyTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/libs/swfobject.js", "extension"), new AddVersionToResourceTask("/modules", "/resources/templating-kit/js/scriptloader-plugin.js", "2.0"), new AddVersionToResourceTask("/modules", "/resources/templating-kit/js/mobile-scriptloader-plugin.js", "2.0")
public ObservationModuleVersionHandler() { register(DeltaBuilder.update("2.0", "") .addTask(new CheckAndModifyPropertyValueTask("Replace activation command", "Replaces old activation command with the new one provided by the activation module.", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/command", "class", "info.magnolia.module.admininterface.commands.ActivationCommand", "info.magnolia.module.activation.commands.ActivationCommand")) .addTask(new CheckAndModifyPropertyValueTask("Replace node type", "Replaces the node type to be used for added pages activation from mgnl:content to mgnl:page.", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener", "nodeType", "mgnl:content", "mgnl:page"))); register(DeltaBuilder.update("2.0.1", "") .addTask(new ArrayDelegateTask("Move repository property", "Moves repository property for activateAddedPages configuration to command params.", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/command", "repository"), new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/params", null, new CreateNodePathTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/params")), new NewPropertyTask("", "", RepositoryConstants.CONFIG, "/modules/observation/config/listenerConfigurations/activateAddedPages/listener/params", "repository", "website")))); register(DeltaBuilder.update("2.0.2", "") .addTask(new BootstrapSingleResource("foo", "bar", "/mgnl-bootstrap/observation/setup/mail/config.modules.mail.config.templatesConfiguration.pageChangeNotification.xml")) .addTask(new UpdateSendMailOnPagesNotificationTask())); register(DeltaBuilder.update("2.1", "") .addTask(usePublicationCommand) ); }
new RemovePropertyTask("", "", "config", "/server", "defaultMailServer")),
.addTask(new RemovePropertyTask("Remove non-existing dialog reference from plaintext template", "/modules/templating/templates/plaintext/", "dialog")) );
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 PropertyExistsDelegateTask("Remove icon for delete action", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/delete", "icon", new RemovePropertyTask("Remove icon for delete action", "", RepositoryConstants.CONFIG, "/modules/contacts/apps/contacts/subApps/browser/actions/delete", "icon")))
.addTask(new NodeExistsDelegateTask("Set i18n property", "/modules/standard-templating-kit/dialogs/pages/categoryOverview/stkCategoryOverviewProperties/form/tabs/tabMain/fields/title", new SetPropertyTask("Set i18n property", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/categoryOverview/stkCategoryOverviewProperties/form/tabs/tabMain/fields/title", "i18n", Boolean.TRUE))) .addTask(new RemovePropertyTask("Remove obsolete 'repository' property", "Remove obsolete 'repository' property from /modules/categorization/dialogs/catCloud/form/tabs/tabMain/fields/catCloud", RepositoryConstants.CONFIG, "/modules/categorization/dialogs/catCloud/form/tabs/tabMain/fields/catCloud", "repository")) .addTask(new NodeExistsDelegateTask("Add missing 'dialogName' property", "Sets 'dialogName' property of 'categoryRSSFeed/form/tabs/tabFeed/fields/siteRoot' to 'ui-pages-app:link'", RepositoryConstants.CONFIG, new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/categorization/apps/categories/subApps/browser/actions/delete/availability"))) .addTask(new PropertyExistsDelegateTask("Remove label for delete action", "", RepositoryConstants.CONFIG, "/modules/categorization/apps/categories/subApps/browser/actions/delete", "label", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/categorization/apps/categories/subApps/browser/actions/delete", "label"))) .addTask(new PropertyExistsDelegateTask("Remove icon for delete action", "", RepositoryConstants.CONFIG, "/modules/categorization/apps/categories/subApps/browser/actions/delete", "icon", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/categorization/apps/categories/subApps/browser/actions/delete", "icon"))) new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/categorization/apps/categories/permissions/roles", "demo-project-base", "demo-project-base")))) .addTask(new ArrayDelegateTask("Rename property", "Rename property [workspace] to [targetWorkspace].", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/categorization/dialogs/categoryRSSFeed/form/tabs/tabFeed/fields/siteRoot", "workspace"), new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/categorization/dialogs/categoryRSSFeed/form/tabs/tabFeed/fields/siteRoot", "targetWorkspace", RepositoryConstants.WEBSITE))) .addTask(new RemovePropertyTask("Remove useless property", "Remove 'required=false' property.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/features/stkRelatedCategoriesLinkList/form/tabs/tabMain/fields/listTitle", "required")) .addTask(new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/features/stkRelatedCategoriesLinkList/form/tabs/tabMain", "label", "dialogs.paragraphs.features.stkCategoryOverview.tabMain.label"))); new RemovePropertyTask("Remove AutoGeneratedExtrasArea class, has been replaced by AreaElement.", "/modules/standard-templating-kit/templates/pages/stkCategoryOverview/areas/extras/", "class"))) .addTask(new RemovePropertyTask("Remove obsolete permission demo-project-base", "/modules/categorization/apps/categories/permissions/roles", "demo-project-base")));
new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of data group on the applauncher", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/data", "label"))));
new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteAsset/availability"))) .addTask(new PropertyExistsDelegateTask("Remove label for deleteAsset action", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteAsset", "label", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteAsset", "label"))) .addTask(new PropertyExistsDelegateTask("Remove icon for deleteAsset action", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteAsset", "icon", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteAsset", "icon"))) new RemovePropertyTask("Remove label for deleteFolder action", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", "label"))) .addTask(new PropertyExistsDelegateTask("Remove icon for deleteFolder action", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", "icon", new RemovePropertyTask("Remove icon for deleteFolder action", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", "icon"))) new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/detail/editor/form/tabs/asset/fields/metadataStandard", "class", StaticFieldDefinition.class.getName()))) .addTask(new PropertyExistsDelegateTask("Remove default value of the metadataStandard field Definition ", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/detail/editor/form/tabs/asset/fields/metadataStandard", "defaultValue", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/detail/editor/form/tabs/asset/fields/metadataStandard", "defaultValue"))) .addTask(new PropertyExistsDelegateTask("Set value property of the static metadataStandard field ", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/detail/editor/form/tabs/asset/fields/metadataStandard", "defaultValue", new SetPropertyTask("Set value of the static metadataStandard field ", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/detail/editor/form/tabs/asset/fields/metadataStandard", "value", "Simple Dublin Core Metadata Element Set (DCMES)"))) new RenameNodesTask("", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions", "deleteAsset", "delete", NodeTypes.ContentNode.NAME))) .addTask(new NodeExistsDelegateTask("Remove label of the moveFolder action", "So that it is standardized.", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/moveFolder", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/moveFolder", "label"))) .addTask(new NodeExistsDelegateTask("In confirmDeleteAsset: Rename action deleteAsset to delete", "So that it is standardized.", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/confirmDeleteAsset", new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/confirmDeleteAsset", "successActionName", "delete"))) new RemovePropertyTask("Remove obsolete 'categoryName'", "Remove '/modules/dam/apps/assets/categoryName'", RepositoryConstants.CONFIG, "/modules/dam/apps/assets/", "categoryName"))) .addTask(new PartialBootstrapTask("Bootstrap 'chooseDialog'", "Bootstrap chooseDialog into 'assets' app", "/mgnl-bootstrap/dam-app-1-x/config.modules.dam.apps.assets.xml", "/assets/chooseDialog")) .addTask(new ArrayDelegateTask("Configure icons for assets app", new PropertyExistsDelegateTask("", "/modules/dam/apps/assets/subApps/browser/workbench/nodeTypes/mainNodeType", "icon", new RemovePropertyTask("", "/modules/dam/apps/assets/subApps/browser/workbench/nodeTypes/mainNodeType", "icon")),
.addTask(new PropertyExistsDelegateTask("Rename property", "", RepositoryConstants.CONFIG, "/modules/forum/dialogs/forumEdit/tabForum/allowsNestingMessages", "checked", new ArrayDelegateTask("", new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/forum/dialogs/forumEdit/tabForum/allowsNestingMessages", "checked"), new SetPropertyTask("", RepositoryConstants.CONFIG, "/modules/forum/dialogs/forumEdit/tabForum/allowsNestingMessages", "selected", Boolean.FALSE)
.addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of Cache tools app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/cacheTools", "label")) .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of Cache tools app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/cacheTools", "icon")));
.addTask(new ArrayDelegateTask("Remove velocity template", "Removes velocity template support.", new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/mail/config/templatesConfiguration/testVelocity"), new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/mail/config/factory/renderers/", "velocity"))) .addTask(new RemoveNodeTask("Remove legacy ui page", "Removes old legacy adminInterface page.", RepositoryConstants.CONFIG, "/modules/mail/pages")) .addTask(new BootstrapSingleModuleResource("Bootstrap field types", "Bootstraps new field types used by mail tools app.", "config.modules.mail.fieldTypes.xml"))
.addTask(new NodeExistsDelegateTask("Remove hardcoded i18n properties from '/modules/form/dialogs' subtree","/modules/form/dialogs", new RemoveHardcodedI18nPropertiesTask("/modules/form/dialogs"))) .addTask(new NodeExistsDelegateTask("Remove hardcoded i18n properties from '/modules/form/templates/components' subtree","/modules/form/templates/components", new RemoveHardcodedI18nPropertiesTask("/modules/form/templates/components"))) .addTask(new HasPropertyDelegateTask("Remove hardcoded i18n property - 'formCondition.tabMain.text.value '", "/modules/form/dialogs/formCondition/form/tabs/tabMain/fields/text", "value", new RemovePropertyTask("Remove hardcoded i18n property - 'formCondition.tabMain.text.value '", "/modules/form/dialogs/formCondition/form/tabs/tabMain/fields/text", "value"))) );
.addTask(new NodeExistsDelegateTask("Enable csrfTokenSecurity filter", "Adds or enables csrfTokenSecurity filter.", "config", "/server/filters/csrfTokenSecurity", new ValueOfPropertyDelegateTask("Enable csrfTokenSecurity filter", "/server/filters/csrfTokenSecurity", "enabled", "false", false, new RemovePropertyTask("", "/server/filters/csrfTokenSecurity", "enabled")), new ArrayDelegateTask("Add csrfTokenSecurity filter", "", new BootstrapSingleModuleResource("", "", "config.server.filters.xml", "/filters/csrfTokenSecurity"),