private List<String> invertSelections(List<String> selectedPipelines) { List<String> unselectedPipelines = new ArrayList<>(); List<PipelineConfig> pipelineConfigList = cruiseConfig().getAllPipelineConfigs(); for (PipelineConfig pipelineConfig : pipelineConfigList) { String pipelineName = CaseInsensitiveString.str(pipelineConfig.name()); if (!selectedPipelines.contains(pipelineName)) { unselectedPipelines.add(pipelineName); } } return unselectedPipelines; }
public MaterialConfig findMaterialWithName( final CaseInsensitiveString pipelineName, final CaseInsensitiveString materialName) { MaterialConfigs materialConfigs = materialConfigsFor(pipelineName); for (MaterialConfig materialConfig : materialConfigs) { if (materialName.equals(materialConfig.getName())) { return materialConfig; } } LOGGER.error("material [" + materialName + "] not found in pipeline [" + pipelineName + "]"); return null; }
public JobConfigIdentifier translateToActualCase(JobConfigIdentifier identifier) { PipelineConfig pipelineConfig = getCurrentConfig() .pipelineConfigByName(new CaseInsensitiveString(identifier.getPipelineName())); String translatedPipelineName = CaseInsensitiveString.str(pipelineConfig.name()); StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(identifier.getStageName())); if (stageConfig == null) { throw new StageNotFoundException( new CaseInsensitiveString(identifier.getPipelineName()), new CaseInsensitiveString(identifier.getStageName())); } String translatedStageName = CaseInsensitiveString.str(stageConfig.name()); JobConfig plan = stageConfig.jobConfigByInstanceName(identifier.getJobName(), true); if (plan == null) { throw new JobNotFoundException( identifier.getPipelineName(), identifier.getStageName(), identifier.getJobName()); } String translatedJobName = plan.translatedName(identifier.getJobName()); return new JobConfigIdentifier(translatedPipelineName, translatedStageName, translatedJobName); }
public boolean isAdministrator(CaseInsensitiveString username) { return isAdministrator(username.toString()); }
public boolean isUserAdmin(Username username) { return isAdministrator(CaseInsensitiveString.str(username.getUsername())); }