Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public List<AlertEntry> getAlertForServiceId(String serviceId) {
- final String sql = "serviceId = ?";
- // create the sql query object with entity type of the value part of the key value cache
- SqlQuery<String, AlertEntry> query = new SqlQuery<>(AlertEntry.class, sql);
- // set the query params
- query.setArgs(serviceId);
- //then execute it over the cache
- return Optional.ofNullable(getAlertsCache().query(query).getAll().stream().map(stringAlertEntryEntry -> stringAlertEntryEntry.getValue()).collect(Collectors.toList()))
- .orElseThrow(() -> new ResourceNotFoundException(String.format("Alert for %s not found", serviceId)));
- }
Add Comment
Please, Sign In to add comment