@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()); } }
private void setIssueType(Issue issue, com.atlassian.jira.rest.client.api.domain.Issue jiraIssue) { String type = jiraIssue.getIssueType().getName(); issue.setType(getIssueType(type)); }
String summary = issue.getSummary(); String status = issue.getStatus().getName(); String type = issue.getIssueType().getName();
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); } }
issue.setPriority(fromMap(jiraIssue.getPriority().getName(), priorityMapping)); issue.setSeverity(fromMap(jiraIssue.getPriority().getName(), severityMapping)); issue.setType(fromMap(jiraIssue.getIssueType().getName(), typeMapping));