net.rcarz.jiraclient
Class Issue

java.lang.Object
  extended by net.rcarz.jiraclient.Resource
      extended by net.rcarz.jiraclient.Issue

public final class Issue
extends Resource

Represents a JIRA issue.


Nested Class Summary
static class Issue.FluentCreate
          Used to chain fields to a create action.
 class Issue.FluentTransition
          Used to chain fields to a transition action.
 class Issue.FluentUpdate
          Used to chain fields to an update action.
static class Issue.SearchResult
          Issue search results structure.
 
Field Summary
 
Fields inherited from class net.rcarz.jiraclient.Resource
id, RESOURCE_URI, restclient, self
 
Constructor Summary
protected Issue(RestClient restclient, net.sf.json.JSONObject json)
          Creates an issue from a JSON payload.
 
Method Summary
 void addComment(String body)
          Adds a comment to this issue.
 void addComment(String body, String visType, String visName)
          Adds a comment to this issue with limited visibility.
 void addWatcher(String username)
          Adds a watcher to the issue.
static Issue.FluentCreate create(RestClient restclient, String project, String issueType)
          Creates a new JIRA issue.
 Issue.FluentCreate createSubtask()
          Creates a new sub-task.
 void deleteWatcher(String username)
          Removes a watcher to the issue.
static Issue get(RestClient restclient, String key)
          Retrieves the given issue record.
 User getAssignee()
           
 List<Attachment> getAttachments()
           
 List<Comment> getComments()
           
 List<Component> getComponents()
           
 String getDescription()
           
 Date getDueDate()
           
 Object getField(String name)
          Gets an arbitrary field by its name.
 List<Version> getFixVersions()
           
 List<IssueLink> getIssueLinks()
           
 IssueType getIssueType()
           
 String getKey()
           
 List<String> getLabels()
           
 Priority getPriority()
           
 Project getProject()
           
 User getReporter()
           
 Resolution getResolution()
           
 Date getResolutionDate()
           
 Status getStatus()
           
 List<Issue> getSubtasks()
           
 String getSummary()
           
 TimeTracking getTimeTracking()
           
 List<Version> getVersions()
           
 Votes getVotes()
           
 Watches getWatches()
           
 List<WorkLog> getWorkLogs()
           
 void link(String issue, String type)
          Links this issue with another issue.
 void link(String issue, String type, String body)
          Links this issue with another issue and adds a comment.
 void link(String issue, String type, String body, String visType, String visName)
          Links this issue with another issue and adds a comment with limited visibility.
 void refresh()
          Reloads issue data from the JIRA server.
static Issue.SearchResult search(RestClient restclient, String jql)
          Search for issues with the given query.
 String toString()
           
 Issue.FluentTransition transition()
          Begins a transition field chain.
 void unvote()
          Removes the current user's vote from the issue.
 Issue.FluentUpdate update()
          Begins an update field chain.
 void vote()
          Casts a vote in favour of an issue.
 
Methods inherited from class net.rcarz.jiraclient.Resource
getId, getUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Issue

protected Issue(RestClient restclient,
                net.sf.json.JSONObject json)
Creates an issue from a JSON payload.

Parameters:
restclient - REST client instance
json - JSON payload
Method Detail

addComment

public void addComment(String body)
                throws JiraException
Adds a comment to this issue.

Parameters:
body - Comment text
Throws:
JiraException - when the comment creation fails

addComment

public void addComment(String body,
                       String visType,
                       String visName)
                throws JiraException
Adds a comment to this issue with limited visibility.

Parameters:
body - Comment text
visType - Target audience type (role or group)
visName - Name of the role or group to limit visibility to
Throws:
JiraException - when the comment creation fails

link

public void link(String issue,
                 String type)
          throws JiraException
Links this issue with another issue.

Parameters:
issue - Other issue key
type - Link type name
Throws:
JiraException - when the link creation fails

link

public void link(String issue,
                 String type,
                 String body)
          throws JiraException
Links this issue with another issue and adds a comment.

Parameters:
issue - Other issue key
type - Link type name
body - Comment text
Throws:
JiraException - when the link creation fails

link

public void link(String issue,
                 String type,
                 String body,
                 String visType,
                 String visName)
          throws JiraException
Links this issue with another issue and adds a comment with limited visibility.

Parameters:
issue - Other issue key
type - Link type name
body - Comment text
visType - Target audience type (role or group)
visName - Name of the role or group to limit visibility to
Throws:
JiraException - when the link creation fails

create

public static Issue.FluentCreate create(RestClient restclient,
                                        String project,
                                        String issueType)
                                 throws JiraException
Creates a new JIRA issue.

Parameters:
restclient - REST client instance
project - Key of the project to create the issue in
issueType - Name of the issue type to create
Returns:
a fluent create instance
Throws:
JiraException - when the client fails to retrieve issue metadata

createSubtask

public Issue.FluentCreate createSubtask()
                                 throws JiraException
Creates a new sub-task.

Returns:
a fluent create instance
Throws:
JiraException - when the client fails to retrieve issue metadata

get

public static Issue get(RestClient restclient,
                        String key)
                 throws JiraException
Retrieves the given issue record.

Parameters:
restclient - REST client instance
key - Issue key (PROJECT-123)
Returns:
an issue instance
Throws:
JiraException - when the retrieval fails

search

public static Issue.SearchResult search(RestClient restclient,
                                        String jql)
                                 throws JiraException
Search for issues with the given query.

Parameters:
restclient - REST client instance
jql - JQL statement
Returns:
a search result structure with results
Throws:
JiraException - when the search fails

refresh

public void refresh()
             throws JiraException
Reloads issue data from the JIRA server.

Throws:
JiraException - when the retrieval fails

getField

public Object getField(String name)
Gets an arbitrary field by its name.

Parameters:
name - Name of the field to retrieve
Returns:
the field value or null if not found

transition

public Issue.FluentTransition transition()
                                  throws JiraException
Begins a transition field chain.

Returns:
a fluent transition instance
Throws:
JiraException - when the client fails to retrieve issue metadata

update

public Issue.FluentUpdate update()
                          throws JiraException
Begins an update field chain.

Returns:
a fluent update instance
Throws:
JiraException - when the client fails to retrieve issue metadata

vote

public void vote()
          throws JiraException
Casts a vote in favour of an issue.

Throws:
JiraException - when the voting fails

unvote

public void unvote()
            throws JiraException
Removes the current user's vote from the issue.

Throws:
JiraException - when the voting fails

addWatcher

public void addWatcher(String username)
                throws JiraException
Adds a watcher to the issue.

Parameters:
username - Username of the watcher to add
Throws:
JiraException - when the operation fails

deleteWatcher

public void deleteWatcher(String username)
                   throws JiraException
Removes a watcher to the issue.

Parameters:
username - Username of the watcher to remove
Throws:
JiraException - when the operation fails

toString

public String toString()
Overrides:
toString in class Object

getKey

public String getKey()

getAssignee

public User getAssignee()

getAttachments

public List<Attachment> getAttachments()

getComments

public List<Comment> getComments()

getComponents

public List<Component> getComponents()

getDescription

public String getDescription()

getDueDate

public Date getDueDate()

getFixVersions

public List<Version> getFixVersions()

getIssueLinks

public List<IssueLink> getIssueLinks()

getIssueType

public IssueType getIssueType()

getLabels

public List<String> getLabels()

getPriority

public Priority getPriority()

getProject

public Project getProject()

getReporter

public User getReporter()

getResolution

public Resolution getResolution()

getResolutionDate

public Date getResolutionDate()

getStatus

public Status getStatus()

getSubtasks

public List<Issue> getSubtasks()

getSummary

public String getSummary()

getTimeTracking

public TimeTracking getTimeTracking()

getVersions

public List<Version> getVersions()

getVotes

public Votes getVotes()

getWatches

public Watches getWatches()

getWorkLogs

public List<WorkLog> getWorkLogs()


Copyright © 2013. All Rights Reserved.