public List<Status> getStatuses() { try { final Iterable<Status> statuses = jiraRestClient.getMetadataClient().getStatuses() .get(timeout, TimeUnit.SECONDS); return Lists.newArrayList(statuses); } catch (Exception e) { LOGGER.log(WARNING, "jira rest client get statuses error. cause: " + e.getMessage(), e); return Collections.emptyList(); } }
public List<IssueType> getIssueTypes() { try { return Lists.newArrayList(jiraRestClient.getMetadataClient().getIssueTypes().get(timeout, TimeUnit.SECONDS)); } catch (Exception e) { LOGGER.log(WARNING, "jira rest client get issue types error. cause: " + e.getMessage(), e); return Collections.emptyList(); } }
public List<Priority> getPriorities() { try { return Lists.newArrayList(jiraRestClient.getMetadataClient().getPriorities().get(timeout, TimeUnit.SECONDS)); } catch (Exception e) { LOGGER.log(WARNING, "jira rest client get priorities error. cause: " + e.getMessage(), e); return Collections.emptyList(); } }
/** * Convenient method to get all issue types of a project. * * @param client The {@link JiraRestClient} * @param projectKey The project key. Is null or empty, all issue types are returned, otherwise issue types for the given projectKey are returned. * @return All issue types or issue types for the given projectKey. * * @throws ExecutionException * @throws InterruptedException */ public static Iterable<? extends IssueType> getIssueTypes(JiraRestClient client, String projectKey) throws ExecutionException, InterruptedException { if (Strings.isNullOrEmpty(projectKey)) { return client.getMetadataClient().getIssueTypes().get(); } final Iterable<CimProject> cimProjects = getIssueMetaData(client, null, (String) null, projectKey); if (cimProjects.iterator().hasNext()) { return cimProjects.iterator().next().getIssueTypes(); } return Lists.newArrayList(); } }
/** * Convenient method to get all issue types of a project. * * @param client The {@link JiraRestClient} * @param projectKey The project key. Is null or empty, all issue types are returned, otherwise issue types for the given projectKey are returned. * @return All issue types or issue types for the given projectKey. * * @throws ExecutionException * @throws InterruptedException */ public static Iterable<? extends IssueType> getIssueTypes(JiraRestClient client, String projectKey) throws ExecutionException, InterruptedException { if (Strings.isNullOrEmpty(projectKey)) { return client.getMetadataClient().getIssueTypes().get(); } final Iterable<CimProject> cimProjects = getIssueMetaData(client, null, (String) null, projectKey); if (cimProjects.iterator().hasNext()) { return cimProjects.iterator().next().getIssueTypes(); } return Lists.newArrayList(); } }
@Override protected void doExecute(JiraRestClient jiraRestClient) throws Exception { Iterable<Priority> priorities = jiraRestClient.getMetadataClient().getPriorities().get(); if (!priorities.iterator().hasNext()) { System.out.println("No priorities found"); return; } System.out.println(String.format(DEFAULT_ROW_FORMAT, "Id", "Name", "Description")); for (Priority eachPriority : priorities) { System.out.println( String.format( DEFAULT_ROW_FORMAT, eachPriority.getId(), eachPriority.getName(), removeNewLines(eachPriority.getDescription()))); } } }
@Override protected void doExecute(JiraRestClient jiraRestClient) throws Exception { Iterable<Priority> priorities = jiraRestClient.getMetadataClient().getPriorities().get(); if (!priorities.iterator().hasNext()) { System.out.println("No priorities found"); return; } System.out.println(String.format(DEFAULT_ROW_FORMAT, "Id", "Name", "Description")); for (Priority eachPriority : priorities) { System.out.println( String.format( DEFAULT_ROW_FORMAT, eachPriority.getId(), eachPriority.getName(), removeNewLines(eachPriority.getDescription()))); } } }
private JiraRestClient verifyConnection() { final String host = config.getHost(); final String username = config.getUsername(); final String password = config.getPassword(); try { System.out.println(); System.out.println("Try connecting to jira server " + host + " with username: '" + username + "' and password: '" + password +"'..."); final JiraRestClient connection = JiraConnectionFactory.createConnection(host, username, password); final ServerInfo serverInfo = connection.getMetadataClient().getServerInfo().get(); System.out.println("Successfully connected to jira instance at " + host); System.out.println("Server Info:" + serverInfo.toString()); System.out.println("OK"); return connection; } catch (PluginException | InterruptedException | ExecutionException e) { throw new RuntimeException("Could not connect to jira server", e); } }
private JiraRestClient verifyConnection() { final String host = config.getHost(); final String username = config.getUsername(); final String password = config.getPassword(); try { System.out.println(); System.out.println("Try connecting to jira server " + host + " with username: '" + username + "' and password: '" + password +"'..."); final JiraRestClient connection = JiraConnectionFactory.createConnection(host, username, password); final ServerInfo serverInfo = connection.getMetadataClient().getServerInfo().get(); System.out.println("Successfully connected to jira instance at " + host); System.out.println("Server Info:" + serverInfo.toString()); System.out.println("OK"); return connection; } catch (PluginException | InterruptedException | ExecutionException e) { throw new RuntimeException("Could not connect to jira server", e); } }
final int buildNumber = restClient.getMetadataClient().getServerInfo().claim().getBuildNumber();
String jiraVersion = client.getMetadataClient() .getServerInfo().claim() .getVersion();