1
0
Fork 0

implemented creating subtasks

master
Bob Carroll 2013-05-29 15:09:26 -07:00
parent b0d3c3d7c6
commit db798c8880
3 changed files with 24 additions and 1 deletions

View File

@ -17,6 +17,8 @@ jira-client is still under heavily development. Here's what works:
* Add comments to issues
* Vote on issues
* Add and remove issue watchers
* Add and remove issue links
* Create sub-tasks
## Contributing ##
@ -141,6 +143,14 @@ public class Example {
.field(Field.ASSIGNEE, "robin")
.execute();
System.out.println(newIssue);
/* Link to the old issue */
newIssue.link("TEST-123", "Dependency");
/* Create sub-task */
Issue subtask = newIssue.createSubtask()
.field(Field.SUMMARY, "replace lightbulb")
.execute();
} catch (JiraException ex) {
System.err.println(ex.getMessage());

View File

@ -471,7 +471,7 @@ public final class Field {
json.put("name", value.toString());
return json.toString();
} else if (m.type.equals("project")) {
} else if (m.type.equals("project") || m.type.equals("issuelink")) {
JSONObject json = new JSONObject();
json.put("key", value.toString());

View File

@ -552,6 +552,19 @@ public final class Issue extends Resource {
.field(Field.ISSUE_TYPE, issueType);
}
/**
* 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("parent", getKey());
}
private static JSONObject realGet(RestClient restclient, String key)
throws JiraException {