Search in sources :

Example 1 with GoDashboardPipeline

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));
    });
}
Also used : OutputListWriter(com.thoughtworks.go.api.base.OutputListWriter) Consumer(java.util.function.Consumer) TrackingTool(com.thoughtworks.go.config.TrackingTool) OutputWriter(com.thoughtworks.go.api.base.OutputWriter) StringUtils(org.apache.commons.lang.StringUtils) GoDashboardPipeline(com.thoughtworks.go.server.dashboard.GoDashboardPipeline) Username(com.thoughtworks.go.server.domain.Username) PipelinePauseInfo(com.thoughtworks.go.domain.PipelinePauseInfo) OutputLinkWriter(com.thoughtworks.go.api.base.OutputLinkWriter) Routes(com.thoughtworks.go.spark.Routes) EmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel) TrackingTool(com.thoughtworks.go.config.TrackingTool)

Aggregations

OutputLinkWriter (com.thoughtworks.go.api.base.OutputLinkWriter)1 OutputListWriter (com.thoughtworks.go.api.base.OutputListWriter)1 OutputWriter (com.thoughtworks.go.api.base.OutputWriter)1 TrackingTool (com.thoughtworks.go.config.TrackingTool)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)1 GoDashboardPipeline (com.thoughtworks.go.server.dashboard.GoDashboardPipeline)1 Username (com.thoughtworks.go.server.domain.Username)1 Routes (com.thoughtworks.go.spark.Routes)1 Consumer (java.util.function.Consumer)1 StringUtils (org.apache.commons.lang.StringUtils)1