hudson.plugins.jira
Class JiraSite

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<JiraSite>
      extended by hudson.plugins.jira.JiraSite
All Implemented Interfaces:
hudson.model.Describable<JiraSite>

public class JiraSite
extends hudson.model.AbstractDescribableImpl<JiraSite>

Represents an external JIRA installation and configuration needed to access this JIRA.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class JiraSite.DescriptorImpl
           
 
Field Summary
protected static Pattern DEFAULT_ISSUE_PATTERN
          Regexp pattern that identifies JIRA issue token.
 String groupVisibility
          Group visibility to constrain the visibility of the added comment.
 String password
          Password needed to login.
 boolean recordScmChanges
          to record scm changes in jira issue
 String roleVisibility
          Role visibility to constrain the visibility of the added comment.
 boolean supportsWikiStyleComment
          True if this JIRA is configured to allow Confluence-style Wiki comment.
 boolean updateJiraIssueForAllStatus
          updated jira issue for all status
 URL url
          URL of JIRA, like http://jira.codehaus.org/.
 String userName
          User name needed to login.
 
Constructor Summary
JiraSite(URL url, String userName, String password, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility)
           
 
Method Summary
 JiraSession createSession()
          Creates a remote access session to this JIRA.
 boolean existsIssue(String id)
          Checks if the given JIRA id will be likely to exist in this issue tracker.
static JiraSite get(hudson.model.AbstractProject<?,?> p)
          Gets the effective JiraSite associated with the given project.
 JiraIssue getIssue(String id)
          Returns the remote issue with the given id or null if it wasn't found.
 Pattern getIssuePattern()
           
 Set<JiraIssue> getIssueWithFixVersion(String projectKey, String versionName)
          Gets a set of issues that have the given fixVersion associated with them.
 String getName()
           
 Set<String> getProjectKeys()
          Gets the list of project IDs in this JIRA.
 String getReleaseNotesForFixVersion(String projectKey, String versionName)
          Generates release notes for a given version.
 String getReleaseNotesForFixVersion(String projectKey, String versionName, String filter)
          Generates release notes for a given version.
 URL getUrl(JiraIssue issue)
          Computes the URL to the given issue.
 URL getUrl(String id)
          Computes the URL to the given issue.
 Pattern getUserPattern()
          Gets the user-defined issue pattern if any.
 Set<JiraVersion> getVersions(String projectKey)
          Returns all versions for the given project key.
 void migrateIssuesToFixVersion(String projectKey, String versionName, String query)
          Migrates issues matching the jql query provided to a new fix version.
 boolean progressMatchingIssues(String jqlSearch, String workflowActionName, String comment, PrintStream console)
          Progresses all issues matching the JQL search, using the given workflow action.
protected  Object readResolve()
           
 void releaseVersion(String projectKey, String versionName)
          Release a given version.
 
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ISSUE_PATTERN

protected static final Pattern DEFAULT_ISSUE_PATTERN
Regexp pattern that identifies JIRA issue token. If this pattern changes help pages (help-issue-pattern_xy.html) must be updated

First char must be a letter, then at least one letter, digit or underscore. See issue JENKINS-729, JENKINS-4092


url

public final URL url
URL of JIRA, like http://jira.codehaus.org/. Mandatory. Normalized to end with '/'


userName

public final String userName
User name needed to login. Optional.


password

public final String password
Password needed to login. Optional.


groupVisibility

public final String groupVisibility
Group visibility to constrain the visibility of the added comment. Optional.


roleVisibility

public final String roleVisibility
Role visibility to constrain the visibility of the added comment. Optional.


supportsWikiStyleComment

public final boolean supportsWikiStyleComment
True if this JIRA is configured to allow Confluence-style Wiki comment.


recordScmChanges

public final boolean recordScmChanges
to record scm changes in jira issue

Since:
1.21

updateJiraIssueForAllStatus

public final boolean updateJiraIssueForAllStatus
updated jira issue for all status

Since:
1.22
Constructor Detail

JiraSite

@DataBoundConstructor
public JiraSite(URL url,
                                     String userName,
                                     String password,
                                     boolean supportsWikiStyleComment,
                                     boolean recordScmChanges,
                                     String userPattern,
                                     boolean updateJiraIssueForAllStatus,
                                     String groupVisibility,
                                     String roleVisibility)
Method Detail

readResolve

protected Object readResolve()

getName

public String getName()

createSession

public JiraSession createSession()
                          throws IOException,
                                 javax.xml.rpc.ServiceException
Creates a remote access session to this JIRA.

Returns:
null if remote access is not supported.
Throws:
IOException
javax.xml.rpc.ServiceException

getUrl

public URL getUrl(JiraIssue issue)
           throws IOException
Computes the URL to the given issue.

Throws:
IOException

getUrl

public URL getUrl(String id)
           throws MalformedURLException
Computes the URL to the given issue.

Throws:
MalformedURLException

getUserPattern

public Pattern getUserPattern()
Gets the user-defined issue pattern if any.

Returns:
the pattern or null

getIssuePattern

public Pattern getIssuePattern()

getProjectKeys

public Set<String> getProjectKeys()
Gets the list of project IDs in this JIRA. This information could be bit old, or it can be null.


get

public static JiraSite get(hudson.model.AbstractProject<?,?> p)
Gets the effective JiraSite associated with the given project.

Returns:
null if no such was found.

existsIssue

public boolean existsIssue(String id)
Checks if the given JIRA id will be likely to exist in this issue tracker.

This method checks whether the key portion is a valid key (except that it can potentially use stale data). Number portion is not checked at all.

Parameters:
id - String like MNG-1234

getIssue

public JiraIssue getIssue(String id)
                   throws IOException,
                          javax.xml.rpc.ServiceException
Returns the remote issue with the given id or null if it wasn't found.

Throws:
IOException
javax.xml.rpc.ServiceException

releaseVersion

public void releaseVersion(String projectKey,
                           String versionName)
                    throws IOException,
                           javax.xml.rpc.ServiceException
Release a given version.

Parameters:
projectKey - The Project Key
versionName - The name of the version
Throws:
IOException
javax.xml.rpc.ServiceException

getVersions

public Set<JiraVersion> getVersions(String projectKey)
                             throws IOException,
                                    javax.xml.rpc.ServiceException
Returns all versions for the given project key.

Parameters:
projectKey - Project Key
Returns:
A set of JiraVersions
Throws:
IOException
javax.xml.rpc.ServiceException

getReleaseNotesForFixVersion

public String getReleaseNotesForFixVersion(String projectKey,
                                           String versionName)
                                    throws IOException,
                                           javax.xml.rpc.ServiceException
Generates release notes for a given version.

Parameters:
projectKey -
versionName -
Returns:
release notes
Throws:
IOException
javax.xml.rpc.ServiceException

getReleaseNotesForFixVersion

public String getReleaseNotesForFixVersion(String projectKey,
                                           String versionName,
                                           String filter)
                                    throws IOException,
                                           javax.xml.rpc.ServiceException
Generates release notes for a given version.

Parameters:
projectKey -
versionName -
filter - Additional JQL Filter. Example: status in (Resolved,Closed)
Returns:
release notes
Throws:
IOException
javax.xml.rpc.ServiceException

getIssueWithFixVersion

public Set<JiraIssue> getIssueWithFixVersion(String projectKey,
                                             String versionName)
                                      throws IOException,
                                             javax.xml.rpc.ServiceException
Gets a set of issues that have the given fixVersion associated with them.

Parameters:
projectKey - The project key
versionName - The fixVersion
Returns:
A set of JiraIssues
Throws:
IOException
javax.xml.rpc.ServiceException

migrateIssuesToFixVersion

public void migrateIssuesToFixVersion(String projectKey,
                                      String versionName,
                                      String query)
                               throws IOException,
                                      javax.xml.rpc.ServiceException
Migrates issues matching the jql query provided to a new fix version.

Parameters:
projectKey - The project key
versionName - The new fixVersion
query - A JQL Query
Throws:
IOException
javax.xml.rpc.ServiceException

progressMatchingIssues

public boolean progressMatchingIssues(String jqlSearch,
                                      String workflowActionName,
                                      String comment,
                                      PrintStream console)
                               throws IOException,
                                      javax.xml.rpc.ServiceException
Progresses all issues matching the JQL search, using the given workflow action. Optionally adds a comment to the issue(s) at the same time.

Parameters:
jqlSearch -
workflowActionName -
comment -
console -
Throws:
IOException
javax.xml.rpc.ServiceException


Copyright © 2004-2012 Hudson. All Rights Reserved.