2

JRJC v1.0を使用してサブタスクを作成する方法はありますか?私はこれに関する良いドキュメントを見つけることができませんでした。そこにサンプルコードはありますか?

ライブラリではサポートされていないようですが、直接のRESTAPIを使用して可能です。

JIRA v5.1.5

4

3 に答える 3

5

動作する以下のコードをまとめることができました。

    IssueInputBuilder issueBuilder = new IssueInputBuilder("Project1", 5L);//5 is the id for subtask type. You can know the id of subtask type by querying this REST api /rest/api/2/issue/createmeta
    issueBuilder.setDescription(">> Test Description");
    issueBuilder.setSummary("Test summary");
    issueBuilder.setProjectKey("Project1");
    Map<String, Object> parent = new HashMap<String, Object>();
    parent.put("key", "SOMEISSUE-234");
    FieldInput parentField = new FieldInput("parent", new ComplexIssueInputFieldValue(parent));

    Map<String, Object> customField = new HashMap<String, Object>();
    customField.put("value", "someValue");//This is some custom field value on the subtask
    customField.put("id", "12345");//This is the id of the custom field. You can know this by calling REST GET for a manually created sub-task

    issueBuilder.setFieldInput(parentField);
    issueBuilder.setFieldValue("customfield_12345",  new ComplexIssueInputFieldValue(customField));//here again you have to query an existing subtask to know the "customfield_*" value

    com.atlassian.jira.rest.client.domain.input.IssueInput issueInput = issueBuilder.build();
    BasicIssue bIssue = restClient.getIssueClient().createIssue(issueInput, pm);    
    System.out.println(">>> " + bIssue.getKey());
于 2013-03-14T19:02:17.067 に答える
3

通常どおりに問題を作成しますが()、問題の種類を必要なサブタスクの種類に設定します。次に、サブタスクをその親の使用にリンクするには、次のlinkIssueようにします。

LinkIssuesInput linkIssuesInput = new LinkIssuesInput("TST-1", "TST-2", "jira_subtask_link", Comment.valueOf("simple comment"));
issueClient.linkIssue( linkIssuesInput , pm);

自分でテストしたことはありません。古いJIraではXML-RPCを使用し、新しいJIraではpython-jiraを使用しました。完全なAPIはこちらから入手できます

于 2013-02-05T13:09:40.043 に答える
2

RESTAPIhttp ://docs.atlassian.com/jira/REST/latest/#id326540にコメントがあります。

サブタスクの作成は通常の問題の作成と似ていますが、2つの重要な違いがあります。

issueTypeフィールドは、サブタスクの課題タイプに対応している必要があり(/ issue / createmetaを使用して、サブタスクの課題タイプを検出できます)、親課題のIDまたはキーを含む課題作成リクエストに親フィールドを指定する必要があります。 。

したがって、通常のcreateIssueメソッドは機能するはずですが、( "parent"、 "ABC-123")で構築された追加のFieldInputオブジェクトを渡したことを確認する必要があります。

サブタスクリンクタイプを使用したリンクが実際に機能する場合は、驚きます。

于 2013-02-05T21:05:22.180 に答える