Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. //Acceptance validation on the range of data being requested
  2. acceptableInterval(from, to, DeviceParameters.from(paramId).getResolution())
  3. .fold(
  4. failure -> asyncResponse
  5. .resume(status(422)
  6. .entity(asErrorReply(failure))
  7. .build())
  8. ,
  9.  
  10. accepted -> runAsync(() -> {
  11.  
  12. final OptionalLong deployment = activeDeploymentFrom(request);
  13.  
  14. if (deployment.isPresent()) {
  15.  
  16. log.info("Active deployment found within request: {}", deployment.getAsLong());
  17.  
  18. FetchCriteria criteria = ... //Some fetching criteria is created
  19.  
  20. readings
  21. .fetch(criteria)
  22. .thenApplyAsync(outcome -> replyWith(outcome.mapR(asApiReadings), asyncResponse), executor)
  23. .exceptionally(asyncResponse::resume);
  24.  
  25. } else {
  26. log.warn("No active deployment nor subject was found within request");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement