use of com.atlassian.jira.rest.client.api.domain.BasicProject in project opennms by OpenNMS.
the class ListProjectsCommand method doExecute.
@Override
protected void doExecute(JiraRestClient jiraRestClient) throws Exception {
Iterable<BasicProject> basicProjects = jiraRestClient.getProjectClient().getAllProjects().get();
if (!basicProjects.iterator().hasNext()) {
System.out.println("No projects available or visible to the current user");
} else {
System.out.println(String.format(DEFAULT_ROW_FORMAT, "Key", "Name", "Description"));
for (BasicProject eachProject : basicProjects) {
String description = jiraRestClient.getProjectClient().getProject(eachProject.getKey()).get().getDescription();
System.out.println(String.format(DEFAULT_ROW_FORMAT, eachProject.getKey(), eachProject.getName(), description == null ? "" : removeNewLines(description)));
}
}
}
use of com.atlassian.jira.rest.client.api.domain.BasicProject in project jira-plugin by jenkinsci.
the class JiraRestService method getProjectsKeys.
public List<String> getProjectsKeys() {
Iterable<BasicProject> projects = Collections.emptyList();
try {
projects = jiraRestClient.getProjectClient().getAllProjects().get(timeout, TimeUnit.SECONDS);
} catch (Exception e) {
LOGGER.log(WARNING, "Jira REST client get project keys error. cause: " + e.getMessage(), e);
}
final List<String> keys = new ArrayList<>();
for (BasicProject project : projects) {
keys.add(project.getKey());
}
return keys;
}
Aggregations