}
throw ex;
}
// Create Result
WebSiteGetHistoricalUsageMetricsResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new WebSiteGetHistoricalUsageMetricsResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element metricResponsesElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "MetricResponses");
if (metricResponsesElement != null) {
if (metricResponsesElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(metricResponsesElement, "http://schemas.microsoft.com/windowsazure", "MetricResponse").size(); i1 = i1 + 1) {
org.w3c.dom.Element usageMetricsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(metricResponsesElement, "http://schemas.microsoft.com/windowsazure", "MetricResponse").get(i1));
WebSiteGetHistoricalUsageMetricsResponse.HistoricalUsageMetric metricResponseInstance = new WebSiteGetHistoricalUsageMetricsResponse.HistoricalUsageMetric();
result.getUsageMetrics().add(metricResponseInstance);
Element codeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Code");
if (codeElement != null) {
String codeInstance;
codeInstance = codeElement.getTextContent();
metricResponseInstance.setCode(codeInstance);
}
Element dataElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Data");
if (dataElement != null) {
WebSiteGetHistoricalUsageMetricsResponse.HistoricalUsageMetricData dataInstance = new WebSiteGetHistoricalUsageMetricsResponse.HistoricalUsageMetricData();
metricResponseInstance.setData(dataInstance);
Element displayNameElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "DisplayName");
if (displayNameElement != null) {
String displayNameInstance;
displayNameInstance = displayNameElement.getTextContent();
dataInstance.setDisplayName(displayNameInstance);
}
Element endTimeElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "EndTime");
if (endTimeElement != null) {
Calendar endTimeInstance;
endTimeInstance = DatatypeConverter.parseDateTime(endTimeElement.getTextContent());
dataInstance.setEndTime(endTimeInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
dataInstance.setName(nameInstance);
}
Element primaryAggregationTypeElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "PrimaryAggregationType");
if (primaryAggregationTypeElement != null) {
String primaryAggregationTypeInstance;
primaryAggregationTypeInstance = primaryAggregationTypeElement.getTextContent();
dataInstance.setPrimaryAggregationType(primaryAggregationTypeInstance);
}
Element startTimeElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "StartTime");
if (startTimeElement != null) {
Calendar startTimeInstance;
startTimeInstance = DatatypeConverter.parseDateTime(startTimeElement.getTextContent());
dataInstance.setStartTime(startTimeInstance);
}
Element timeGrainElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "TimeGrain");
if (timeGrainElement != null) {
String timeGrainInstance;
timeGrainInstance = timeGrainElement.getTextContent();
dataInstance.setTimeGrain(timeGrainInstance);
}
Element unitElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "Unit");
if (unitElement != null) {
String unitInstance;
unitInstance = unitElement.getTextContent();
dataInstance.setUnit(unitInstance);
}
Element valuesSequenceElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "Values");
if (valuesSequenceElement != null) {
for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(valuesSequenceElement, "http://schemas.microsoft.com/windowsazure", "MetricSample").size(); i2 = i2 + 1) {
org.w3c.dom.Element valuesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(valuesSequenceElement, "http://schemas.microsoft.com/windowsazure", "MetricSample").get(i2));
WebSiteGetHistoricalUsageMetricsResponse.HistoricalUsageMetricSample metricSampleInstance = new WebSiteGetHistoricalUsageMetricsResponse.HistoricalUsageMetricSample();
dataInstance.getValues().add(metricSampleInstance);
Element countElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Count");
if (countElement != null) {
int countInstance;
countInstance = DatatypeConverter.parseInt(countElement.getTextContent());
metricSampleInstance.setCount(countInstance);
}
Element maximumElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Maximum");
if (maximumElement != null) {
boolean isNil = false;
Attr nilAttribute = maximumElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
if (nilAttribute != null) {
isNil = "true".equals(nilAttribute.getValue());
}
if (isNil == false) {
String maximumInstance;
maximumInstance = maximumElement.getTextContent();
metricSampleInstance.setMaximum(maximumInstance);
}
}
Element minimumElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Minimum");
if (minimumElement != null) {
boolean isNil2 = false;
Attr nilAttribute2 = minimumElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
if (nilAttribute2 != null) {
isNil2 = "true".equals(nilAttribute2.getValue());
}
if (isNil2 == false) {
String minimumInstance;
minimumInstance = minimumElement.getTextContent();
metricSampleInstance.setMinimum(minimumInstance);
}
}
Element timeCreatedElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "TimeCreated");
if (timeCreatedElement != null) {
Calendar timeCreatedInstance;
timeCreatedInstance = DatatypeConverter.parseDateTime(timeCreatedElement.getTextContent());
metricSampleInstance.setTimeCreated(timeCreatedInstance);
}
Element totalElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Total");
if (totalElement != null) {
String totalInstance;
totalInstance = totalElement.getTextContent();
metricSampleInstance.setTotal(totalInstance);
}
}
}
}
Element messageElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Message");
if (messageElement != null) {
String messageInstance;
messageInstance = messageElement.getTextContent();
metricResponseInstance.setMessage(messageInstance);
}
}
}
}
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);
}