Search in sources :

Example 1 with BuildAgent

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

the class Build method getDelayedByBuild.

@XmlElement(name = "delayedByBuild")
public Build getDelayedByBuild() {
    return ValueWithDefault.decideDefault(myFields.isIncluded("delayedByBuild", false, false), () -> {
        if (myQueuedBuild == null || myQueuedBuild.getBuildPromotion().isCompositeBuild()) {
            return null;
        }
        BuildEstimates estimates = myQueuedBuild.getBuildEstimates();
        if (estimates == null) {
            return null;
        }
        BuildAgent agent = estimates.getAgent();
        if (agent == null || !(agent instanceof SBuildAgent)) {
            return null;
        }
        SRunningBuild delayer = ((SBuildAgent) agent).getRunningBuild();
        if (delayer == null) {
            return null;
        }
        return new Build(delayer, myFields.getNestedField("delayedByBuild"), myBeanContext);
    });
}
Also used : BaseBuild(jetbrains.buildServer.serverSide.impl.BaseBuild) BuildAgent(jetbrains.buildServer.BuildAgent) XmlElement(javax.xml.bind.annotation.XmlElement)

Example 2 with BuildAgent

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

the class Build method getPlannedAgent.

@XmlElement(name = "plannedAgent")
public Agent getPlannedAgent() {
    return ValueWithDefault.decideDefault(myFields.isIncluded("plannedAgent", false, false), () -> {
        if (myQueuedBuild == null || myQueuedBuild.getBuildPromotion().isCompositeBuild()) {
            return null;
        }
        BuildEstimates estimates = myQueuedBuild.getBuildEstimates();
        if (estimates == null) {
            return null;
        }
        BuildAgent agent = estimates.getAgent();
        if (agent == null || !(agent instanceof SBuildAgent)) {
            return null;
        }
        return new Agent((SBuildAgent) agent, myFields.getNestedField("plannedAgent"), myBeanContext);
    });
}
Also used : Agent(jetbrains.buildServer.server.rest.model.agent.Agent) BuildAgent(jetbrains.buildServer.BuildAgent) BuildAgent(jetbrains.buildServer.BuildAgent) XmlElement(javax.xml.bind.annotation.XmlElement)

Aggregations

XmlElement (javax.xml.bind.annotation.XmlElement)2 BuildAgent (jetbrains.buildServer.BuildAgent)2 Agent (jetbrains.buildServer.server.rest.model.agent.Agent)1 BaseBuild (jetbrains.buildServer.serverSide.impl.BaseBuild)1