Search in sources :

Example 1 with INDEX_TYPE

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());
}
Also used : Arrays(java.util.Arrays) LocalDateTime(java.time.LocalDateTime) EntityContainer(com.epam.pipeline.elasticsearchagent.model.EntityContainer) ElasticsearchSynchronizer(com.epam.pipeline.elasticsearchagent.service.ElasticsearchSynchronizer) ElasticsearchServiceClient(com.epam.pipeline.elasticsearchagent.service.ElasticsearchServiceClient) CollectionUtils(org.apache.commons.collections4.CollectionUtils) Value(org.springframework.beans.factory.annotation.Value) DeleteRequest(org.elasticsearch.action.delete.DeleteRequest) IndexRequest(org.elasticsearch.action.index.IndexRequest) PipelineIdConverter(com.epam.pipeline.elasticsearchagent.service.impl.converter.pipeline.PipelineIdConverter) Service(org.springframework.stereotype.Service) EventProcessorUtils(com.epam.pipeline.elasticsearchagent.utils.EventProcessorUtils) ListUtils(org.apache.commons.collections4.ListUtils) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) PipelineEvent(com.epam.pipeline.elasticsearchagent.model.PipelineEvent) PipelineLoader(com.epam.pipeline.elasticsearchagent.service.impl.converter.pipeline.PipelineLoader) INDEX_TYPE(com.epam.pipeline.elasticsearchagent.service.EventToRequestConverter.INDEX_TYPE) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) PipelineMapper(com.epam.pipeline.elasticsearchagent.service.impl.converter.pipeline.PipelineMapper) BulkResponsePostProcessor(com.epam.pipeline.elasticsearchagent.service.BulkResponsePostProcessor) Collection(java.util.Collection) EventType(com.epam.pipeline.elasticsearchagent.model.EventType) EntityNotFoundException(com.epam.pipeline.elasticsearchagent.exception.EntityNotFoundException) DocWriteRequest(org.elasticsearch.action.DocWriteRequest) Collectors(java.util.stream.Collectors) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) PipelineEventDao(com.epam.pipeline.elasticsearchagent.dao.PipelineEventDao) Stream(java.util.stream.Stream) Builder(lombok.Builder) PipelineDoc(com.epam.pipeline.elasticsearchagent.model.PipelineDoc) Revision(com.epam.pipeline.entity.pipeline.Revision) Data(lombok.Data) AllArgsConstructor(lombok.AllArgsConstructor) Collections(java.util.Collections) Revision(com.epam.pipeline.entity.pipeline.Revision) Collection(java.util.Collection) IndexRequest(org.elasticsearch.action.index.IndexRequest) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline)

Aggregations

PipelineEventDao (com.epam.pipeline.elasticsearchagent.dao.PipelineEventDao)1 EntityNotFoundException (com.epam.pipeline.elasticsearchagent.exception.EntityNotFoundException)1 EntityContainer (com.epam.pipeline.elasticsearchagent.model.EntityContainer)1 EventType (com.epam.pipeline.elasticsearchagent.model.EventType)1 PipelineDoc (com.epam.pipeline.elasticsearchagent.model.PipelineDoc)1 PipelineEvent (com.epam.pipeline.elasticsearchagent.model.PipelineEvent)1 BulkResponsePostProcessor (com.epam.pipeline.elasticsearchagent.service.BulkResponsePostProcessor)1 ElasticsearchServiceClient (com.epam.pipeline.elasticsearchagent.service.ElasticsearchServiceClient)1 ElasticsearchSynchronizer (com.epam.pipeline.elasticsearchagent.service.ElasticsearchSynchronizer)1 INDEX_TYPE (com.epam.pipeline.elasticsearchagent.service.EventToRequestConverter.INDEX_TYPE)1 PipelineIdConverter (com.epam.pipeline.elasticsearchagent.service.impl.converter.pipeline.PipelineIdConverter)1 PipelineLoader (com.epam.pipeline.elasticsearchagent.service.impl.converter.pipeline.PipelineLoader)1 PipelineMapper (com.epam.pipeline.elasticsearchagent.service.impl.converter.pipeline.PipelineMapper)1 EventProcessorUtils (com.epam.pipeline.elasticsearchagent.utils.EventProcessorUtils)1 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)1 Revision (com.epam.pipeline.entity.pipeline.Revision)1 LocalDateTime (java.time.LocalDateTime)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1