Search in sources :

Example 1 with StageJsonPresentationModel

use of com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel in project gocd by gocd.

the class CachedCurrentActivityService method stagesModel.

private List<StageJsonPresentationModel> stagesModel(PipelineConfig pipelineConfig) {
    List<StageJsonPresentationModel> presenters = new ArrayList<>();
    for (StageConfig stageConfig : pipelineConfig) {
        Stage mostRecentStage = stageService.mostRecentStageWithBuilds(CaseInsensitiveString.str(pipelineConfig.name()), stageConfig);
        Pipeline pipeline = pipelineService.pipelineWithModsByStageId(CaseInsensitiveString.str(pipelineConfig.name()), mostRecentStage.getId());
        presenters.add(stageModel(pipeline, mostRecentStage));
    }
    return presenters;
}
Also used : ArrayList(java.util.ArrayList) StageJsonPresentationModel(com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel) Stage(com.thoughtworks.go.domain.Stage) StageConfig(com.thoughtworks.go.config.StageConfig) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 2 with StageJsonPresentationModel

use of com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel in project gocd by gocd.

the class CachedCurrentActivityService method pipelineModel.

private PipelineJsonPresentationModel pipelineModel(PipelineConfig pipelineConfig) {
    String name = CaseInsensitiveString.str(pipelineConfig.name());
    PipelinePauseInfo pauseInfo = pipelinePauseService.pipelinePauseInfo(name);
    boolean forcedBuild = pipelineScheduleQueue.hasForcedBuildCause(name);
    List<StageJsonPresentationModel> stageModels = stagesModel(pipelineConfig);
    return new PipelineJsonPresentationModel(goConfigService.findGroupNameByPipeline(new CaseInsensitiveString(name)), name, pauseInfo, forcedBuild, stageModels);
}
Also used : PipelinePauseInfo(com.thoughtworks.go.domain.PipelinePauseInfo) StageJsonPresentationModel(com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) PipelineJsonPresentationModel(com.thoughtworks.go.server.presentation.models.PipelineJsonPresentationModel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 3 with StageJsonPresentationModel

use of com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel in project gocd by gocd.

the class CachedCurrentActivityService method stageModel.

private StageJsonPresentationModel stageModel(Pipeline currentPipeline, Stage stage) {
    StageIdentifier lastSuccessfulPipelineForStage = pipelineService.findLastSuccessfulStageIdentifier(currentPipeline.getName(), stage.getName());
    final DurationBeans durations = stageService.getBuildDurations(currentPipeline.getName(), stage);
    TrackingTool trackingTool = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(currentPipeline.getName())).trackingTool();
    return new StageJsonPresentationModel(currentPipeline, stage, lastSuccessfulPipelineForStage, goConfigService.agents(), durations, trackingTool);
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageJsonPresentationModel(com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel) DurationBeans(com.thoughtworks.go.dto.DurationBeans) TrackingTool(com.thoughtworks.go.config.TrackingTool) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

StageJsonPresentationModel (com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 StageConfig (com.thoughtworks.go.config.StageConfig)1 TrackingTool (com.thoughtworks.go.config.TrackingTool)1 Pipeline (com.thoughtworks.go.domain.Pipeline)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 Stage (com.thoughtworks.go.domain.Stage)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 DurationBeans (com.thoughtworks.go.dto.DurationBeans)1 PipelineJsonPresentationModel (com.thoughtworks.go.server.presentation.models.PipelineJsonPresentationModel)1 ArrayList (java.util.ArrayList)1