use of net.cryptonomica.entities.Verification in project cryptonomica by Cryptonomica.
the class VerificationAPI method getVerificationByID.
/* --- Get verification info by verification ID: */
@ApiMethod(name = "getVerificationByID", path = "getVerificationByID", httpMethod = ApiMethod.HttpMethod.GET)
@SuppressWarnings("unused")
public VerificationGeneralView getVerificationByID(final HttpServletRequest httpServletRequest, final User googleUser, @Named("verificationID") final String verificationID) throws // see: https://cloud.google.com/appengine/docs/java/endpoints/exceptions
UnauthorizedException, BadRequestException, NotFoundException {
/* --- Check authorization: */
CryptonomicaUser cryptonomicaUser = UserTools.ensureCryptonomicaRegisteredUser(googleUser);
/* --- Check input: */
if (verificationID == null || verificationID.equals("")) {
throw new BadRequestException("Verification ID missing");
}
/* --- Load verification entity from DS: */
Verification verification = ofy().load().key(Key.create(Verification.class, verificationID)).now();
if (verification == null) {
throw new NotFoundException("Verification info not found");
}
/* --- Create new verification info representation: */
VerificationGeneralView verificationGeneralView = new VerificationGeneralView(verification);
LOG.warning(new Gson().toJson(verificationGeneralView));
return verificationGeneralView;
}
use of net.cryptonomica.entities.Verification in project cryptonomica by Cryptonomica.
the class VerificationAPI method getVerificationByWebSafeString.
// end: getVerificationByID
/* --- Get verification info by web-safe key string: */
@ApiMethod(name = "getVerificationByWebSafeString", path = "getVerificationByWebSafeString", httpMethod = ApiMethod.HttpMethod.GET)
@SuppressWarnings("unused")
public VerificationGeneralView getVerificationByWebSafeString(final HttpServletRequest httpServletRequest, final User googleUser, @Named("verificationWebSafeString") final String verificationWebSafeString) throws // see: https://cloud.google.com/appengine/docs/java/endpoints/exceptions
UnauthorizedException, BadRequestException, NotFoundException {
/* --- Check authorization: */
CryptonomicaUser cryptonomicaUser = UserTools.ensureCryptonomicaRegisteredUser(googleUser);
/* --- Check input: */
if (verificationWebSafeString == null || verificationWebSafeString.equals("")) {
throw new BadRequestException("Verification ID missing");
}
/* --- Load verification entity from DS: */
Key<Verification> verificationKey = Key.create(verificationWebSafeString);
Verification verification = ofy().load().key(verificationKey).now();
if (verification == null) {
throw new NotFoundException("Verification info not found");
}
/* --- Create new verification info representation: */
VerificationGeneralView verificationGeneralView = new VerificationGeneralView(verification);
LOG.warning(new Gson().toJson(verificationGeneralView));
return verificationGeneralView;
}
Aggregations