@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); }
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; }
/** * Moves every node to the mappings node. */ @Override protected void operateOnChildNode(Content node, InstallContext ctx) throws RepositoryException, TaskExecutionException { final String oldHandle = node.getHandle(); final String newHandle = SERVER_URI2REPOSITORY_MAPPING + "/mappings/" + node.getName(); subTasks.addTask(new MoveNodeTask("Move " + oldHandle + " to " + newHandle + "", "Moves the " + oldHandle + " node to its new location", RepositoryConstants.CONFIG, oldHandle, newHandle, true)); }
@Override protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { final Session session = installContext.getConfigJCRSession(); final String newCacheFactoryName = StringUtils.substringBefore(StringUtils.lowerCase(StringUtils.substringAfterLast(session.getNode("/modules/cache/config/cacheFactory/").getProperty("class").getString(), ".")), "factory"); new RenameNodeTask("", RepositoryConstants.CONFIG, "/modules/cache/config", "cacheFactory", newCacheFactoryName, false).execute(installContext); new BootstrapSingleModuleResource("config.modules.cache.config.cacheFactory.xml").execute(installContext); new MoveNodeTask("", "/modules/cache/config/" + newCacheFactoryName, "/modules/cache/config/cacheFactory/delegateFactories/" + newCacheFactoryName, false).execute(installContext); } }
/** * @param workspace the workspace that contains path * @param path the path to the node that is to be backed up. * @param info indicates if an info message should be displayed. */ public BackupTask(String workspace, String path, boolean info) { super("Backup", "Does a backup of the node path '" + path + "' in the " + workspace + " workspace."); this.workspace = workspace; this.path = path; this.info = info; final String parentPath = StringUtils.substringBeforeLast(path, "/"); final String backupParentPath = getBackupPath() + parentPath; this.backupPath = backupParentPath + "/" + StringUtils.substringAfterLast(path, "/"); final CreateNodePathTask backupParent = new CreateNodePathTask("Create node", "Creates the " + path + " backup location.", workspace, backupParentPath); final MoveNodeTask moveNodeToBackupPath = new MoveNodeTask("Move node", "Moves " + path + " to the " + backupPath + " backup location.", workspace, path, backupPath, true); addTask(backupParent); addTask(moveNodeToBackupPath); }
@Test public void moveWithOverwriteTrueWhenItIsExisitingAtNewLocation() throws Exception { // GIVEN root.addNode(DEST_PATH, NodeTypes.Folder.NAME); final MoveNodeTask task = new MoveNodeTask("test", "/" + SRC_PATH, "/" + DEST_PATH, true); // WHEN task.execute(ctx); // THEN assertThat("Node doesn't exist at old location", root, not(hasNode(SRC_PATH))); assertThat("Node exists at new location with proper nodeType", root, hasNode(DEST_PATH, NodeTypes.Content.NAME)); }
.addTask(new ArrayDelegateTask("Merge activation monitor into activation tools", new NodeExistsDelegateTask("Rename subApp main to activation", "", RepositoryConstants.CONFIG, "/modules/activation/apps/activation/subApps/main", new MoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/activation/apps/activation/subApps/main", "/modules/activation/apps/activation/subApps/activation", false)), new NodeExistsDelegateTask("Move activationMonitor SubApp under activation", "", RepositoryConstants.CONFIG, "/modules/activation/apps/activationMonitor/subApps/main", 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")),
@Test public void moveWithOverwriteFalseWhenItIsExisitingAtNewLocation() throws Exception { // GIVEN root.addNode(DEST_PATH, NodeTypes.Folder.NAME); final MoveNodeTask task = new MoveNodeTask("test", "/" + SRC_PATH, "/" + DEST_PATH, false); // WHEN task.execute(ctx); // THEN assertThat("Node exists at old location", root, hasNode(SRC_PATH, NodeTypes.Content.NAME)); assertThat("Node exists at new location with previous nodeType", root, hasNode(DEST_PATH, NodeTypes.Folder.NAME)); assertThat(ctx.getMessages().values(), is(not(empty()))); } }
RepositoryConstants.USERS, "/anonymous", "/mgnl-bootstrap/core/users.system.anonymous.xml", new ArrayDelegateTask("", new MoveNodeTask("", "", RepositoryConstants.USERS, "/anonymous", "/system/anonymous", false), new NewPropertyTask("Anonymous user", "Anonymous user must have a password.", RepositoryConstants.USERS, "/system/anonymous", "pswd", new String(Base64.encodeBase64("anonymous".getBytes()))) )), new MoveNodeTask("", "", RepositoryConstants.USERS, "/superuser", "/system/superuser", false)),
@Test public void moveToNewDestination() throws Exception { // GIVEN final MoveNodeTask task = new MoveNodeTask("test", "/" + SRC_PATH, "/" + DEST_PATH, false); // WHEN task.execute(ctx); // THEN assertThat("Node exists at new location", root, hasNode(DEST_PATH, NodeTypes.Content.NAME)); assertThat("Node doesn't exist at old location", root, not(hasNode(SRC_PATH))); }
new MoveNodeTask("", OBSOLETE_DEFAULT_CONFIGURATION_PATH + "cachePolicy/voters", OBSOLETE_DEFAULT_CONFIGURATION_PATH + "cachePolicy/shouldBypassVoters", false), new RemoveNodesTask("Remove deprecated cacheable voters", RepositoryConstants.CONFIG, Arrays.asList(OBSOLETE_DEFAULT_CONFIGURATION_PATH + "executors/store/cacheContent/isCacheableVoters"), false)
new MoveNodeTask("Move categoryFeeds node", "Move categoryFeeds node to categorization module", "config", "/modules/adminInterface/virtualURIMapping/categoryFeeds", "/modules/categorization/virtualURIMapping/categoryFeeds", false), new ArrayDelegateTask("Move categoryFeeds node", "Move categoryFeeds node to categorization module", new CreateNodeTask("Create node", "Create virtualURIMapping node in categorization module", "config", "/modules/categorization", "virtualURIMapping", NodeTypes.Content.NAME), new MoveNodeTask("Move categoryFeeds node", "Move categoryFeeds node to categorization module", "config", "/modules/adminInterface/virtualURIMapping/categoryFeeds", "/modules/categorization/virtualURIMapping/categoryFeeds", false)))));