private Task addBypassToResourcesServlet() { return new ArrayDelegateTask("Add delegateResourceVoter to ResourcesServlet.", new NodeExistsDelegateTask("", "/server/filters/servlets/ResourcesServlet", new NodeExistsDelegateTask("", "/server/filters/servlets/ResourcesServlet/bypasses", new WarnTask("", "DelegateResourceVoter couldn't be installed since there is already a bypass defined for ResourcesServlet."), new ArrayDelegateTask("", new CreateNodeTask("", "/server/filters/servlets/ResourcesServlet", "bypasses", NodeTypes.ContentNode.NAME), new CreateNodeTask("", "/server/filters/servlets/ResourcesServlet/bypasses", "bypassWhenNotInResourceFilter", NodeTypes.ContentNode.NAME), new NewPropertyTask("", "/server/filters/servlets/ResourcesServlet/bypasses/bypassWhenNotInResourceFilter", "class", "info.magnolia.module.resources.DelegateResourceVoter"), new NewPropertyTask("", "/server/filters/servlets/ResourcesServlet/bypasses/bypassWhenNotInResourceFilter", "not", true))))); }
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)); } }
private void addCancelButtonTextFieldToFormSubmitTemplate(DeltaBuilder delta) { final String parentPath = "/modules/form/dialogs/formSubmit/form/tabs/tabMain/fields"; String generalDescTxt = " an additional field 'cancelButtonLabel' to" + parentPath + "."; Task bootstrapSingleModuleResource = new BootstrapSingleModuleResource("Add" + generalDescTxt, "Adds" + generalDescTxt, "dialogs/config.modules.form.dialogs.formSubmit.yaml", "/formSubmit/form/tabs/tabMain/fields/cancelButtonText"); NodeExistsDelegateTask nodeExistsDelegateTask = new NodeExistsDelegateTask("Conditionally add" + generalDescTxt + "(If " + parentPath + " exists.)", parentPath, bootstrapSingleModuleResource); delta.addTask(nodeExistsDelegateTask); }
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")); } }
private Task configureActionsAsAsynchronous() { return new IsModuleInstalledOrRegistered("Configure actions as asynchronous", "Configure actions as asynchronous if scheduler module is installed", "scheduler", new ArrayDelegateTask("", "", new NodeExistsDelegateTask("Configure activation as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/activate", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/activate", "asynchronous", "true")), new NodeExistsDelegateTask("Configure recursive activation as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/activateRecursive", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/activateRecursive", "asynchronous", "true")), new NodeExistsDelegateTask("Configure deletion as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/delete", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/delete", "asynchronous", "true")), new NodeExistsDelegateTask("Configure deletion of folder as asynchronous", "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/dam/apps/assets/subApps/browser/actions/deleteFolder", "asynchronous", "true")) )); }
protected List<Task> getCommonTasks() { final List<Task> commonTasks = new ArrayList<>(); commonTasks.add(new IsInstallSamplesTask("Re-Bootstrap website content for sample pages", "Re-bootstrap website content to account for all changes", new ArrayDelegateTask("", new BootstrapSingleResource("", "", "/mgnl-bootstrap-samples/samples/website.ftl-sample-site.xml"), new BootstrapSingleResource("", "", "/mgnl-bootstrap-samples/samples/dam.samples.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))); // We re-bootstrap twice because a simple (and single) re-bootstrap (using ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) would NOT // "move" an existing site definition (which might actually exist from a previous version) in the site module commonTasks.add(new BootstrapSingleModuleResource("config.modules.samples.config.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)); commonTasks.add(new BootstrapSingleModuleResource("config.modules.samples.config.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)); return commonTasks; }
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 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")); }
public static DeltaBuilder checkPrecondition(String minimalVersion, String newVersion) { return update(minimalVersion, "minimal version required for updating to " + newVersion).addCondition( new FalseCondition("checkPrerequisite", "Updating to " + newVersion + " is only supported from " + minimalVersion + " or higher.")); }
private Task moveExistingApps(String dest) { String src = "/modules/forum/apps"; Task moveAppsTask = new MoveNodeTask("Move " + src + " to " + dest, "Moving " + src + " to " + dest, RepositoryConstants.CONFIG, src, dest, false); Task checkNodeTask = new NodeExistsDelegateTask("Check if " + src + " exists.", "Check if " + src + " exists.", RepositoryConstants.CONFIG, "/modules/forum/apps", moveAppsTask); return checkNodeTask; }
public BootstrapSingleResourceAndOrderBefore(String name, String description, String resource, String orderBeforeName) { super(name, description); String workspace = BootstrapUtil.getWorkspaceNameFromResource(resource); String path = BootstrapUtil.getFullpathFromResource(resource); addTask(new BootstrapSingleResource(name, description, resource)); addTask(new OrderNodeBeforeTask(name, description, workspace, path, orderBeforeName)); } }
public BootstrapSingleResourceAndOrderAfter(String name, String description, String resource, String orderAfterName) { super(name, description); String workspace = BootstrapUtil.getWorkspaceNameFromResource(resource); String path = BootstrapUtil.getFullpathFromResource(resource); addTask(new BootstrapSingleResource(name, description, resource)); addTask(new OrderNodeAfterTask(name, description, workspace, path, orderAfterName)); } }
@Override public void execute(InstallContext ctx) throws TaskExecutionException { try { String outputResourceName = getOutputResourceName(resource, itemPath); //bootstrap bootstrap(outputResourceName, itemName, importUUIDBehavior, getNodeStream(resource, itemPath)); } catch (IOException e) { throw new TaskExecutionException("Cant find resource file"); } catch (RepositoryException e) { throw new TaskExecutionException("Cant bootstrap resource file"); } }
@Override public void execute(InstallContext ctx) throws TaskExecutionException { new MoveNodeTask("", "", RepositoryConstants.CONFIG, from, to, true).execute(ctx); new SetPropertyTask(RepositoryConstants.CONFIG, to, "icon", icon).execute(ctx); }
/** * Bootstraps the given resource if the corresponding node does not exist yet, executes the given task otherwise. */ public BootstrapConditionally(String taskName, String taskDescription, String resourceToBootstrap, Task ifNodeExists) { super(taskName, taskDescription, determineRepository(resourceToBootstrap), determinePath(resourceToBootstrap), ifNodeExists, new BootstrapSingleResource(taskName, taskDescription, resourceToBootstrap)); }
protected Task updateSecurityBaseRolePermissions() { ArrayDelegateTask permissionsTask = new ArrayDelegateTask("Update security-base role", "Disallows access to some sensitive URIs and grants basic access to AdminCentral."); for (String path : PERMISSIONS_FOR_LEGACY_PAGES) { permissionsTask.addTask(new RemovePermissionTask("", SECURITY_BASE_ROLE, "uri", path, AddURIPermissionTask.DENY)); } permissionsTask.addTask(new RemovePermissionTask("", SECURITY_BASE_ROLE, RepositoryConstants.USER_ROLES, "/" + SECURITY_BASE_ROLE, Permission.READ)); return permissionsTask; }
public AddMailTemplateTask(String templateName, String description, String from, String subject, String templatePath, String type) { super("Mail template", "Adds the " + templateName + " " + description + ".", new CreateNodeTask(null, null, RepositoryConstants.CONFIG, "/modules/mail/config/templatesConfiguration", templateName, NodeTypes.ContentNode.NAME), new NewPropertyTask(null, null, RepositoryConstants.CONFIG, "/modules/mail/config/templatesConfiguration/" + templateName, "from", from), new NewPropertyTask(null, null, RepositoryConstants.CONFIG, "/modules/mail/config/templatesConfiguration/" + templateName, "subject", subject), new NewPropertyTask(null, null, RepositoryConstants.CONFIG, "/modules/mail/config/templatesConfiguration/" + templateName, "templateFile", templatePath), new NewPropertyTask(null, null, RepositoryConstants.CONFIG, "/modules/mail/config/templatesConfiguration/" + templateName, "type", type)); } }
@Override public void visit(Node node) throws RepositoryException { if (nodeMatches(node)) { operateOnNode(installContext, node); } } };
/** * Bootstraps the given resource if the corresponding node does not exist yet, does nothing otherwise. */ public BootstrapConditionally(String taskName, String taskDescription, String resourceToBootstrap) { super(taskName, taskDescription, determineRepository(resourceToBootstrap), determinePath(resourceToBootstrap), null, new BootstrapSingleResource(taskName, taskDescription, resourceToBootstrap)); }