이 문서는 Java에서 Jira 이슈를 생성하는 방법을 공유하기 위해 작성되었다.
도구명 | Jira |
---|---|
버전 | 8.22 |
IssueService api 적용
issueService api 불러오기
@ComponentImport private final IssueService issueService; private final JiraAuthenticationContext jiraAuthenticationContext; ApplicationUser loggedInUser = jiraAuthenticationContext.getLoggedInUser(); IssueInputParameters issueInputParameters = issueService.newIssueInputParameters(); issueInputParameters.setSummary(String summary) .setDescription(String description) .setAssigneeId(String assignee) .setReporterId(String reporter) .setProjectId(Long projectId) .setIssueTypeId(Long issueType id) IssueService.CreateValidationResult result = issueService.validateCreate(loggedInUser, issueInputParameters);
- IssueInputParameters Type의 변수에 이슈 생성시 설정할 값 set
- ApplicationUser, IssueInputParameters Type parameter로 validateCreate 생성
task,subtask issue 생성하기
@ComponentImport private final IssueService issueService; private final JiraAuthenticationContext jiraAuthenticationContext; ApplicationUser loggedInUser = jiraAuthenticationContext.getLoggedInUser(); IssueService.CreateValidationResult result = issueService.validateCreate(loggedInUser, issueInputParameters); if(issue = '작업'){ issueService.create(loggedInUser, result); }else if(issue = '부작업'){ MutableIssue issue = issueManager.getIssueByCurrentKey(issueKey); IssueService.CreateValidationResult validationResult = issueService.validateSubTaskCreate(loggedInUser, issue.getId(), issueInputParameters); issueService.create(loggedInUser, validationResult); }
- 작업 이슈의 경우 생성한 validateCreate result를 issueService.create에 적용하면 새로운 이슈 생성됨
- 하위 작업 이슈의 경우 MutableIssue Type의 parentIssue get
- validateSubTaskCreate에 ApplicationUser Type의 creator, Long Type의 parentIssueID, issueInputParameters 를 적용하면 하위 작업이 생성됨
Issue Create시 Parent Issue와 Link
Parent issue와 Chlid issue link하기
@ComponentImport private final SubTaskManager subTaskManaer ApplicationUser loggedInUser = jiraAuthenticationContext.getLoggedInUser(); MutableIssue issue = issueManager.getIssueByCurrentKey(issueKey); MutableIssue parentIssue= issueManager.getIssueByCurrentKey(parentIssueKey); subTaskManager.createSubTaskIssueLink(parentIssue, chlidIssue , loggedInUser);
- SubTaskManager.createSubTaskIssueLink API
- 생성할 SubTask의 ParentIssue, SubTask issue, ApplicationUser를 parameter로 issue Link 생성