public BasicIssue createIssue(String projectKey, String description, String assignee, Iterable<String> components, String summary, @Nonnull Long issueTypeId, @Nullable Long priorityId) { IssueInputBuilder builder = new IssueInputBuilder(); builder.setProjectKey(projectKey) .setDescription(description) .setIssueTypeId(issueTypeId) .setSummary(summary); if (priorityId != null) { builder.setPriorityId(priorityId); } if (!assignee.equals("")) builder.setAssigneeName(assignee); if (Iterators.size(components.iterator()) > 0){ builder.setComponentsNames(components); } final IssueInput issueInput = builder.build(); try { return jiraRestClient.getIssueClient().createIssue(issueInput).get(timeout, TimeUnit.SECONDS); } catch (Exception e) { LOGGER.log(WARNING, "JIRA REST createIssue error: " + e.getMessage(), e); return null; } }
JiraRestClient restClient; public boolean createIssue(IssueJiraDTO issueDTO) throws IOException{ final IssueInputBuilder builder = new IssueInputBuilder(PROJECT_KEY, issueDTO.getIssueType(), issueDTO.getSummary()); final ComponentRestClient componentClient = restClient.getComponentClient(); try { openClient(); //completamos los datos Component component = componentClient.getComponent(new URI(issueDTO.getComponent())).claim(); builder.setComponents(component); builder.setFieldValue(CODCESCEFIELDID, issueDTO.getCodcesce()); builder.setFieldValue(LINKCAFIELD, issueDTO.getLinkCA().trim()); builder.setFieldValue(SECURITYFIELD, ComplexIssueInputFieldValue.with("id", issueDTO.getSecurityLevel())); builder.setPriorityId(issueDTO.getPriority()); builder.setDescription(issueDTO.getDescription()); final IssueInput input = builder.build(); // create issue final IssueRestClient client = restClient.getIssueClient(); final BasicIssue issue = client.createIssue(input).claim(); logger.info("Incidencia creada correctamente: "+ issue.getId()); }catch(Exception e){ logger.error("Error al crear la Issue en Jira: " + issueDTO.getCodcesce(), e); } finally { closeClient(); } return true; }
createdIssue = jira.getIssueClient().createIssue(builder.build()).get(); } catch (InterruptedException | ExecutionException e) { throw new PluginException("Failed to create issue.", e);
createdIssue = jira.getIssueClient().createIssue(builder.build()).get(); } catch (InterruptedException | ExecutionException e) { throw new PluginException("Failed to create issue.", e);