/** * Retrieves the given issue record. * * @param restclient REST client instance * @param key Issue key (PROJECT-123) * * @return an issue instance (issue includes all navigable fields) * * @throws JiraException when the retrieval fails */ public static Issue get(RestClient restclient, String key) throws JiraException { return new Issue(restclient, realGet(restclient, key, new HashMap<String, String>())); }
/** * Adds a comment to this issue. * * @param body Comment text * * @throws JiraException when the comment creation fails */ public Comment addComment(String body) throws JiraException { return addComment(body, null, null); }
/** * count issues with the given query. * * @param jql JQL statement * * @return the count * * @throws JiraException when the search fails */ public int countIssues(String jql) throws JiraException { return Issue.count(restclient, jql); }
/** * Reloads issue data from the JIRA server (issue includes all navigable * fields). * * @throws JiraException when the retrieval fails */ public void refresh() throws JiraException { JSONObject result = realGet(restclient, key, new HashMap<String, String>()); deserialise(result); }
/** * Creates a new sub-task. * * @return a fluent create instance * * @throws JiraException when the client fails to retrieve issue metadata */ public FluentCreate createSubtask() throws JiraException { return Issue.create(restclient, getProject().getKey(), "Sub-task") .field(Field.PARENT, getKey()); }
return String.format("Bug %s \"%s\" with status \"%s\" associated", bugUrl, bug.getSummary(), bug.getStatus().getName()); } catch (Exception e) { LOG.error("Exception during retrieving bug info", e);
private static String getRestUri(String key) { return getBaseUri() + "issue/" + (key != null ? key : ""); }
/** * Retreives the issue with the given key. * * @param key Issue key (PROJECT-123) * * @return an issue instance (issue includes all fields) * * @throws JiraException when something goes wrong */ public Issue getIssue(String key) throws JiraException { return Issue.get(restclient, key); }
/** * Get a list of options for a components * * @param project Key of the project context * @param issueType Name of the issue type * * @return a search result structure with results * * @throws JiraException when the search fails */ public List<Component> getComponentsAllowedValues(String project, String issueType) throws JiraException { JSONObject createMetadata = (JSONObject) Issue.getCreateMetadata(restclient, project, issueType); JSONObject fieldMetadata = (JSONObject) createMetadata.get(Field.COMPONENTS); List<Component> componentOptions = Field.getResourceArray( Component.class, fieldMetadata.get("allowedValues"), restclient ); return componentOptions; }
public boolean isIssueClosed(Issue issue) throws ServiceException { boolean isIssueClosed = false; String[] closeStatuses = settingsService.getSettingValue(JIRA_CLOSED_STATUS).split(";"); for (String closeStatus : closeStatuses) { if (issue.getStatus().getName().equalsIgnoreCase(closeStatus)) { isIssueClosed = true; } } return isIssueClosed; }
/** * Begins an update field chain. * * @return a fluent update instance * * @throws JiraException when the client fails to retrieve issue metadata */ public FluentUpdate update() throws JiraException { return new FluentUpdate(getEditMetadata()); }
/** * Creates an issue from a JSON payload. * * @param restclient REST client instance * @param json JSON payload */ protected Issue(RestClient restclient, JSONObject json) { super(restclient); if (json != null) deserialise(json); }
/** * Creates a new issue in the given project. * * @param project Key of the project to create in * @param issueType Name of the issue type to create * * @return a fluent create instance * * @throws JiraException when something goes wrong */ public Issue.FluentCreate createIssue(String project, String issueType) throws JiraException { return Issue.create(restclient, project, issueType); }
result = (T)new CustomFieldOption(restclient, (JSONObject)r); else if (type == Issue.class) result = (T)new Issue(restclient, (JSONObject)r); else if (type == IssueLink.class) result = (T)new IssueLink(restclient, (JSONObject)r);
/** * Creates a new sub-task. * * @return a fluent create instance * * @throws JiraException when the client fails to retrieve issue metadata */ public FluentCreate createSubtask() throws JiraException { return Issue.create(restclient, getProject().getKey(), "Sub-task") .field(Field.PARENT, getKey()); }
return String.format("Bug %s \"%s\" with status \"%s\" associated", bugUrl, bug.getSummary(), bug.getStatus().getName()); } catch (Exception e) { LOG.error("Exception during retrieving bug info", e);
/** * Reloads issue data from the JIRA server (issue includes all navigable * fields). * * @throws JiraException when the retrieval fails */ public void refresh() throws JiraException { JSONObject result = realGet(restclient, key, new HashMap<String, String>()); deserialise(result); }
private static String getRestUri(String key) { return getBaseUri() + "issue/" + (key != null ? key : ""); }
/** * Retrieves the full JIRA issue. * * @return an Issue * * @throws JiraException when the retrieval fails */ public Issue getJiraIssue() throws JiraException { return Issue.get(restclient, key); }
/** * Get a list of options for a custom field * * @param field field id * @param project Key of the project context * @param issueType Name of the issue type * * @return a search result structure with results * * @throws JiraException when the search fails */ public List<CustomFieldOption> getCustomFieldAllowedValues(String field, String project, String issueType) throws JiraException { JSONObject createMetadata = (JSONObject) Issue.getCreateMetadata(restclient, project, issueType); JSONObject fieldMetadata = (JSONObject) createMetadata.get(field); List<CustomFieldOption> customFieldOptions = Field.getResourceArray( CustomFieldOption.class, fieldMetadata.get("allowedValues"), restclient ); return customFieldOptions; }