Search in sources :

Example 1 with WaitingJobPlan

use of com.thoughtworks.go.domain.WaitingJobPlan in project gocd by gocd.

the class JobPlanXmlRepresenter method populateJob.

public void populateJob(ElementBuilder builder, XmlWriterContext ctx, WaitingJobPlan waitingJobPlan) {
    JobPlan jobPlan = waitingJobPlan.jobPlan();
    builder.attr("name", jobPlan.getName()).link(ctx.jobXmlLink(jobPlan.getIdentifier()), "self").link(ctx.jobDetailsLink(jobPlan.getIdentifier()), "alternate", jobPlan.getName() + " Job Detail", "text/html").textNode("buildLocator", jobPlan.getIdentifier().buildLocator());
    if (isNotBlank(waitingJobPlan.envName())) {
        builder.textNode("environment", waitingJobPlan.envName());
    }
    if (!jobPlan.getResources().isEmpty()) {
        builder.node("resources", rb -> jobPlan.getResources().forEach(resource -> {
            rb.cdataNode("resource", resource.getName());
        }));
    }
    if (!jobPlan.getVariables().isEmpty()) {
        builder.node("environmentVariables", eb -> jobPlan.getVariables().forEach(variable -> {
            eb.node("variable", vb -> vb.attr("name", variable.getName()).text(variable.getDisplayValue()));
        }));
    }
}
Also used : Document(org.dom4j.Document) List(java.util.List) StringUtils.isNotBlank(org.apache.commons.lang3.StringUtils.isNotBlank) XmlWriterContext(com.thoughtworks.go.domain.XmlWriterContext) ElementBuilder(com.thoughtworks.go.server.domain.xml.builder.ElementBuilder) DocumentBuilder(com.thoughtworks.go.server.domain.xml.builder.DocumentBuilder) JobPlan(com.thoughtworks.go.domain.JobPlan) WaitingJobPlan(com.thoughtworks.go.domain.WaitingJobPlan) XmlRepresentable(com.thoughtworks.go.domain.XmlRepresentable) JobPlan(com.thoughtworks.go.domain.JobPlan) WaitingJobPlan(com.thoughtworks.go.domain.WaitingJobPlan)

Aggregations

JobPlan (com.thoughtworks.go.domain.JobPlan)1 WaitingJobPlan (com.thoughtworks.go.domain.WaitingJobPlan)1 XmlRepresentable (com.thoughtworks.go.domain.XmlRepresentable)1 XmlWriterContext (com.thoughtworks.go.domain.XmlWriterContext)1 DocumentBuilder (com.thoughtworks.go.server.domain.xml.builder.DocumentBuilder)1 ElementBuilder (com.thoughtworks.go.server.domain.xml.builder.ElementBuilder)1 List (java.util.List)1 StringUtils.isNotBlank (org.apache.commons.lang3.StringUtils.isNotBlank)1 Document (org.dom4j.Document)1