use of jetbrains.buildServer.vcs.ChangeStatusProvider in project teamcity-rest by JetBrains.
the class ChangeRequest method getChangeFirstBuilds.
/**
* Experimental support only!
*/
@GET
@Path("/{changeLocator}/firstBuilds")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get first builds of the matching change.", nickname = "getChangeFirstBuilds", hidden = true)
public Builds getChangeFirstBuilds(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
List<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull).collect(Collectors.toList());
return Builds.createFromBuildPromotions(firstBuildsPromotions, null, new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.vcs.ChangeStatusProvider in project teamcity-rest by JetBrains.
the class ChangeRequest method getDeploymentConfigurations.
/**
* Experimental support only!
*/
@GET
@Path("/{changeLocator}/deploymentConfigurations")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get build configurations where this change could potentially be deployed.", nickname = "getDeploymentConfigurations", hidden = true)
public BuildTypes getDeploymentConfigurations(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
return new BuildTypes(BuildTypes.fromBuildTypes(changeStatus.getDeploymentStatus().keySet()), null, new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.vcs.ChangeStatusProvider in project teamcity-rest by JetBrains.
the class ChangeRequest method getRelatedBuildTypes.
/**
* Experimental support only!
*/
@GET
@Path("/{changeLocator}/buildTypes")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get build configurations related to the matching change.", nickname = "getRelatedBuildTypes", hidden = true)
public BuildTypes getRelatedBuildTypes(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
return new BuildTypes(BuildTypes.fromBuildTypes(changeStatus.getRelatedConfigurations()), null, new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.vcs.ChangeStatusProvider in project teamcity-rest by JetBrains.
the class ChangeRequest method getChangeProblemsTree.
/**
* Experimental, subject to change
* @since 2021.2
*/
@GET
@Path("/{changeLocator}/problemsTree")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get problems tree for the matching change.", nickname = "getChangeProblemsTree", hidden = true)
public ProblemOccurrencesTree getChangeProblemsTree(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, // todo: remove after ui migration
@QueryParam(ProblemOccurrencesTreeCollector.SUB_TREE_ROOT_ID) String subTreeRootId, @QueryParam("treeLocator") String treeLocatorText, @QueryParam("fields") String fields) {
final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
Stream<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull);
Locator treeLocator = Locator.createPotentiallyEmptyLocator(treeLocatorText);
if (subTreeRootId != null) {
treeLocator.setDimension(ProblemOccurrencesTreeCollector.SUB_TREE_ROOT_ID, subTreeRootId);
}
return new ProblemOccurrencesTree(myProblemOccurrencesTreeCollector.getTreeFromBuildPromotions(firstBuildsPromotions, treeLocator), new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.vcs.ChangeStatusProvider in project teamcity-rest by JetBrains.
the class Change method getStatus.
@XmlElement(name = "status")
public ChangeStatus getStatus() {
return ValueWithDefault.decideDefault(myFields.isIncluded("status", false, false), () -> {
ChangeStatusProvider statusProvider = myBeanContext.getSingletonService(ChangeStatusProvider.class);
jetbrains.buildServer.vcs.ChangeStatus mergedStatus = statusProvider.getMergedChangeStatus(myModification);
return new ChangeStatus(mergedStatus, myFields.getNestedField("status"), myBeanContext);
});
}
Aggregations