Created
January 28, 2016 19:01
-
-
Save mancvso/31f53dcada8dfd7169a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Override | |
public F.Promise<Usuario> findById(String id) { | |
F.RedeemablePromise<Usuario> promise = F.RedeemablePromise.empty(); | |
System.out.println("querying..."); | |
usuarios. | |
usuarios.find( eq("_id", id) ).first( (u, e) -> { // FIXME: Single field query | |
System.out.println("dispatching callback..."); | |
if(u == null || e != null){ | |
promise.failure( new Throwable("no user")); | |
} else { | |
promise.success(u); | |
} | |
}); //first( (user, t) -> Promise.pure(user) ); // map( (user, t) -> user ); //first( (res, t) -> res ); | |
System.out.println("derefing completion"); | |
return promise; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment