hudson.plugins.jira
Class JiraSession

java.lang.Object
  extended by hudson.plugins.jira.JiraSession

public class JiraSession
extends Object

Connection to JIRA.

JIRA has a built-in timeout for a session, so after some inactive period the session will become invalid. The caller must make sure that this doesn't happen.

Author:
Kohsuke Kawaguchi

Field Summary
 JiraSoapService service
           
 String token
          This security token is used by the server to associate SOAP invocations with a specific user.
 
Method Summary
 void addComment(String issueId, String comment, String groupVisibility, String roleVisibility)
          Adds a comment to the existing issue.
 boolean existsIssue(String id)
           
 String getActionIdForIssue(String issueKey, String workflowAction)
          Returns the matching action id for a given action name.
 RemoteGroup getGroup(String groupId)
          Gets the details of a group, given a groupId.
 RemoteIssue getIssue(String id)
          Gets the details of one issue.
 RemoteIssue[] getIssuesFromJqlSearch(String jqlSearch)
          Gets all issues that match the given JQL filter
 RemoteIssue[] getIssuesWithFixVersion(String projectKey, String version)
           
 RemoteIssue[] getIssuesWithFixVersion(String projectKey, String version, String filter)
           
 RemoteIssueType[] getIssueTypes()
          Get all issue types
 Set<String> getProjectKeys()
          Returns the set of project keys (like MNG, JENKINS, etc) that are available in this JIRA.
 RemoteProjectRole getRole(String roleId)
          Gets the details of a role, given a roleId.
 String getStatusById(String statusId)
          Returns the status name by status id.
 RemoteVersion getVersionByName(String projectKey, String name)
          Get a version by its name
 RemoteVersion[] getVersions(String projectKey)
          Get all versions from the given project
 void migrateIssuesToFixVersion(String projectKey, String version, String query)
           
 String progressWorkflowAction(String issueKey, String workflowActionName, RemoteFieldValue[] fields)
          Progresses the issue's workflow by performing the specified action.
 void releaseVersion(String projectKey, RemoteVersion version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

service

public final JiraSoapService service

token

public final String token
This security token is used by the server to associate SOAP invocations with a specific user.

Method Detail

getProjectKeys

public Set<String> getProjectKeys()
                           throws RemoteException
Returns the set of project keys (like MNG, JENKINS, etc) that are available in this JIRA. Guarantees to return all project keys in upper case.

Throws:
RemoteException

addComment

public void addComment(String issueId,
                       String comment,
                       String groupVisibility,
                       String roleVisibility)
                throws RemoteException
Adds a comment to the existing issue. Constrains the visibility of the comment the the supplied groupVisibility.

Parameters:
groupVisibility -
Throws:
RemoteException

getIssue

public RemoteIssue getIssue(String id)
                     throws RemoteException
Gets the details of one issue.

Parameters:
id - Issue ID like "MNG-1235".
Returns:
null if no such issue exists.
Throws:
RemoteException

getIssuesFromJqlSearch

public RemoteIssue[] getIssuesFromJqlSearch(String jqlSearch)
                                     throws RemoteException
Gets all issues that match the given JQL filter

Parameters:
jqlSearch - JQL query string to execute
Returns:
issues matching the JQL query
Throws:
RemoteException

getGroup

public RemoteGroup getGroup(String groupId)
                     throws RemoteException
Gets the details of a group, given a groupId. Used for validating group visibility.

Parameters:
Group - ID like "Software Development"
Returns:
null if no such group exists
Throws:
RemoteException

getRole

public RemoteProjectRole getRole(String roleId)
                          throws RemoteException
Gets the details of a role, given a roleId. Used for validating role visibility. TODO: Cannot validate against the real project role the user have in the project, jira soap api has no such function!

Parameters:
Role - ID like "Software Development"
Returns:
null if no such role exists
Throws:
RemoteException

getVersions

public RemoteVersion[] getVersions(String projectKey)
                            throws RemoteException
Get all versions from the given project

Parameters:
projectKey - The key for the project
Returns:
An array of versions
Throws:
RemoteException

getVersionByName

public RemoteVersion getVersionByName(String projectKey,
                                      String name)
                               throws RemoteException
Get a version by its name

Parameters:
projectKey - The key for the project
name - The version name
Returns:
A RemoteVersion, or null if not found
Throws:
RemoteException

getIssuesWithFixVersion

public RemoteIssue[] getIssuesWithFixVersion(String projectKey,
                                             String version)
                                      throws RemoteException
Throws:
RemoteException

getIssuesWithFixVersion

public RemoteIssue[] getIssuesWithFixVersion(String projectKey,
                                             String version,
                                             String filter)
                                      throws RemoteException
Throws:
RemoteException

getIssueTypes

public RemoteIssueType[] getIssueTypes()
                                throws RemoteException
Get all issue types

Returns:
An array of issue types
Throws:
RemoteException

existsIssue

public boolean existsIssue(String id)
                    throws RemoteException
Throws:
RemoteException

releaseVersion

public void releaseVersion(String projectKey,
                           RemoteVersion version)
                    throws RemoteException
Throws:
RemoteException

migrateIssuesToFixVersion

public void migrateIssuesToFixVersion(String projectKey,
                                      String version,
                                      String query)
                               throws RemoteException
Throws:
RemoteException

progressWorkflowAction

public String progressWorkflowAction(String issueKey,
                                     String workflowActionName,
                                     RemoteFieldValue[] fields)
                              throws RemoteException
Progresses the issue's workflow by performing the specified action. The issue's new status is returned.

Parameters:
issueKey -
workflowActionName -
fields -
Returns:
The new status
Throws:
RemoteException

getActionIdForIssue

public String getActionIdForIssue(String issueKey,
                                  String workflowAction)
                           throws RemoteException
Returns the matching action id for a given action name.

Parameters:
issueKey -
workflowAction -
Returns:
The action id, or null if the action cannot be found.
Throws:
RemoteException

getStatusById

public String getStatusById(String statusId)
                     throws RemoteException
Returns the status name by status id.

Parameters:
statusId -
Returns:
Throws:
RemoteException


Copyright © 2004-2012 Hudson. All Rights Reserved.