hudson.plugins.collabnet.util
Class CNHudsonUtil

java.lang.Object
  extended by hudson.plugins.collabnet.util.CNHudsonUtil

public class CNHudsonUtil
extends java.lang.Object

Class for methods that are useful across Hudson plugins.


Method Summary
static CollabNetApp getCollabNetApp(org.kohsuke.stapler.StaplerRequest request)
          Get a CollabNetApp, given a StaplerRequest with url, username, and password set.
static CollabNetApp getCollabNetApp(java.lang.String url, java.lang.String username, java.lang.String password)
           
static java.lang.String getFileId(CollabNetApp cna, java.lang.String releaseId, java.lang.String file)
          Get the file id.
static java.lang.String getFileId(CollabNetApp cna, java.lang.String project, java.lang.String rpackage, java.lang.String release, java.lang.String file)
          Given project, package, release, and file name, find the fileId for a file in the system, or null if none is found.
static java.lang.String getPackageId(CollabNetApp cna, java.lang.String rpackage, java.lang.String projectId)
          Get the packageId for the package name.
static java.lang.String getProjectId(CollabNetApp cna, java.lang.String project)
          Get the projectId for the project name.
static java.lang.String getProjectReleaseId(CollabNetApp cna, java.lang.String projectId, java.lang.String release)
          Get a releaseId, given a projectId and a release title.
static java.lang.String getReleaseId(CollabNetApp cna, java.lang.String packageId, java.lang.String release)
          Get the release id.
static com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO getTrackerArtifact(CollabNetApp cna, java.lang.String project, java.lang.String tracker, java.lang.String issueTitle)
          Given a project and issue title, find the most recent matching issue object, or null if none matches.
static java.lang.String getTrackerId(CollabNetApp cna, java.lang.String projectId, java.lang.String trackerName)
          Given a tracker title and a projectId, find the matching tracker id.
static boolean isUserMember(CollabNetApp cna, java.lang.String username, java.lang.String projectId)
           
static boolean isUserValid(CollabNetApp cna, java.lang.String username)
           
static void logoff(CollabNetApp cna)
          Logs off the CollabNetApp, if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCollabNetApp

public static CollabNetApp getCollabNetApp(java.lang.String url,
                                           java.lang.String username,
                                           java.lang.String password)
Parameters:
url -
username -
password -
Returns:
collabnet app, if one can be created; null otherwise.

getCollabNetApp

public static CollabNetApp getCollabNetApp(org.kohsuke.stapler.StaplerRequest request)
Get a CollabNetApp, given a StaplerRequest with url, username, and password set. If login fails, null will be returned.


logoff

public static void logoff(CollabNetApp cna)
Logs off the CollabNetApp, if possible.

Parameters:
cna - CollabNetApp

getPackageId

public static java.lang.String getPackageId(CollabNetApp cna,
                                            java.lang.String rpackage,
                                            java.lang.String projectId)
Get the packageId for the package name.

Parameters:
fa - for accessing the FileReleaseSystem webservices.
rpackage - name of the package.
projectId - the project id.
Returns:
the package id if found, null otherwise.

getProjectId

public static java.lang.String getProjectId(CollabNetApp cna,
                                            java.lang.String project)
Get the projectId for the project name.

Parameters:
cna - for accessing the webservice methods.
project - name.
Returns:
the id for the project or null, if no such project exist.

getReleaseId

public static java.lang.String getReleaseId(CollabNetApp cna,
                                            java.lang.String packageId,
                                            java.lang.String release)
Get the release id.

Parameters:
cna - for accessing the webservice methods.
packageId - the id of the package which contains this release.
release - the name of the release
Returns:
the release id, or null if none is found.

getFileId

public static java.lang.String getFileId(CollabNetApp cna,
                                         java.lang.String releaseId,
                                         java.lang.String file)
Get the file id.

Parameters:
cna - for accessing the webservice methods.
releaseId - the id of the release.
file - name
Returns:
the file id, or null if none is found.

getProjectReleaseId

public static java.lang.String getProjectReleaseId(CollabNetApp cna,
                                                   java.lang.String projectId,
                                                   java.lang.String release)
Get a releaseId, given a projectId and a release title.

Parameters:
cna - for accessing the webservice methods.
projectId -
release -
Returns:
the releaseId in this project which matches the release name or null if none is found.

getTrackerId

public static java.lang.String getTrackerId(CollabNetApp cna,
                                            java.lang.String projectId,
                                            java.lang.String trackerName)
Given a tracker title and a projectId, find the matching tracker id.

Parameters:
cna - for accessing the webservice methods.
projectId -
trackerName -
Returns:
the tracker id for the tracker that matches this name, or null if no matching tracker is found.

getTrackerArtifact

public static com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO getTrackerArtifact(CollabNetApp cna,
                                                                                            java.lang.String project,
                                                                                            java.lang.String tracker,
                                                                                            java.lang.String issueTitle)
Given a project and issue title, find the most recent matching issue object, or null if none matches.


getFileId

public static java.lang.String getFileId(CollabNetApp cna,
                                         java.lang.String project,
                                         java.lang.String rpackage,
                                         java.lang.String release,
                                         java.lang.String file)
Given project, package, release, and file name, find the fileId for a file in the system, or null if none is found.

Parameters:
cna - for accessing webservice methods
project - name
rpackage - name
release - name
file - name

isUserValid

public static boolean isUserValid(CollabNetApp cna,
                                  java.lang.String username)
Parameters:
cna - for accessing the webservice methods.
username -
Returns:
true if the user can be found.

isUserMember

public static boolean isUserMember(CollabNetApp cna,
                                   java.lang.String username,
                                   java.lang.String projectId)
Parameters:
cna - for accessing the webservice methods.
username -
projectId -
Returns:
true if the user is a member of the project.


Copyright © 2009. All Rights Reserved.