public IssueInputBuilder setIssueType(IssueType issueType) { return setIssueTypeId(issueType.getId()); }
public IssueInputBuilder setIssueType(IssueType issueType) { return setIssueTypeId(issueType.getId()); }
@Override protected void doExecute(JiraRestClient jiraRestClient) throws Exception { final String theProjectKey = Strings.isNullOrEmpty(projectKey) ? getConfig().getProjectKey() : projectKey; final Iterable<? extends IssueType> issueTypes = JiraClientUtils.getIssueTypes(jiraRestClient, theProjectKey); if (!issueTypes.iterator().hasNext()) { if (Strings.isNullOrEmpty(theProjectKey)) { System.out.println("No issue types found. The user making the ReST call may not have sufficient permissions."); } else { System.out.println("No issue types found for project with key '" + theProjectKey + "' found. The user making the ReST call may not have sufficient permissions."); } } else { System.out.println(String.format(DEFAULT_ROW_FORMAT, "Id", "Name", "Description")); Lists.newArrayList(issueTypes).stream() .sorted(Comparator.comparing(IssueType::getId)) .forEach(issueType -> System.out.println(String.format(DEFAULT_ROW_FORMAT, issueType.getId(), issueType.getName(), removeNewLines(issueType.getDescription())))); } }
@Override protected void doExecute(JiraRestClient jiraRestClient) throws Exception { final String theProjectKey = Strings.isNullOrEmpty(projectKey) ? getConfig().getProjectKey() : projectKey; final Iterable<? extends IssueType> issueTypes = JiraClientUtils.getIssueTypes(jiraRestClient, theProjectKey); if (!issueTypes.iterator().hasNext()) { if (Strings.isNullOrEmpty(theProjectKey)) { System.out.println("No issue types found. The user making the ReST call may not have sufficient permissions."); } else { System.out.println("No issue types found for project with key '" + theProjectKey + "' found. The user making the ReST call may not have sufficient permissions."); } } else { System.out.println(String.format(DEFAULT_ROW_FORMAT, "Id", "Name", "Description")); Lists.newArrayList(issueTypes).stream() .sorted(Comparator.comparing(IssueType::getId)) .forEach(issueType -> System.out.println(String.format(DEFAULT_ROW_FORMAT, issueType.getId(), issueType.getName(), removeNewLines(issueType.getDescription())))); } }
private static final String JIRA_SERVER = "http://jiralab"; public static void main(String[] args) { try { JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); URI uri = new URI(JIRA_SERVER); JiraRestClient client = factory.createWithBasicHttpAuthentication(uri, "admin", "admin"); listAllIssueTypes(client); } catch (Exception ex) { } } private static void listAllIssueTypes(JiraRestClient client) throws Exception { Promise<Iterable<IssueType>> promise = client.getMetadataClient().getIssueTypes(); Iterable<IssueType> issueTypes = promise.claim(); for (IssueType it : issueTypes) { System.out.println("Type ID = " + it.getId() + ", Name = " + it.getName()); } }
IssueInput issueToFluentUpdate(Issue issue, com.atlassian.jira.rest.client.api.domain.Issue jiraIssue, Project project) throws NotFoundException { checkUnsupportedUpdateFields(issue); IssueInputBuilder inputBuilder = new IssueInputBuilder(jiraIssue.getProject().getKey(), jiraIssue.getIssueType().getId()); issue.getSummary().ifPresent(inputBuilder::setSummary); inputBuilder.setFieldInput(new FieldInput(IssueFieldId.COMPONENTS_FIELD, issue.getComponents().stream().map(e -> ComplexIssueInputFieldValue.with("name", e)).collect(Collectors.toList())) ); issue.getDescription().ifPresent(inputBuilder::setDescription); issue.getAssignee().ifPresent(assignee -> inputBuilder.setFieldInput( new FieldInput(IssueFieldId.ASSIGNEE_FIELD, ComplexIssueInputFieldValue.with("name", assignee.getName().orElseThrow(this::nullUsername))))); // this is ok but does nothing if there is no permissions. issue.getStage().getStateMap().entrySet() .stream().filter(entry -> entry.getValue() != FlagStatus.NO_SET) .forEach(entry -> inputBuilder.setFieldInput(new FieldInput(JSON_CUSTOM_FIELD + FLAG_MAP.get(entry.getKey()), entry.getValue().getSymbol()))); Map<String, Version> versionsMap = StreamSupport.stream(project.getVersions().spliterator(), false) .collect(Collectors.toMap(Version::getName, Function.identity())); updateFixVersions(issue, versionsMap, inputBuilder); updateStreamStatus(issue, jiraIssue, versionsMap, inputBuilder); return inputBuilder.build(); }
public ListBoxModel doFillTypeIdItems() { ListBoxModel items = new ListBoxModel().add(""); // optional field for (JiraSite site : JiraProjectProperty.DESCRIPTOR.getSites()) { JiraSession session = site.getSession(); if (session != null) { for (IssueType type : session.getIssueTypes()) { items.add("[" + site.getName() + "] " + type.getName(), String.valueOf(type.getId())); } } } return items; }
@Override public CimIssueType parse(final JSONObject json) throws JSONException { final IssueType issueType = issueTypeJsonParser.parse(json); final JSONObject jsonFieldsMap = json.optJSONObject("fields"); final Map<String, CimFieldInfo> fields = (jsonFieldsMap == null) ? Collections.<String, CimFieldInfo>emptyMap() : fieldsParser.parse(jsonFieldsMap); return new CimIssueType(issueType.getSelf(), issueType.getId(), issueType.getName(), issueType.isSubtask(), issueType.getDescription(), issueType.getIconUri(), fields); } }
@Override public CimIssueType parse(final JSONObject json) throws JSONException { final IssueType issueType = issueTypeJsonParser.parse(json); final JSONObject jsonFieldsMap = json.optJSONObject("fields"); final Map<String, CimFieldInfo> fields = (jsonFieldsMap == null) ? Collections.<String, CimFieldInfo>emptyMap() : fieldsParser.parse(jsonFieldsMap); return new CimIssueType(issueType.getSelf(), issueType.getId(), issueType.getName(), issueType.isSubtask(), issueType.getDescription(), issueType.getIconUri(), fields); } }