com.atlassian.jira.project.version.Version.getProjectObject()方法的使用及代码示例

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

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

Version.getProjectObject介绍

[英]Returns project this version relates to.

Same as getProject() and exists for legacy reasons.
[中]返回与此版本相关的项目。
与getProject()相同,并因遗留原因而存在。

代码示例

代码示例来源:origin: com.atlassian.jira/jira-core

private boolean canView(final ApplicationUser user, final Version version)
{
  return version != null && isProjectBrowser(user, version.getProjectObject());
}

代码示例来源:origin: com.atlassian.jira/jira-core

private boolean canEdit(final ApplicationUser user, final Version version)
{
  return version != null && isProjectAdmin(user, version.getProjectObject());
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
  public Version apply(final Long versionId)
  {
    final Version version = versionManager.getVersion(versionId);
    if (version == null)
    {
      return null;
    }
    final Long projectId = version.getProjectId();
    Boolean hasAccess = projectAccessCache.get(projectId);
    if (hasAccess == null)
    {
      hasAccess = isProjectBrowser(user, version.getProjectObject());
      projectAccessCache.put(projectId, hasAccess);
    }
    return hasAccess ? version : null;
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

public boolean isDuplicateName(final Version currentVersion, final String name)
{
  //Chek to see if there is already a version with that name for the project
  for (final Version version : currentVersion.getProjectObject().getVersions())
  {
    if (!currentVersion.getId().equals(version.getId()) && name.trim().equalsIgnoreCase(version.getName()))
    {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: com.atlassian.jira/jira-core

return ((Version) context.get("version")).getProjectObject();

代码示例来源:origin: com.atlassian.jira/jira-api

public Results getPossibleValues(final ApplicationUser searcher, final String jqlClauseName, final String valuePrefix, final int maxNumResults)
{
  final List<Version> versions = new ArrayList<Version>(versionManager.getAllVersions());
  Collections.sort(versions, new LocaleSensitiveVersionNameComparator(getLocale(searcher)));
  final Set<Result> versionValues = new LinkedHashSet<Result>();
  for (Version version : versions)
  {
    if (versionValues.size() == maxNumResults)
    {
      break;
    }
    final String lowerCaseVersionName = version.getName().toLowerCase();
    if (StringUtils.isBlank(valuePrefix) || lowerCaseVersionName.startsWith(valuePrefix.toLowerCase()))
    {
      final Project project = version.getProjectObject();
      if (project != null && permissionManager.hasPermission(BROWSE_PROJECTS, project, searcher))
      {
        versionValues.add(new Result(version.getName()));
      }
    }
  }
  return new Results(new ArrayList<Result>(versionValues));
}

代码示例来源:origin: com.atlassian.streams/streams-jira-plugin

public URI getFixForVersionUri(URI baseUri, Version version)
{
  return getFixForVersionUri(baseUri, version.getProjectObject().getKey(), version.getId());
}

代码示例来源:origin: com.atlassian.jira/jira-api

boolean versionExists(final ApplicationUser searcher, final List<String> ids)
{
  for (String sid : ids)
  {
    Long id = convertToLong(sid);
    if (id != null)
    {
      final Version version = versionManager.getVersion(id);
      if (version != null && permissionManager.hasPermission(BROWSE_PROJECTS, version.getProjectObject(), searcher))
      {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: com.atlassian.jira/jira-rest-plugin

private ArrayList<SimpleLinkBean> getOperations(final Version version)
{
  final HttpServletRequest httpServletRequest = ExecutingHttpRequest.get();
  final ApplicationUser loggedInUser = authContext.getUser();
  final Project project = version.getProjectObject();
  final Map<String, Object> params = MapBuilder.<String, Object>build("version", version, "user", loggedInUser, "project", project);
  final List<SimpleLink> links = simpleLinkManager.getLinksForSection(VERSION_OPERATIONS_WEB_LOCATION,
      loggedInUser, new JiraHelper(httpServletRequest, project, params));
  final ArrayList<SimpleLinkBean> linkBeans = new ArrayList<SimpleLinkBean>(links.size());
  for (SimpleLink link : links)
  {
    linkBeans.add(new SimpleLinkBean(link));
  }
  return linkBeans;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionUnarchiveEvent(@Nonnull final VersionUnarchiveEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.unarchived")
      .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()));
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionReleaseEvent(@Nonnull final VersionReleaseEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.released")
      .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()));
}

代码示例来源:origin: com.atlassian.jira/jira-webhooks-plugin

@ProvidesUrlVariables({"project.key", "project.id", "version.id"})
  @Override
  public Map<String, Object> uriVariables(AbstractVersionEvent event) {
    final Project project = event.getVersion().getProjectObject();
    return contextSerializer.getContext(project, event.getVersion());
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionDeleteEvent(@Nonnull final AbstractVersionEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.deleted")
      .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()));
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionArchiveEvent(@Nonnull final VersionArchiveEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.archived")
      .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()));
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionUnreleaseEvent(@Nonnull final VersionUnreleaseEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.unreleased")
      .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()));
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public Option<RecordRequest> onVersionUpdatedEvent(@Nonnull final VersionUpdatedEvent event)
{
  final List<ChangedValue> values = computeChangedValues(event.getOriginalVersion(), event.getVersion());
  if (!values.isEmpty())
  {
    return Option.some(new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.updated")
        .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
        .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()))
        .withChangedValues(values));
  }
  return Option.none();
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionCreateEvent(@Nonnull AbstractVersionEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.created")
      .forObject(AssociatedItem.Type.VERSION, event.getVersion().getName(), event.getVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()))
      .withChangedValues(computeChangedValues(null, event.getVersion()));
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nonnull
@Override
public RecordRequest onVersionMergeEvent(@Nonnull final VersionMergeEvent event)
{
  return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.version.merged")
      .forObject(AssociatedItem.Type.VERSION, event.getMergedVersion().getName(), event.getMergedVersionId())
      .withAssociatedItems(new AffectedProject(event.getVersion().getProjectObject()))
      .withChangedValues(computeChangedValues(event.getMergedVersion(), event.getVersion()));
}

代码示例来源:origin: com.atlassian.jira/jira-api

@Override
public void appendNonNullItem(Version version, JqlClauseBuilder clauseBuilder)
{
  clauseBuilder
      .sub()
      .project(version.getProjectObject().getKey())
      .and()
      .addStringCondition(clauseName, EQUALS, version.getName())
      .endsub();
}

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

/**
 * Getter for all the {@link Build}s related to the given {@link Version}
 *
 * @param version the {@link Version} to get all the builds for
 * @param user    the current logged in {@link User}
 * @return the collection of {@link Build}s
 */
public Iterable<? extends Build> getBuildsByRelation(Version version, User user) {
  LOGGER.debug("Looking for builds related to version [{}]", version.getName());
  return getBuildsByRelation(JqlQueryBuilder.newBuilder().where().project(version.getProjectObject().getKey()).and().addClause
      (JqlQueryBuilder.newClauseBuilder().affectedVersion(version.getName()).or().fixVersion(version.getId()).buildClause())
      .endWhere(), user);
}

相关文章