本文整理了Java中com.atlassian.jira.rest.client.api.domain.Version.getName()
方法的一些代码示例,展示了Version.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getName()
方法的具体详情如下:
包路径:com.atlassian.jira.rest.client.api.domain.Version
类名称:Version
方法名:getName
暂无
代码示例来源: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: jenkinsci/jira-plugin
public Result(final Version version) {
this.name = version.getName();
this.id = version.getId();
}
}
代码示例来源: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: 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: org.jboss.set/jboss-aphrodite-jira
private static void setIssueAffectedVersions(JiraIssue issue, com.atlassian.jira.rest.client.api.domain.Issue jiraIssue) {
if (jiraIssue.getAffectedVersions() != null) {
List<String> affectedVersion = new ArrayList<String>(0);
for (Version version : jiraIssue.getAffectedVersions())
affectedVersion.add(version.getName());
issue.setAffectedVersions(affectedVersion);
}
}
代码示例来源:origin: jenkinsci/jira-plugin
public int compare(Version rev1, Version rev2) {
ComparableVersion comparableVersion1 = new ComparableVersion(getNumberVersion(rev1.getName()));
ComparableVersion comparableVersion2 = new ComparableVersion(getNumberVersion(rev2.getName()));
int comparisonResult = comparableVersion2.compareTo(comparableVersion1);
if (comparisonResult == 0) {
comparableVersion1 = new ComparableVersion(rev1.getName());
comparableVersion2 = new ComparableVersion(rev2.getName());
comparisonResult = comparableVersion1.compareTo(comparableVersion2);
}
return comparisonResult;
}
代码示例来源: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
@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 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: 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: jenkinsci/jira-plugin
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);
}
}
代码示例来源:origin: jenkinsci/jira-plugin
/**
* Adds the specified version to the fix version list of all issues matching the JQL.
*
* @param projectKey The JIRA Project
* @param version The version to add
* @param query The JQL Query
*/
public void addFixVersion(String projectKey, String version, String query) throws TimeoutException {
Version newVersion = getVersionByName(projectKey, version);
if (newVersion == null) {
LOGGER.warning("Version " + version + " was not found");
return;
}
LOGGER.fine("Fetching issues with JQL:" + query);
List<Issue> issues = service.getIssuesFromJqlSearch(query, Integer.MAX_VALUE);
if (issues == null || issues.isEmpty()) {
return;
}
LOGGER.fine("Found issues: " + issues.size());
for (Issue issue : issues) {
LOGGER.fine("Adding version: " + newVersion.getName() + " to issue: " + issue.getKey());
List<Version> fixVersions = new ArrayList<>();
issue.getFixVersions().forEach(fixVersions::add);
fixVersions.add(newVersion);
service.updateIssue(issue.getKey(), fixVersions);
}
}
代码示例来源: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: jenkinsci/jira-plugin
Matcher versionToRemove = fromVersionPattern.matcher(currentVersion.getName());
if (!versionToRemove.matches()) {
newVersions.add(currentVersion);
if (!currentVersion.getName().equals(fromVersion)) {
newVersions.add(currentVersion);
代码示例来源: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: 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: 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: jenkinsci/jira-plugin
public JiraVersion(Version version) {
this(version.getName(), version.getReleaseDate() == null ? null : version.getReleaseDate().toGregorianCalendar(), version.isReleased(), version.isArchived());
}
内容来源于网络,如有侵权,请联系作者删除!