}
throw ex;
}
// Create Result
DatabaseGetEventLogsResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new DatabaseGetEventLogsResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element serviceResourcesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServiceResources");
if (serviceResourcesSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serviceResourcesSequenceElement, "http://schemas.microsoft.com/windowsazure", "ServiceResource").size(); i1 = i1 + 1) {
org.w3c.dom.Element serviceResourcesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serviceResourcesSequenceElement, "http://schemas.microsoft.com/windowsazure", "ServiceResource").get(i1));
DatabaseEventLog serviceResourceInstance = new DatabaseEventLog();
result.getEventLogs().add(serviceResourceInstance);
Element databaseNameElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "DatabaseName");
if (databaseNameElement != null) {
String databaseNameInstance;
databaseNameInstance = databaseNameElement.getTextContent();
serviceResourceInstance.setDatabaseName(databaseNameInstance);
}
Element startTimeUtcElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "StartTimeUtc");
if (startTimeUtcElement != null) {
Calendar startTimeUtcInstance;
startTimeUtcInstance = DatatypeConverter.parseDateTime(startTimeUtcElement.getTextContent());
serviceResourceInstance.setStartTimeUtc(startTimeUtcInstance);
}
Element intervalSizeInMinutesElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "IntervalSizeInMinutes");
if (intervalSizeInMinutesElement != null) {
int intervalSizeInMinutesInstance;
intervalSizeInMinutesInstance = DatatypeConverter.parseInt(intervalSizeInMinutesElement.getTextContent());
serviceResourceInstance.setIntervalSizeInMinutes(intervalSizeInMinutesInstance);
}
Element eventCategoryElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "EventCategory");
if (eventCategoryElement != null) {
String eventCategoryInstance;
eventCategoryInstance = eventCategoryElement.getTextContent();
serviceResourceInstance.setEventCategory(eventCategoryInstance);
}
Element eventTypeElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "EventType");
if (eventTypeElement != null) {
String eventTypeInstance;
eventTypeInstance = eventTypeElement.getTextContent();
serviceResourceInstance.setEventType(eventTypeInstance);
}
Element eventSubtypeElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "EventSubtype");
if (eventSubtypeElement != null) {
String eventSubtypeInstance;
eventSubtypeInstance = eventSubtypeElement.getTextContent();
serviceResourceInstance.setEventSubtype(eventSubtypeInstance);
}
Element eventSubtypeDescriptionElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "EventSubtypeDescription");
if (eventSubtypeDescriptionElement != null) {
String eventSubtypeDescriptionInstance;
eventSubtypeDescriptionInstance = eventSubtypeDescriptionElement.getTextContent();
serviceResourceInstance.setEventSubtypeDescription(eventSubtypeDescriptionInstance);
}
Element numberOfEventsElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "NumberOfEvents");
if (numberOfEventsElement != null) {
int numberOfEventsInstance;
numberOfEventsInstance = DatatypeConverter.parseInt(numberOfEventsElement.getTextContent());
serviceResourceInstance.setNumberOfEvents(numberOfEventsInstance);
}
Element severityElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "Severity");
if (severityElement != null) {
int severityInstance;
severityInstance = DatatypeConverter.parseInt(severityElement.getTextContent());
serviceResourceInstance.setSeverity(severityInstance);
}
Element descriptionElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "Description");
if (descriptionElement != null) {
String descriptionInstance;
descriptionInstance = descriptionElement.getTextContent();
serviceResourceInstance.setDescription(descriptionInstance);
}
Element additionalDataElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "AdditionalData");
if (additionalDataElement != null) {
boolean isNil = false;
Attr nilAttribute = additionalDataElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
if (nilAttribute != null) {
isNil = "true".equals(nilAttribute.getValue());
}
if (isNil == false) {
String additionalDataInstance;
additionalDataInstance = additionalDataElement.getTextContent();
serviceResourceInstance.setAdditionalData(additionalDataInstance);
}
}
Element nameElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
serviceResourceInstance.setName(nameInstance);
}
Element typeElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "http://schemas.microsoft.com/windowsazure", "Type");
if (typeElement != null) {
String typeInstance;
typeInstance = typeElement.getTextContent();
serviceResourceInstance.setType(typeInstance);
}
Element stateElement = XmlUtility.getElementByTagNameNS(serviceResourcesElement, "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);
}