本文整理了Java中com.atlassian.jira.rest.client.api.domain.Version
类的一些代码示例,展示了Version
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version
类的具体详情如下:
包路径:com.atlassian.jira.rest.client.api.domain.Version
类名称:Version
[英]Complete information about a version defined for a JIRA project
[中]有关为JIRA项目定义的版本的完整信息
代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-api
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();
}
代码示例来源:origin: jenkinsci/jira-plugin
/**
* 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);
}
}
代码示例来源:origin: jenkinsci/jira-plugin
public Result(final Version version) {
this.name = version.getName();
this.id = version.getId();
}
}
代码示例来源:origin: jenkinsci/jira-plugin
private boolean match(Version version) {
// Match regex if it exists
if (pattern != null) {
if (!pattern.matcher(version.getName()).matches()) return false;
}
// Filter released versions
if (!showReleased && version.isReleased()) return false;
// Filter archived versions
if (!showArchived && version.isArchived()) return false;
return true;
}
代码示例来源:origin: OpenNMS/opennms
@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())));
}
}
}
代码示例来源:origin: org.jboss.set/jboss-aphrodite-jira
@Override
public boolean isCPReleased(String cpVersion) {
// For Jira, only accept GA version format x.y.z.GA, e.g. 7.1.2.GA
// ignore CR version like 7.0.7.CR3
Matcher matcher = JIRAFIXVERSION.matcher(cpVersion);
if (!matcher.matches()) {
return false;
}
Promise<Project> promise = restClient.getProjectClient().getProject("JBEAP");
Project project = promise.claim();
Optional<Version> version = StreamSupport.stream(project.getVersions().spliterator(), false)
.filter(v -> v.getName().equals(cpVersion))
.findAny();
if (version.isPresent()) {
return version.get().isReleased();
}
return false;
}
}
代码示例来源:origin: jenkinsci/jira-plugin
/**
* Release given version in given project
* @param projectKey
* @param version
*/
public void releaseVersion(String projectKey, Version version) {
LOGGER.fine("Releasing version: " + version.getName());
service.releaseVersion(projectKey, version);
}
代码示例来源:origin: org.smartdeveloperhub.harvesters.it.backend/it-backend-core
private Set<String> getVersionsByIds(com.atlassian.jira.rest.client.api.domain.Project jiraProject) {
Set<String> versionsIds = new HashSet<>();
for (com.atlassian.jira.rest.client.api.domain.Version version : jiraProject.getVersions()) {
versionsIds.add(String.valueOf(version.getId()));
}
return versionsIds;
}
代码示例来源:origin: jenkinsci/jira-plugin
public List<Version> getVersions(String projectKey) {
final URIBuilder builder = new URIBuilder(uri)
.setPath(String.format("%s/project/%s/versions", baseApiPath, projectKey));
List<Map<String, Object>> decoded = Collections.emptyList();
try {
URI uri = builder.build();
final Content content = buildGetRequest(uri)
.execute()
.returnContent();
decoded = objectMapper.readValue(content.asString(), new TypeReference<List<Map<String, Object>>>() {
});
} catch (Exception e) {
LOGGER.log(WARNING, "jira rest client get versions error. cause: " + e.getMessage(), e);
}
return decoded.stream().map( decodedVersion -> {
final DateTime releaseDate = decodedVersion.containsKey("releaseDate") ? DATE_TIME_FORMATTER.parseDateTime((String) decodedVersion.get("releaseDate")) : null;
return new Version(URI.create((String) decodedVersion.get("self")), Long.parseLong((String) decodedVersion.get("id")),
(String) decodedVersion.get("name"), (String) decodedVersion.get("description"), (Boolean) decodedVersion.get("archived"),
(Boolean) decodedVersion.get("released"), releaseDate);
} ).collect( Collectors.toList() );
}
代码示例来源:origin: org.opennms.features/jira-troubleticketer
@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())));
}
}
}
代码示例来源:origin: jenkinsci/jira-plugin
JiraSite site = getSiteForProject(project);
Optional<Version> sameNamedVersion = site.getVersions(realProjectKey).stream()
.filter(version -> version.getName().equals(finalRealVersion) && version.isReleased()).findFirst();
代码示例来源:origin: jenkinsci/jira-plugin
/**
* Get a version by its name
*
* @param projectKey The key for the project
* @param name The version name
* @return A RemoteVersion, or null if not found
*/
public Version getVersionByName(String projectKey, String name) {
LOGGER.fine("Fetching versions from project: " + projectKey);
List<Version> versions = getVersions(projectKey);
if (versions == null) {
return null;
}
for (Version version : versions) {
if (version.getName().equals(name)) {
return version;
}
}
return null;
}
代码示例来源:origin: org.smartdeveloperhub.harvesters.it.backend/it-backend-core
public Version createVersion(String projectId, com.atlassian.jira.rest.client.api.domain.Version jiraVersion) {
Objects.requireNonNull(jiraVersion, "Jira User cannot be null.");
Version version = new Version();
version.setId(String.valueOf(jiraVersion.getId()));
version.setProjectId(projectId);
version.setName(jiraVersion.getName());
return version;
}
}
代码示例来源:origin: org.smartdeveloperhub.harvesters.it.backend/it-backend-core
private Set<String> getVersions(com.atlassian.jira.rest.client.api.domain.Issue jiraIssue) {
Set<String> versions = new HashSet<>();
for (Version version : jiraIssue.getAffectedVersions()) {
versions.add(String.valueOf(version.getId()));
}
return versions;
}
代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-core
@Override
public Version parse(JSONObject json) throws JSONException {
final URI self = JsonParseUtil.getSelfUri(json);
final Long id = JsonParseUtil.getOptionalLong(json, "id");
final String name = json.getString("name");
final String description = JsonParseUtil.getOptionalString(json, "description");
final boolean isArchived = json.getBoolean("archived");
final boolean isReleased = json.getBoolean("released");
final String releaseDateStr = JsonParseUtil.getOptionalString(json, "releaseDate");
final DateTime releaseDate = parseReleaseDate(releaseDateStr);
return new Version(self, id, name, description, isArchived, isReleased, releaseDate);
}
代码示例来源:origin: com.atlassian.jira/jira-rest-java-android-client-api
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();
}
代码示例来源:origin: jenkinsci/jira-plugin
JiraSite site = getSiteForProject(project);
Optional<Version> sameNamedVersion = site.getVersions(realProjectKey).stream()
.filter(version -> version.getName().equals(finalRealRelease) && version.isReleased()).findFirst();
代码示例来源:origin: org.jboss.set/jboss-aphrodite-jira
private void setIssueReleases(Issue issue, com.atlassian.jira.rest.client.api.domain.Issue jiraIssue) {
Iterable<Version> versions = jiraIssue.getFixVersions();
if (versions != null) {
List<Release> releases = StreamSupport.stream(jiraIssue.getFixVersions().spliterator(), false)
.map(version -> new Release(version.getName()))
.collect(Collectors.toList());
issue.setReleases(releases);
}
}
代码示例来源:origin: org.jboss.set/jboss-aphrodite-jira
private void updateStreamStatus(Issue issue, com.atlassian.jira.rest.client.api.domain.Issue jiraIssue,
Map<String, Version> versionsMap, IssueInputBuilder inputBuilder) throws NotFoundException {
String customField = JSON_CUSTOM_FIELD + TARGET_RELEASE;
IssueField issueField = jiraIssue.getField(customField);
if (issueField == null || (issueField.getType() == null && issueField.getValue() == null)) {
String msg = String.format("Unable to set a stream status for issue %1$s as %2$s projects do not utilise field: %3$s",
jiraIssue.getKey(), jiraIssue.getProject().getName(), customField);
Utils.logWarnMessage(LOG, msg);
return;
}
for (Map.Entry<String, FlagStatus> entry : issue.getStreamStatus().entrySet()) {
if (entry.getValue() != FlagStatus.ACCEPTED) {
String streamName = entry.getKey();
Version version = versionsMap.get(streamName);
if (version != null) {
inputBuilder.setFieldInput(new FieldInput(customField, ComplexIssueInputFieldValue.with("value", version.getId())));
} else {
throw new NotFoundException("No Stream exists for this project with the name : " + streamName);
}
}
}
}
代码示例来源:origin: org.openengsb.wrapped/jira-rest-java-client-core
@Override
public Version parse(JSONObject json) throws JSONException {
final URI self = JsonParseUtil.getSelfUri(json);
final Long id = JsonParseUtil.getOptionalLong(json, "id");
final String name = json.getString("name");
final String description = JsonParseUtil.getOptionalString(json, "description");
final boolean isArchived = json.getBoolean("archived");
final boolean isReleased = json.getBoolean("released");
final String releaseDateStr = JsonParseUtil.getOptionalString(json, "releaseDate");
final DateTime releaseDate = parseReleaseDate(releaseDateStr);
return new Version(self, id, name, description, isArchived, isReleased, releaseDate);
}
内容来源于网络,如有侵权,请联系作者删除!