Search in sources :

Example 21 with EventListener

use of org.springframework.context.event.EventListener in project ArachneCentralAPI by OHDSI.

the class BaseStudyServiceImpl method processAntivirusResponse.

@EventListener
@Transactional
@Override
public void processAntivirusResponse(AntivirusJobStudyFileResponseEvent event) {
    final AntivirusJobResponse antivirusJobResponse = event.getAntivirusJobResponse();
    final StudyFile studyFile = studyFileRepository.findOne(antivirusJobResponse.getFileId());
    if (studyFile != null) {
        studyFile.setAntivirusStatus(antivirusJobResponse.getStatus());
        studyFile.setAntivirusDescription(antivirusJobResponse.getDescription());
        studyFileRepository.save(studyFile);
    }
}
Also used : StudyFile(com.odysseusinc.arachne.portal.model.StudyFile) AntivirusJobResponse(com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse) EventListener(org.springframework.context.event.EventListener) Transactional(org.springframework.transaction.annotation.Transactional)

Example 22 with EventListener

use of org.springframework.context.event.EventListener in project metacat by Netflix.

the class MetacatElasticSearchEventHandlers method metacatSaveTablePartitionPostEventHandler.

/**
     * Subscriber.
     *
     * @param event event
     */
@EventListener
public void metacatSaveTablePartitionPostEventHandler(final MetacatSaveTablePartitionPostEvent event) {
    log.debug("Received SaveTablePartitionEvent {}", event);
    registry.counter(Metrics.CounterElasticSearchPartitionSave.name()).increment();
    final List<PartitionDto> partitionDtos = event.getPartitions();
    final MetacatRequestContext context = event.getRequestContext();
    final List<ElasticSearchDoc> docs = partitionDtos.stream().map(dto -> new ElasticSearchDoc(dto.getName().toString(), dto, context.getUserName(), false)).collect(Collectors.toList());
    es.save(ElasticSearchDoc.Type.partition.name(), docs);
}
Also used : MetacatDeleteTablePartitionPostEvent(com.netflix.metacat.common.server.events.MetacatDeleteTablePartitionPostEvent) MetacatDeleteTablePostEvent(com.netflix.metacat.common.server.events.MetacatDeleteTablePostEvent) MetacatUpdateTablePostEvent(com.netflix.metacat.common.server.events.MetacatUpdateTablePostEvent) TableDto(com.netflix.metacat.common.dto.TableDto) MetacatRenameTablePostEvent(com.netflix.metacat.common.server.events.MetacatRenameTablePostEvent) EventListener(org.springframework.context.event.EventListener) DatabaseDto(com.netflix.metacat.common.dto.DatabaseDto) MetacatDeleteDatabasePostEvent(com.netflix.metacat.common.server.events.MetacatDeleteDatabasePostEvent) Collectors(java.util.stream.Collectors) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) MetacatJsonLocator(com.netflix.metacat.common.json.MetacatJsonLocator) MetacatCreateDatabasePostEvent(com.netflix.metacat.common.server.events.MetacatCreateDatabasePostEvent) Objects(java.util.Objects) MetacatCreateTablePostEvent(com.netflix.metacat.common.server.events.MetacatCreateTablePostEvent) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) PartitionDto(com.netflix.metacat.common.dto.PartitionDto) Registry(com.netflix.spectator.api.Registry) MetacatSaveTablePartitionPostEvent(com.netflix.metacat.common.server.events.MetacatSaveTablePartitionPostEvent) MetacatRequestContext(com.netflix.metacat.common.MetacatRequestContext) Metrics(com.netflix.metacat.common.server.monitoring.Metrics) MetacatRequestContext(com.netflix.metacat.common.MetacatRequestContext) PartitionDto(com.netflix.metacat.common.dto.PartitionDto) EventListener(org.springframework.context.event.EventListener)

Example 23 with EventListener

use of org.springframework.context.event.EventListener in project metacat by Netflix.

the class MetacatElasticSearchEventHandlers method metacatRenameTablePostEventHandler.

/**
     * Subscriber.
     *
     * @param event event
     */
@EventListener
public void metacatRenameTablePostEventHandler(final MetacatRenameTablePostEvent event) {
    log.debug("Received RenameTableEvent {}", event);
    registry.counter(Metrics.CounterElasticSearchTableRename.name()).increment();
    es.delete(ElasticSearchDoc.Type.table.name(), event.getName().toString());
    final TableDto dto = event.getCurrentTable();
    final ElasticSearchDoc doc = new ElasticSearchDoc(dto.getName().toString(), dto, event.getRequestContext().getUserName(), false);
    es.save(ElasticSearchDoc.Type.table.name(), doc.getId(), doc.toJsonString());
}
Also used : TableDto(com.netflix.metacat.common.dto.TableDto) EventListener(org.springframework.context.event.EventListener)

Example 24 with EventListener

use of org.springframework.context.event.EventListener in project metacat by Netflix.

the class MetacatElasticSearchEventHandlers method metacatCreateTablePostEventHandler.

/**
     * Subscriber.
     *
     * @param event event
     */
@EventListener
public void metacatCreateTablePostEventHandler(final MetacatCreateTablePostEvent event) {
    log.debug("Received CreateTableEvent {}", event);
    registry.counter(Metrics.CounterElasticSearchTableCreate.name()).increment();
    final TableDto dto = event.getTable();
    final ElasticSearchDoc doc = new ElasticSearchDoc(dto.getName().toString(), dto, event.getRequestContext().getUserName(), false);
    es.save(ElasticSearchDoc.Type.table.name(), doc.getId(), doc.toJsonString());
}
Also used : TableDto(com.netflix.metacat.common.dto.TableDto) EventListener(org.springframework.context.event.EventListener)

Example 25 with EventListener

use of org.springframework.context.event.EventListener in project metacat by Netflix.

the class MetacatElasticSearchEventHandlers method metacatCreateDatabasePostEventHandler.

/**
     * Subscriber.
     *
     * @param event event
     */
@EventListener
public void metacatCreateDatabasePostEventHandler(final MetacatCreateDatabasePostEvent event) {
    log.debug("Received CreateDatabaseEvent {}", event);
    registry.counter(Metrics.CounterElasticSearchDatabaseCreate.name()).increment();
    final DatabaseDto dto = event.getDatabase();
    final ElasticSearchDoc doc = new ElasticSearchDoc(dto.getName().toString(), dto, event.getRequestContext().getUserName(), false);
    es.save(ElasticSearchDoc.Type.database.name(), doc.getId(), doc.toJsonString());
}
Also used : DatabaseDto(com.netflix.metacat.common.dto.DatabaseDto) EventListener(org.springframework.context.event.EventListener)

Aggregations

EventListener (org.springframework.context.event.EventListener)34 TableDto (com.netflix.metacat.common.dto.TableDto)10 DatabaseDto (com.netflix.metacat.common.dto.DatabaseDto)6 AbstractCasEvent (org.apereo.cas.support.events.AbstractCasEvent)4 CasEvent (org.apereo.cas.support.events.dao.CasEvent)4 PartitionDto (com.netflix.metacat.common.dto.PartitionDto)3 AntivirusJobResponse (com.odysseusinc.arachne.portal.service.impl.antivirus.events.AntivirusJobResponse)3 IOException (java.io.IOException)3 List (java.util.List)3 Transactional (org.springframework.transaction.annotation.Transactional)3 InvalidParameterException (com.amazonaws.services.sns.model.InvalidParameterException)2 InvalidParameterValueException (com.amazonaws.services.sns.model.InvalidParameterValueException)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 MetacatRequestContext (com.netflix.metacat.common.MetacatRequestContext)2 NameDateDto (com.netflix.metacat.common.NameDateDto)2 QualifiedName (com.netflix.metacat.common.QualifiedName)2 UpdateTableMessage (com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTableMessage)2 UpdateTablePartitionsMessage (com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTablePartitionsMessage)2 TablePartitionsUpdatePayload (com.netflix.metacat.common.dto.notifications.sns.payloads.TablePartitionsUpdatePayload)2 MetacatJsonLocator (com.netflix.metacat.common.json.MetacatJsonLocator)2