コード例 #1
0
ファイル: GoConfigService.java プロジェクト: jyotisingh/gocd
  public long persistSelectedPipelines(
      String id, Long userId, List<String> selectedPipelines, boolean isBlacklist) {
    PipelineSelections pipelineSelections = findOrCreateCurrentPipelineSelectionsFor(id, userId);

    if (isBlacklist) {
      List<String> unselectedPipelines = invertSelections(selectedPipelines);
      pipelineSelections.update(unselectedPipelines, clock.currentTime(), userId, isBlacklist);
    } else {
      pipelineSelections.update(selectedPipelines, clock.currentTime(), userId, isBlacklist);
    }

    return pipelineRepository.saveSelectedPipelines(pipelineSelections);
  }
コード例 #2
0
ファイル: GoConfigService.java プロジェクト: jyotisingh/gocd
 private PipelineSelections findOrCreateCurrentPipelineSelectionsFor(String id, Long userId) {
   PipelineSelections pipelineSelections =
       isSecurityEnabled()
           ? pipelineRepository.findPipelineSelectionsByUserId(userId)
           : pipelineRepository.findPipelineSelectionsById(id);
   if (pipelineSelections == null) {
     pipelineSelections =
         new PipelineSelections(new ArrayList<String>(), clock.currentTime(), userId, true);
   }
   return pipelineSelections;
 }