Search in sources :

Example 11 with BuildPromotion

use of jetbrains.buildServer.serverSide.BuildPromotion in project teamcity-rest by JetBrains.

the class ChangeRequest method getDeployments.

/**
 * Experimental support only!
 */
@GET
@Path("/{changeLocator}/deployments")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get deployments with this change.", nickname = "getDeployments", hidden = true)
public Builds getDeployments(@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> promotions = changeStatus.getDeploymentStatus().values().stream().filter(Objects::nonNull).collect(Collectors.toList());
    return Builds.createFromBuildPromotions(promotions, null, new Fields(fields), myBeanContext);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) BuildPromotion(jetbrains.buildServer.serverSide.BuildPromotion) Fields(jetbrains.buildServer.server.rest.model.Fields) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

BuildPromotion (jetbrains.buildServer.serverSide.BuildPromotion)11 ApiOperation (io.swagger.annotations.ApiOperation)5 Fields (jetbrains.buildServer.server.rest.model.Fields)5 Locator (jetbrains.buildServer.server.rest.data.Locator)4 ChangeStatus (jetbrains.buildServer.vcs.ChangeStatus)4 ChangeStatusProvider (jetbrains.buildServer.vcs.ChangeStatusProvider)4 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)4 NotNull (org.jetbrains.annotations.NotNull)4 Objects (java.util.Objects)2 ServiceLocator (jetbrains.buildServer.ServiceLocator)2 PagerData (jetbrains.buildServer.server.rest.model.PagerData)2 SBuild (jetbrains.buildServer.serverSide.SBuild)2 java.util (java.util)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 XmlElement (javax.xml.bind.annotation.XmlElement)1 Build (jetbrains.buildServer.Build)1