use of com.thinkbiganalytics.metadata.api.alerts.EntityAwareAlertSummary in project kylo by Teradata.
the class AlertsModel method groupAlertSummaries.
public Collection<AlertSummaryGrouped> groupAlertSummaries(List<AlertSummary> alertSummaries) {
Map<String, AlertSummaryGrouped> group = new HashMap<>();
alertSummaries.forEach(alertSummary -> {
String key = alertSummary.getType() + ":" + alertSummary.getSubtype();
String displayName = alertTypeDisplayName(alertSummary);
if (alertSummary instanceof EntityAwareAlertSummary) {
EntityAwareAlertSummary entityAwareAlertSummary = (EntityAwareAlertSummary) alertSummary;
key = entityAwareAlertSummary.getGroupByKey();
group.computeIfAbsent(key, key1 -> new AlertSummaryGrouped.Builder().typeString(alertSummary.getType()).typeDisplayName(displayName).subType(entityAwareAlertSummary.getSubtype()).feedId(entityAwareAlertSummary.getFeedId() != null ? entityAwareAlertSummary.getFeedId().toString() : null).feedName(entityAwareAlertSummary.getFeedName()).slaId(entityAwareAlertSummary.getSlaId() != null ? entityAwareAlertSummary.getSlaId().toString() : null).slaName(entityAwareAlertSummary.getSlaName()).build()).add(toModel(alertSummary.getLevel()), alertSummary.getCount(), alertSummary.getLastAlertTimestamp());
} else {
group.computeIfAbsent(key, key1 -> new AlertSummaryGrouped.Builder().typeString(alertSummary.getType()).typeDisplayName(displayName).subType(alertSummary.getSubtype()).build()).add(toModel(alertSummary.getLevel()), alertSummary.getCount(), alertSummary.getLastAlertTimestamp());
}
});
return group.values();
}
Aggregations