Gets all commits for a given pipeline stage, taking into account the mappings for environment stages
@param dashboard
@param pipeline
@param stageType
@return
181757
private Map<String, PipelineCommit> findCommitsForStage(Dashboard dashboard, Pipeline pipeline, PipelineStage stage) {
    	 Map<String, PipelineCommit> commitMap = new HashMap<>();
    	
    	// The environment name including the pseudo environments "Build" and "Commit"
    	String psuedoEnvironmentName = 
    			PipelineStage.COMMIT.equals(stage) || PipelineStage.BUILD.equals(stage)? stage.getName() : 
    			PipelineUtils.getStageToEnvironmentNameMap(dashboard).get(stage);
    	
        if(psuedoEnvironmentName != null){
            commitMap = pipeline.getCommitsByEnvironmentName(psuedoEnvironmentName);
        }
        return commitMap;
    }
847596
@Override
    public Page<Dashboard> findDashboardsByPage(String type, Pageable page) {
        if ((type != null) && (!type.isEmpty()) && (!UNDEFINED.equalsIgnoreCase(type))) {
            return dashboardRepository.findAllByTypeContainingIgnoreCase(type, page);
        }
        return dashboardRepository.findAll(page);
    }
816098
protected RepoBranch getComponentRepoBranch(Component component) {
        CollectorItem item = component.getFirstCollectorItemForType(CollectorType.SCM);
        if (item == null) {
        	logger.warn("Error encountered building pipeline: could not find scm collector item for dashboard.");
        	return new RepoBranch("", "", RepoType.Unknown);
        }
        
        // TODO find a better way?
        String url = (String)item.getOptions().get("url");
        String branch = (String)item.getOptions().get("branch");
        
        return new RepoBranch(url, branch, RepoType.Unknown);
	}
932088
@Override
    public List<Dashboard> getDashboardsByCollectorItems(Set<CollectorItem> collectorItems, CollectorType collectorType) {
        if (org.apache.commons.collections4.CollectionUtils.isEmpty(collectorItems)) {
            return new ArrayList<>();
        }
        List<ObjectId> collectorItemIds = collectorItems.stream().map(BaseModel::getId).collect(Collectors.toList());
        // Find the components that have these collector items
        List<com.capitalone.dashboard.model.Component> components = componentRepository.findByCollectorTypeAndItemIdIn(collectorType, collectorItemIds);
        List<ObjectId> componentIds = components.stream().map(BaseModel::getId).collect(Collectors.toList());
        return dashboardRepository.findByApplicationComponentIdsIn(componentIds);
    }
627676
public java.util.List<DashboardEntry> getDashboardEntries() {
        if (dashboardEntries == null) {
            dashboardEntries = new com.amazonaws.internal.SdkInternalList<DashboardEntry>();
        }
        return dashboardEntries;
    }
1006384
public StorageObjectMetadata createStorageMetadataObj(StageInfo.StageType stageType)
  {
    switch (stageType)
    {
      case S3:
        return new S3ObjectMetadata();

      case AZURE:
        return new AzureObjectMetadata();

      default:
        // An unsupported remote storage client type was specified
        // We don't create/implement a storage client for FS_LOCAL,
        // so we should never end up here while running on local file system
        throw new IllegalArgumentException("Unsupported stage type specified: "
                                           + stageType.name());
    }
  }
216515
private Map<String, Collection<String>> buildCommitGraph(List<Commit> commits) {
		// multimap api doesn't quite fit what we want to do here
		Map<String, Collection<String>> rt = new HashMap<>();
		
		// TODO build graph for svn
		
		for (Commit commit : commits) {
			String revisionNumber = commit.getScmRevisionNumber();
			boolean alreadyExists = false;
			
			List<String> parentRevisionNumbers = commit.getScmParentRevisionNumbers();
			if (parentRevisionNumbers == null) {
				alreadyExists = rt.put(revisionNumber, new ArrayList<>()) != null;
			} else {
				alreadyExists = rt.put(revisionNumber, parentRevisionNumbers) != null;
			}
			
			if (alreadyExists) {
				logger.warn("Error encountered building pipeline: multiple commits exist for revision number " + revisionNumber);
			}
		}
		
		return rt;
	}
956020
public ByteBuffer getSecretStage(final String secretId, final Stage stage) {
        final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest();
        getSecretValueRequest.setSecretId(secretId);
        getSecretValueRequest.setVersionStage(stage.getAwsName());
        final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest);
        return result.getSecretBinary();
    }
734662
public java.util.List<String> getLifecycleHookTypes() {
        if (lifecycleHookTypes == null) {
            lifecycleHookTypes = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return lifecycleHookTypes;
    }
755265
public java.util.List<Pipeline> getPipelines() {
        if (pipelines == null) {
            pipelines = new com.amazonaws.internal.SdkInternalList<Pipeline>();
        }
        return pipelines;
    }
999429
public List<Step<Job<T>>> getAllStep()
   {
      List<Step<Job<T>>> list = new ArrayList<Step<Job<T>>>();
      List<Node> nodeList = childNode.get("step");
      for(Node node: nodeList)
      {
         Step<Job<T>>  type = new StepImpl<Job<T>>(this, "step", childNode, node);
         list.add(type);
      }
      return list;
   }
937339
public static PipelineConfiguration
    mkInitial(List<String> inputFiles,
              ActionConfiguration configuration,
              AppVersionInfo versionInfo) {
        LightFileDescriptor[] inputDescriptors = inputFiles.stream()
                .map(f -> LightFileDescriptor.calculate(Paths.get(f))).toArray(LightFileDescriptor[]::new);
        return new PipelineConfiguration(
                new PipelineStep[] { new PipelineStep(versionInfo, inputDescriptors, configuration) });
    }
691943
public java.util.List<PipelineObject> getPipelineObjects() {
        if (pipelineObjects == null) {
            pipelineObjects = new com.amazonaws.internal.SdkInternalList<PipelineObject>();
        }
        return pipelineObjects;
    }
107784
@SuppressWarnings("VariableNotUsedInsideIf")
  public Stage stage()
  {
    if (sortProject != null) {
      return Stage.SORT_PROJECT;
    } else if (sort != null) {
      return Stage.SORT;
    } else if (aggregateProject != null) {
      return Stage.AGGREGATE_PROJECT;
    } else if (havingFilter != null) {
      return Stage.HAVING_FILTER;
    } else if (aggregate != null) {
      return Stage.AGGREGATE;
    } else if (selectSort != null) {
      return Stage.SELECT_SORT;
    } else if (selectProject != null) {
      return Stage.SELECT_PROJECT;
    } else if (whereFilter != null) {
      return Stage.WHERE_FILTER;
    } else {
      return Stage.SCAN;
    }
  }
206534
@RequestMapping(value = "/dashboardReview", method = GET, produces = APPLICATION_JSON_VALUE)
	@ApiOperation(value = "Dashboard Review", notes = "This endpoint validates that your artifact is meeting the quality gate threshold established in Sonar and returns an appropriate audit status based on whether the threshold has been met or not.", response = DashboardReviewResponse.class, responseContainer = "List")
    public ResponseEntity<DashboardReviewResponse> dashboardReview(@Valid DashboardAuditRequest request) throws AuditException {
        DashboardReviewResponse dashboardReviewResponse = dashboardAuditService.getDashboardReviewResponse(request.getTitle(), DashboardType.Team,
                request.getBusinessService(), request.getBusinessApplication(),
                request.getBeginDate(), request.getEndDate(), request.getAuditType());

        return ResponseEntity.ok().body(dashboardReviewResponse);
    }
249395
@RequestMapping(value = "/dashboard/count/{type}", method = GET, produces = APPLICATION_JSON_VALUE)
    public long dashboardsCount(@PathVariable String type) {
        return dashboardService.count(type);
    }
663546
public AnalysisEngineDescription buildComponent(int stageId, int phase, AnyObject aeDescription)
          throws Exception {
    Map<String, Object> tuples = Maps.newLinkedHashMap();
    tuples.put(BasePhase.QA_INTERNAL_PHASEID, new Integer(phase));
    tuples.put(EXPERIMENT_UUID_PROPERTY, experimentUuid);
    tuples.put(STAGE_ID_PROPERTY, stageId);
    Class<? extends AnalysisComponent> ac = getFromClassOrInherit(aeDescription,
            AnalysisComponent.class, tuples);
    Object[] params = getParamList(tuples);
    AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(ac,
            typeSystem, typePriorities, params);
    String name = (String) tuples.get("name");
    description.getAnalysisEngineMetaData().setName(name);
    return description;
  }