I've been trying to convert this statement from C# to JAVA, without much luck. Yes I've search Azure, stackoverflow, and such, but can't find a good example of READDOCUMENT in java.
UserInfo response = _DocumentClient.ReadDocument<UserInfo>(UriFactory.CreateDocumentUri(_DBConfiguration.DatabaseID, _DBConfiguration.DocumentCollectionId, pPhoneNumber));
This is as far as I've gotten:
UserInfo returnUserInfo = null;
try {
//todo: document link is incorrect, but reference pPhoneNumber as key
ResourceResponse<Document> response = _DocumentClient.readDocument(<<NEED To generate URI>>,null);
if (response != null) {
Document returnUserInfoDocument = response.getResource();
returnUserInfo = <<I have a document, but can't cast it to USERINFO>>;
}
}
catch (DocumentClientException ex) {
if (!ex.getError().getCode().equals("NotFound")) {
throw ex;
}
}
return returnUserInfo;