コード例 #1
1
  private void removeOldIssueLinks(Issue issue, net.rcarz.jiraclient.Issue jiraIssue)
      throws JiraException, NotFoundException {
    Set<String> ids = new HashSet<>();
    for (URL url : Iterables.concat(issue.getBlocks(), issue.getDependsOn()))
      ids.add(getIssueKey(url));

    for (IssueLink link : jiraIssue.getIssueLinks()) {
      net.rcarz.jiraclient.Issue linkedIssue = link.getInwardIssue();
      if (linkedIssue == null) linkedIssue = link.getOutwardIssue();

      if (!ids.contains(linkedIssue.getKey())) link.delete();
    }
  }
コード例 #2
0
  private void addNewIssueLinks(Issue issue, net.rcarz.jiraclient.Issue jiraIssue)
      throws JiraException, NotFoundException {
    for (URL url : issue.getBlocks()) {
      String trackerId = getIssueKey(url);
      net.rcarz.jiraclient.Issue issueToBlock = getIssue(trackerId);
      if (!issueLinkExists(url, issueToBlock.getIssueLinks()))
        issueToBlock.link(jiraIssue.getKey(), "Dependency");
    }

    for (URL url : issue.getDependsOn()) {
      if (!issueLinkExists(url, jiraIssue.getIssueLinks())) {
        String trackerId = getIssueKey(url);
        jiraIssue.link(trackerId, "Dependency");
      }
    }
  }