Пример #1
0
 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;
 }
Пример #2
0
 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;
 }
Пример #3
0
 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);
 }
Пример #4
0
 public boolean isAdministrator(CaseInsensitiveString username) {
   return isAdministrator(username.toString());
 }
Пример #5
0
 public boolean isUserAdmin(Username username) {
   return isAdministrator(CaseInsensitiveString.str(username.getUsername()));
 }