Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.collabnet.ce.webservices;
  
  import  com.collabnet.ce.soap50.webservices.ClientSoapStubFactory;
  
  import  com.collabnet.ce.soap50.webservices.frs.IFrsAppSoap;
  import  com.collabnet.ce.soap50.webservices.frs.FrsFileSoapDO;
  import  com.collabnet.ce.soap50.webservices.frs.FrsFileSoapList;
  import  com.collabnet.ce.soap50.webservices.frs.FrsFileSoapRow;
  import  com.collabnet.ce.soap50.webservices.frs.PackageSoapList;
 import  com.collabnet.ce.soap50.webservices.frs.PackageSoapRow;
 import  com.collabnet.ce.soap50.webservices.frs.ReleaseSoapDO;
 import  com.collabnet.ce.soap50.webservices.frs.ReleaseSoapList;
 import  com.collabnet.ce.soap50.webservices.frs.ReleaseSoapRow;
 
 
Class to hold the package and release-related methods. Wraps a collabNetApp.
 
 public class FrsApp {
     private CollabNetApp collabNetApp;
     private IFrsAppSoap ifa;
    
    
Constructs a FileReleaseSystem webservice container, from a CollabNetApp webservice container.

Parameters:
collabNetApp logged in main CollabNet webservice.
 
     public FrsApp(CollabNetApp collabNetApp) {
         this. = collabNetApp;
         this. = this.getFrsAppSoap();
     }
    
    
Create a new interface to the underlying SOAP methods.

Returns:
an instance of the FileReleseSystem webservice client.
 
     private IFrsAppSoap getFrsAppSoap() {
         String soapURL = this.getUrl() + . + 
             "FrsApp?wsdl";
         return (IFrsAppSoap) ClientSoapStubFactory.
             getSoapStub(IFrsAppSoap.classsoapURL);
     }

    
Find the packageId in a project with a given name.

Parameters:
packageName
projectId
Returns:
the package id for a package with this name in the project, or null if the package cannot be found.
Throws:
RemoteException
 
     public String findPackageId(String packageNameString projectId
         throws RemoteException {
         this.checkValidSessionId();
         if (packageName == null || packageName.equals("")) {
             return null;
         }
         PackageSoapList psList = this..getPackageList(this.getSessionId(), 
                                                          projectId);
         for (PackageSoapRow prowpsList.getDataRows()) {
             if (prow.getTitle().equals(packageName)) {
                 return prow.getId();
             }
         }
         return null;
     }

    
Get the list of package names associated with a given projectId.

Parameters:
projectId
Returns:
collection of package names.
Throws:
RemoteException
 
     public Collection<StringgetPackages(String projectId
         throws RemoteException {
         this.checkValidSessionId();
         PackageSoapList psList = this..getPackageList(this.getSessionId(), 
                                                          projectId);
         Collection<Stringnames = new ArrayList<String>();
         for (PackageSoapRow prowpsList.getDataRows()) {
             names.add(prow.getTitle());
         }
         return names;
     }
    
    
Find the releaseId when we don't know the package. We'll need to get all packages for the project, then get all releases for each package and search for the release we're looking for.

Parameters:
releaseName
projectId
Returns:
the id for the first matching release, or null, if the release cannot be found.
Throws:
RemoteException
    public String findReleaseId (String releaseNameString projectId
        throws RemoteException {
        this.checkValidSessionId();
        if (releaseName == null || releaseName.equals("")) {
            return null;
        }
        PackageSoapList psList = this..getPackageList(this.getSessionId(), 
                                                         projectId);
        String matchingReleaseId = null;
        for (PackageSoapRow prowpsList.getDataRows()) {
            if ((matchingReleaseId = 
                 this.findReleaseIdByPackage(releaseNameprow.getId())) 
                != null) {
                break;
            }
        }
        return matchingReleaseId;
    }

    
Get the list of possible releases, in a given project.

Parameters:
projectId
Returns:
a collection of unique release names.
    public Collection<StringgetProjectReleases(String projectId
        throws RemoteException {
        this.checkValidSessionId();
        Collection<Stringnames = new TreeSet<String>();
        PackageSoapList psList = this..getPackageList(this.getSessionId(), 
                                                         projectId);
        for (PackageSoapRow prowpsList.getDataRows()) {
            names.addAll(this.getReleases(prow.getId()));
        }
        return names;
    }

    
Get the releaseId when we know the packageId.

Parameters:
releaseName
packageId
Returns:
the id for the release from this package or null, if none is found.
Throws:
RemoteException
    public String findReleaseIdByPackage(String releaseNameString packageId
        throws RemoteException {
        this.checkValidSessionId();
        if (releaseName == null || releaseName.equals("")) {
            return null;
        }
        ReleaseSoapList rsList = this..getReleaseList(this.getSessionId(), 
                                                          packageId);
        for (ReleaseSoapRow rrowrsList.getDataRows()) {
            if (rrow.getTitle().equals(releaseName)) {
                return rrow.getId();
            }
        }
        return null;
    }

    
Get the list of release names, given a packageId.

Parameters:
packageId
Returns:
a list of release names.
Throws:
RemoteException
    public Collection<StringgetReleases(String packageId
        throws RemoteException {
        this.checkValidSessionId();
        ReleaseSoapList rsList = this..getReleaseList(this.getSessionId(), 
                                                         packageId);
        Collection<Stringnames = new ArrayList<String>();
        for (ReleaseSoapRow rrowrsList.getDataRows()) {
            names.add(rrow.getTitle());
        }
        return names;
    }

    
Get the path to the release's page.

Parameters:
releaseId
Returns:
the path to the release.
Throws:
RemoteException
    public String getReleasePath(String releaseIdthrows RemoteException {
        this.checkValidSessionId();
        ReleaseSoapDO rsd = this..getReleaseData(this.getSessionId(), 
                                                    releaseId);
        return rsd.getPath();
    }

    
Find the File Release System file which matches the given name, if any. Otherwise, return null.

Parameters:
name match with the file's title.
releaseId for this file.
Returns:
the id for this file, or null if none is found.
Throws:
RemoteException
    public String findFrsFile(String nameString releaseId
        throws RemoteException {
        this.checkValidSessionId();
        String fileId = null;
        FrsFileSoapList ffslist = this..getFrsFileList(this.getSessionId(), 
                                                          releaseId);
        for (FrsFileSoapRow rowffslist.getDataRows()) {
            if (row.getTitle().equals(name)) {
                fileId = row.getId();
                break;
            }
        }
        return fileId;
    }

    
Delete existing Frs files matching the given name.

Parameters:
fileId of the file to delete.
Throws:
RemoteException
    public void deleteFrsFile(String fileId
        throws RemoteException {
        this.checkValidSessionId();
        this..deleteFrsFile(this.getSessionId(), fileId);
    }

    
Associate an uploaded file with a release.

Parameters:
releaseId
fileName of file that was uploaded.
mimeType of the uploaded file.
fileId returned when file was uploaded.
Returns:
newly SoapDO for newly created FRSFile.
    public FrsFileSoapDO createFrsFile(String releaseIdString fileName
                                       String mimeTypeString fileId
        throws RemoteException {
        this.checkValidSessionId();
        return this..createFrsFile(this.getSessionId(), releaseIdfileName,
                                      mimeTypefileId);
    }
    
    
Below are wrapping functions, to make the code neater and in case, something changes. /
    
    private void checkValidSessionId() {
        this..checkValidSessionId();
    }
    
    private String getSessionId() {
        return this..getSessionId();
    }
    
    private String getUrl() {
        return this..getServerUrl();
    }
New to GrepCode? Check out our FAQ X