use of jetbrains.buildServer.serverSide.artifacts.BuildArtifactHolder in project teamcity-rest by JetBrains.
the class BuildArtifactsFinder method getArtifactElement.
@NotNull
public static Element getArtifactElement(@NotNull final BuildPromotion buildPromotion, @NotNull final String path, @NotNull final ServiceLocator serviceLocator) {
final BuildPromotionEx buildPromotionEx = (BuildPromotionEx) buildPromotion;
final BuildArtifacts artifacts = buildPromotionEx.getArtifacts(BuildArtifactsViewMode.VIEW_ALL_WITH_ARCHIVES_CONTENT);
if (!artifacts.isAvailable()) {
return new BuildHoldingElement(artifacts.getRootArtifact(), buildPromotion);
}
final BuildArtifactHolder holder = artifacts.findArtifact(path);
if (!holder.isAvailable() && !"".equals(path)) {
// "".equals(path) is a workaround for no artifact directory case
return getItem(new ArtifactsBrowserImpl(artifacts), path, LogUtil.describe(buildPromotionEx), serviceLocator);
}
if (!holder.isAccessible()) {
throw new AuthorizationFailedException("Artifact is not accessible with current user permissions. Relative path: '" + holder.getRelativePath() + "'");
}
return new BuildHoldingElement(holder.getArtifact(), buildPromotion);
}
Aggregations