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);
}
}
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);
}
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());
}
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());
}
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());
}
Aggregations