public PipelineInstanceModels loadMinimalData(String pipelineName, Pagination pagination, Username username, OperationResult result) {
        if (!goConfigService.currentCruiseConfig().hasPipelineNamed(new CaseInsensitiveString(pipelineName))) {
            result.notFound("Not Found", "Pipeline " + pipelineName + " not found", HealthStateType.general(HealthStateScope.GLOBAL));
            return null;
        }
        if (!securityService.hasViewPermissionForPipeline(username, pipelineName)) {
            result.forbidden("Forbidden", NOT_AUTHORIZED_TO_VIEW_PIPELINE, HealthStateType.general(HealthStateScope.forPipeline(pipelineName)));
            return null;
        }

        PipelineInstanceModels history = pipelineDao.loadHistory(pipelineName, pagination.getPageSize(), pagination.getOffset());

        for (PipelineInstanceModel pipelineInstanceModel : history) {
            populateMaterialRevisionsOnBuildCause(pipelineInstanceModel);

            populatePlaceHolderStages(pipelineInstanceModel);
            populateCanRunStatus(username, pipelineInstanceModel);
            populateStageOperatePermission(pipelineInstanceModel, username);
        }

        return history;
    }
public PipelineInstanceModels loadMinimalData ( String pipelineName , Pagination pagination , Username username , OperationResult result ) { if ( ! goConfigService . currentCruiseConfig ( ) . hasPipelineNamed ( new CaseInsensitiveString ( pipelineName ) ) ) { result . notFound ( "Not Found" , "Pipeline " + pipelineName + " not found" , HealthStateType . general ( HealthStateScope . GLOBAL ) ) ; return null ; } if ( ! securityService . hasViewPermissionForPipeline ( username , pipelineName ) ) { result . forbidden ( "Forbidden" , NOT_AUTHORIZED_TO_VIEW_PIPELINE , HealthStateType . general ( HealthStateScope . forPipeline ( pipelineName ) ) ) ; return null ; } PipelineInstanceModels history = pipelineDao . loadHistory ( pipelineName , pagination . getPageSize ( ) , pagination . getOffset ( ) ) ; for ( PipelineInstanceModel pipelineInstanceModel : history ) { populateMaterialRevisionsOnBuildCause ( pipelineInstanceModel ) ; populatePlaceHolderStages ( pipelineInstanceModel ) ; populateCanRunStatus ( username , pipelineInstanceModel ) ; populateStageOperatePermission ( pipelineInstanceModel , username ) ; } return history ; }
/*
Load just enough data for Pipeline History API. The API is complete enough to build Pipeline History Page. Does following:
Exists check, Authorized check, Loads paginated pipeline data, Populates build-cause,
Populates future stages as empty, Populates can run for pipeline & each stage, Populate stage run permission