}
throw ex;
}
// Create Result
WebSiteGetUsageMetricsResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new WebSiteGetUsageMetricsResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element usagesElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Usages");
if (usagesElement != null) {
if (usagesElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(usagesElement, "http://schemas.microsoft.com/windowsazure", "Usage").size(); i1 = i1 + 1) {
org.w3c.dom.Element usageMetricsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(usagesElement, "http://schemas.microsoft.com/windowsazure", "Usage").get(i1));
WebSiteGetUsageMetricsResponse.UsageMetric usageInstance = new WebSiteGetUsageMetricsResponse.UsageMetric();
result.getUsageMetrics().add(usageInstance);
Element computeModeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "ComputeMode");
if (computeModeElement != null) {
WebSiteComputeMode computeModeInstance;
computeModeInstance = WebSiteComputeMode.valueOf(computeModeElement.getTextContent());
usageInstance.setComputeMode(computeModeInstance);
}
Element currentValueElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "CurrentValue");
if (currentValueElement != null) {
String currentValueInstance;
currentValueInstance = currentValueElement.getTextContent();
usageInstance.setCurrentValue(currentValueInstance);
}
Element displayNameElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "DisplayName");
if (displayNameElement != null) {
String displayNameInstance;
displayNameInstance = displayNameElement.getTextContent();
usageInstance.setDisplayName(displayNameInstance);
}
Element limitElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Limit");
if (limitElement != null) {
String limitInstance;
limitInstance = limitElement.getTextContent();
usageInstance.setLimit(limitInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
usageInstance.setName(nameInstance);
}
Element nextResetTimeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "NextResetTime");
if (nextResetTimeElement != null) {
Calendar nextResetTimeInstance;
nextResetTimeInstance = DatatypeConverter.parseDateTime(nextResetTimeElement.getTextContent());
usageInstance.setNextResetTime(nextResetTimeInstance);
}
Element resourceNameElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "ResourceName");
if (resourceNameElement != null) {
String resourceNameInstance;
resourceNameInstance = resourceNameElement.getTextContent();
usageInstance.setResourceName(resourceNameInstance);
}
Element siteModeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "SiteMode");
if (siteModeElement != null) {
WebSiteMode siteModeInstance;
siteModeInstance = WebSiteMode.valueOf(siteModeElement.getTextContent());
usageInstance.setSiteMode(siteModeInstance);
}
Element unitElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Unit");
if (unitElement != null) {
String unitInstance;
unitInstance = unitElement.getTextContent();
usageInstance.setUnit(unitInstance);
}
}
}
}
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);
}