@Override public Optional<URI> branchResource() { return this.enrichment.branchResource(); }
private static void populateEnrichedData(final IndividualPropertyHelper helper, final ExecutionEnrichment enrichment) { final Optional<URI> branchResource = enrichment.branchResource(); if(branchResource.isPresent()) { helper. property(CI_FOR_BRANCH). withIndividual(branchResource.get()); } final Optional<URI> commitResource = enrichment.commitResource(); if(commitResource.isPresent()) { helper. property(CI_FOR_COMMIT). withIndividual(commitResource.get()); } }
private void processCompletedEnrichment(final EnrichmentContext context, final Set<URI> executions) { final CompletedEnrichment completed=this.completedRepository.completedEnrichmentOfExecution(context.targetExecution().executionId()); if(completed!=null) { LOGGER.trace("{} enrichment is already completed (#{})",context,completed.id()); return; } final ExecutionEnrichment enrichment=context.enrichment(); final List<CompletedEnrichment> potentialEnrichments=this.completedRepository.findCompletedEnrichments(enrichment.repositoryResource().orNull(),enrichment.branchResource().orNull(),enrichment.commitResource().orNull()); if(!potentialEnrichments.isEmpty()) { final CompletedEnrichment delegate = potentialEnrichments.get(0); delegate.executions().addAll(executions); LOGGER.trace("{} enrichment is now completed by enrichment #{}",context,delegate.id()); return; } final CompletedEnrichment newCompleted=CompletedEnrichment.newInstance(enrichment.repositoryResource().orNull(),enrichment.branchResource().orNull(),enrichment.commitResource().orNull()); newCompleted.executions().addAll(executions); this.completedRepository.add(newCompleted); LOGGER.trace("{} enrichment is completed by {}",context,newCompleted); }
private void createBranch( final EnrichmentContext context, final ExecutionEnrichment enrichment, final URI repositoryLocation, final String branchName) { final URI branchResource = enrichment.branchResource().get(); this.scmService.createBranch( CreateBranchCommand. builder(). withRepositoryLocation(repositoryLocation). withBranchName(branchName). withResource(branchResource). build()); context.setBranchResource(branchResource); LOGGER.debug("Created branch {} ({}) in repository {}",branchName,branchResource,repositoryLocation); }
if(freshContext.requiresBranch() && !freshContext.enrichment().branchResource().isPresent()) { if(enrichment.branchResource().isPresent()) { createBranch(freshContext, enrichment, repositoryLocation,branchName); } else {