use of com.thoughtworks.go.server.dashboard.GoDashboardPipeline in project gocd by gocd.
the class PipelineRepresenter method toJSON.
public static void toJSON(OutputWriter jsonOutputWriter, GoDashboardPipeline model, Username username) {
String usernameString = username.getUsername().toString();
jsonOutputWriter.addLinks(linksWriter -> addLinks(linksWriter, model)).add("name", model.name().toString()).add("last_updated_timestamp", model.getLastUpdatedTimeStamp()).add("locked", model.model().getLatestPipelineInstance().isCurrentlyLocked()).addChild("pause_info", getPauseInfoNEW(model)).add("can_operate", model.isPipelineOperator(usernameString)).add("can_administer", model.canBeAdministeredBy(usernameString)).add("can_unlock", model.canBeOperatedBy(usernameString)).add("can_pause", model.canBeOperatedBy(usernameString)).add("from_config_repo", !model.isLocal());
if (model.getTrackingTool().isPresent()) {
TrackingTool trackingTool = model.getTrackingTool().get();
jsonOutputWriter.addChild("tracking_tool", childWriter -> {
childWriter.add("regex", trackingTool.getRegex()).add("link", trackingTool.getLink());
});
}
jsonOutputWriter.addChild("_embedded", childWriter -> {
childWriter.addChildList("instances", writeInstances(model));
});
}
Aggregations