use of org.springframework.context.event.EventListener in project cas by apereo.
the class DefaultCasEventListener method handleCasAuthenticationTransactionFailureEvent.
/**
* Handle cas authentication policy failure event.
*
* @param event the event
*/
@EventListener
public void handleCasAuthenticationTransactionFailureEvent(final CasAuthenticationTransactionFailureEvent event) {
if (this.casEventRepository != null) {
final CasEvent dto = prepareCasEvent(event);
dto.setPrincipalId(event.getCredential().getId());
dto.putId(CasAuthenticationPolicyFailureEvent.class.getSimpleName());
this.casEventRepository.save(dto);
}
}
use of org.springframework.context.event.EventListener in project cas by apereo.
the class DefaultCasEventListener method handleCasRiskyAuthenticationDetectedEvent.
/**
* Handle cas risky authentication detected event.
*
* @param event the event
*/
@EventListener
public void handleCasRiskyAuthenticationDetectedEvent(final CasRiskyAuthenticationDetectedEvent event) {
if (this.casEventRepository != null) {
final CasEvent dto = prepareCasEvent(event);
dto.putId(event.getService().getName());
dto.setPrincipalId(event.getAuthentication().getPrincipal().getId());
this.casEventRepository.save(dto);
}
}
use of org.springframework.context.event.EventListener in project metacat by Netflix.
the class MetacatElasticSearchEventHandlers method metacatUpdateTablePostEventHandler.
/**
* Subscriber.
*
* @param event event
*/
@EventListener
public void metacatUpdateTablePostEventHandler(final MetacatUpdateTablePostEvent event) {
log.debug("Received UpdateTableEvent {}", event);
registry.counter(Metrics.CounterElasticSearchTableUpdate.name()).increment();
final TableDto dto = event.getCurrentTable();
final ElasticSearchDoc doc = new ElasticSearchDoc(dto.getName().toString(), dto, event.getRequestContext().getUserName(), false);
final ElasticSearchDoc oldDoc = es.get(ElasticSearchDoc.Type.table.name(), doc.getId());
es.save(ElasticSearchDoc.Type.table.name(), doc.getId(), doc.toJsonString());
if (oldDoc == null || oldDoc.getDto() == null || !Objects.equals(((TableDto) oldDoc.getDto()).getDataMetadata(), dto.getDataMetadata())) {
updateEntitiesWithSameUri(ElasticSearchDoc.Type.table.name(), dto, event.getRequestContext());
}
}
use of org.springframework.context.event.EventListener in project metacat by Netflix.
the class MetacatElasticSearchEventHandlers method metacatDeleteTablePostEventHandler.
/**
* Subscriber.
*
* @param event event
*/
@EventListener
public void metacatDeleteTablePostEventHandler(final MetacatDeleteTablePostEvent event) {
log.debug("Received DeleteTableEvent {}", event);
registry.counter(Metrics.CounterElasticSearchTableDelete.name()).increment();
final TableDto dto = event.getTable();
es.softDelete(ElasticSearchDoc.Type.table.name(), dto.getName().toString(), event.getRequestContext());
try {
final List<String> partitionIdsToBeDeleted = es.getIdsByQualifiedName(ElasticSearchDoc.Type.partition.name(), dto.getName());
es.delete(ElasticSearchDoc.Type.partition.name(), partitionIdsToBeDeleted);
} catch (Exception e) {
log.warn("Failed deleting the partitions for the dropped table/view:{}", dto.getName().toString());
}
}
use of org.springframework.context.event.EventListener in project metacat by Netflix.
the class MetacatElasticSearchEventHandlers method metacatDeleteDatabasePostEventHandler.
/**
* Subscriber.
*
* @param event event
*/
@EventListener
public void metacatDeleteDatabasePostEventHandler(final MetacatDeleteDatabasePostEvent event) {
log.debug("Received DeleteDatabaseEvent {}", event);
registry.counter(Metrics.CounterElasticSearchDatabaseDelete.name()).increment();
final DatabaseDto dto = event.getDatabase();
es.softDelete(ElasticSearchDoc.Type.database.name(), dto.getName().toString(), event.getRequestContext());
}
Aggregations