1 37 package net.sourceforge.cruisecontrol.publishers.sfee; 38 39 import com.vasoftware.sf.soap42.webservices.sfmain.ISourceForgeSoap; 40 import com.vasoftware.sf.soap42.webservices.sfmain.ProjectSoapList; 41 import com.vasoftware.sf.soap42.webservices.sfmain.ProjectSoapRow; 42 import net.sourceforge.cruisecontrol.CruiseControlException; 43 44 import java.rmi.RemoteException ; 45 46 public final class SfeeUtils { 47 private SfeeUtils() { 48 } 49 50 static String findProjectID(ISourceForgeSoap soap, String sessionID, String projectName) 51 throws RemoteException , CruiseControlException { 52 ProjectSoapList projectList = soap.getProjectList(sessionID); 53 ProjectSoapRow[] rows = projectList.getDataRows(); 54 String projectID = null; 55 for (int i = 0; i < rows.length; i++) { 56 ProjectSoapRow nextProjectRow = rows[i]; 57 if (nextProjectRow.getTitle().equals(projectName)) { 58 projectID = nextProjectRow.getId(); 59 } 60 } 61 assertFoundValue(projectID, "projectName", projectName); 62 return projectID; 63 } 64 65 static void assertFoundValue(Object object, String lookupName, String lookupValue) 66 throws CruiseControlException { 67 if (object == null) { 68 throw new CruiseControlException(lookupName + " [" + lookupValue + "] not found"); 69 } 70 } 71 } 72 | Popular Tags |