Search in sources :

Example 1 with BranchImpl

use of io.jenkins.blueocean.rest.impl.pipeline.BranchImpl in project blueocean-plugin by jenkinsci.

the class BlueOceanWebURLBuilder method getPipelineModelMapping.

private static BlueOceanModelMapping getPipelineModelMapping(Job job) {
    BluePipeline blueResource = (BluePipeline) BluePipelineFactory.resolve(job);
    if (blueResource instanceof BranchImpl) {
        // No abstract "Branch" type?
        ItemGroup multibranchJob = job.getParent();
        BluePipeline multibranchJobResource = (BluePipeline) BluePipelineFactory.resolve((Item) multibranchJob);
        return new BlueOceanModelMapping(multibranchJob, multibranchJobResource, getOrgPrefix() + "/" + encodeURIComponent(multibranchJobResource.getFullName()));
    } else {
        return new BlueOceanModelMapping(job, blueResource, getOrgPrefix() + "/" + encodeURIComponent(blueResource.getFullName()));
    }
}
Also used : Item(hudson.model.Item) ItemGroup(hudson.model.ItemGroup) BranchImpl(io.jenkins.blueocean.rest.impl.pipeline.BranchImpl) BluePipeline(io.jenkins.blueocean.rest.model.BluePipeline)

Aggregations

Item (hudson.model.Item)1 ItemGroup (hudson.model.ItemGroup)1 BranchImpl (io.jenkins.blueocean.rest.impl.pipeline.BranchImpl)1 BluePipeline (io.jenkins.blueocean.rest.model.BluePipeline)1