use of com.epam.pipeline.elasticsearchagent.service.EventToRequestConverter.INDEX_TYPE in project cloud-pipeline by epam.
the class PipelineSynchronizer method createIndexDocuments.
private void createIndexDocuments(final PipelineEvent event, final String pipelineIndex, final String codeIndex, final PipelineDocRequests.PipelineDocRequestsBuilder requestsBuilder, final EntityContainer<PipelineDoc> pipelineEntity) {
requestsBuilder.pipelineRequests(Collections.singletonList(new IndexRequest(pipelineIndex, INDEX_TYPE, String.valueOf(event.getObjectId())).source(mapper.map(pipelineEntity))));
final Pipeline pipeline = pipelineEntity.getEntity().getPipeline();
final List<Revision> revisions = cloudPipelineAPIClient.loadPipelineVersions(pipeline.getId());
log.debug("Loaded revisions for pipeline: {}", ListUtils.emptyIfNull(revisions).stream().map(Revision::getName).collect(Collectors.joining(", ")));
requestsBuilder.codeRequests(revisions.stream().map(revision -> pipelineCodeHandler.createPipelineCodeDocuments(pipeline, pipelineEntity.getPermissions(), revision.getName(), codeIndex, pipelineFileIndexPaths)).flatMap(Collection::stream).collect(Collectors.toList()));
log.debug("Created index and documents for {} pipeline.", pipeline.getName());
}
Aggregations