/** * Make sure that a workspace with the supplied name exists. * * @param workspaceName the name of the workspace; may not be null */ protected void predefineWorkspace( RepositoryConfiguration configuration, String workspaceName ) { assertThat(workspaceName, is(notNullValue())); // Edit the configuration ... Editor editor = configuration.edit(); EditableDocument workspaces = editor.getOrCreateDocument("workspaces"); EditableArray predefined = workspaces.getOrCreateArray("predefined"); predefined.addStringIfAbsent(workspaceName); // And apply the changes ... Changes changes = editor.getChanges(); if (changes.isEmpty()) return; try { repository.apply(changes); } catch (Exception e) { e.printStackTrace(); throw new AssertionFailedError("Unexpected error while predefining the \"" + workspaceName + "\" workspace:" + e.getMessage()); } }
parents.addStringIfAbsent(parent.toString()); if (oldParent != null) { parents.remove((Object)oldParent.toString()); parents.addStringIfAbsent(added.toString());
parents.addStringIfAbsent(parent.toString()); if (oldParent != null) { parents.remove((Object)oldParent.toString()); parents.addStringIfAbsent(added.toString());