Version Differences for Remoting Specific Scripts

(AHPSCRIPTS-74)
(Migrate All Workflows Using One Branch to Use Different Branch (CVS))
Line 811:
       
  uow.commitAndClose();</pre>    uow.commitAndClose();</pre> 
       
    + = Check for Circular Dependencies in Workflow Configuration =  
    + This Script goes through all of the Workflow Dependency Configurations checking for any circular deps that may be configured. This can only really happen through remote scripting since our UI prevents it.  
    + ==== AHPSCRIPTS-72 ====  
    + <pre>import com.urbancode.anthill3.main.client.AnthillClient;  
    + import com.urbancode.anthill3.persistence.UnitOfWork;  
    + import com.urbancode.anthill3.domain.profile.*;  
    + import com.urbancode.anthill3.domain.project.*;  
    + import com.urbancode.anthill3.domain.workflow.*;  
    + import com.urbancode.codestation2.domain.project.*;  
       
    + import java.util.*;  
       
    + String serverHost = "localhost";  
    + int serverPort = 4567;  
    + String userName = "admin";  
    + String password = "admin";  
       
    + serverHost = bsh.args[0];  
    + serverPort = Integer.parseInt(bsh.args[1]);  
    + userName = bsh.args[2];  
    + password = bsh.args[3];  
       
    + HashSet getAllDeps(CodestationCompatableProject depProject) {  
    + HashSet allDeps = new HashSet();  
    + addAllDeps(allDeps, depProject);  
    + return allDeps;  
    + }  
       
    + addAllDeps(HashSet deps, CodestationCompatableProject depProject) {  
       
    + if (deps.add(depProject)) {  
    + Dependency[] trans = ((WithAnthillDependencies) depProject).getDependencyArray();  
    + for (int i =0; i < trans.length; i++) {  
    + addAllDeps(deps, trans[i].getDependency());  
    + }  
    + }  
    + }  
       
    + // obtain connection to the Anthill server  
    + AnthillClient anthill = AnthillClient.connect(serverHost, serverPort,  
    + userName, password);  
       
    + // create a Unit of Work  
    + UnitOfWork uow = anthill.createUnitOfWork();  
       
    + // Project  
    + Project[] projects = ProjectFactory.getInstance().restoreAll();  
       
    + for (int i = 0; i < projects.length; i++) {  
    + Workflow workflow = projects[i].getWorkflow("CommonModuleBuildWorkflow");  
    + if (workflow != null) {  
    + Dependency[] deps = workflow.getBuildProfile().getDependencyArray();  
    + for (int j =0; j < deps.length; j++) {  
    + if (getAllDeps(deps[j].getDependency()).contains(new AnthillProject(workflow.getBuildProfile()))) {  
    + throw new IllegalStateException("Circular Dependency Found in project " + projects[i].getName() + " for dependency " + deps[j].getDependency().getName() + " with dependent " + deps[j].getDependent().getName());  
    + }  
    + }  
    + }  
    + }  
       
    + uow.commitAndClose();</pre>