com.atlassian.jira.rest.client.api.domain.Version.getId()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中com.atlassian.jira.rest.client.api.domain.Version.getId()方法的一些代码示例,展示了Version.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getId()方法的具体详情如下:
包路径:com.atlassian.jira.rest.client.api.domain.Version
类名称:Version
方法名:getId

Version.getId介绍

暂无

代码示例

代码示例来源: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: 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 Result(final Version version) {
    this.name = version.getName();
    this.id = version.getId();
  }
}

代码示例来源: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: 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

/**
 * 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.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: 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);
      }
    }
  }
}

相关文章