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()));
}));
}
}
Aggregations