use of com.thinkbiganalytics.alerts.spi.defaults.KyloEntityAwareAlertCriteria in project kylo by Teradata.
the class KyloEntityAwareAlertManager method entityDeleted.
public Iterator<Alert> entityDeleted(AlertCriteria criteria, String message) {
log.info("Query for Entity Alerts data");
List<Alert> handledAlerts = this.metadataAccess.commit(() -> {
List<Alert> alerts = new ArrayList<>();
criteria.state(Alert.State.UNHANDLED);
KyloEntityAwareAlertCriteria critImpl = ensureAlertCriteriaType(criteria);
critImpl.createEntityQuery().fetch().stream().forEach(jpaAlert -> {
JpaAlertChangeEvent event = new JpaAlertChangeEvent(Alert.State.HANDLED, MetadataAccess.SERVICE, message, null);
jpaAlert.addEvent(event);
// hide it
jpaAlert.setCleared(true);
alerts.add(asValue(jpaAlert));
});
return alerts;
}, MetadataAccess.SERVICE);
return handledAlerts.iterator();
}
Aggregations