Last active
August 29, 2015 14:25
-
-
Save gszeliga/0c492f19a936e444f7a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Acceptance validation on the range of data being requested | |
acceptableInterval(from, to, DeviceParameters.from(paramId).getResolution()) | |
.fold( | |
failure -> asyncResponse | |
.resume(status(422) | |
.entity(asErrorReply(failure)) | |
.build()) | |
, | |
accepted -> runAsync(() -> { | |
final OptionalLong deployment = activeDeploymentFrom(request); | |
if (deployment.isPresent()) { | |
log.info("Active deployment found within request: {}", deployment.getAsLong()); | |
FetchCriteria criteria = ... //Some fetching criteria is created | |
readings | |
.fetch(criteria) | |
.thenApplyAsync(outcome -> replyWith(outcome.mapR(asApiReadings), asyncResponse), executor) | |
.exceptionally(asyncResponse::resume); | |
} else { | |
log.warn("No active deployment nor subject was found within request"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment