@Override protected void doExecute(JiraRestClient jiraRestClient) throws Exception { final String theProjectKey = Strings.isNullOrEmpty(projectKey) ? getConfig().getProjectKey() : projectKey; final Iterable<Version> versions = jiraRestClient.getProjectClient().getProject(theProjectKey).get().getVersions(); if (!versions.iterator().hasNext()) { System.out.println("No versions found for project '" + theProjectKey + "'."); return; } System.out.println(String.format(DEFAULT_ROW_FORMAT, "Id", "Name", "Description")); for (Version eachVersion : versions) { System.out.println( String.format( DEFAULT_ROW_FORMAT, eachVersion.getId(), eachVersion.getName(), eachVersion.getDescription() == null ? "" : removeNewLines(eachVersion.getDescription()))); } } }
public void releaseVersion(String projectKey, Version version) { final URIBuilder builder = new URIBuilder(uri) .setPath(String.format("%s/version/%s", baseApiPath, version.getId())); final VersionInput versionInput = new VersionInput(projectKey, version.getName(), version.getDescription(), version .getReleaseDate(), version.isArchived(), version.isReleased()); try { jiraRestClient.getVersionRestClient().updateVersion(builder.build(), versionInput).get(timeout, TimeUnit.SECONDS); }catch (Exception e) { LOGGER.log(WARNING, "jira rest client release version error. cause: " + e.getMessage(), e); } }
@Override protected void doExecute(JiraRestClient jiraRestClient) throws Exception { final String theProjectKey = Strings.isNullOrEmpty(projectKey) ? getConfig().getProjectKey() : projectKey; final Iterable<Version> versions = jiraRestClient.getProjectClient().getProject(theProjectKey).get().getVersions(); if (!versions.iterator().hasNext()) { System.out.println("No versions found for project '" + theProjectKey + "'."); return; } System.out.println(String.format(DEFAULT_ROW_FORMAT, "Id", "Name", "Description")); for (Version eachVersion : versions) { System.out.println( String.format( DEFAULT_ROW_FORMAT, eachVersion.getId(), eachVersion.getName(), eachVersion.getDescription() == null ? "" : removeNewLines(eachVersion.getDescription()))); } } }
/** * Release a given version. * * @param projectKey The Project Key * @param versionName The name of the version */ protected void releaseVersion(String projectKey, String versionName, JiraSession session) { if (session == null) { LOGGER.warning("JIRA session could not be established"); return; } List<Version> versions = session.getVersions(projectKey); java.util.Optional<Version> matchingVersion = versions.stream() .filter(version -> version.getName().equals(versionName)) .findFirst(); if (matchingVersion.isPresent()) { Version version = matchingVersion.get(); Version releaseVersion = new Version(version.getSelf(), version.getId(), version.getName(), version.getDescription(), version.isArchived(), true, new DateTime()); session.releaseVersion(projectKey, releaseVersion); } }
public VersionInputBuilder(String projectKey, Version version) { this(projectKey); this.name = version.getName(); this.description = version.getDescription(); this.archived = version.isArchived(); this.released = version.isReleased(); this.releaseDate = version.getReleaseDate(); }
public VersionInputBuilder(String projectKey, Version version) { this(projectKey); this.name = version.getName(); this.description = version.getDescription(); this.archived = version.isArchived(); this.released = version.isReleased(); this.releaseDate = version.getReleaseDate(); }