use of com.hortonworks.streamline.streams.notification.Notification in project streamline by hortonworks.
the class NotificationServiceImpl method findNotifications.
@Override
public List<Notification> findNotifications(List<QueryParam> queryParams) {
LOG.debug("findNotifications with queryParams {}", queryParams);
CriteriaImpl<Notification> criteria = new CriteriaImpl<>(Notification.class);
for (QueryParam qp : queryParams) {
if (qp.name.equalsIgnoreCase(QUERY_PARAM_NUM_ROWS)) {
criteria.setNumRows(Integer.parseInt(qp.value));
} else if (qp.name.equals(QUERY_PARAM_START_TS)) {
criteria.setStartTs(Long.parseLong(qp.value));
} else if (qp.name.equals((QUERY_PARAM_END_TS))) {
criteria.setEndTs(Long.parseLong(qp.value));
} else if (qp.name.equals((QUERY_PARAM_DESC))) {
criteria.setDescending(true);
} else {
criteria.addFieldRestriction(qp.name, qp.value);
}
}
LOG.debug("Finding entities from notification store with criteria {}", criteria);
return notificationStore.map(s -> s.findEntities(criteria)).orElse(Collections.emptyList());
}
Aggregations