/** * @return the workspace this module belongs to. * @throws RulesRepositoryException */ public String[] getWorkspaces() throws RulesRepositoryException { return getStringPropertyArray(WORKSPACE_PROPERTY_NAME); }
/** * @return the workspace this module belongs to. * @throws RulesRepositoryException */ public String[] getWorkspaces() throws RulesRepositoryException { return getStringPropertyArray(WORKSPACE_PROPERTY_NAME); }
/** * This removes a workspace * * @param workspace */ public void removeWorkspace(String workspace) { String[] existingWorkspaces = getStringPropertyArray(WORKSPACE_PROPERTY_NAME); if (existingWorkspaces.length == 0) { return; } List<String> existingWorkspaceList = new ArrayList<String>(existingWorkspaces.length); Collections.addAll(existingWorkspaceList, existingWorkspaces); existingWorkspaceList.remove(workspace); if (existingWorkspaceList.size() != existingWorkspaces.length) { this.updateStringArrayProperty(existingWorkspaceList.toArray(new String[existingWorkspaceList.size()]), WORKSPACE_PROPERTY_NAME, false); } }
/** * This removes a workspace * * @param workspace */ public void removeWorkspace(String workspace) { String[] existingWorkspaces = getStringPropertyArray(WORKSPACE_PROPERTY_NAME); if (existingWorkspaces.length == 0) { return; } List<String> existingWorkspaceList = new ArrayList<String>(existingWorkspaces.length); Collections.addAll(existingWorkspaceList, existingWorkspaces); existingWorkspaceList.remove(workspace); if (existingWorkspaceList.size() != existingWorkspaces.length) { this.updateStringArrayProperty(existingWorkspaceList.toArray(new String[existingWorkspaceList.size()]), WORKSPACE_PROPERTY_NAME, false); } }
/** * This adds a workspace * * @param workspace */ public void addWorkspace(String workspace) { String[] existingWorkspaces = getStringPropertyArray(WORKSPACE_PROPERTY_NAME); boolean found = false; for (String existingWorkspace : existingWorkspaces) { if (existingWorkspace.equals(workspace)) { found = true; break; } } if (!found) { String[] newWorkspaces = new String[existingWorkspaces.length + 1]; System.arraycopy(existingWorkspaces, 0, newWorkspaces, 0, existingWorkspaces.length); newWorkspaces[existingWorkspaces.length] = workspace; this.updateStringArrayProperty(newWorkspaces, WORKSPACE_PROPERTY_NAME, false); } }
/** * This adds a workspace * * @param workspace */ public void addWorkspace(String workspace) { String[] existingWorkspaces = getStringPropertyArray(WORKSPACE_PROPERTY_NAME); boolean found = false; for (String existingWorkspace : existingWorkspaces) { if (existingWorkspace.equals(workspace)) { found = true; break; } } if (!found) { String[] newWorkspaces = new String[existingWorkspaces.length + 1]; System.arraycopy(existingWorkspaces, 0, newWorkspaces, 0, existingWorkspaces.length); newWorkspaces[existingWorkspaces.length] = workspace; this.updateStringArrayProperty(newWorkspaces, WORKSPACE_PROPERTY_NAME, false); } }
public void updateDependency(String dependencyPath) { String[] existingDependencies = getStringPropertyArray(DEPENDENCIES_PROPERTY_NAME); boolean found = false; for (int i = 0; i < existingDependencies.length; i++) { if (decodeDependencyPath(existingDependencies[i])[0] .equals(decodeDependencyPath(dependencyPath)[0])) { found = true; existingDependencies[i] = dependencyPath; this.updateStringArrayProperty(existingDependencies, DEPENDENCIES_PROPERTY_NAME, false); break; } } if (!found) { String[] newDependencies = new String[existingDependencies.length + 1]; System.arraycopy(existingDependencies, 0, newDependencies, 0, existingDependencies.length); newDependencies[existingDependencies.length] = dependencyPath; this.updateStringArrayProperty(newDependencies, DEPENDENCIES_PROPERTY_NAME, false); } }
public void updateDependency(String dependencyPath) { String[] existingDependencies = getStringPropertyArray(DEPENDENCIES_PROPERTY_NAME); boolean found = false; for (int i = 0; i < existingDependencies.length; i++) { if (decodeDependencyPath(existingDependencies[i])[0] .equals(decodeDependencyPath(dependencyPath)[0])) { found = true; existingDependencies[i] = dependencyPath; this.updateStringArrayProperty(existingDependencies, DEPENDENCIES_PROPERTY_NAME, false); break; } } if (!found) { String[] newDependencies = new String[existingDependencies.length + 1]; System.arraycopy(existingDependencies, 0, newDependencies, 0, existingDependencies.length); newDependencies[existingDependencies.length] = dependencyPath; this.updateStringArrayProperty(newDependencies, DEPENDENCIES_PROPERTY_NAME, false); } }
String[] existingDependencies = getStringPropertyArray(DEPENDENCIES_PROPERTY_NAME); for (String existingDependency : existingDependencies) { String path = decodeDependencyPath(existingDependency)[0];
String[] existingDependencies = getStringPropertyArray(DEPENDENCIES_PROPERTY_NAME); for (String existingDependency : existingDependencies) { String path = decodeDependencyPath(existingDependency)[0];
@Test @Ignore("JackRabbit errors about node type for property {}testing. Probably repository changes have broken test.") public void testAddPackageProperties() throws Exception { RulesRepository repo = getRepo(); ModuleItem item = repo.createModule( "testListPackages1", "lalalala" ); assertNotNull(item.getCreator()); String[] testProp = new String[]{"Test1","Test2"}; item.node.checkout(); item.node.setProperty("testing", testProp); //item.node.setProperty("testing", "blah"); String[] newProp = item.getStringPropertyArray( "testing" ); assertTrue((testProp[0]).equals(newProp[0])); assertTrue(("Test2").equals(newProp[1])); //assertEquals(testProp[0], ); assertFalse(item.getCreator().equals( "" )); List list = iteratorToList( repo.listModules() ); int prevSize = list.size(); repo.createModule( "testListPackages2", "abc" ); list = iteratorToList( repo.listModules() ); assertEquals(prevSize + 1, list.size()); }