1

ある問題から別の問題への「関連」タイプのリンクをプログラムで作成する必要があります。方法を見つけました

createIssueLink(Long sourceIssueId, Long destinationIssueId, Long issueLinkTypeId, Long sequence, User remoteUser) 

IssueLinkManagerで、しかし、私はissueLinkTypeIdを取得するためにとにかく見つけることができません. 誰でもそれを手伝ってもらえますか?

4

2 に答える 2

1

あなたはおそらく使いたい

    Collection linkTypes = issueLinkTypeManager.getIssueLinkTypesByName(name);

次に、必要な IssueLinkType インスタンスが見つかるまで繰り返し、次に linkType.getId()

リモート アクセスには、jira-python ライブラリとcreate_issue_linkメソッドを使用することをお勧めします。

内部的には、そのメソッドはこれを行います:

def create_issue_link(self, type, inwardIssue, outwardIssue, comment=None):
    """
    Create a link between two issues.

    :param type: the type of link to create
    :param inwardIssue: the issue to link from
    :param outwardIssue: the issue to link to
    :param comment:  a comment to add to the issues with the link. Should be a dict containing ``body``\
    and ``visibility`` fields: ``body`` being the text of the comment and ``visibility`` being a dict containing\
    two entries: ``type`` and ``value``. ``type`` is ``role`` (or ``group`` if the JIRA server has configured\
    comment visibility for groups) and ``value`` is the name of the role (or group) to which viewing of this\
    comment will be restricted.
    """
    data = {
        'type': {
            'name': type
        },
        'inwardIssue': {
            'key': inwardIssue
        },
        'outwardIssue': {
            'key': outwardIssue
        },
        'comment': comment
    }
    url = self._get_url('issueLink')
    r = self._session.post(url, data=json.dumps(data))

〜マット

于 2012-12-11T22:28:31.013 に答える