Search in sources :

Example 1 with ProblemOccurrencesTree

use of jetbrains.buildServer.server.rest.model.problem.scope.ProblemOccurrencesTree 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);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) BuildPromotion(jetbrains.buildServer.serverSide.BuildPromotion) ServiceLocator(jetbrains.buildServer.ServiceLocator) Locator(jetbrains.buildServer.server.rest.data.Locator) Fields(jetbrains.buildServer.server.rest.model.Fields) Objects(java.util.Objects) ProblemOccurrencesTree(jetbrains.buildServer.server.rest.model.problem.scope.ProblemOccurrencesTree) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 Objects (java.util.Objects)1 ServiceLocator (jetbrains.buildServer.ServiceLocator)1 Locator (jetbrains.buildServer.server.rest.data.Locator)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 ProblemOccurrencesTree (jetbrains.buildServer.server.rest.model.problem.scope.ProblemOccurrencesTree)1 BuildPromotion (jetbrains.buildServer.serverSide.BuildPromotion)1 ChangeStatus (jetbrains.buildServer.vcs.ChangeStatus)1 ChangeStatusProvider (jetbrains.buildServer.vcs.ChangeStatusProvider)1 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)1