}
throw ex;
}
// Create Result
JobCollectionGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new JobCollectionGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element resourceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Resource");
if (resourceElement != null) {
Element nameElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
result.setName(nameInstance);
}
Element eTagElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "ETag");
if (eTagElement != null) {
String eTagInstance;
eTagInstance = eTagElement.getTextContent();
result.setETag(eTagInstance);
}
Element stateElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "State");
if (stateElement != null) {
JobCollectionState stateInstance;
stateInstance = JobCollectionState.valueOf(stateElement.getTextContent());
result.setState(stateInstance);
}
Element schemaVersionElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "SchemaVersion");
if (schemaVersionElement != null) {
String schemaVersionInstance;
schemaVersionInstance = schemaVersionElement.getTextContent();
result.setSchemaVersion(schemaVersionInstance);
}
Element promotionCodeElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "PromotionCode");
if (promotionCodeElement != null) {
String promotionCodeInstance;
promotionCodeInstance = promotionCodeElement.getTextContent();
result.setPromotionCode(promotionCodeInstance);
}
Element intrinsicSettingsElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "IntrinsicSettings");
if (intrinsicSettingsElement != null) {
JobCollectionIntrinsicSettings intrinsicSettingsInstance = new JobCollectionIntrinsicSettings();
result.setIntrinsicSettings(intrinsicSettingsInstance);
Element planElement = XmlUtility.getElementByTagNameNS(intrinsicSettingsElement, "http://schemas.microsoft.com/windowsazure", "Plan");
if (planElement != null) {
JobCollectionPlan planInstance;
planInstance = JobCollectionPlan.valueOf(planElement.getTextContent());
intrinsicSettingsInstance.setPlan(planInstance);
}
Element quotaElement = XmlUtility.getElementByTagNameNS(intrinsicSettingsElement, "http://schemas.microsoft.com/windowsazure", "Quota");
if (quotaElement != null) {
JobCollectionQuota quotaInstance = new JobCollectionQuota();
intrinsicSettingsInstance.setQuota(quotaInstance);
Element maxJobCountElement = XmlUtility.getElementByTagNameNS(quotaElement, "http://schemas.microsoft.com/windowsazure", "MaxJobCount");
if (maxJobCountElement != null && (maxJobCountElement.getTextContent() == null || maxJobCountElement.getTextContent().isEmpty() == true) == false) {
int maxJobCountInstance;
maxJobCountInstance = DatatypeConverter.parseInt(maxJobCountElement.getTextContent());
quotaInstance.setMaxJobCount(maxJobCountInstance);
}
Element maxJobOccurrenceElement = XmlUtility.getElementByTagNameNS(quotaElement, "http://schemas.microsoft.com/windowsazure", "MaxJobOccurrence");
if (maxJobOccurrenceElement != null && (maxJobOccurrenceElement.getTextContent() == null || maxJobOccurrenceElement.getTextContent().isEmpty() == true) == false) {
int maxJobOccurrenceInstance;
maxJobOccurrenceInstance = DatatypeConverter.parseInt(maxJobOccurrenceElement.getTextContent());
quotaInstance.setMaxJobOccurrence(maxJobOccurrenceInstance);
}
Element maxRecurrenceElement = XmlUtility.getElementByTagNameNS(quotaElement, "http://schemas.microsoft.com/windowsazure", "MaxRecurrence");
if (maxRecurrenceElement != null) {
JobCollectionMaxRecurrence maxRecurrenceInstance = new JobCollectionMaxRecurrence();
quotaInstance.setMaxRecurrence(maxRecurrenceInstance);
Element frequencyElement = XmlUtility.getElementByTagNameNS(maxRecurrenceElement, "http://schemas.microsoft.com/windowsazure", "Frequency");
if (frequencyElement != null) {
JobCollectionRecurrenceFrequency frequencyInstance;
frequencyInstance = JobCollectionRecurrenceFrequency.valueOf(frequencyElement.getTextContent());
maxRecurrenceInstance.setFrequency(frequencyInstance);
}
Element intervalElement = XmlUtility.getElementByTagNameNS(maxRecurrenceElement, "http://schemas.microsoft.com/windowsazure", "Interval");
if (intervalElement != null) {
int intervalInstance;
intervalInstance = DatatypeConverter.parseInt(intervalElement.getTextContent());
maxRecurrenceInstance.setInterval(intervalInstance);
}
}
}
}
Element labelElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "Label");
if (labelElement != null) {
String labelInstance;
labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null;
result.setLabel(labelInstance);
}
Element operationStatusElement = XmlUtility.getElementByTagNameNS(resourceElement, "http://schemas.microsoft.com/windowsazure", "OperationStatus");
if (operationStatusElement != null) {
JobCollectionGetResponse.OperationStatus operationStatusInstance = new JobCollectionGetResponse.OperationStatus();
result.setLastOperationStatus(operationStatusInstance);
Element errorElement = XmlUtility.getElementByTagNameNS(operationStatusElement, "http://schemas.microsoft.com/windowsazure", "Error");
if (errorElement != null) {
JobCollectionGetResponse.OperationStatusResponseDetails errorInstance = new JobCollectionGetResponse.OperationStatusResponseDetails();
operationStatusInstance.setResponseDetails(errorInstance);
Element httpCodeElement = XmlUtility.getElementByTagNameNS(errorElement, "http://schemas.microsoft.com/windowsazure", "HttpCode");
if (httpCodeElement != null) {
Integer httpCodeInstance;
httpCodeInstance = Integer.valueOf(httpCodeElement.getTextContent());
errorInstance.setStatusCode(httpCodeInstance);
}
Element messageElement = XmlUtility.getElementByTagNameNS(errorElement, "http://schemas.microsoft.com/windowsazure", "Message");
if (messageElement != null) {
String messageInstance;
messageInstance = messageElement.getTextContent();
errorInstance.setMessage(messageInstance);
}
}
Element resultElement = XmlUtility.getElementByTagNameNS(operationStatusElement, "http://schemas.microsoft.com/windowsazure", "Result");
if (resultElement != null) {
SchedulerOperationStatus resultInstance;
resultInstance = SchedulerOperationStatus.valueOf(resultElement.getTextContent());
operationStatusInstance.setStatus(resultInstance);
}
}
}
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);
}