}
throw ex;
}
// Create Result
RecoverableDatabaseGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new RecoverableDatabaseGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element serviceResourceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServiceResource");
if (serviceResourceElement != null) {
RecoverableDatabase serviceResourceInstance = new RecoverableDatabase();
result.setDatabase(serviceResourceInstance);
Element entityIdElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "EntityId");
if (entityIdElement != null) {
String entityIdInstance;
entityIdInstance = entityIdElement.getTextContent();
serviceResourceInstance.setEntityId(entityIdInstance);
}
Element serverNameElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "ServerName");
if (serverNameElement != null) {
String serverNameInstance;
serverNameInstance = serverNameElement.getTextContent();
serviceResourceInstance.setServerName(serverNameInstance);
}
Element editionElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "Edition");
if (editionElement != null) {
String editionInstance;
editionInstance = editionElement.getTextContent();
serviceResourceInstance.setEdition(editionInstance);
}
Element lastAvailableBackupDateElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "LastAvailableBackupDate");
if (lastAvailableBackupDateElement != null) {
Calendar lastAvailableBackupDateInstance;
lastAvailableBackupDateInstance = DatatypeConverter.parseDateTime(lastAvailableBackupDateElement.getTextContent());
serviceResourceInstance.setLastAvailableBackupDate(lastAvailableBackupDateInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
serviceResourceInstance.setName(nameInstance);
}
Element typeElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "Type");
if (typeElement != null) {
String typeInstance;
typeInstance = typeElement.getTextContent();
serviceResourceInstance.setType(typeInstance);
}
Element stateElement = XmlUtility.getElementByTagNameNS(serviceResourceElement, "http://schemas.microsoft.com/windowsazure", "State");
if (stateElement != null) {
String stateInstance;
stateInstance = stateElement.getTextContent();
serviceResourceInstance.setState(stateInstance);
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}