public ExecutionEnrichment getEnrichment(final Execution execution) { this.read.lock(); try { return createContext(execution).enrichment(); } finally { this.read.unlock(); } }
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); }
if(freshContext.requiresRepository() && !freshContext.enrichment().repositoryResource().isPresent()) { if(enrichment.repositoryResource().isPresent()) { createRepository(freshContext, enrichment, repositoryLocation); if(freshContext.requiresBranch() && !freshContext.enrichment().branchResource().isPresent()) { if(enrichment.branchResource().isPresent()) { createBranch(freshContext, enrichment, repositoryLocation,branchName); if(freshContext.requiresCommit() && !freshContext.enrichment().commitResource().isPresent()) { if(enrichment.commitResource().isPresent()) { createCommit(freshContext, enrichment, repositoryLocation, branchName, commitId);