Example usage for javax.xml.bind DatatypeConverter parseDateTime

List of usage examples for javax.xml.bind DatatypeConverter parseDateTime

Introduction

In this page you can find the example usage for javax.xml.bind DatatypeConverter parseDateTime.

Prototype

public static java.util.Calendar parseDateTime(String lexicalXSDDateTime) 

Source Link

Document

Converts the string argument into a Calendar value.

Usage

From source file:com.microsoft.windowsazure.scheduler.JobOperationsImpl.java

/**
* Get the execution history of a Job with a filter on the job Status.
*
* @param jobId Required. Id of the job to get the history of.
* @param parameters Required. Parameters supplied to the Get Job History
* With Filter operation./* www.  j av  a 2 s . com*/
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return The Get Job History operation response.
*/
@Override
public JobGetHistoryResponse getHistoryWithFilter(String jobId, JobGetHistoryWithFilterParameters parameters)
        throws IOException, ServiceException {
    // Validate
    if (jobId == null) {
        throw new NullPointerException("jobId");
    }
    if (parameters == null) {
        throw new NullPointerException("parameters");
    }
    if (parameters.getStatus() == null) {
        throw new NullPointerException("parameters.Status");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("jobId", jobId);
        tracingParameters.put("parameters", parameters);
        CloudTracing.enter(invocationId, this, "getHistoryWithFilterAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/cloudservices/";
    url = url + URLEncoder.encode(this.getClient().getCloudServiceName(), "UTF-8");
    url = url + "/resources/";
    url = url + "scheduler";
    url = url + "/~/";
    url = url + "JobCollections";
    url = url + "/";
    url = url + URLEncoder.encode(this.getClient().getJobCollectionName(), "UTF-8");
    url = url + "/jobs/";
    url = url + URLEncoder.encode(jobId, "UTF-8");
    url = url + "/history";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2014-04-01");
    ArrayList<String> odataFilter = new ArrayList<String>();
    odataFilter.add("status eq "
            + URLEncoder.encode(SchedulerClientImpl.jobHistoryStatusToString(parameters.getStatus()), "UTF-8"));
    if (odataFilter.size() > 0) {
        queryParameters.add("$filter=" + CollectionStringBuilder.join(odataFilter, null));
    }
    if (parameters.getSkip() != null) {
        queryParameters.add("$skip=" + URLEncoder.encode(Integer.toString(parameters.getSkip()), "UTF-8"));
    }
    if (parameters.getTop() != null) {
        queryParameters.add("$top=" + URLEncoder.encode(Integer.toString(parameters.getTop()), "UTF-8"));
    }
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2013-03-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        JobGetHistoryResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new JobGetHistoryResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode jobHistoryArray = responseDoc;
                if (jobHistoryArray != null && jobHistoryArray instanceof NullNode == false) {
                    for (JsonNode jobHistoryValue : ((ArrayNode) jobHistoryArray)) {
                        JobGetHistoryResponse.JobHistoryEntry jobHistoryEntryInstance = new JobGetHistoryResponse.JobHistoryEntry();
                        result.getJobHistory().add(jobHistoryEntryInstance);

                        JsonNode jobIdValue = jobHistoryValue.get("jobId");
                        if (jobIdValue != null && jobIdValue instanceof NullNode == false) {
                            String jobIdInstance;
                            jobIdInstance = jobIdValue.getTextValue();
                            jobHistoryEntryInstance.setId(jobIdInstance);
                        }

                        JsonNode timestampValue = jobHistoryValue.get("timestamp");
                        if (timestampValue != null && timestampValue instanceof NullNode == false) {
                            Calendar timestampInstance;
                            timestampInstance = DatatypeConverter.parseDateTime(timestampValue.getTextValue());
                            jobHistoryEntryInstance.setTimestamp(timestampInstance);
                        }

                        JsonNode startTimeValue = jobHistoryValue.get("startTime");
                        if (startTimeValue != null && startTimeValue instanceof NullNode == false) {
                            Calendar startTimeInstance;
                            startTimeInstance = DatatypeConverter.parseDateTime(startTimeValue.getTextValue());
                            jobHistoryEntryInstance.setStartTime(startTimeInstance);
                        }

                        JsonNode endTimeValue = jobHistoryValue.get("endTime");
                        if (endTimeValue != null && endTimeValue instanceof NullNode == false) {
                            Calendar endTimeInstance;
                            endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue());
                            jobHistoryEntryInstance.setEndTime(endTimeInstance);
                        }

                        JsonNode stateValue = jobHistoryValue.get("state");
                        if (stateValue != null && stateValue instanceof NullNode == false) {
                            JobState stateInstance;
                            stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue());
                            jobHistoryEntryInstance.setState(stateInstance);
                        }

                        JsonNode messageValue = jobHistoryValue.get("message");
                        if (messageValue != null && messageValue instanceof NullNode == false) {
                            String messageInstance;
                            messageInstance = messageValue.getTextValue();
                            jobHistoryEntryInstance.setMessage(messageInstance);
                        }

                        JsonNode statusValue = jobHistoryValue.get("status");
                        if (statusValue != null && statusValue instanceof NullNode == false) {
                            JobHistoryStatus statusInstance;
                            statusInstance = SchedulerClientImpl
                                    .parseJobHistoryStatus(statusValue.getTextValue());
                            jobHistoryEntryInstance.setStatus(statusInstance);
                        }

                        JsonNode actionNameValue = jobHistoryValue.get("actionName");
                        if (actionNameValue != null && actionNameValue instanceof NullNode == false) {
                            JobHistoryActionName actionNameInstance;
                            actionNameInstance = SchedulerClientImpl
                                    .parseJobHistoryActionName(actionNameValue.getTextValue());
                            jobHistoryEntryInstance.setActionName(actionNameInstance);
                        }

                        JsonNode repeatCountValue = jobHistoryValue.get("repeatCount");
                        if (repeatCountValue != null && repeatCountValue instanceof NullNode == false) {
                            int repeatCountInstance;
                            repeatCountInstance = repeatCountValue.getIntValue();
                            jobHistoryEntryInstance.setRepeatCount(repeatCountInstance);
                        }

                        JsonNode retryCountValue = jobHistoryValue.get("retryCount");
                        if (retryCountValue != null && retryCountValue instanceof NullNode == false) {
                            int retryCountInstance;
                            retryCountInstance = retryCountValue.getIntValue();
                            jobHistoryEntryInstance.setRetryCount(retryCountInstance);
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.scheduler.JobOperationsImpl.java

/**
* Get the list of all jobs in a job collection.
*
* @param parameters Required. Parameters supplied to the List Jobs
* operation.//from   w  ww  .ja va  2s  .  c  o  m
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The List Jobs operation response.
*/
@Override
public JobListResponse list(JobListParameters parameters)
        throws IOException, ServiceException, URISyntaxException {
    // Validate
    if (parameters == null) {
        throw new NullPointerException("parameters");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("parameters", parameters);
        CloudTracing.enter(invocationId, this, "listAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/cloudservices/";
    url = url + URLEncoder.encode(this.getClient().getCloudServiceName(), "UTF-8");
    url = url + "/resources/";
    url = url + "scheduler";
    url = url + "/~/";
    url = url + "JobCollections";
    url = url + "/";
    url = url + URLEncoder.encode(this.getClient().getJobCollectionName(), "UTF-8");
    url = url + "/jobs";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2014-04-01");
    if (parameters.getSkip() != null) {
        queryParameters.add("$skip=" + URLEncoder.encode(Integer.toString(parameters.getSkip()), "UTF-8"));
    }
    if (parameters.getTop() != null) {
        queryParameters.add("$top=" + URLEncoder.encode(Integer.toString(parameters.getTop()), "UTF-8"));
    }
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2013-03-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        JobListResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new JobListResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode jobsArray = responseDoc;
                if (jobsArray != null && jobsArray instanceof NullNode == false) {
                    for (JsonNode jobsValue : ((ArrayNode) jobsArray)) {
                        Job jobInstance = new Job();
                        result.getJobs().add(jobInstance);

                        JsonNode idValue = jobsValue.get("id");
                        if (idValue != null && idValue instanceof NullNode == false) {
                            String idInstance;
                            idInstance = idValue.getTextValue();
                            jobInstance.setId(idInstance);
                        }

                        JsonNode startTimeValue = jobsValue.get("startTime");
                        if (startTimeValue != null && startTimeValue instanceof NullNode == false) {
                            Calendar startTimeInstance;
                            startTimeInstance = DatatypeConverter.parseDateTime(startTimeValue.getTextValue());
                            jobInstance.setStartTime(startTimeInstance);
                        }

                        JsonNode actionValue = jobsValue.get("action");
                        if (actionValue != null && actionValue instanceof NullNode == false) {
                            JobAction actionInstance = new JobAction();
                            jobInstance.setAction(actionInstance);

                            JsonNode typeValue = actionValue.get("type");
                            if (typeValue != null && typeValue instanceof NullNode == false) {
                                JobActionType typeInstance;
                                typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue());
                                actionInstance.setType(typeInstance);
                            }

                            JsonNode retryPolicyValue = actionValue.get("retryPolicy");
                            if (retryPolicyValue != null && retryPolicyValue instanceof NullNode == false) {
                                RetryPolicy retryPolicyInstance = new RetryPolicy();
                                actionInstance.setRetryPolicy(retryPolicyInstance);

                                JsonNode retryTypeValue = retryPolicyValue.get("retryType");
                                if (retryTypeValue != null && retryTypeValue instanceof NullNode == false) {
                                    RetryType retryTypeInstance;
                                    retryTypeInstance = SchedulerClientImpl
                                            .parseRetryType(retryTypeValue.getTextValue());
                                    retryPolicyInstance.setRetryType(retryTypeInstance);
                                }

                                JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval");
                                if (retryIntervalValue != null
                                        && retryIntervalValue instanceof NullNode == false) {
                                    Duration retryIntervalInstance;
                                    retryIntervalInstance = TimeSpan8601Converter
                                            .parse(retryIntervalValue.getTextValue());
                                    retryPolicyInstance.setRetryInterval(retryIntervalInstance);
                                }

                                JsonNode retryCountValue = retryPolicyValue.get("retryCount");
                                if (retryCountValue != null && retryCountValue instanceof NullNode == false) {
                                    int retryCountInstance;
                                    retryCountInstance = retryCountValue.getIntValue();
                                    retryPolicyInstance.setRetryCount(retryCountInstance);
                                }
                            }

                            JsonNode errorActionValue = actionValue.get("errorAction");
                            if (errorActionValue != null && errorActionValue instanceof NullNode == false) {
                                JobErrorAction errorActionInstance = new JobErrorAction();
                                actionInstance.setErrorAction(errorActionInstance);

                                JsonNode typeValue2 = errorActionValue.get("type");
                                if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
                                    JobActionType typeInstance2;
                                    typeInstance2 = SchedulerClientImpl
                                            .parseJobActionType(typeValue2.getTextValue());
                                    errorActionInstance.setType(typeInstance2);
                                }

                                JsonNode requestValue = errorActionValue.get("request");
                                if (requestValue != null && requestValue instanceof NullNode == false) {
                                    JobHttpRequest requestInstance = new JobHttpRequest();
                                    errorActionInstance.setRequest(requestInstance);

                                    JsonNode uriValue = requestValue.get("uri");
                                    if (uriValue != null && uriValue instanceof NullNode == false) {
                                        URI uriInstance;
                                        uriInstance = new URI(uriValue.getTextValue());
                                        requestInstance.setUri(uriInstance);
                                    }

                                    JsonNode methodValue = requestValue.get("method");
                                    if (methodValue != null && methodValue instanceof NullNode == false) {
                                        String methodInstance;
                                        methodInstance = methodValue.getTextValue();
                                        requestInstance.setMethod(methodInstance);
                                    }

                                    JsonNode headersSequenceElement = ((JsonNode) requestValue.get("headers"));
                                    if (headersSequenceElement != null
                                            && headersSequenceElement instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr = headersSequenceElement
                                                .getFields();
                                        while (itr.hasNext()) {
                                            Map.Entry<String, JsonNode> property = itr.next();
                                            String headersKey = property.getKey();
                                            String headersValue = property.getValue().getTextValue();
                                            requestInstance.getHeaders().put(headersKey, headersValue);
                                        }
                                    }

                                    JsonNode bodyValue = requestValue.get("body");
                                    if (bodyValue != null && bodyValue instanceof NullNode == false) {
                                        String bodyInstance;
                                        bodyInstance = bodyValue.getTextValue();
                                        requestInstance.setBody(bodyInstance);
                                    }

                                    JsonNode authenticationValue = requestValue.get("authentication");
                                    if (authenticationValue != null
                                            && authenticationValue instanceof NullNode == false) {
                                        String typeName = authenticationValue.get("type").getTextValue();
                                        if ("ClientCertificate".equals(typeName)) {
                                            ClientCertAuthentication clientCertAuthenticationInstance = new ClientCertAuthentication();

                                            JsonNode passwordValue = authenticationValue.get("password");
                                            if (passwordValue != null
                                                    && passwordValue instanceof NullNode == false) {
                                                String passwordInstance;
                                                passwordInstance = passwordValue.getTextValue();
                                                clientCertAuthenticationInstance.setPassword(passwordInstance);
                                            }

                                            JsonNode pfxValue = authenticationValue.get("pfx");
                                            if (pfxValue != null && pfxValue instanceof NullNode == false) {
                                                String pfxInstance;
                                                pfxInstance = pfxValue.getTextValue();
                                                clientCertAuthenticationInstance.setPfx(pfxInstance);
                                            }

                                            JsonNode certificateThumbprintValue = authenticationValue
                                                    .get("certificateThumbprint");
                                            if (certificateThumbprintValue != null
                                                    && certificateThumbprintValue instanceof NullNode == false) {
                                                String certificateThumbprintInstance;
                                                certificateThumbprintInstance = certificateThumbprintValue
                                                        .getTextValue();
                                                clientCertAuthenticationInstance.setCertificateThumbprint(
                                                        certificateThumbprintInstance);
                                            }

                                            JsonNode certificateExpirationValue = authenticationValue
                                                    .get("certificateExpiration");
                                            if (certificateExpirationValue != null
                                                    && certificateExpirationValue instanceof NullNode == false) {
                                                Calendar certificateExpirationInstance;
                                                certificateExpirationInstance = DatatypeConverter.parseDateTime(
                                                        certificateExpirationValue.getTextValue());
                                                clientCertAuthenticationInstance.setCertificateExpiration(
                                                        certificateExpirationInstance);
                                            }

                                            JsonNode certificateSubjectNameValue = authenticationValue
                                                    .get("certificateSubjectName");
                                            if (certificateSubjectNameValue != null
                                                    && certificateSubjectNameValue instanceof NullNode == false) {
                                                String certificateSubjectNameInstance;
                                                certificateSubjectNameInstance = certificateSubjectNameValue
                                                        .getTextValue();
                                                clientCertAuthenticationInstance.setCertificateSubjectName(
                                                        certificateSubjectNameInstance);
                                            }

                                            JsonNode typeValue3 = authenticationValue.get("type");
                                            if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance3;
                                                typeInstance3 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue3.getTextValue());
                                                clientCertAuthenticationInstance.setType(typeInstance3);
                                            }
                                            requestInstance.setAuthentication(clientCertAuthenticationInstance);
                                        }
                                        if ("ActiveDirectoryOAuth".equals(typeName)) {
                                            AADOAuthAuthentication aADOAuthAuthenticationInstance = new AADOAuthAuthentication();

                                            JsonNode secretValue = authenticationValue.get("secret");
                                            if (secretValue != null
                                                    && secretValue instanceof NullNode == false) {
                                                String secretInstance;
                                                secretInstance = secretValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setSecret(secretInstance);
                                            }

                                            JsonNode tenantValue = authenticationValue.get("tenant");
                                            if (tenantValue != null
                                                    && tenantValue instanceof NullNode == false) {
                                                String tenantInstance;
                                                tenantInstance = tenantValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setTenant(tenantInstance);
                                            }

                                            JsonNode audienceValue = authenticationValue.get("audience");
                                            if (audienceValue != null
                                                    && audienceValue instanceof NullNode == false) {
                                                String audienceInstance;
                                                audienceInstance = audienceValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setAudience(audienceInstance);
                                            }

                                            JsonNode clientIdValue = authenticationValue.get("clientId");
                                            if (clientIdValue != null
                                                    && clientIdValue instanceof NullNode == false) {
                                                String clientIdInstance;
                                                clientIdInstance = clientIdValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setClientId(clientIdInstance);
                                            }

                                            JsonNode typeValue4 = authenticationValue.get("type");
                                            if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance4;
                                                typeInstance4 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue4.getTextValue());
                                                aADOAuthAuthenticationInstance.setType(typeInstance4);
                                            }
                                            requestInstance.setAuthentication(aADOAuthAuthenticationInstance);
                                        }
                                        if ("Basic".equals(typeName)) {
                                            BasicAuthentication basicAuthenticationInstance = new BasicAuthentication();

                                            JsonNode usernameValue = authenticationValue.get("username");
                                            if (usernameValue != null
                                                    && usernameValue instanceof NullNode == false) {
                                                String usernameInstance;
                                                usernameInstance = usernameValue.getTextValue();
                                                basicAuthenticationInstance.setUsername(usernameInstance);
                                            }

                                            JsonNode passwordValue2 = authenticationValue.get("password");
                                            if (passwordValue2 != null
                                                    && passwordValue2 instanceof NullNode == false) {
                                                String passwordInstance2;
                                                passwordInstance2 = passwordValue2.getTextValue();
                                                basicAuthenticationInstance.setPassword(passwordInstance2);
                                            }

                                            JsonNode typeValue5 = authenticationValue.get("type");
                                            if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance5;
                                                typeInstance5 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue5.getTextValue());
                                                basicAuthenticationInstance.setType(typeInstance5);
                                            }
                                            requestInstance.setAuthentication(basicAuthenticationInstance);
                                        }
                                    }
                                }

                                JsonNode queueMessageValue = errorActionValue.get("queueMessage");
                                if (queueMessageValue != null
                                        && queueMessageValue instanceof NullNode == false) {
                                    JobQueueMessage queueMessageInstance = new JobQueueMessage();
                                    errorActionInstance.setQueueMessage(queueMessageInstance);

                                    JsonNode storageAccountValue = queueMessageValue.get("storageAccount");
                                    if (storageAccountValue != null
                                            && storageAccountValue instanceof NullNode == false) {
                                        String storageAccountInstance;
                                        storageAccountInstance = storageAccountValue.getTextValue();
                                        queueMessageInstance.setStorageAccountName(storageAccountInstance);
                                    }

                                    JsonNode queueNameValue = queueMessageValue.get("queueName");
                                    if (queueNameValue != null && queueNameValue instanceof NullNode == false) {
                                        String queueNameInstance;
                                        queueNameInstance = queueNameValue.getTextValue();
                                        queueMessageInstance.setQueueName(queueNameInstance);
                                    }

                                    JsonNode sasTokenValue = queueMessageValue.get("sasToken");
                                    if (sasTokenValue != null && sasTokenValue instanceof NullNode == false) {
                                        String sasTokenInstance;
                                        sasTokenInstance = sasTokenValue.getTextValue();
                                        queueMessageInstance.setSasToken(sasTokenInstance);
                                    }

                                    JsonNode messageValue = queueMessageValue.get("message");
                                    if (messageValue != null && messageValue instanceof NullNode == false) {
                                        String messageInstance;
                                        messageInstance = messageValue.getTextValue();
                                        queueMessageInstance.setMessage(messageInstance);
                                    }
                                }

                                JsonNode serviceBusTopicMessageValue = errorActionValue
                                        .get("serviceBusTopicMessage");
                                if (serviceBusTopicMessageValue != null
                                        && serviceBusTopicMessageValue instanceof NullNode == false) {
                                    JobServiceBusTopicMessage serviceBusTopicMessageInstance = new JobServiceBusTopicMessage();
                                    errorActionInstance
                                            .setServiceBusTopicMessage(serviceBusTopicMessageInstance);

                                    JsonNode topicPathValue = serviceBusTopicMessageValue.get("topicPath");
                                    if (topicPathValue != null && topicPathValue instanceof NullNode == false) {
                                        String topicPathInstance;
                                        topicPathInstance = topicPathValue.getTextValue();
                                        serviceBusTopicMessageInstance.setTopicPath(topicPathInstance);
                                    }

                                    JsonNode namespaceValue = serviceBusTopicMessageValue.get("namespace");
                                    if (namespaceValue != null && namespaceValue instanceof NullNode == false) {
                                        String namespaceInstance;
                                        namespaceInstance = namespaceValue.getTextValue();
                                        serviceBusTopicMessageInstance.setNamespace(namespaceInstance);
                                    }

                                    JsonNode transportTypeValue = serviceBusTopicMessageValue
                                            .get("transportType");
                                    if (transportTypeValue != null
                                            && transportTypeValue instanceof NullNode == false) {
                                        JobServiceBusTransportType transportTypeInstance;
                                        transportTypeInstance = SchedulerClientImpl
                                                .parseJobServiceBusTransportType(
                                                        transportTypeValue.getTextValue());
                                        serviceBusTopicMessageInstance.setTransportType(transportTypeInstance);
                                    }

                                    JsonNode authenticationValue2 = serviceBusTopicMessageValue
                                            .get("authentication");
                                    if (authenticationValue2 != null
                                            && authenticationValue2 instanceof NullNode == false) {
                                        JobServiceBusAuthentication authenticationInstance = new JobServiceBusAuthentication();
                                        serviceBusTopicMessageInstance
                                                .setAuthentication(authenticationInstance);

                                        JsonNode sasKeyNameValue = authenticationValue2.get("sasKeyName");
                                        if (sasKeyNameValue != null
                                                && sasKeyNameValue instanceof NullNode == false) {
                                            String sasKeyNameInstance;
                                            sasKeyNameInstance = sasKeyNameValue.getTextValue();
                                            authenticationInstance.setSasKeyName(sasKeyNameInstance);
                                        }

                                        JsonNode sasKeyValue = authenticationValue2.get("sasKey");
                                        if (sasKeyValue != null && sasKeyValue instanceof NullNode == false) {
                                            String sasKeyInstance;
                                            sasKeyInstance = sasKeyValue.getTextValue();
                                            authenticationInstance.setSasKey(sasKeyInstance);
                                        }

                                        JsonNode typeValue6 = authenticationValue2.get("type");
                                        if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
                                            JobServiceBusAuthenticationType typeInstance6;
                                            typeInstance6 = SchedulerClientImpl
                                                    .parseJobServiceBusAuthenticationType(
                                                            typeValue6.getTextValue());
                                            authenticationInstance.setType(typeInstance6);
                                        }
                                    }

                                    JsonNode messageValue2 = serviceBusTopicMessageValue.get("message");
                                    if (messageValue2 != null && messageValue2 instanceof NullNode == false) {
                                        String messageInstance2;
                                        messageInstance2 = messageValue2.getTextValue();
                                        serviceBusTopicMessageInstance.setMessage(messageInstance2);
                                    }

                                    JsonNode brokeredMessagePropertiesValue = serviceBusTopicMessageValue
                                            .get("brokeredMessageProperties");
                                    if (brokeredMessagePropertiesValue != null
                                            && brokeredMessagePropertiesValue instanceof NullNode == false) {
                                        JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance = new JobServiceBusBrokeredMessageProperties();
                                        serviceBusTopicMessageInstance.setBrokeredMessageProperties(
                                                brokeredMessagePropertiesInstance);

                                        JsonNode contentTypeValue = brokeredMessagePropertiesValue
                                                .get("contentType");
                                        if (contentTypeValue != null
                                                && contentTypeValue instanceof NullNode == false) {
                                            String contentTypeInstance;
                                            contentTypeInstance = contentTypeValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setContentType(contentTypeInstance);
                                        }

                                        JsonNode correlationIdValue = brokeredMessagePropertiesValue
                                                .get("correlationId");
                                        if (correlationIdValue != null
                                                && correlationIdValue instanceof NullNode == false) {
                                            String correlationIdInstance;
                                            correlationIdInstance = correlationIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setCorrelationId(correlationIdInstance);
                                        }

                                        JsonNode forcePersistenceValue = brokeredMessagePropertiesValue
                                                .get("forcePersistence");
                                        if (forcePersistenceValue != null
                                                && forcePersistenceValue instanceof NullNode == false) {
                                            boolean forcePersistenceInstance;
                                            forcePersistenceInstance = forcePersistenceValue.getBooleanValue();
                                            brokeredMessagePropertiesInstance
                                                    .setForcePersistence(forcePersistenceInstance);
                                        }

                                        JsonNode labelValue = brokeredMessagePropertiesValue.get("label");
                                        if (labelValue != null && labelValue instanceof NullNode == false) {
                                            String labelInstance;
                                            labelInstance = labelValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setLabel(labelInstance);
                                        }

                                        JsonNode messageIdValue = brokeredMessagePropertiesValue
                                                .get("messageId");
                                        if (messageIdValue != null
                                                && messageIdValue instanceof NullNode == false) {
                                            String messageIdInstance;
                                            messageIdInstance = messageIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setMessageId(messageIdInstance);
                                        }

                                        JsonNode partitionKeyValue = brokeredMessagePropertiesValue
                                                .get("partitionKey");
                                        if (partitionKeyValue != null
                                                && partitionKeyValue instanceof NullNode == false) {
                                            String partitionKeyInstance;
                                            partitionKeyInstance = partitionKeyValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setPartitionKey(partitionKeyInstance);
                                        }

                                        JsonNode replyToValue = brokeredMessagePropertiesValue.get("replyTo");
                                        if (replyToValue != null && replyToValue instanceof NullNode == false) {
                                            String replyToInstance;
                                            replyToInstance = replyToValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setReplyTo(replyToInstance);
                                        }

                                        JsonNode replyToSessionIdValue = brokeredMessagePropertiesValue
                                                .get("replyToSessionId");
                                        if (replyToSessionIdValue != null
                                                && replyToSessionIdValue instanceof NullNode == false) {
                                            String replyToSessionIdInstance;
                                            replyToSessionIdInstance = replyToSessionIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setReplyToSessionId(replyToSessionIdInstance);
                                        }

                                        JsonNode scheduledEnqueueTimeUtcValue = brokeredMessagePropertiesValue
                                                .get("scheduledEnqueueTimeUtc");
                                        if (scheduledEnqueueTimeUtcValue != null
                                                && scheduledEnqueueTimeUtcValue instanceof NullNode == false) {
                                            Calendar scheduledEnqueueTimeUtcInstance;
                                            scheduledEnqueueTimeUtcInstance = DatatypeConverter
                                                    .parseDateTime(scheduledEnqueueTimeUtcValue.getTextValue());
                                            brokeredMessagePropertiesInstance.setScheduledEnqueueTimeUtc(
                                                    scheduledEnqueueTimeUtcInstance);
                                        }

                                        JsonNode sessionIdValue = brokeredMessagePropertiesValue
                                                .get("sessionId");
                                        if (sessionIdValue != null
                                                && sessionIdValue instanceof NullNode == false) {
                                            String sessionIdInstance;
                                            sessionIdInstance = sessionIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setSessionId(sessionIdInstance);
                                        }

                                        JsonNode timeToLiveValue = brokeredMessagePropertiesValue
                                                .get("timeToLive");
                                        if (timeToLiveValue != null
                                                && timeToLiveValue instanceof NullNode == false) {
                                            Calendar timeToLiveInstance;
                                            timeToLiveInstance = DatatypeConverter
                                                    .parseDateTime(timeToLiveValue.getTextValue());
                                            brokeredMessagePropertiesInstance.setTimeToLive(timeToLiveInstance);
                                        }

                                        JsonNode toValue = brokeredMessagePropertiesValue.get("to");
                                        if (toValue != null && toValue instanceof NullNode == false) {
                                            String toInstance;
                                            toInstance = toValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setTo(toInstance);
                                        }

                                        JsonNode viaPartitionKeyValue = brokeredMessagePropertiesValue
                                                .get("viaPartitionKey");
                                        if (viaPartitionKeyValue != null
                                                && viaPartitionKeyValue instanceof NullNode == false) {
                                            String viaPartitionKeyInstance;
                                            viaPartitionKeyInstance = viaPartitionKeyValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setViaPartitionKey(viaPartitionKeyInstance);
                                        }
                                    }

                                    JsonNode customMessagePropertiesSequenceElement = ((JsonNode) serviceBusTopicMessageValue
                                            .get("customMessageProperties"));
                                    if (customMessagePropertiesSequenceElement != null
                                            && customMessagePropertiesSequenceElement instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr2 = customMessagePropertiesSequenceElement
                                                .getFields();
                                        while (itr2.hasNext()) {
                                            Map.Entry<String, JsonNode> property2 = itr2.next();
                                            String customMessagePropertiesKey = property2.getKey();
                                            String customMessagePropertiesValue = property2.getValue()
                                                    .getTextValue();
                                            serviceBusTopicMessageInstance.getCustomMessageProperties().put(
                                                    customMessagePropertiesKey, customMessagePropertiesValue);
                                        }
                                    }
                                }

                                JsonNode serviceBusQueueMessageValue = errorActionValue
                                        .get("serviceBusQueueMessage");
                                if (serviceBusQueueMessageValue != null
                                        && serviceBusQueueMessageValue instanceof NullNode == false) {
                                    JobServiceBusQueueMessage serviceBusQueueMessageInstance = new JobServiceBusQueueMessage();
                                    errorActionInstance
                                            .setServiceBusQueueMessage(serviceBusQueueMessageInstance);

                                    JsonNode queueNameValue2 = serviceBusQueueMessageValue.get("queueName");
                                    if (queueNameValue2 != null
                                            && queueNameValue2 instanceof NullNode == false) {
                                        String queueNameInstance2;
                                        queueNameInstance2 = queueNameValue2.getTextValue();
                                        serviceBusQueueMessageInstance.setQueueName(queueNameInstance2);
                                    }

                                    JsonNode namespaceValue2 = serviceBusQueueMessageValue.get("namespace");
                                    if (namespaceValue2 != null
                                            && namespaceValue2 instanceof NullNode == false) {
                                        String namespaceInstance2;
                                        namespaceInstance2 = namespaceValue2.getTextValue();
                                        serviceBusQueueMessageInstance.setNamespace(namespaceInstance2);
                                    }

                                    JsonNode transportTypeValue2 = serviceBusQueueMessageValue
                                            .get("transportType");
                                    if (transportTypeValue2 != null
                                            && transportTypeValue2 instanceof NullNode == false) {
                                        JobServiceBusTransportType transportTypeInstance2;
                                        transportTypeInstance2 = SchedulerClientImpl
                                                .parseJobServiceBusTransportType(
                                                        transportTypeValue2.getTextValue());
                                        serviceBusQueueMessageInstance.setTransportType(transportTypeInstance2);
                                    }

                                    JsonNode authenticationValue3 = serviceBusQueueMessageValue
                                            .get("authentication");
                                    if (authenticationValue3 != null
                                            && authenticationValue3 instanceof NullNode == false) {
                                        JobServiceBusAuthentication authenticationInstance2 = new JobServiceBusAuthentication();
                                        serviceBusQueueMessageInstance
                                                .setAuthentication(authenticationInstance2);

                                        JsonNode sasKeyNameValue2 = authenticationValue3.get("sasKeyName");
                                        if (sasKeyNameValue2 != null
                                                && sasKeyNameValue2 instanceof NullNode == false) {
                                            String sasKeyNameInstance2;
                                            sasKeyNameInstance2 = sasKeyNameValue2.getTextValue();
                                            authenticationInstance2.setSasKeyName(sasKeyNameInstance2);
                                        }

                                        JsonNode sasKeyValue2 = authenticationValue3.get("sasKey");
                                        if (sasKeyValue2 != null && sasKeyValue2 instanceof NullNode == false) {
                                            String sasKeyInstance2;
                                            sasKeyInstance2 = sasKeyValue2.getTextValue();
                                            authenticationInstance2.setSasKey(sasKeyInstance2);
                                        }

                                        JsonNode typeValue7 = authenticationValue3.get("type");
                                        if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
                                            JobServiceBusAuthenticationType typeInstance7;
                                            typeInstance7 = SchedulerClientImpl
                                                    .parseJobServiceBusAuthenticationType(
                                                            typeValue7.getTextValue());
                                            authenticationInstance2.setType(typeInstance7);
                                        }
                                    }

                                    JsonNode messageValue3 = serviceBusQueueMessageValue.get("message");
                                    if (messageValue3 != null && messageValue3 instanceof NullNode == false) {
                                        String messageInstance3;
                                        messageInstance3 = messageValue3.getTextValue();
                                        serviceBusQueueMessageInstance.setMessage(messageInstance3);
                                    }

                                    JsonNode brokeredMessagePropertiesValue2 = serviceBusQueueMessageValue
                                            .get("brokeredMessageProperties");
                                    if (brokeredMessagePropertiesValue2 != null
                                            && brokeredMessagePropertiesValue2 instanceof NullNode == false) {
                                        JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance2 = new JobServiceBusBrokeredMessageProperties();
                                        serviceBusQueueMessageInstance.setBrokeredMessageProperties(
                                                brokeredMessagePropertiesInstance2);

                                        JsonNode contentTypeValue2 = brokeredMessagePropertiesValue2
                                                .get("contentType");
                                        if (contentTypeValue2 != null
                                                && contentTypeValue2 instanceof NullNode == false) {
                                            String contentTypeInstance2;
                                            contentTypeInstance2 = contentTypeValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setContentType(contentTypeInstance2);
                                        }

                                        JsonNode correlationIdValue2 = brokeredMessagePropertiesValue2
                                                .get("correlationId");
                                        if (correlationIdValue2 != null
                                                && correlationIdValue2 instanceof NullNode == false) {
                                            String correlationIdInstance2;
                                            correlationIdInstance2 = correlationIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setCorrelationId(correlationIdInstance2);
                                        }

                                        JsonNode forcePersistenceValue2 = brokeredMessagePropertiesValue2
                                                .get("forcePersistence");
                                        if (forcePersistenceValue2 != null
                                                && forcePersistenceValue2 instanceof NullNode == false) {
                                            boolean forcePersistenceInstance2;
                                            forcePersistenceInstance2 = forcePersistenceValue2
                                                    .getBooleanValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setForcePersistence(forcePersistenceInstance2);
                                        }

                                        JsonNode labelValue2 = brokeredMessagePropertiesValue2.get("label");
                                        if (labelValue2 != null && labelValue2 instanceof NullNode == false) {
                                            String labelInstance2;
                                            labelInstance2 = labelValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setLabel(labelInstance2);
                                        }

                                        JsonNode messageIdValue2 = brokeredMessagePropertiesValue2
                                                .get("messageId");
                                        if (messageIdValue2 != null
                                                && messageIdValue2 instanceof NullNode == false) {
                                            String messageIdInstance2;
                                            messageIdInstance2 = messageIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setMessageId(messageIdInstance2);
                                        }

                                        JsonNode partitionKeyValue2 = brokeredMessagePropertiesValue2
                                                .get("partitionKey");
                                        if (partitionKeyValue2 != null
                                                && partitionKeyValue2 instanceof NullNode == false) {
                                            String partitionKeyInstance2;
                                            partitionKeyInstance2 = partitionKeyValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setPartitionKey(partitionKeyInstance2);
                                        }

                                        JsonNode replyToValue2 = brokeredMessagePropertiesValue2.get("replyTo");
                                        if (replyToValue2 != null
                                                && replyToValue2 instanceof NullNode == false) {
                                            String replyToInstance2;
                                            replyToInstance2 = replyToValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setReplyTo(replyToInstance2);
                                        }

                                        JsonNode replyToSessionIdValue2 = brokeredMessagePropertiesValue2
                                                .get("replyToSessionId");
                                        if (replyToSessionIdValue2 != null
                                                && replyToSessionIdValue2 instanceof NullNode == false) {
                                            String replyToSessionIdInstance2;
                                            replyToSessionIdInstance2 = replyToSessionIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setReplyToSessionId(replyToSessionIdInstance2);
                                        }

                                        JsonNode scheduledEnqueueTimeUtcValue2 = brokeredMessagePropertiesValue2
                                                .get("scheduledEnqueueTimeUtc");
                                        if (scheduledEnqueueTimeUtcValue2 != null
                                                && scheduledEnqueueTimeUtcValue2 instanceof NullNode == false) {
                                            Calendar scheduledEnqueueTimeUtcInstance2;
                                            scheduledEnqueueTimeUtcInstance2 = DatatypeConverter.parseDateTime(
                                                    scheduledEnqueueTimeUtcValue2.getTextValue());
                                            brokeredMessagePropertiesInstance2.setScheduledEnqueueTimeUtc(
                                                    scheduledEnqueueTimeUtcInstance2);
                                        }

                                        JsonNode sessionIdValue2 = brokeredMessagePropertiesValue2
                                                .get("sessionId");
                                        if (sessionIdValue2 != null
                                                && sessionIdValue2 instanceof NullNode == false) {
                                            String sessionIdInstance2;
                                            sessionIdInstance2 = sessionIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setSessionId(sessionIdInstance2);
                                        }

                                        JsonNode timeToLiveValue2 = brokeredMessagePropertiesValue2
                                                .get("timeToLive");
                                        if (timeToLiveValue2 != null
                                                && timeToLiveValue2 instanceof NullNode == false) {
                                            Calendar timeToLiveInstance2;
                                            timeToLiveInstance2 = DatatypeConverter
                                                    .parseDateTime(timeToLiveValue2.getTextValue());
                                            brokeredMessagePropertiesInstance2
                                                    .setTimeToLive(timeToLiveInstance2);
                                        }

                                        JsonNode toValue2 = brokeredMessagePropertiesValue2.get("to");
                                        if (toValue2 != null && toValue2 instanceof NullNode == false) {
                                            String toInstance2;
                                            toInstance2 = toValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setTo(toInstance2);
                                        }

                                        JsonNode viaPartitionKeyValue2 = brokeredMessagePropertiesValue2
                                                .get("viaPartitionKey");
                                        if (viaPartitionKeyValue2 != null
                                                && viaPartitionKeyValue2 instanceof NullNode == false) {
                                            String viaPartitionKeyInstance2;
                                            viaPartitionKeyInstance2 = viaPartitionKeyValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setViaPartitionKey(viaPartitionKeyInstance2);
                                        }
                                    }

                                    JsonNode customMessagePropertiesSequenceElement2 = ((JsonNode) serviceBusQueueMessageValue
                                            .get("customMessageProperties"));
                                    if (customMessagePropertiesSequenceElement2 != null
                                            && customMessagePropertiesSequenceElement2 instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr3 = customMessagePropertiesSequenceElement2
                                                .getFields();
                                        while (itr3.hasNext()) {
                                            Map.Entry<String, JsonNode> property3 = itr3.next();
                                            String customMessagePropertiesKey2 = property3.getKey();
                                            String customMessagePropertiesValue2 = property3.getValue()
                                                    .getTextValue();
                                            serviceBusQueueMessageInstance.getCustomMessageProperties().put(
                                                    customMessagePropertiesKey2, customMessagePropertiesValue2);
                                        }
                                    }
                                }
                            }

                            JsonNode requestValue2 = actionValue.get("request");
                            if (requestValue2 != null && requestValue2 instanceof NullNode == false) {
                                JobHttpRequest requestInstance2 = new JobHttpRequest();
                                actionInstance.setRequest(requestInstance2);

                                JsonNode uriValue2 = requestValue2.get("uri");
                                if (uriValue2 != null && uriValue2 instanceof NullNode == false) {
                                    URI uriInstance2;
                                    uriInstance2 = new URI(uriValue2.getTextValue());
                                    requestInstance2.setUri(uriInstance2);
                                }

                                JsonNode methodValue2 = requestValue2.get("method");
                                if (methodValue2 != null && methodValue2 instanceof NullNode == false) {
                                    String methodInstance2;
                                    methodInstance2 = methodValue2.getTextValue();
                                    requestInstance2.setMethod(methodInstance2);
                                }

                                JsonNode headersSequenceElement2 = ((JsonNode) requestValue2.get("headers"));
                                if (headersSequenceElement2 != null
                                        && headersSequenceElement2 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr4 = headersSequenceElement2
                                            .getFields();
                                    while (itr4.hasNext()) {
                                        Map.Entry<String, JsonNode> property4 = itr4.next();
                                        String headersKey2 = property4.getKey();
                                        String headersValue2 = property4.getValue().getTextValue();
                                        requestInstance2.getHeaders().put(headersKey2, headersValue2);
                                    }
                                }

                                JsonNode bodyValue2 = requestValue2.get("body");
                                if (bodyValue2 != null && bodyValue2 instanceof NullNode == false) {
                                    String bodyInstance2;
                                    bodyInstance2 = bodyValue2.getTextValue();
                                    requestInstance2.setBody(bodyInstance2);
                                }

                                JsonNode authenticationValue4 = requestValue2.get("authentication");
                                if (authenticationValue4 != null
                                        && authenticationValue4 instanceof NullNode == false) {
                                    String typeName2 = authenticationValue4.get("type").getTextValue();
                                    if ("ClientCertificate".equals(typeName2)) {
                                        ClientCertAuthentication clientCertAuthenticationInstance2 = new ClientCertAuthentication();

                                        JsonNode passwordValue3 = authenticationValue4.get("password");
                                        if (passwordValue3 != null
                                                && passwordValue3 instanceof NullNode == false) {
                                            String passwordInstance3;
                                            passwordInstance3 = passwordValue3.getTextValue();
                                            clientCertAuthenticationInstance2.setPassword(passwordInstance3);
                                        }

                                        JsonNode pfxValue2 = authenticationValue4.get("pfx");
                                        if (pfxValue2 != null && pfxValue2 instanceof NullNode == false) {
                                            String pfxInstance2;
                                            pfxInstance2 = pfxValue2.getTextValue();
                                            clientCertAuthenticationInstance2.setPfx(pfxInstance2);
                                        }

                                        JsonNode certificateThumbprintValue2 = authenticationValue4
                                                .get("certificateThumbprint");
                                        if (certificateThumbprintValue2 != null
                                                && certificateThumbprintValue2 instanceof NullNode == false) {
                                            String certificateThumbprintInstance2;
                                            certificateThumbprintInstance2 = certificateThumbprintValue2
                                                    .getTextValue();
                                            clientCertAuthenticationInstance2
                                                    .setCertificateThumbprint(certificateThumbprintInstance2);
                                        }

                                        JsonNode certificateExpirationValue2 = authenticationValue4
                                                .get("certificateExpiration");
                                        if (certificateExpirationValue2 != null
                                                && certificateExpirationValue2 instanceof NullNode == false) {
                                            Calendar certificateExpirationInstance2;
                                            certificateExpirationInstance2 = DatatypeConverter
                                                    .parseDateTime(certificateExpirationValue2.getTextValue());
                                            clientCertAuthenticationInstance2
                                                    .setCertificateExpiration(certificateExpirationInstance2);
                                        }

                                        JsonNode certificateSubjectNameValue2 = authenticationValue4
                                                .get("certificateSubjectName");
                                        if (certificateSubjectNameValue2 != null
                                                && certificateSubjectNameValue2 instanceof NullNode == false) {
                                            String certificateSubjectNameInstance2;
                                            certificateSubjectNameInstance2 = certificateSubjectNameValue2
                                                    .getTextValue();
                                            clientCertAuthenticationInstance2
                                                    .setCertificateSubjectName(certificateSubjectNameInstance2);
                                        }

                                        JsonNode typeValue8 = authenticationValue4.get("type");
                                        if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance8;
                                            typeInstance8 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue8.getTextValue());
                                            clientCertAuthenticationInstance2.setType(typeInstance8);
                                        }
                                        requestInstance2.setAuthentication(clientCertAuthenticationInstance2);
                                    }
                                    if ("ActiveDirectoryOAuth".equals(typeName2)) {
                                        AADOAuthAuthentication aADOAuthAuthenticationInstance2 = new AADOAuthAuthentication();

                                        JsonNode secretValue2 = authenticationValue4.get("secret");
                                        if (secretValue2 != null && secretValue2 instanceof NullNode == false) {
                                            String secretInstance2;
                                            secretInstance2 = secretValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setSecret(secretInstance2);
                                        }

                                        JsonNode tenantValue2 = authenticationValue4.get("tenant");
                                        if (tenantValue2 != null && tenantValue2 instanceof NullNode == false) {
                                            String tenantInstance2;
                                            tenantInstance2 = tenantValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setTenant(tenantInstance2);
                                        }

                                        JsonNode audienceValue2 = authenticationValue4.get("audience");
                                        if (audienceValue2 != null
                                                && audienceValue2 instanceof NullNode == false) {
                                            String audienceInstance2;
                                            audienceInstance2 = audienceValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setAudience(audienceInstance2);
                                        }

                                        JsonNode clientIdValue2 = authenticationValue4.get("clientId");
                                        if (clientIdValue2 != null
                                                && clientIdValue2 instanceof NullNode == false) {
                                            String clientIdInstance2;
                                            clientIdInstance2 = clientIdValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setClientId(clientIdInstance2);
                                        }

                                        JsonNode typeValue9 = authenticationValue4.get("type");
                                        if (typeValue9 != null && typeValue9 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance9;
                                            typeInstance9 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue9.getTextValue());
                                            aADOAuthAuthenticationInstance2.setType(typeInstance9);
                                        }
                                        requestInstance2.setAuthentication(aADOAuthAuthenticationInstance2);
                                    }
                                    if ("Basic".equals(typeName2)) {
                                        BasicAuthentication basicAuthenticationInstance2 = new BasicAuthentication();

                                        JsonNode usernameValue2 = authenticationValue4.get("username");
                                        if (usernameValue2 != null
                                                && usernameValue2 instanceof NullNode == false) {
                                            String usernameInstance2;
                                            usernameInstance2 = usernameValue2.getTextValue();
                                            basicAuthenticationInstance2.setUsername(usernameInstance2);
                                        }

                                        JsonNode passwordValue4 = authenticationValue4.get("password");
                                        if (passwordValue4 != null
                                                && passwordValue4 instanceof NullNode == false) {
                                            String passwordInstance4;
                                            passwordInstance4 = passwordValue4.getTextValue();
                                            basicAuthenticationInstance2.setPassword(passwordInstance4);
                                        }

                                        JsonNode typeValue10 = authenticationValue4.get("type");
                                        if (typeValue10 != null && typeValue10 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance10;
                                            typeInstance10 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue10.getTextValue());
                                            basicAuthenticationInstance2.setType(typeInstance10);
                                        }
                                        requestInstance2.setAuthentication(basicAuthenticationInstance2);
                                    }
                                }
                            }

                            JsonNode queueMessageValue2 = actionValue.get("queueMessage");
                            if (queueMessageValue2 != null && queueMessageValue2 instanceof NullNode == false) {
                                JobQueueMessage queueMessageInstance2 = new JobQueueMessage();
                                actionInstance.setQueueMessage(queueMessageInstance2);

                                JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount");
                                if (storageAccountValue2 != null
                                        && storageAccountValue2 instanceof NullNode == false) {
                                    String storageAccountInstance2;
                                    storageAccountInstance2 = storageAccountValue2.getTextValue();
                                    queueMessageInstance2.setStorageAccountName(storageAccountInstance2);
                                }

                                JsonNode queueNameValue3 = queueMessageValue2.get("queueName");
                                if (queueNameValue3 != null && queueNameValue3 instanceof NullNode == false) {
                                    String queueNameInstance3;
                                    queueNameInstance3 = queueNameValue3.getTextValue();
                                    queueMessageInstance2.setQueueName(queueNameInstance3);
                                }

                                JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken");
                                if (sasTokenValue2 != null && sasTokenValue2 instanceof NullNode == false) {
                                    String sasTokenInstance2;
                                    sasTokenInstance2 = sasTokenValue2.getTextValue();
                                    queueMessageInstance2.setSasToken(sasTokenInstance2);
                                }

                                JsonNode messageValue4 = queueMessageValue2.get("message");
                                if (messageValue4 != null && messageValue4 instanceof NullNode == false) {
                                    String messageInstance4;
                                    messageInstance4 = messageValue4.getTextValue();
                                    queueMessageInstance2.setMessage(messageInstance4);
                                }
                            }

                            JsonNode serviceBusTopicMessageValue2 = actionValue.get("serviceBusTopicMessage");
                            if (serviceBusTopicMessageValue2 != null
                                    && serviceBusTopicMessageValue2 instanceof NullNode == false) {
                                JobServiceBusTopicMessage serviceBusTopicMessageInstance2 = new JobServiceBusTopicMessage();
                                actionInstance.setServiceBusTopicMessage(serviceBusTopicMessageInstance2);

                                JsonNode topicPathValue2 = serviceBusTopicMessageValue2.get("topicPath");
                                if (topicPathValue2 != null && topicPathValue2 instanceof NullNode == false) {
                                    String topicPathInstance2;
                                    topicPathInstance2 = topicPathValue2.getTextValue();
                                    serviceBusTopicMessageInstance2.setTopicPath(topicPathInstance2);
                                }

                                JsonNode namespaceValue3 = serviceBusTopicMessageValue2.get("namespace");
                                if (namespaceValue3 != null && namespaceValue3 instanceof NullNode == false) {
                                    String namespaceInstance3;
                                    namespaceInstance3 = namespaceValue3.getTextValue();
                                    serviceBusTopicMessageInstance2.setNamespace(namespaceInstance3);
                                }

                                JsonNode transportTypeValue3 = serviceBusTopicMessageValue2
                                        .get("transportType");
                                if (transportTypeValue3 != null
                                        && transportTypeValue3 instanceof NullNode == false) {
                                    JobServiceBusTransportType transportTypeInstance3;
                                    transportTypeInstance3 = SchedulerClientImpl
                                            .parseJobServiceBusTransportType(
                                                    transportTypeValue3.getTextValue());
                                    serviceBusTopicMessageInstance2.setTransportType(transportTypeInstance3);
                                }

                                JsonNode authenticationValue5 = serviceBusTopicMessageValue2
                                        .get("authentication");
                                if (authenticationValue5 != null
                                        && authenticationValue5 instanceof NullNode == false) {
                                    JobServiceBusAuthentication authenticationInstance3 = new JobServiceBusAuthentication();
                                    serviceBusTopicMessageInstance2.setAuthentication(authenticationInstance3);

                                    JsonNode sasKeyNameValue3 = authenticationValue5.get("sasKeyName");
                                    if (sasKeyNameValue3 != null
                                            && sasKeyNameValue3 instanceof NullNode == false) {
                                        String sasKeyNameInstance3;
                                        sasKeyNameInstance3 = sasKeyNameValue3.getTextValue();
                                        authenticationInstance3.setSasKeyName(sasKeyNameInstance3);
                                    }

                                    JsonNode sasKeyValue3 = authenticationValue5.get("sasKey");
                                    if (sasKeyValue3 != null && sasKeyValue3 instanceof NullNode == false) {
                                        String sasKeyInstance3;
                                        sasKeyInstance3 = sasKeyValue3.getTextValue();
                                        authenticationInstance3.setSasKey(sasKeyInstance3);
                                    }

                                    JsonNode typeValue11 = authenticationValue5.get("type");
                                    if (typeValue11 != null && typeValue11 instanceof NullNode == false) {
                                        JobServiceBusAuthenticationType typeInstance11;
                                        typeInstance11 = SchedulerClientImpl
                                                .parseJobServiceBusAuthenticationType(
                                                        typeValue11.getTextValue());
                                        authenticationInstance3.setType(typeInstance11);
                                    }
                                }

                                JsonNode messageValue5 = serviceBusTopicMessageValue2.get("message");
                                if (messageValue5 != null && messageValue5 instanceof NullNode == false) {
                                    String messageInstance5;
                                    messageInstance5 = messageValue5.getTextValue();
                                    serviceBusTopicMessageInstance2.setMessage(messageInstance5);
                                }

                                JsonNode brokeredMessagePropertiesValue3 = serviceBusTopicMessageValue2
                                        .get("brokeredMessageProperties");
                                if (brokeredMessagePropertiesValue3 != null
                                        && brokeredMessagePropertiesValue3 instanceof NullNode == false) {
                                    JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance3 = new JobServiceBusBrokeredMessageProperties();
                                    serviceBusTopicMessageInstance2
                                            .setBrokeredMessageProperties(brokeredMessagePropertiesInstance3);

                                    JsonNode contentTypeValue3 = brokeredMessagePropertiesValue3
                                            .get("contentType");
                                    if (contentTypeValue3 != null
                                            && contentTypeValue3 instanceof NullNode == false) {
                                        String contentTypeInstance3;
                                        contentTypeInstance3 = contentTypeValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setContentType(contentTypeInstance3);
                                    }

                                    JsonNode correlationIdValue3 = brokeredMessagePropertiesValue3
                                            .get("correlationId");
                                    if (correlationIdValue3 != null
                                            && correlationIdValue3 instanceof NullNode == false) {
                                        String correlationIdInstance3;
                                        correlationIdInstance3 = correlationIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setCorrelationId(correlationIdInstance3);
                                    }

                                    JsonNode forcePersistenceValue3 = brokeredMessagePropertiesValue3
                                            .get("forcePersistence");
                                    if (forcePersistenceValue3 != null
                                            && forcePersistenceValue3 instanceof NullNode == false) {
                                        boolean forcePersistenceInstance3;
                                        forcePersistenceInstance3 = forcePersistenceValue3.getBooleanValue();
                                        brokeredMessagePropertiesInstance3
                                                .setForcePersistence(forcePersistenceInstance3);
                                    }

                                    JsonNode labelValue3 = brokeredMessagePropertiesValue3.get("label");
                                    if (labelValue3 != null && labelValue3 instanceof NullNode == false) {
                                        String labelInstance3;
                                        labelInstance3 = labelValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setLabel(labelInstance3);
                                    }

                                    JsonNode messageIdValue3 = brokeredMessagePropertiesValue3.get("messageId");
                                    if (messageIdValue3 != null
                                            && messageIdValue3 instanceof NullNode == false) {
                                        String messageIdInstance3;
                                        messageIdInstance3 = messageIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setMessageId(messageIdInstance3);
                                    }

                                    JsonNode partitionKeyValue3 = brokeredMessagePropertiesValue3
                                            .get("partitionKey");
                                    if (partitionKeyValue3 != null
                                            && partitionKeyValue3 instanceof NullNode == false) {
                                        String partitionKeyInstance3;
                                        partitionKeyInstance3 = partitionKeyValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setPartitionKey(partitionKeyInstance3);
                                    }

                                    JsonNode replyToValue3 = brokeredMessagePropertiesValue3.get("replyTo");
                                    if (replyToValue3 != null && replyToValue3 instanceof NullNode == false) {
                                        String replyToInstance3;
                                        replyToInstance3 = replyToValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setReplyTo(replyToInstance3);
                                    }

                                    JsonNode replyToSessionIdValue3 = brokeredMessagePropertiesValue3
                                            .get("replyToSessionId");
                                    if (replyToSessionIdValue3 != null
                                            && replyToSessionIdValue3 instanceof NullNode == false) {
                                        String replyToSessionIdInstance3;
                                        replyToSessionIdInstance3 = replyToSessionIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setReplyToSessionId(replyToSessionIdInstance3);
                                    }

                                    JsonNode scheduledEnqueueTimeUtcValue3 = brokeredMessagePropertiesValue3
                                            .get("scheduledEnqueueTimeUtc");
                                    if (scheduledEnqueueTimeUtcValue3 != null
                                            && scheduledEnqueueTimeUtcValue3 instanceof NullNode == false) {
                                        Calendar scheduledEnqueueTimeUtcInstance3;
                                        scheduledEnqueueTimeUtcInstance3 = DatatypeConverter
                                                .parseDateTime(scheduledEnqueueTimeUtcValue3.getTextValue());
                                        brokeredMessagePropertiesInstance3
                                                .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance3);
                                    }

                                    JsonNode sessionIdValue3 = brokeredMessagePropertiesValue3.get("sessionId");
                                    if (sessionIdValue3 != null
                                            && sessionIdValue3 instanceof NullNode == false) {
                                        String sessionIdInstance3;
                                        sessionIdInstance3 = sessionIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setSessionId(sessionIdInstance3);
                                    }

                                    JsonNode timeToLiveValue3 = brokeredMessagePropertiesValue3
                                            .get("timeToLive");
                                    if (timeToLiveValue3 != null
                                            && timeToLiveValue3 instanceof NullNode == false) {
                                        Calendar timeToLiveInstance3;
                                        timeToLiveInstance3 = DatatypeConverter
                                                .parseDateTime(timeToLiveValue3.getTextValue());
                                        brokeredMessagePropertiesInstance3.setTimeToLive(timeToLiveInstance3);
                                    }

                                    JsonNode toValue3 = brokeredMessagePropertiesValue3.get("to");
                                    if (toValue3 != null && toValue3 instanceof NullNode == false) {
                                        String toInstance3;
                                        toInstance3 = toValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setTo(toInstance3);
                                    }

                                    JsonNode viaPartitionKeyValue3 = brokeredMessagePropertiesValue3
                                            .get("viaPartitionKey");
                                    if (viaPartitionKeyValue3 != null
                                            && viaPartitionKeyValue3 instanceof NullNode == false) {
                                        String viaPartitionKeyInstance3;
                                        viaPartitionKeyInstance3 = viaPartitionKeyValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setViaPartitionKey(viaPartitionKeyInstance3);
                                    }
                                }

                                JsonNode customMessagePropertiesSequenceElement3 = ((JsonNode) serviceBusTopicMessageValue2
                                        .get("customMessageProperties"));
                                if (customMessagePropertiesSequenceElement3 != null
                                        && customMessagePropertiesSequenceElement3 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr5 = customMessagePropertiesSequenceElement3
                                            .getFields();
                                    while (itr5.hasNext()) {
                                        Map.Entry<String, JsonNode> property5 = itr5.next();
                                        String customMessagePropertiesKey3 = property5.getKey();
                                        String customMessagePropertiesValue3 = property5.getValue()
                                                .getTextValue();
                                        serviceBusTopicMessageInstance2.getCustomMessageProperties().put(
                                                customMessagePropertiesKey3, customMessagePropertiesValue3);
                                    }
                                }
                            }

                            JsonNode serviceBusQueueMessageValue2 = actionValue.get("serviceBusQueueMessage");
                            if (serviceBusQueueMessageValue2 != null
                                    && serviceBusQueueMessageValue2 instanceof NullNode == false) {
                                JobServiceBusQueueMessage serviceBusQueueMessageInstance2 = new JobServiceBusQueueMessage();
                                actionInstance.setServiceBusQueueMessage(serviceBusQueueMessageInstance2);

                                JsonNode queueNameValue4 = serviceBusQueueMessageValue2.get("queueName");
                                if (queueNameValue4 != null && queueNameValue4 instanceof NullNode == false) {
                                    String queueNameInstance4;
                                    queueNameInstance4 = queueNameValue4.getTextValue();
                                    serviceBusQueueMessageInstance2.setQueueName(queueNameInstance4);
                                }

                                JsonNode namespaceValue4 = serviceBusQueueMessageValue2.get("namespace");
                                if (namespaceValue4 != null && namespaceValue4 instanceof NullNode == false) {
                                    String namespaceInstance4;
                                    namespaceInstance4 = namespaceValue4.getTextValue();
                                    serviceBusQueueMessageInstance2.setNamespace(namespaceInstance4);
                                }

                                JsonNode transportTypeValue4 = serviceBusQueueMessageValue2
                                        .get("transportType");
                                if (transportTypeValue4 != null
                                        && transportTypeValue4 instanceof NullNode == false) {
                                    JobServiceBusTransportType transportTypeInstance4;
                                    transportTypeInstance4 = SchedulerClientImpl
                                            .parseJobServiceBusTransportType(
                                                    transportTypeValue4.getTextValue());
                                    serviceBusQueueMessageInstance2.setTransportType(transportTypeInstance4);
                                }

                                JsonNode authenticationValue6 = serviceBusQueueMessageValue2
                                        .get("authentication");
                                if (authenticationValue6 != null
                                        && authenticationValue6 instanceof NullNode == false) {
                                    JobServiceBusAuthentication authenticationInstance4 = new JobServiceBusAuthentication();
                                    serviceBusQueueMessageInstance2.setAuthentication(authenticationInstance4);

                                    JsonNode sasKeyNameValue4 = authenticationValue6.get("sasKeyName");
                                    if (sasKeyNameValue4 != null
                                            && sasKeyNameValue4 instanceof NullNode == false) {
                                        String sasKeyNameInstance4;
                                        sasKeyNameInstance4 = sasKeyNameValue4.getTextValue();
                                        authenticationInstance4.setSasKeyName(sasKeyNameInstance4);
                                    }

                                    JsonNode sasKeyValue4 = authenticationValue6.get("sasKey");
                                    if (sasKeyValue4 != null && sasKeyValue4 instanceof NullNode == false) {
                                        String sasKeyInstance4;
                                        sasKeyInstance4 = sasKeyValue4.getTextValue();
                                        authenticationInstance4.setSasKey(sasKeyInstance4);
                                    }

                                    JsonNode typeValue12 = authenticationValue6.get("type");
                                    if (typeValue12 != null && typeValue12 instanceof NullNode == false) {
                                        JobServiceBusAuthenticationType typeInstance12;
                                        typeInstance12 = SchedulerClientImpl
                                                .parseJobServiceBusAuthenticationType(
                                                        typeValue12.getTextValue());
                                        authenticationInstance4.setType(typeInstance12);
                                    }
                                }

                                JsonNode messageValue6 = serviceBusQueueMessageValue2.get("message");
                                if (messageValue6 != null && messageValue6 instanceof NullNode == false) {
                                    String messageInstance6;
                                    messageInstance6 = messageValue6.getTextValue();
                                    serviceBusQueueMessageInstance2.setMessage(messageInstance6);
                                }

                                JsonNode brokeredMessagePropertiesValue4 = serviceBusQueueMessageValue2
                                        .get("brokeredMessageProperties");
                                if (brokeredMessagePropertiesValue4 != null
                                        && brokeredMessagePropertiesValue4 instanceof NullNode == false) {
                                    JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance4 = new JobServiceBusBrokeredMessageProperties();
                                    serviceBusQueueMessageInstance2
                                            .setBrokeredMessageProperties(brokeredMessagePropertiesInstance4);

                                    JsonNode contentTypeValue4 = brokeredMessagePropertiesValue4
                                            .get("contentType");
                                    if (contentTypeValue4 != null
                                            && contentTypeValue4 instanceof NullNode == false) {
                                        String contentTypeInstance4;
                                        contentTypeInstance4 = contentTypeValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setContentType(contentTypeInstance4);
                                    }

                                    JsonNode correlationIdValue4 = brokeredMessagePropertiesValue4
                                            .get("correlationId");
                                    if (correlationIdValue4 != null
                                            && correlationIdValue4 instanceof NullNode == false) {
                                        String correlationIdInstance4;
                                        correlationIdInstance4 = correlationIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setCorrelationId(correlationIdInstance4);
                                    }

                                    JsonNode forcePersistenceValue4 = brokeredMessagePropertiesValue4
                                            .get("forcePersistence");
                                    if (forcePersistenceValue4 != null
                                            && forcePersistenceValue4 instanceof NullNode == false) {
                                        boolean forcePersistenceInstance4;
                                        forcePersistenceInstance4 = forcePersistenceValue4.getBooleanValue();
                                        brokeredMessagePropertiesInstance4
                                                .setForcePersistence(forcePersistenceInstance4);
                                    }

                                    JsonNode labelValue4 = brokeredMessagePropertiesValue4.get("label");
                                    if (labelValue4 != null && labelValue4 instanceof NullNode == false) {
                                        String labelInstance4;
                                        labelInstance4 = labelValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setLabel(labelInstance4);
                                    }

                                    JsonNode messageIdValue4 = brokeredMessagePropertiesValue4.get("messageId");
                                    if (messageIdValue4 != null
                                            && messageIdValue4 instanceof NullNode == false) {
                                        String messageIdInstance4;
                                        messageIdInstance4 = messageIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setMessageId(messageIdInstance4);
                                    }

                                    JsonNode partitionKeyValue4 = brokeredMessagePropertiesValue4
                                            .get("partitionKey");
                                    if (partitionKeyValue4 != null
                                            && partitionKeyValue4 instanceof NullNode == false) {
                                        String partitionKeyInstance4;
                                        partitionKeyInstance4 = partitionKeyValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setPartitionKey(partitionKeyInstance4);
                                    }

                                    JsonNode replyToValue4 = brokeredMessagePropertiesValue4.get("replyTo");
                                    if (replyToValue4 != null && replyToValue4 instanceof NullNode == false) {
                                        String replyToInstance4;
                                        replyToInstance4 = replyToValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setReplyTo(replyToInstance4);
                                    }

                                    JsonNode replyToSessionIdValue4 = brokeredMessagePropertiesValue4
                                            .get("replyToSessionId");
                                    if (replyToSessionIdValue4 != null
                                            && replyToSessionIdValue4 instanceof NullNode == false) {
                                        String replyToSessionIdInstance4;
                                        replyToSessionIdInstance4 = replyToSessionIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setReplyToSessionId(replyToSessionIdInstance4);
                                    }

                                    JsonNode scheduledEnqueueTimeUtcValue4 = brokeredMessagePropertiesValue4
                                            .get("scheduledEnqueueTimeUtc");
                                    if (scheduledEnqueueTimeUtcValue4 != null
                                            && scheduledEnqueueTimeUtcValue4 instanceof NullNode == false) {
                                        Calendar scheduledEnqueueTimeUtcInstance4;
                                        scheduledEnqueueTimeUtcInstance4 = DatatypeConverter
                                                .parseDateTime(scheduledEnqueueTimeUtcValue4.getTextValue());
                                        brokeredMessagePropertiesInstance4
                                                .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance4);
                                    }

                                    JsonNode sessionIdValue4 = brokeredMessagePropertiesValue4.get("sessionId");
                                    if (sessionIdValue4 != null
                                            && sessionIdValue4 instanceof NullNode == false) {
                                        String sessionIdInstance4;
                                        sessionIdInstance4 = sessionIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setSessionId(sessionIdInstance4);
                                    }

                                    JsonNode timeToLiveValue4 = brokeredMessagePropertiesValue4
                                            .get("timeToLive");
                                    if (timeToLiveValue4 != null
                                            && timeToLiveValue4 instanceof NullNode == false) {
                                        Calendar timeToLiveInstance4;
                                        timeToLiveInstance4 = DatatypeConverter
                                                .parseDateTime(timeToLiveValue4.getTextValue());
                                        brokeredMessagePropertiesInstance4.setTimeToLive(timeToLiveInstance4);
                                    }

                                    JsonNode toValue4 = brokeredMessagePropertiesValue4.get("to");
                                    if (toValue4 != null && toValue4 instanceof NullNode == false) {
                                        String toInstance4;
                                        toInstance4 = toValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setTo(toInstance4);
                                    }

                                    JsonNode viaPartitionKeyValue4 = brokeredMessagePropertiesValue4
                                            .get("viaPartitionKey");
                                    if (viaPartitionKeyValue4 != null
                                            && viaPartitionKeyValue4 instanceof NullNode == false) {
                                        String viaPartitionKeyInstance4;
                                        viaPartitionKeyInstance4 = viaPartitionKeyValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setViaPartitionKey(viaPartitionKeyInstance4);
                                    }
                                }

                                JsonNode customMessagePropertiesSequenceElement4 = ((JsonNode) serviceBusQueueMessageValue2
                                        .get("customMessageProperties"));
                                if (customMessagePropertiesSequenceElement4 != null
                                        && customMessagePropertiesSequenceElement4 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr6 = customMessagePropertiesSequenceElement4
                                            .getFields();
                                    while (itr6.hasNext()) {
                                        Map.Entry<String, JsonNode> property6 = itr6.next();
                                        String customMessagePropertiesKey4 = property6.getKey();
                                        String customMessagePropertiesValue4 = property6.getValue()
                                                .getTextValue();
                                        serviceBusQueueMessageInstance2.getCustomMessageProperties().put(
                                                customMessagePropertiesKey4, customMessagePropertiesValue4);
                                    }
                                }
                            }
                        }

                        JsonNode recurrenceValue = jobsValue.get("recurrence");
                        if (recurrenceValue != null && recurrenceValue instanceof NullNode == false) {
                            JobRecurrence recurrenceInstance = new JobRecurrence();
                            jobInstance.setRecurrence(recurrenceInstance);

                            JsonNode frequencyValue = recurrenceValue.get("frequency");
                            if (frequencyValue != null && frequencyValue instanceof NullNode == false) {
                                JobRecurrenceFrequency frequencyInstance;
                                frequencyInstance = SchedulerClientImpl
                                        .parseJobRecurrenceFrequency(frequencyValue.getTextValue());
                                recurrenceInstance.setFrequency(frequencyInstance);
                            }

                            JsonNode intervalValue = recurrenceValue.get("interval");
                            if (intervalValue != null && intervalValue instanceof NullNode == false) {
                                int intervalInstance;
                                intervalInstance = intervalValue.getIntValue();
                                recurrenceInstance.setInterval(intervalInstance);
                            }

                            JsonNode countValue = recurrenceValue.get("count");
                            if (countValue != null && countValue instanceof NullNode == false) {
                                int countInstance;
                                countInstance = countValue.getIntValue();
                                recurrenceInstance.setCount(countInstance);
                            }

                            JsonNode endTimeValue = recurrenceValue.get("endTime");
                            if (endTimeValue != null && endTimeValue instanceof NullNode == false) {
                                Calendar endTimeInstance;
                                endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue());
                                recurrenceInstance.setEndTime(endTimeInstance);
                            }

                            JsonNode scheduleValue = recurrenceValue.get("schedule");
                            if (scheduleValue != null && scheduleValue instanceof NullNode == false) {
                                JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule();
                                recurrenceInstance.setSchedule(scheduleInstance);

                                JsonNode minutesArray = scheduleValue.get("minutes");
                                if (minutesArray != null && minutesArray instanceof NullNode == false) {
                                    scheduleInstance.setMinutes(new ArrayList<Integer>());
                                    for (JsonNode minutesValue : ((ArrayNode) minutesArray)) {
                                        scheduleInstance.getMinutes().add(minutesValue.getIntValue());
                                    }
                                }

                                JsonNode hoursArray = scheduleValue.get("hours");
                                if (hoursArray != null && hoursArray instanceof NullNode == false) {
                                    scheduleInstance.setHours(new ArrayList<Integer>());
                                    for (JsonNode hoursValue : ((ArrayNode) hoursArray)) {
                                        scheduleInstance.getHours().add(hoursValue.getIntValue());
                                    }
                                }

                                JsonNode weekDaysArray = scheduleValue.get("weekDays");
                                if (weekDaysArray != null && weekDaysArray instanceof NullNode == false) {
                                    scheduleInstance.setDays(new ArrayList<JobScheduleDay>());
                                    for (JsonNode weekDaysValue : ((ArrayNode) weekDaysArray)) {
                                        scheduleInstance.getDays().add(SchedulerClientImpl
                                                .parseJobScheduleDay(weekDaysValue.getTextValue()));
                                    }
                                }

                                JsonNode monthsArray = scheduleValue.get("months");
                                if (monthsArray != null && monthsArray instanceof NullNode == false) {
                                    scheduleInstance.setMonths(new ArrayList<Integer>());
                                    for (JsonNode monthsValue : ((ArrayNode) monthsArray)) {
                                        scheduleInstance.getMonths().add(monthsValue.getIntValue());
                                    }
                                }

                                JsonNode monthDaysArray = scheduleValue.get("monthDays");
                                if (monthDaysArray != null && monthDaysArray instanceof NullNode == false) {
                                    scheduleInstance.setMonthDays(new ArrayList<Integer>());
                                    for (JsonNode monthDaysValue : ((ArrayNode) monthDaysArray)) {
                                        scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue());
                                    }
                                }

                                JsonNode monthlyOccurrencesArray = scheduleValue.get("monthlyOccurrences");
                                if (monthlyOccurrencesArray != null
                                        && monthlyOccurrencesArray instanceof NullNode == false) {
                                    scheduleInstance.setMonthlyOccurrences(
                                            new ArrayList<JobScheduleMonthlyOccurrence>());
                                    for (JsonNode monthlyOccurrencesValue : ((ArrayNode) monthlyOccurrencesArray)) {
                                        JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence();
                                        scheduleInstance.getMonthlyOccurrences()
                                                .add(jobScheduleMonthlyOccurrenceInstance);

                                        JsonNode dayValue = monthlyOccurrencesValue.get("day");
                                        if (dayValue != null && dayValue instanceof NullNode == false) {
                                            JobScheduleDay dayInstance;
                                            dayInstance = SchedulerClientImpl
                                                    .parseJobScheduleDay(dayValue.getTextValue());
                                            jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance);
                                        }

                                        JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence");
                                        if (occurrenceValue != null
                                                && occurrenceValue instanceof NullNode == false) {
                                            int occurrenceInstance;
                                            occurrenceInstance = occurrenceValue.getIntValue();
                                            jobScheduleMonthlyOccurrenceInstance
                                                    .setOccurrence(occurrenceInstance);
                                        }
                                    }
                                }
                            }
                        }

                        JsonNode statusValue = jobsValue.get("status");
                        if (statusValue != null && statusValue instanceof NullNode == false) {
                            JobStatus statusInstance = new JobStatus();
                            jobInstance.setStatus(statusInstance);

                            JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime");
                            if (lastExecutionTimeValue != null
                                    && lastExecutionTimeValue instanceof NullNode == false) {
                                Calendar lastExecutionTimeInstance;
                                lastExecutionTimeInstance = DatatypeConverter
                                        .parseDateTime(lastExecutionTimeValue.getTextValue());
                                statusInstance.setLastExecutionTime(lastExecutionTimeInstance);
                            }

                            JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime");
                            if (nextExecutionTimeValue != null
                                    && nextExecutionTimeValue instanceof NullNode == false) {
                                Calendar nextExecutionTimeInstance;
                                nextExecutionTimeInstance = DatatypeConverter
                                        .parseDateTime(nextExecutionTimeValue.getTextValue());
                                statusInstance.setNextExecutionTime(nextExecutionTimeInstance);
                            }

                            JsonNode executionCountValue = statusValue.get("executionCount");
                            if (executionCountValue != null
                                    && executionCountValue instanceof NullNode == false) {
                                int executionCountInstance;
                                executionCountInstance = executionCountValue.getIntValue();
                                statusInstance.setExecutionCount(executionCountInstance);
                            }

                            JsonNode failureCountValue = statusValue.get("failureCount");
                            if (failureCountValue != null && failureCountValue instanceof NullNode == false) {
                                int failureCountInstance;
                                failureCountInstance = failureCountValue.getIntValue();
                                statusInstance.setFailureCount(failureCountInstance);
                            }

                            JsonNode faultedCountValue = statusValue.get("faultedCount");
                            if (faultedCountValue != null && faultedCountValue instanceof NullNode == false) {
                                int faultedCountInstance;
                                faultedCountInstance = faultedCountValue.getIntValue();
                                statusInstance.setFaultedCount(faultedCountInstance);
                            }
                        }

                        JsonNode stateValue = jobsValue.get("state");
                        if (stateValue != null && stateValue instanceof NullNode == false) {
                            JobState stateInstance;
                            stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue());
                            jobInstance.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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.DeploymentOperationsImpl.java

/**
* The Get Deployment By Slot operation returns configuration information,
* status, and system properties for a deployment.  (see
* http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx for
* more information)/*from  w  w  w . jav a 2 s. co m*/
*
* @param serviceName Required. The name of the cloud service.
* @param deploymentSlot Required. The deployment slot.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return A deployment that exists in the cloud service.
*/
@Override
public DeploymentGetResponse getBySlot(String serviceName, DeploymentSlot deploymentSlot)
        throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
    // Validate
    if (serviceName == null) {
        throw new NullPointerException("serviceName");
    }
    if (deploymentSlot == null) {
        throw new NullPointerException("deploymentSlot");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("serviceName", serviceName);
        tracingParameters.put("deploymentSlot", deploymentSlot);
        CloudTracing.enter(invocationId, this, "getBySlotAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/hostedservices/";
    url = url + URLEncoder.encode(serviceName, "UTF-8");
    url = url + "/deploymentslots/";
    url = url + URLEncoder.encode(deploymentSlot.toString(), "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        DeploymentGetResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new DeploymentGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element deploymentElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "Deployment");
            if (deploymentElement != null) {
                Element nameElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    String nameInstance;
                    nameInstance = nameElement.getTextContent();
                    result.setName(nameInstance);
                }

                Element deploymentSlotElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "DeploymentSlot");
                if (deploymentSlotElement != null && deploymentSlotElement.getTextContent() != null
                        && !deploymentSlotElement.getTextContent().isEmpty()) {
                    DeploymentSlot deploymentSlotInstance;
                    deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent());
                    result.setDeploymentSlot(deploymentSlotInstance);
                }

                Element privateIDElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "PrivateID");
                if (privateIDElement != null) {
                    String privateIDInstance;
                    privateIDInstance = privateIDElement.getTextContent();
                    result.setPrivateId(privateIDInstance);
                }

                Element statusElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null && statusElement.getTextContent() != null
                        && !statusElement.getTextContent().isEmpty()) {
                    DeploymentStatus statusInstance;
                    statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }

                Element labelElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "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 urlElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Url");
                if (urlElement != null) {
                    URI urlInstance;
                    urlInstance = new URI(urlElement.getTextContent());
                    result.setUri(urlInstance);
                }

                Element configurationElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Configuration");
                if (configurationElement != null) {
                    String configurationInstance;
                    configurationInstance = configurationElement.getTextContent() != null
                            ? new String(Base64.decode(configurationElement.getTextContent()))
                            : null;
                    result.setConfiguration(configurationInstance);
                }

                Element roleInstanceListSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleInstanceList");
                if (roleInstanceListSequenceElement != null) {
                    for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(roleInstanceListSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "RoleInstance")
                            .size(); i1 = i1 + 1) {
                        org.w3c.dom.Element roleInstanceListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(roleInstanceListSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "RoleInstance")
                                .get(i1));
                        RoleInstance roleInstanceInstance = new RoleInstance();
                        result.getRoleInstances().add(roleInstanceInstance);

                        Element roleNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleName");
                        if (roleNameElement != null) {
                            String roleNameInstance;
                            roleNameInstance = roleNameElement.getTextContent();
                            roleInstanceInstance.setRoleName(roleNameInstance);
                        }

                        Element instanceNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "InstanceName");
                        if (instanceNameElement != null) {
                            String instanceNameInstance;
                            instanceNameInstance = instanceNameElement.getTextContent();
                            roleInstanceInstance.setInstanceName(instanceNameInstance);
                        }

                        Element instanceStatusElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceStatus");
                        if (instanceStatusElement != null) {
                            String instanceStatusInstance;
                            instanceStatusInstance = instanceStatusElement.getTextContent();
                            roleInstanceInstance.setInstanceStatus(instanceStatusInstance);
                        }

                        Element instanceUpgradeDomainElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceUpgradeDomain");
                        if (instanceUpgradeDomainElement != null
                                && instanceUpgradeDomainElement.getTextContent() != null
                                && !instanceUpgradeDomainElement.getTextContent().isEmpty()) {
                            int instanceUpgradeDomainInstance;
                            instanceUpgradeDomainInstance = DatatypeConverter
                                    .parseInt(instanceUpgradeDomainElement.getTextContent());
                            roleInstanceInstance.setInstanceUpgradeDomain(instanceUpgradeDomainInstance);
                        }

                        Element instanceFaultDomainElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceFaultDomain");
                        if (instanceFaultDomainElement != null
                                && instanceFaultDomainElement.getTextContent() != null
                                && !instanceFaultDomainElement.getTextContent().isEmpty()) {
                            int instanceFaultDomainInstance;
                            instanceFaultDomainInstance = DatatypeConverter
                                    .parseInt(instanceFaultDomainElement.getTextContent());
                            roleInstanceInstance.setInstanceFaultDomain(instanceFaultDomainInstance);
                        }

                        Element instanceSizeElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "InstanceSize");
                        if (instanceSizeElement != null) {
                            String instanceSizeInstance;
                            instanceSizeInstance = instanceSizeElement.getTextContent();
                            roleInstanceInstance.setInstanceSize(instanceSizeInstance);
                        }

                        Element instanceStateDetailsElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceStateDetails");
                        if (instanceStateDetailsElement != null) {
                            String instanceStateDetailsInstance;
                            instanceStateDetailsInstance = instanceStateDetailsElement.getTextContent();
                            roleInstanceInstance.setInstanceStateDetails(instanceStateDetailsInstance);
                        }

                        Element instanceErrorCodeElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceErrorCode");
                        if (instanceErrorCodeElement != null) {
                            String instanceErrorCodeInstance;
                            instanceErrorCodeInstance = instanceErrorCodeElement.getTextContent();
                            roleInstanceInstance.setInstanceErrorCode(instanceErrorCodeInstance);
                        }

                        Element ipAddressElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "IpAddress");
                        if (ipAddressElement != null) {
                            InetAddress ipAddressInstance;
                            ipAddressInstance = InetAddress.getByName(ipAddressElement.getTextContent());
                            roleInstanceInstance.setIPAddress(ipAddressInstance);
                        }

                        Element instanceEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceEndpoints");
                        if (instanceEndpointsSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(instanceEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InstanceEndpoint")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element instanceEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(instanceEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InstanceEndpoint")
                                        .get(i2));
                                InstanceEndpoint instanceEndpointInstance = new InstanceEndpoint();
                                roleInstanceInstance.getInstanceEndpoints().add(instanceEndpointInstance);

                                Element localPortElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LocalPort");
                                if (localPortElement != null && localPortElement.getTextContent() != null
                                        && !localPortElement.getTextContent().isEmpty()) {
                                    int localPortInstance;
                                    localPortInstance = DatatypeConverter
                                            .parseInt(localPortElement.getTextContent());
                                    instanceEndpointInstance.setLocalPort(localPortInstance);
                                }

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    instanceEndpointInstance.setName(nameInstance2);
                                }

                                Element publicPortElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "PublicPort");
                                if (publicPortElement != null) {
                                    int publicPortInstance;
                                    publicPortInstance = DatatypeConverter
                                            .parseInt(publicPortElement.getTextContent());
                                    instanceEndpointInstance.setPort(publicPortInstance);
                                }

                                Element protocolElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement != null) {
                                    String protocolInstance;
                                    protocolInstance = protocolElement.getTextContent();
                                    instanceEndpointInstance.setProtocol(protocolInstance);
                                }

                                Element vipElement = XmlUtility.getElementByTagNameNS(instanceEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Vip");
                                if (vipElement != null) {
                                    InetAddress vipInstance;
                                    vipInstance = InetAddress.getByName(vipElement.getTextContent());
                                    instanceEndpointInstance.setVirtualIPAddress(vipInstance);
                                }

                                Element idleTimeoutInMinutesElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement != null
                                        && idleTimeoutInMinutesElement.getTextContent() != null
                                        && !idleTimeoutInMinutesElement.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance;
                                    idleTimeoutInMinutesInstance = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement.getTextContent());
                                    instanceEndpointInstance
                                            .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance);
                                }
                            }
                        }

                        Element guestAgentStatusElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "GuestAgentStatus");
                        if (guestAgentStatusElement != null) {
                            GuestAgentStatus guestAgentStatusInstance = new GuestAgentStatus();
                            roleInstanceInstance.setGuestAgentStatus(guestAgentStatusInstance);

                            Element protocolVersionElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "ProtocolVersion");
                            if (protocolVersionElement != null) {
                                String protocolVersionInstance;
                                protocolVersionInstance = protocolVersionElement.getTextContent();
                                guestAgentStatusInstance.setProtocolVersion(protocolVersionInstance);
                            }

                            Element timestampElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Timestamp");
                            if (timestampElement != null && timestampElement.getTextContent() != null
                                    && !timestampElement.getTextContent().isEmpty()) {
                                Calendar timestampInstance;
                                timestampInstance = DatatypeConverter
                                        .parseDateTime(timestampElement.getTextContent());
                                guestAgentStatusInstance.setTimestamp(timestampInstance);
                            }

                            Element guestAgentVersionElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "GuestAgentVersion");
                            if (guestAgentVersionElement != null) {
                                String guestAgentVersionInstance;
                                guestAgentVersionInstance = guestAgentVersionElement.getTextContent();
                                guestAgentStatusInstance.setGuestAgentVersion(guestAgentVersionInstance);
                            }

                            Element statusElement2 = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Status");
                            if (statusElement2 != null) {
                                String statusInstance2;
                                statusInstance2 = statusElement2.getTextContent();
                                guestAgentStatusInstance.setStatus(statusInstance2);
                            }

                            Element codeElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Code");
                            if (codeElement != null && codeElement.getTextContent() != null
                                    && !codeElement.getTextContent().isEmpty()) {
                                int codeInstance;
                                codeInstance = DatatypeConverter.parseInt(codeElement.getTextContent());
                                guestAgentStatusInstance.setCode(codeInstance);
                            }

                            Element messageElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Message");
                            if (messageElement != null) {
                                GuestAgentMessage messageInstance = new GuestAgentMessage();
                                guestAgentStatusInstance.setMessage(messageInstance);

                                Element messageResourceIdElement = XmlUtility.getElementByTagNameNS(
                                        messageElement, "http://schemas.microsoft.com/windowsazure",
                                        "MessageResourceId");
                                if (messageResourceIdElement != null) {
                                    String messageResourceIdInstance;
                                    messageResourceIdInstance = messageResourceIdElement.getTextContent();
                                    messageInstance.setMessageResourceId(messageResourceIdInstance);
                                }

                                Element paramListSequenceElement = XmlUtility.getElementByTagNameNS(
                                        messageElement, "http://schemas.microsoft.com/windowsazure",
                                        "ParamList");
                                if (paramListSequenceElement != null) {
                                    for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(paramListSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Param")
                                            .size(); i3 = i3 + 1) {
                                        org.w3c.dom.Element paramListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(paramListSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Param")
                                                .get(i3));
                                        messageInstance.getParamList().add(paramListElement.getTextContent());
                                    }
                                }
                            }

                            Element formattedMessageElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "FormattedMessage");
                            if (formattedMessageElement != null) {
                                GuestAgentFormattedMessage formattedMessageInstance = new GuestAgentFormattedMessage();
                                guestAgentStatusInstance.setFormattedMessage(formattedMessageInstance);

                                Element languageElement = XmlUtility.getElementByTagNameNS(
                                        formattedMessageElement, "http://schemas.microsoft.com/windowsazure",
                                        "Language");
                                if (languageElement != null) {
                                    String languageInstance;
                                    languageInstance = languageElement.getTextContent();
                                    formattedMessageInstance.setLanguage(languageInstance);
                                }

                                Element messageElement2 = XmlUtility.getElementByTagNameNS(
                                        formattedMessageElement, "http://schemas.microsoft.com/windowsazure",
                                        "Message");
                                if (messageElement2 != null) {
                                    String messageInstance2;
                                    messageInstance2 = messageElement2.getTextContent();
                                    formattedMessageInstance.setMessage(messageInstance2);
                                }
                            }
                        }

                        Element resourceExtensionStatusListSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "ResourceExtensionStatusList");
                        if (resourceExtensionStatusListSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(resourceExtensionStatusListSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ResourceExtensionStatus")
                                    .size(); i4 = i4 + 1) {
                                org.w3c.dom.Element resourceExtensionStatusListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(resourceExtensionStatusListSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionStatus")
                                        .get(i4));
                                ResourceExtensionStatus resourceExtensionStatusInstance = new ResourceExtensionStatus();
                                roleInstanceInstance.getResourceExtensionStatusList()
                                        .add(resourceExtensionStatusInstance);

                                Element handlerNameElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "HandlerName");
                                if (handlerNameElement != null) {
                                    String handlerNameInstance;
                                    handlerNameInstance = handlerNameElement.getTextContent();
                                    resourceExtensionStatusInstance.setHandlerName(handlerNameInstance);
                                }

                                Element versionElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Version");
                                if (versionElement != null) {
                                    String versionInstance;
                                    versionInstance = versionElement.getTextContent();
                                    resourceExtensionStatusInstance.setVersion(versionInstance);
                                }

                                Element statusElement3 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Status");
                                if (statusElement3 != null) {
                                    String statusInstance3;
                                    statusInstance3 = statusElement3.getTextContent();
                                    resourceExtensionStatusInstance.setStatus(statusInstance3);
                                }

                                Element codeElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Code");
                                if (codeElement2 != null && codeElement2.getTextContent() != null
                                        && !codeElement2.getTextContent().isEmpty()) {
                                    int codeInstance2;
                                    codeInstance2 = DatatypeConverter.parseInt(codeElement2.getTextContent());
                                    resourceExtensionStatusInstance.setCode(codeInstance2);
                                }

                                Element messageElement3 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Message");
                                if (messageElement3 != null) {
                                    GuestAgentMessage messageInstance3 = new GuestAgentMessage();
                                    resourceExtensionStatusInstance.setMessage(messageInstance3);

                                    Element messageResourceIdElement2 = XmlUtility.getElementByTagNameNS(
                                            messageElement3, "http://schemas.microsoft.com/windowsazure",
                                            "MessageResourceId");
                                    if (messageResourceIdElement2 != null) {
                                        String messageResourceIdInstance2;
                                        messageResourceIdInstance2 = messageResourceIdElement2.getTextContent();
                                        messageInstance3.setMessageResourceId(messageResourceIdInstance2);
                                    }

                                    Element paramListSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                            messageElement3, "http://schemas.microsoft.com/windowsazure",
                                            "ParamList");
                                    if (paramListSequenceElement2 != null) {
                                        for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(paramListSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure", "Param")
                                                .size(); i5 = i5 + 1) {
                                            org.w3c.dom.Element paramListElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(paramListSequenceElement2,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Param")
                                                    .get(i5));
                                            messageInstance3.getParamList()
                                                    .add(paramListElement2.getTextContent());
                                        }
                                    }
                                }

                                Element formattedMessageElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "FormattedMessage");
                                if (formattedMessageElement2 != null) {
                                    GuestAgentFormattedMessage formattedMessageInstance2 = new GuestAgentFormattedMessage();
                                    resourceExtensionStatusInstance
                                            .setFormattedMessage(formattedMessageInstance2);

                                    Element languageElement2 = XmlUtility.getElementByTagNameNS(
                                            formattedMessageElement2,
                                            "http://schemas.microsoft.com/windowsazure", "Language");
                                    if (languageElement2 != null) {
                                        String languageInstance2;
                                        languageInstance2 = languageElement2.getTextContent();
                                        formattedMessageInstance2.setLanguage(languageInstance2);
                                    }

                                    Element messageElement4 = XmlUtility.getElementByTagNameNS(
                                            formattedMessageElement2,
                                            "http://schemas.microsoft.com/windowsazure", "Message");
                                    if (messageElement4 != null) {
                                        String messageInstance4;
                                        messageInstance4 = messageElement4.getTextContent();
                                        formattedMessageInstance2.setMessage(messageInstance4);
                                    }
                                }

                                Element extensionSettingStatusElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "ExtensionSettingStatus");
                                if (extensionSettingStatusElement != null) {
                                    ResourceExtensionConfigurationStatus extensionSettingStatusInstance = new ResourceExtensionConfigurationStatus();
                                    resourceExtensionStatusInstance
                                            .setExtensionSettingStatus(extensionSettingStatusInstance);

                                    Element timestampElement2 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Timestamp");
                                    if (timestampElement2 != null && timestampElement2.getTextContent() != null
                                            && !timestampElement2.getTextContent().isEmpty()) {
                                        Calendar timestampInstance2;
                                        timestampInstance2 = DatatypeConverter
                                                .parseDateTime(timestampElement2.getTextContent());
                                        extensionSettingStatusInstance.setTimestamp(timestampInstance2);
                                    }

                                    Element configurationAppliedTimeElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ConfigurationAppliedTime");
                                    if (configurationAppliedTimeElement != null
                                            && configurationAppliedTimeElement.getTextContent() != null
                                            && !configurationAppliedTimeElement.getTextContent().isEmpty()) {
                                        Calendar configurationAppliedTimeInstance;
                                        configurationAppliedTimeInstance = DatatypeConverter.parseDateTime(
                                                configurationAppliedTimeElement.getTextContent());
                                        extensionSettingStatusInstance
                                                .setConfigurationAppliedTime(configurationAppliedTimeInstance);
                                    }

                                    Element nameElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement3 != null) {
                                        String nameInstance3;
                                        nameInstance3 = nameElement3.getTextContent();
                                        extensionSettingStatusInstance.setName(nameInstance3);
                                    }

                                    Element operationElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Operation");
                                    if (operationElement != null) {
                                        String operationInstance;
                                        operationInstance = operationElement.getTextContent();
                                        extensionSettingStatusInstance.setOperation(operationInstance);
                                    }

                                    Element statusElement4 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Status");
                                    if (statusElement4 != null) {
                                        String statusInstance4;
                                        statusInstance4 = statusElement4.getTextContent();
                                        extensionSettingStatusInstance.setStatus(statusInstance4);
                                    }

                                    Element codeElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Code");
                                    if (codeElement3 != null && codeElement3.getTextContent() != null
                                            && !codeElement3.getTextContent().isEmpty()) {
                                        int codeInstance3;
                                        codeInstance3 = DatatypeConverter
                                                .parseInt(codeElement3.getTextContent());
                                        extensionSettingStatusInstance.setCode(codeInstance3);
                                    }

                                    Element messageElement5 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Message");
                                    if (messageElement5 != null) {
                                        GuestAgentMessage messageInstance5 = new GuestAgentMessage();
                                        extensionSettingStatusInstance.setMessage(messageInstance5);

                                        Element messageResourceIdElement3 = XmlUtility.getElementByTagNameNS(
                                                messageElement5, "http://schemas.microsoft.com/windowsazure",
                                                "MessageResourceId");
                                        if (messageResourceIdElement3 != null) {
                                            String messageResourceIdInstance3;
                                            messageResourceIdInstance3 = messageResourceIdElement3
                                                    .getTextContent();
                                            messageInstance5.setMessageResourceId(messageResourceIdInstance3);
                                        }

                                        Element paramListSequenceElement3 = XmlUtility.getElementByTagNameNS(
                                                messageElement5, "http://schemas.microsoft.com/windowsazure",
                                                "ParamList");
                                        if (paramListSequenceElement3 != null) {
                                            for (int i6 = 0; i6 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(paramListSequenceElement3,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Param")
                                                    .size(); i6 = i6 + 1) {
                                                org.w3c.dom.Element paramListElement3 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(paramListSequenceElement3,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "Param")
                                                        .get(i6));
                                                messageInstance5.getParamList()
                                                        .add(paramListElement3.getTextContent());
                                            }
                                        }
                                    }

                                    Element formattedMessageElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "FormattedMessage");
                                    if (formattedMessageElement3 != null) {
                                        GuestAgentFormattedMessage formattedMessageInstance3 = new GuestAgentFormattedMessage();
                                        extensionSettingStatusInstance
                                                .setFormattedMessage(formattedMessageInstance3);

                                        Element languageElement3 = XmlUtility.getElementByTagNameNS(
                                                formattedMessageElement3,
                                                "http://schemas.microsoft.com/windowsazure", "Language");
                                        if (languageElement3 != null) {
                                            String languageInstance3;
                                            languageInstance3 = languageElement3.getTextContent();
                                            formattedMessageInstance3.setLanguage(languageInstance3);
                                        }

                                        Element messageElement6 = XmlUtility.getElementByTagNameNS(
                                                formattedMessageElement3,
                                                "http://schemas.microsoft.com/windowsazure", "Message");
                                        if (messageElement6 != null) {
                                            String messageInstance6;
                                            messageInstance6 = messageElement6.getTextContent();
                                            formattedMessageInstance3.setMessage(messageInstance6);
                                        }
                                    }

                                    Element subStatusListSequenceElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "SubStatusList");
                                    if (subStatusListSequenceElement != null) {
                                        for (int i7 = 0; i7 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(subStatusListSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubStatus")
                                                .size(); i7 = i7 + 1) {
                                            org.w3c.dom.Element subStatusListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(subStatusListSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "SubStatus")
                                                    .get(i7));
                                            ResourceExtensionSubStatus subStatusInstance = new ResourceExtensionSubStatus();
                                            extensionSettingStatusInstance.getSubStatusList()
                                                    .add(subStatusInstance);

                                            Element nameElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Name");
                                            if (nameElement4 != null) {
                                                String nameInstance4;
                                                nameInstance4 = nameElement4.getTextContent();
                                                subStatusInstance.setName(nameInstance4);
                                            }

                                            Element statusElement5 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Status");
                                            if (statusElement5 != null) {
                                                String statusInstance5;
                                                statusInstance5 = statusElement5.getTextContent();
                                                subStatusInstance.setStatus(statusInstance5);
                                            }

                                            Element codeElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Code");
                                            if (codeElement4 != null && codeElement4.getTextContent() != null
                                                    && !codeElement4.getTextContent().isEmpty()) {
                                                int codeInstance4;
                                                codeInstance4 = DatatypeConverter
                                                        .parseInt(codeElement4.getTextContent());
                                                subStatusInstance.setCode(codeInstance4);
                                            }

                                            Element messageElement7 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Message");
                                            if (messageElement7 != null) {
                                                GuestAgentMessage messageInstance7 = new GuestAgentMessage();
                                                subStatusInstance.setMessage(messageInstance7);

                                                Element messageResourceIdElement4 = XmlUtility
                                                        .getElementByTagNameNS(messageElement7,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "MessageResourceId");
                                                if (messageResourceIdElement4 != null) {
                                                    String messageResourceIdInstance4;
                                                    messageResourceIdInstance4 = messageResourceIdElement4
                                                            .getTextContent();
                                                    messageInstance7
                                                            .setMessageResourceId(messageResourceIdInstance4);
                                                }

                                                Element paramListSequenceElement4 = XmlUtility
                                                        .getElementByTagNameNS(messageElement7,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "ParamList");
                                                if (paramListSequenceElement4 != null) {
                                                    for (int i8 = 0; i8 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(paramListSequenceElement4,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Param")
                                                            .size(); i8 = i8 + 1) {
                                                        org.w3c.dom.Element paramListElement4 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                                .getElementsByTagNameNS(
                                                                        paramListSequenceElement4,
                                                                        "http://schemas.microsoft.com/windowsazure",
                                                                        "Param")
                                                                .get(i8));
                                                        messageInstance7.getParamList()
                                                                .add(paramListElement4.getTextContent());
                                                    }
                                                }
                                            }

                                            Element formattedMessageElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "FormattedMessage");
                                            if (formattedMessageElement4 != null) {
                                                GuestAgentFormattedMessage formattedMessageInstance4 = new GuestAgentFormattedMessage();
                                                subStatusInstance
                                                        .setFormattedMessage(formattedMessageInstance4);

                                                Element languageElement4 = XmlUtility.getElementByTagNameNS(
                                                        formattedMessageElement4,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "Language");
                                                if (languageElement4 != null) {
                                                    String languageInstance4;
                                                    languageInstance4 = languageElement4.getTextContent();
                                                    formattedMessageInstance4.setLanguage(languageInstance4);
                                                }

                                                Element messageElement8 = XmlUtility.getElementByTagNameNS(
                                                        formattedMessageElement4,
                                                        "http://schemas.microsoft.com/windowsazure", "Message");
                                                if (messageElement8 != null) {
                                                    String messageInstance8;
                                                    messageInstance8 = messageElement8.getTextContent();
                                                    formattedMessageInstance4.setMessage(messageInstance8);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        Element powerStateElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "PowerState");
                        if (powerStateElement != null && powerStateElement.getTextContent() != null
                                && !powerStateElement.getTextContent().isEmpty()) {
                            RoleInstancePowerState powerStateInstance;
                            powerStateInstance = RoleInstancePowerState
                                    .valueOf(powerStateElement.getTextContent());
                            roleInstanceInstance.setPowerState(powerStateInstance);
                        }

                        Element hostNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "HostName");
                        if (hostNameElement != null) {
                            String hostNameInstance;
                            hostNameInstance = hostNameElement.getTextContent();
                            roleInstanceInstance.setHostName(hostNameInstance);
                        }

                        Element remoteAccessCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "RemoteAccessCertificateThumbprint");
                        if (remoteAccessCertificateThumbprintElement != null) {
                            String remoteAccessCertificateThumbprintInstance;
                            remoteAccessCertificateThumbprintInstance = remoteAccessCertificateThumbprintElement
                                    .getTextContent();
                            roleInstanceInstance.setRemoteAccessCertificateThumbprint(
                                    remoteAccessCertificateThumbprintInstance);
                        }

                        Element publicIPsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "PublicIPs");
                        if (publicIPsSequenceElement != null) {
                            for (int i9 = 0; i9 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(publicIPsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                    .size(); i9 = i9 + 1) {
                                org.w3c.dom.Element publicIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(publicIPsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                        .get(i9));
                                RoleInstance.PublicIP publicIPInstance = new RoleInstance.PublicIP();
                                roleInstanceInstance.getPublicIPs().add(publicIPInstance);

                                Element nameElement5 = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement5 != null) {
                                    String nameInstance5;
                                    nameInstance5 = nameElement5.getTextContent();
                                    publicIPInstance.setName(nameInstance5);
                                }

                                Element addressElement = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Address");
                                if (addressElement != null) {
                                    InetAddress addressInstance;
                                    addressInstance = InetAddress.getByName(addressElement.getTextContent());
                                    publicIPInstance.setAddress(addressInstance);
                                }

                                Element idleTimeoutInMinutesElement2 = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement2 != null
                                        && idleTimeoutInMinutesElement2.getTextContent() != null
                                        && !idleTimeoutInMinutesElement2.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance2;
                                    idleTimeoutInMinutesInstance2 = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement2.getTextContent());
                                    publicIPInstance.setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance2);
                                }

                                Element domainNameLabelElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainNameLabel");
                                if (domainNameLabelElement != null) {
                                    String domainNameLabelInstance;
                                    domainNameLabelInstance = domainNameLabelElement.getTextContent();
                                    publicIPInstance.setDomainNameLabel(domainNameLabelInstance);
                                }

                                Element fqdnsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure", "Fqdns");
                                if (fqdnsSequenceElement != null) {
                                    for (int i10 = 0; i10 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(fqdnsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fqdn")
                                            .size(); i10 = i10 + 1) {
                                        org.w3c.dom.Element fqdnsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(fqdnsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Fqdn")
                                                .get(i10));
                                        publicIPInstance.getFqdns().add(fqdnsElement.getTextContent());
                                    }
                                }
                            }
                        }

                        Element networkInterfacesSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "NetworkInterfaces");
                        if (networkInterfacesSequenceElement != null) {
                            for (int i11 = 0; i11 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                    .size(); i11 = i11 + 1) {
                                org.w3c.dom.Element networkInterfacesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                        .get(i11));
                                NetworkInterfaceInstance networkInterfaceInstance = new NetworkInterfaceInstance();
                                roleInstanceInstance.getNetworkInterfaces().add(networkInterfaceInstance);

                                Element nameElement6 = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement6 != null) {
                                    String nameInstance6;
                                    nameInstance6 = nameElement6.getTextContent();
                                    networkInterfaceInstance.setName(nameInstance6);
                                }

                                Element macAddressElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "MacAddress");
                                if (macAddressElement != null) {
                                    String macAddressInstance;
                                    macAddressInstance = macAddressElement.getTextContent();
                                    networkInterfaceInstance.setMacAddress(macAddressInstance);
                                }

                                Element iPConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPConfigurations");
                                if (iPConfigurationsSequenceElement != null) {
                                    for (int i12 = 0; i12 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IPConfiguration")
                                            .size(); i12 = i12 + 1) {
                                        org.w3c.dom.Element iPConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfiguration")
                                                .get(i12));
                                        IPConfigurationInstance iPConfigurationInstance = new IPConfigurationInstance();
                                        networkInterfaceInstance.getIPConfigurations()
                                                .add(iPConfigurationInstance);

                                        Element subnetNameElement = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "SubnetName");
                                        if (subnetNameElement != null) {
                                            String subnetNameInstance;
                                            subnetNameInstance = subnetNameElement.getTextContent();
                                            iPConfigurationInstance.setSubnetName(subnetNameInstance);
                                        }

                                        Element addressElement2 = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Address");
                                        if (addressElement2 != null) {
                                            String addressInstance2;
                                            addressInstance2 = addressElement2.getTextContent();
                                            iPConfigurationInstance.setAddress(addressInstance2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                Element upgradeStatusElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "UpgradeStatus");
                if (upgradeStatusElement != null) {
                    UpgradeStatus upgradeStatusInstance = new UpgradeStatus();
                    result.setUpgradeStatus(upgradeStatusInstance);

                    Element upgradeTypeElement = XmlUtility.getElementByTagNameNS(upgradeStatusElement,
                            "http://schemas.microsoft.com/windowsazure", "UpgradeType");
                    if (upgradeTypeElement != null && upgradeTypeElement.getTextContent() != null
                            && !upgradeTypeElement.getTextContent().isEmpty()) {
                        DeploymentUpgradeType upgradeTypeInstance;
                        upgradeTypeInstance = DeploymentUpgradeType
                                .valueOf(upgradeTypeElement.getTextContent());
                        upgradeStatusInstance.setUpgradeType(upgradeTypeInstance);
                    }

                    Element currentUpgradeDomainStateElement = XmlUtility.getElementByTagNameNS(
                            upgradeStatusElement, "http://schemas.microsoft.com/windowsazure",
                            "CurrentUpgradeDomainState");
                    if (currentUpgradeDomainStateElement != null
                            && currentUpgradeDomainStateElement.getTextContent() != null
                            && !currentUpgradeDomainStateElement.getTextContent().isEmpty()) {
                        UpgradeDomainState currentUpgradeDomainStateInstance;
                        currentUpgradeDomainStateInstance = UpgradeDomainState
                                .valueOf(currentUpgradeDomainStateElement.getTextContent());
                        upgradeStatusInstance.setCurrentUpgradeDomainState(currentUpgradeDomainStateInstance);
                    }

                    Element currentUpgradeDomainElement = XmlUtility.getElementByTagNameNS(upgradeStatusElement,
                            "http://schemas.microsoft.com/windowsazure", "CurrentUpgradeDomain");
                    if (currentUpgradeDomainElement != null) {
                        int currentUpgradeDomainInstance;
                        currentUpgradeDomainInstance = DatatypeConverter
                                .parseInt(currentUpgradeDomainElement.getTextContent());
                        upgradeStatusInstance.setCurrentUpgradeDomain(currentUpgradeDomainInstance);
                    }
                }

                Element upgradeDomainCountElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "UpgradeDomainCount");
                if (upgradeDomainCountElement != null) {
                    int upgradeDomainCountInstance;
                    upgradeDomainCountInstance = DatatypeConverter
                            .parseInt(upgradeDomainCountElement.getTextContent());
                    result.setUpgradeDomainCount(upgradeDomainCountInstance);
                }

                Element roleListSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleList");
                if (roleListSequenceElement != null) {
                    for (int i13 = 0; i13 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(roleListSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "Role")
                            .size(); i13 = i13 + 1) {
                        org.w3c.dom.Element roleListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(roleListSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Role")
                                .get(i13));
                        Role roleInstance = new Role();
                        result.getRoles().add(roleInstance);

                        Element roleNameElement2 = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleName");
                        if (roleNameElement2 != null) {
                            String roleNameInstance2;
                            roleNameInstance2 = roleNameElement2.getTextContent();
                            roleInstance.setRoleName(roleNameInstance2);
                        }

                        Element osVersionElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "OsVersion");
                        if (osVersionElement != null) {
                            String osVersionInstance;
                            osVersionInstance = osVersionElement.getTextContent();
                            roleInstance.setOSVersion(osVersionInstance);
                        }

                        Element roleTypeElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleType");
                        if (roleTypeElement != null) {
                            String roleTypeInstance;
                            roleTypeInstance = roleTypeElement.getTextContent();
                            roleInstance.setRoleType(roleTypeInstance);
                        }

                        Element configurationSetsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "ConfigurationSets");
                        if (configurationSetsSequenceElement != null) {
                            for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(configurationSetsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                    .size(); i14 = i14 + 1) {
                                org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(configurationSetsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                        .get(i14));
                                ConfigurationSet configurationSetInstance = new ConfigurationSet();
                                roleInstance.getConfigurationSets().add(configurationSetInstance);

                                Element configurationSetTypeElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ConfigurationSetType");
                                if (configurationSetTypeElement != null) {
                                    String configurationSetTypeInstance;
                                    configurationSetTypeInstance = configurationSetTypeElement.getTextContent();
                                    configurationSetInstance
                                            .setConfigurationSetType(configurationSetTypeInstance);
                                }

                                Element inputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "InputEndpoints");
                                if (inputEndpointsSequenceElement != null) {
                                    for (int i15 = 0; i15 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "InputEndpoint")
                                            .size(); i15 = i15 + 1) {
                                        org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "InputEndpoint")
                                                .get(i15));
                                        InputEndpoint inputEndpointInstance = new InputEndpoint();
                                        configurationSetInstance.getInputEndpoints().add(inputEndpointInstance);

                                        Element loadBalancedEndpointSetNameElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "LoadBalancedEndpointSetName");
                                        if (loadBalancedEndpointSetNameElement != null) {
                                            String loadBalancedEndpointSetNameInstance;
                                            loadBalancedEndpointSetNameInstance = loadBalancedEndpointSetNameElement
                                                    .getTextContent();
                                            inputEndpointInstance.setLoadBalancedEndpointSetName(
                                                    loadBalancedEndpointSetNameInstance);
                                        }

                                        Element localPortElement2 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "LocalPort");
                                        if (localPortElement2 != null
                                                && localPortElement2.getTextContent() != null
                                                && !localPortElement2.getTextContent().isEmpty()) {
                                            int localPortInstance2;
                                            localPortInstance2 = DatatypeConverter
                                                    .parseInt(localPortElement2.getTextContent());
                                            inputEndpointInstance.setLocalPort(localPortInstance2);
                                        }

                                        Element nameElement7 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Name");
                                        if (nameElement7 != null) {
                                            String nameInstance7;
                                            nameInstance7 = nameElement7.getTextContent();
                                            inputEndpointInstance.setName(nameInstance7);
                                        }

                                        Element portElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Port");
                                        if (portElement != null && portElement.getTextContent() != null
                                                && !portElement.getTextContent().isEmpty()) {
                                            int portInstance;
                                            portInstance = DatatypeConverter
                                                    .parseInt(portElement.getTextContent());
                                            inputEndpointInstance.setPort(portInstance);
                                        }

                                        Element loadBalancerProbeElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "LoadBalancerProbe");
                                        if (loadBalancerProbeElement != null) {
                                            LoadBalancerProbe loadBalancerProbeInstance = new LoadBalancerProbe();
                                            inputEndpointInstance
                                                    .setLoadBalancerProbe(loadBalancerProbeInstance);

                                            Element pathElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement != null) {
                                                String pathInstance;
                                                pathInstance = pathElement.getTextContent();
                                                loadBalancerProbeInstance.setPath(pathInstance);
                                            }

                                            Element portElement2 = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Port");
                                            if (portElement2 != null) {
                                                int portInstance2;
                                                portInstance2 = DatatypeConverter
                                                        .parseInt(portElement2.getTextContent());
                                                loadBalancerProbeInstance.setPort(portInstance2);
                                            }

                                            Element protocolElement2 = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Protocol");
                                            if (protocolElement2 != null
                                                    && protocolElement2.getTextContent() != null
                                                    && !protocolElement2.getTextContent().isEmpty()) {
                                                LoadBalancerProbeTransportProtocol protocolInstance2;
                                                protocolInstance2 = com.microsoft.windowsazure.management.compute.ComputeManagementClientImpl
                                                        .parseLoadBalancerProbeTransportProtocol(
                                                                protocolElement2.getTextContent());
                                                loadBalancerProbeInstance.setProtocol(protocolInstance2);
                                            }

                                            Element intervalInSecondsElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IntervalInSeconds");
                                            if (intervalInSecondsElement != null
                                                    && intervalInSecondsElement.getTextContent() != null
                                                    && !intervalInSecondsElement.getTextContent().isEmpty()) {
                                                int intervalInSecondsInstance;
                                                intervalInSecondsInstance = DatatypeConverter
                                                        .parseInt(intervalInSecondsElement.getTextContent());
                                                loadBalancerProbeInstance
                                                        .setIntervalInSeconds(intervalInSecondsInstance);
                                            }

                                            Element timeoutInSecondsElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "TimeoutInSeconds");
                                            if (timeoutInSecondsElement != null
                                                    && timeoutInSecondsElement.getTextContent() != null
                                                    && !timeoutInSecondsElement.getTextContent().isEmpty()) {
                                                int timeoutInSecondsInstance;
                                                timeoutInSecondsInstance = DatatypeConverter
                                                        .parseInt(timeoutInSecondsElement.getTextContent());
                                                loadBalancerProbeInstance
                                                        .setTimeoutInSeconds(timeoutInSecondsInstance);
                                            }
                                        }

                                        Element protocolElement3 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Protocol");
                                        if (protocolElement3 != null) {
                                            String protocolInstance3;
                                            protocolInstance3 = protocolElement3.getTextContent();
                                            inputEndpointInstance.setProtocol(protocolInstance3);
                                        }

                                        Element vipElement2 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Vip");
                                        if (vipElement2 != null) {
                                            InetAddress vipInstance2;
                                            vipInstance2 = InetAddress.getByName(vipElement2.getTextContent());
                                            inputEndpointInstance.setVirtualIPAddress(vipInstance2);
                                        }

                                        Element enableDirectServerReturnElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "EnableDirectServerReturn");
                                        if (enableDirectServerReturnElement != null
                                                && enableDirectServerReturnElement.getTextContent() != null
                                                && !enableDirectServerReturnElement.getTextContent()
                                                        .isEmpty()) {
                                            boolean enableDirectServerReturnInstance;
                                            enableDirectServerReturnInstance = DatatypeConverter
                                                    .parseBoolean(enableDirectServerReturnElement
                                                            .getTextContent().toLowerCase());
                                            inputEndpointInstance.setEnableDirectServerReturn(
                                                    enableDirectServerReturnInstance);
                                        }

                                        Element loadBalancerNameElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "LoadBalancerName");
                                        if (loadBalancerNameElement != null) {
                                            String loadBalancerNameInstance;
                                            loadBalancerNameInstance = loadBalancerNameElement.getTextContent();
                                            inputEndpointInstance.setLoadBalancerName(loadBalancerNameInstance);
                                        }

                                        Element endpointAclElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "EndpointAcl");
                                        if (endpointAclElement != null) {
                                            EndpointAcl endpointAclInstance = new EndpointAcl();
                                            inputEndpointInstance.setEndpointAcl(endpointAclInstance);

                                            Element rulesSequenceElement = XmlUtility.getElementByTagNameNS(
                                                    endpointAclElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Rules");
                                            if (rulesSequenceElement != null) {
                                                for (int i16 = 0; i16 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(rulesSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "Rule")
                                                        .size(); i16 = i16 + 1) {
                                                    org.w3c.dom.Element rulesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(rulesSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Rule")
                                                            .get(i16));
                                                    AccessControlListRule ruleInstance = new AccessControlListRule();
                                                    endpointAclInstance.getRules().add(ruleInstance);

                                                    Element orderElement = XmlUtility.getElementByTagNameNS(
                                                            rulesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Order");
                                                    if (orderElement != null
                                                            && orderElement.getTextContent() != null
                                                            && !orderElement.getTextContent().isEmpty()) {
                                                        int orderInstance;
                                                        orderInstance = DatatypeConverter
                                                                .parseInt(orderElement.getTextContent());
                                                        ruleInstance.setOrder(orderInstance);
                                                    }

                                                    Element actionElement = XmlUtility.getElementByTagNameNS(
                                                            rulesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Action");
                                                    if (actionElement != null) {
                                                        String actionInstance;
                                                        actionInstance = actionElement.getTextContent();
                                                        ruleInstance.setAction(actionInstance);
                                                    }

                                                    Element remoteSubnetElement = XmlUtility
                                                            .getElementByTagNameNS(rulesElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "RemoteSubnet");
                                                    if (remoteSubnetElement != null) {
                                                        String remoteSubnetInstance;
                                                        remoteSubnetInstance = remoteSubnetElement
                                                                .getTextContent();
                                                        ruleInstance.setRemoteSubnet(remoteSubnetInstance);
                                                    }

                                                    Element descriptionElement = XmlUtility
                                                            .getElementByTagNameNS(rulesElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Description");
                                                    if (descriptionElement != null) {
                                                        String descriptionInstance;
                                                        descriptionInstance = descriptionElement
                                                                .getTextContent();
                                                        ruleInstance.setDescription(descriptionInstance);
                                                    }
                                                }
                                            }
                                        }

                                        Element idleTimeoutInMinutesElement3 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "IdleTimeoutInMinutes");
                                        if (idleTimeoutInMinutesElement3 != null
                                                && idleTimeoutInMinutesElement3.getTextContent() != null
                                                && !idleTimeoutInMinutesElement3.getTextContent().isEmpty()) {
                                            int idleTimeoutInMinutesInstance3;
                                            idleTimeoutInMinutesInstance3 = DatatypeConverter
                                                    .parseInt(idleTimeoutInMinutesElement3.getTextContent());
                                            inputEndpointInstance
                                                    .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance3);
                                        }

                                        Element loadBalancerDistributionElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "LoadBalancerDistribution");
                                        if (loadBalancerDistributionElement != null) {
                                            String loadBalancerDistributionInstance;
                                            loadBalancerDistributionInstance = loadBalancerDistributionElement
                                                    .getTextContent();
                                            inputEndpointInstance.setLoadBalancerDistribution(
                                                    loadBalancerDistributionInstance);
                                        }

                                        Element virtualIPNameElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "VirtualIPName");
                                        if (virtualIPNameElement != null) {
                                            String virtualIPNameInstance;
                                            virtualIPNameInstance = virtualIPNameElement.getTextContent();
                                            inputEndpointInstance.setVirtualIPName(virtualIPNameInstance);
                                        }
                                    }
                                }

                                Element subnetNamesSequenceElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "SubnetNames");
                                if (subnetNamesSequenceElement != null) {
                                    for (int i17 = 0; i17 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "SubnetName")
                                            .size(); i17 = i17 + 1) {
                                        org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubnetName")
                                                .get(i17));
                                        configurationSetInstance.getSubnetNames()
                                                .add(subnetNamesElement.getTextContent());
                                    }
                                }

                                Element staticVirtualNetworkIPAddressElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "StaticVirtualNetworkIPAddress");
                                if (staticVirtualNetworkIPAddressElement != null) {
                                    String staticVirtualNetworkIPAddressInstance;
                                    staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement
                                            .getTextContent();
                                    configurationSetInstance.setStaticVirtualNetworkIPAddress(
                                            staticVirtualNetworkIPAddressInstance);
                                }

                                Element publicIPsSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "PublicIPs");
                                if (publicIPsSequenceElement2 != null) {
                                    for (int i18 = 0; i18 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(publicIPsSequenceElement2,
                                                    "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                            .size(); i18 = i18 + 1) {
                                        org.w3c.dom.Element publicIPsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(publicIPsSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                                .get(i18));
                                        ConfigurationSet.PublicIP publicIPInstance2 = new ConfigurationSet.PublicIP();
                                        configurationSetInstance.getPublicIPs().add(publicIPInstance2);

                                        Element nameElement8 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "Name");
                                        if (nameElement8 != null) {
                                            String nameInstance8;
                                            nameInstance8 = nameElement8.getTextContent();
                                            publicIPInstance2.setName(nameInstance8);
                                        }

                                        Element idleTimeoutInMinutesElement4 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "IdleTimeoutInMinutes");
                                        if (idleTimeoutInMinutesElement4 != null
                                                && idleTimeoutInMinutesElement4.getTextContent() != null
                                                && !idleTimeoutInMinutesElement4.getTextContent().isEmpty()) {
                                            int idleTimeoutInMinutesInstance4;
                                            idleTimeoutInMinutesInstance4 = DatatypeConverter
                                                    .parseInt(idleTimeoutInMinutesElement4.getTextContent());
                                            publicIPInstance2
                                                    .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance4);
                                        }

                                        Element domainNameLabelElement2 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "DomainNameLabel");
                                        if (domainNameLabelElement2 != null) {
                                            String domainNameLabelInstance2;
                                            domainNameLabelInstance2 = domainNameLabelElement2.getTextContent();
                                            publicIPInstance2.setDomainNameLabel(domainNameLabelInstance2);
                                        }
                                    }
                                }

                                Element networkInterfacesSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkInterfaces");
                                if (networkInterfacesSequenceElement2 != null) {
                                    for (int i19 = 0; i19 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(networkInterfacesSequenceElement2,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "NetworkInterface")
                                            .size(); i19 = i19 + 1) {
                                        org.w3c.dom.Element networkInterfacesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(networkInterfacesSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "NetworkInterface")
                                                .get(i19));
                                        NetworkInterface networkInterfaceInstance2 = new NetworkInterface();
                                        configurationSetInstance.getNetworkInterfaces()
                                                .add(networkInterfaceInstance2);

                                        Element nameElement9 = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure", "Name");
                                        if (nameElement9 != null) {
                                            String nameInstance9;
                                            nameInstance9 = nameElement9.getTextContent();
                                            networkInterfaceInstance2.setName(nameInstance9);
                                        }

                                        Element iPConfigurationsSequenceElement2 = XmlUtility
                                                .getElementByTagNameNS(networkInterfacesElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfigurations");
                                        if (iPConfigurationsSequenceElement2 != null) {
                                            for (int i20 = 0; i20 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(iPConfigurationsSequenceElement2,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "IPConfiguration")
                                                    .size(); i20 = i20 + 1) {
                                                org.w3c.dom.Element iPConfigurationsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(
                                                                iPConfigurationsSequenceElement2,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "IPConfiguration")
                                                        .get(i20));
                                                IPConfiguration iPConfigurationInstance2 = new IPConfiguration();
                                                networkInterfaceInstance2.getIPConfigurations()
                                                        .add(iPConfigurationInstance2);

                                                Element subnetNameElement2 = XmlUtility.getElementByTagNameNS(
                                                        iPConfigurationsElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubnetName");
                                                if (subnetNameElement2 != null) {
                                                    String subnetNameInstance2;
                                                    subnetNameInstance2 = subnetNameElement2.getTextContent();
                                                    iPConfigurationInstance2.setSubnetName(subnetNameInstance2);
                                                }

                                                Element staticVirtualNetworkIPAddressElement2 = XmlUtility
                                                        .getElementByTagNameNS(iPConfigurationsElement2,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "StaticVirtualNetworkIPAddress");
                                                if (staticVirtualNetworkIPAddressElement2 != null) {
                                                    String staticVirtualNetworkIPAddressInstance2;
                                                    staticVirtualNetworkIPAddressInstance2 = staticVirtualNetworkIPAddressElement2
                                                            .getTextContent();
                                                    iPConfigurationInstance2.setStaticVirtualNetworkIPAddress(
                                                            staticVirtualNetworkIPAddressInstance2);
                                                }
                                            }
                                        }

                                        Element networkSecurityGroupElement = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "NetworkSecurityGroup");
                                        if (networkSecurityGroupElement != null) {
                                            String networkSecurityGroupInstance;
                                            networkSecurityGroupInstance = networkSecurityGroupElement
                                                    .getTextContent();
                                            networkInterfaceInstance2
                                                    .setNetworkSecurityGroup(networkSecurityGroupInstance);
                                        }

                                        Element iPForwardingElement = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure", "IPForwarding");
                                        if (iPForwardingElement != null) {
                                            String iPForwardingInstance;
                                            iPForwardingInstance = iPForwardingElement.getTextContent();
                                            networkInterfaceInstance2.setIPForwarding(iPForwardingInstance);
                                        }
                                    }
                                }

                                Element networkSecurityGroupElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkSecurityGroup");
                                if (networkSecurityGroupElement2 != null) {
                                    String networkSecurityGroupInstance2;
                                    networkSecurityGroupInstance2 = networkSecurityGroupElement2
                                            .getTextContent();
                                    configurationSetInstance
                                            .setNetworkSecurityGroup(networkSecurityGroupInstance2);
                                }

                                Element iPForwardingElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPForwarding");
                                if (iPForwardingElement2 != null) {
                                    String iPForwardingInstance2;
                                    iPForwardingInstance2 = iPForwardingElement2.getTextContent();
                                    configurationSetInstance.setIPForwarding(iPForwardingInstance2);
                                }

                                Element computerNameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ComputerName");
                                if (computerNameElement != null) {
                                    String computerNameInstance;
                                    computerNameInstance = computerNameElement.getTextContent();
                                    configurationSetInstance.setComputerName(computerNameInstance);
                                }

                                Element adminPasswordElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdminPassword");
                                if (adminPasswordElement != null) {
                                    String adminPasswordInstance;
                                    adminPasswordInstance = adminPasswordElement.getTextContent();
                                    configurationSetInstance.setAdminPassword(adminPasswordInstance);
                                }

                                Element resetPasswordOnFirstLogonElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ResetPasswordOnFirstLogon");
                                if (resetPasswordOnFirstLogonElement != null
                                        && resetPasswordOnFirstLogonElement.getTextContent() != null
                                        && !resetPasswordOnFirstLogonElement.getTextContent().isEmpty()) {
                                    boolean resetPasswordOnFirstLogonInstance;
                                    resetPasswordOnFirstLogonInstance = DatatypeConverter.parseBoolean(
                                            resetPasswordOnFirstLogonElement.getTextContent().toLowerCase());
                                    configurationSetInstance
                                            .setResetPasswordOnFirstLogon(resetPasswordOnFirstLogonInstance);
                                }

                                Element enableAutomaticUpdatesElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "EnableAutomaticUpdates");
                                if (enableAutomaticUpdatesElement != null
                                        && enableAutomaticUpdatesElement.getTextContent() != null
                                        && !enableAutomaticUpdatesElement.getTextContent().isEmpty()) {
                                    boolean enableAutomaticUpdatesInstance;
                                    enableAutomaticUpdatesInstance = DatatypeConverter.parseBoolean(
                                            enableAutomaticUpdatesElement.getTextContent().toLowerCase());
                                    configurationSetInstance
                                            .setEnableAutomaticUpdates(enableAutomaticUpdatesInstance);
                                }

                                Element timeZoneElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "TimeZone");
                                if (timeZoneElement != null) {
                                    String timeZoneInstance;
                                    timeZoneInstance = timeZoneElement.getTextContent();
                                    configurationSetInstance.setTimeZone(timeZoneInstance);
                                }

                                Element domainJoinElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainJoin");
                                if (domainJoinElement != null) {
                                    DomainJoinSettings domainJoinInstance = new DomainJoinSettings();
                                    configurationSetInstance.setDomainJoin(domainJoinInstance);

                                    Element credentialsElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "Credentials");
                                    if (credentialsElement != null) {
                                        DomainJoinCredentials credentialsInstance = new DomainJoinCredentials();
                                        domainJoinInstance.setCredentials(credentialsInstance);

                                        Element domainElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Domain");
                                        if (domainElement != null) {
                                            String domainInstance;
                                            domainInstance = domainElement.getTextContent();
                                            credentialsInstance.setDomain(domainInstance);
                                        }

                                        Element usernameElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Username");
                                        if (usernameElement != null) {
                                            String usernameInstance;
                                            usernameInstance = usernameElement.getTextContent();
                                            credentialsInstance.setUserName(usernameInstance);
                                        }

                                        Element passwordElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Password");
                                        if (passwordElement != null) {
                                            String passwordInstance;
                                            passwordInstance = passwordElement.getTextContent();
                                            credentialsInstance.setPassword(passwordInstance);
                                        }
                                    }

                                    Element joinDomainElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "JoinDomain");
                                    if (joinDomainElement != null) {
                                        String joinDomainInstance;
                                        joinDomainInstance = joinDomainElement.getTextContent();
                                        domainJoinInstance.setDomainToJoin(joinDomainInstance);
                                    }

                                    Element machineObjectOUElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "MachineObjectOU");
                                    if (machineObjectOUElement != null) {
                                        String machineObjectOUInstance;
                                        machineObjectOUInstance = machineObjectOUElement.getTextContent();
                                        domainJoinInstance.setLdapMachineObjectOU(machineObjectOUInstance);
                                    }

                                    Element provisioningElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "Provisioning");
                                    if (provisioningElement != null) {
                                        DomainJoinProvisioning provisioningInstance = new DomainJoinProvisioning();
                                        domainJoinInstance.setProvisioning(provisioningInstance);

                                        Element accountDataElement = XmlUtility.getElementByTagNameNS(
                                                provisioningElement,
                                                "http://schemas.microsoft.com/windowsazure", "AccountData");
                                        if (accountDataElement != null) {
                                            String accountDataInstance;
                                            accountDataInstance = accountDataElement.getTextContent();
                                            provisioningInstance.setAccountData(accountDataInstance);
                                        }
                                    }
                                }

                                Element storedCertificateSettingsSequenceElement = XmlUtility
                                        .getElementByTagNameNS(configurationSetsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "StoredCertificateSettings");
                                if (storedCertificateSettingsSequenceElement != null) {
                                    for (int i21 = 0; i21 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(storedCertificateSettingsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "CertificateSetting")
                                            .size(); i21 = i21 + 1) {
                                        org.w3c.dom.Element storedCertificateSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(
                                                        storedCertificateSettingsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "CertificateSetting")
                                                .get(i21));
                                        StoredCertificateSettings certificateSettingInstance = new StoredCertificateSettings();
                                        configurationSetInstance.getStoredCertificateSettings()
                                                .add(certificateSettingInstance);

                                        Element storeLocationElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "StoreLocation");
                                        if (storeLocationElement != null) {
                                        }

                                        Element storeNameElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "StoreName");
                                        if (storeNameElement != null) {
                                            String storeNameInstance;
                                            storeNameInstance = storeNameElement.getTextContent();
                                            certificateSettingInstance.setStoreName(storeNameInstance);
                                        }

                                        Element thumbprintElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Thumbprint");
                                        if (thumbprintElement != null) {
                                            String thumbprintInstance;
                                            thumbprintInstance = thumbprintElement.getTextContent();
                                            certificateSettingInstance.setThumbprint(thumbprintInstance);
                                        }
                                    }
                                }

                                Element winRMElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "WinRM");
                                if (winRMElement != null) {
                                    WindowsRemoteManagementSettings winRMInstance = new WindowsRemoteManagementSettings();
                                    configurationSetInstance.setWindowsRemoteManagement(winRMInstance);

                                    Element listenersSequenceElement = XmlUtility.getElementByTagNameNS(
                                            winRMElement, "http://schemas.microsoft.com/windowsazure",
                                            "Listeners");
                                    if (listenersSequenceElement != null) {
                                        for (int i22 = 0; i22 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(listenersSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Listener")
                                                .size(); i22 = i22 + 1) {
                                            org.w3c.dom.Element listenersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(listenersSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Listener")
                                                    .get(i22));
                                            WindowsRemoteManagementListener listenerInstance = new WindowsRemoteManagementListener();
                                            winRMInstance.getListeners().add(listenerInstance);

                                            Element protocolElement4 = XmlUtility.getElementByTagNameNS(
                                                    listenersElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Protocol");
                                            if (protocolElement4 != null
                                                    && protocolElement4.getTextContent() != null
                                                    && !protocolElement4.getTextContent().isEmpty()) {
                                                VirtualMachineWindowsRemoteManagementListenerType protocolInstance4;
                                                protocolInstance4 = VirtualMachineWindowsRemoteManagementListenerType
                                                        .valueOf(protocolElement4.getTextContent());
                                                listenerInstance.setListenerType(protocolInstance4);
                                            }

                                            Element certificateThumbprintElement = XmlUtility
                                                    .getElementByTagNameNS(listenersElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "CertificateThumbprint");
                                            if (certificateThumbprintElement != null) {
                                                String certificateThumbprintInstance;
                                                certificateThumbprintInstance = certificateThumbprintElement
                                                        .getTextContent();
                                                listenerInstance.setCertificateThumbprint(
                                                        certificateThumbprintInstance);
                                            }
                                        }
                                    }
                                }

                                Element adminUsernameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdminUsername");
                                if (adminUsernameElement != null) {
                                    String adminUsernameInstance;
                                    adminUsernameInstance = adminUsernameElement.getTextContent();
                                    configurationSetInstance.setAdminUserName(adminUsernameInstance);
                                }

                                Element additionalUnattendContentElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdditionalUnattendContent");
                                if (additionalUnattendContentElement != null) {
                                    AdditionalUnattendContentSettings additionalUnattendContentInstance = new AdditionalUnattendContentSettings();
                                    configurationSetInstance
                                            .setAdditionalUnattendContent(additionalUnattendContentInstance);

                                    Element passesSequenceElement = XmlUtility.getElementByTagNameNS(
                                            additionalUnattendContentElement,
                                            "http://schemas.microsoft.com/windowsazure", "Passes");
                                    if (passesSequenceElement != null) {
                                        for (int i23 = 0; i23 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(passesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "UnattendPass")
                                                .size(); i23 = i23 + 1) {
                                            org.w3c.dom.Element passesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(passesSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "UnattendPass")
                                                    .get(i23));
                                            UnattendPassSettings unattendPassInstance = new UnattendPassSettings();
                                            additionalUnattendContentInstance.getUnattendPasses()
                                                    .add(unattendPassInstance);

                                            Element passNameElement = XmlUtility.getElementByTagNameNS(
                                                    passesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "PassName");
                                            if (passNameElement != null) {
                                                String passNameInstance;
                                                passNameInstance = passNameElement.getTextContent();
                                                unattendPassInstance.setPassName(passNameInstance);
                                            }

                                            Element componentsSequenceElement = XmlUtility
                                                    .getElementByTagNameNS(passesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Components");
                                            if (componentsSequenceElement != null) {
                                                for (int i24 = 0; i24 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(componentsSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "UnattendComponent")
                                                        .size(); i24 = i24 + 1) {
                                                    org.w3c.dom.Element componentsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(componentsSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "UnattendComponent")
                                                            .get(i24));
                                                    UnattendComponent unattendComponentInstance = new UnattendComponent();
                                                    unattendPassInstance.getUnattendComponents()
                                                            .add(unattendComponentInstance);

                                                    Element componentNameElement = XmlUtility
                                                            .getElementByTagNameNS(componentsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentName");
                                                    if (componentNameElement != null) {
                                                        String componentNameInstance;
                                                        componentNameInstance = componentNameElement
                                                                .getTextContent();
                                                        unattendComponentInstance
                                                                .setComponentName(componentNameInstance);
                                                    }

                                                    Element componentSettingsSequenceElement = XmlUtility
                                                            .getElementByTagNameNS(componentsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentSettings");
                                                    if (componentSettingsSequenceElement != null) {
                                                        for (int i25 = 0; i25 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                                .getElementsByTagNameNS(
                                                                        componentSettingsSequenceElement,
                                                                        "http://schemas.microsoft.com/windowsazure",
                                                                        "ComponentSetting")
                                                                .size(); i25 = i25 + 1) {
                                                            org.w3c.dom.Element componentSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                                    .getElementsByTagNameNS(
                                                                            componentSettingsSequenceElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "ComponentSetting")
                                                                    .get(i25));
                                                            ComponentSetting componentSettingInstance = new ComponentSetting();
                                                            unattendComponentInstance
                                                                    .getUnattendComponentSettings()
                                                                    .add(componentSettingInstance);

                                                            Element settingNameElement = XmlUtility
                                                                    .getElementByTagNameNS(
                                                                            componentSettingsElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "SettingName");
                                                            if (settingNameElement != null) {
                                                                String settingNameInstance;
                                                                settingNameInstance = settingNameElement
                                                                        .getTextContent();
                                                                componentSettingInstance
                                                                        .setSettingName(settingNameInstance);
                                                            }

                                                            Element contentElement = XmlUtility
                                                                    .getElementByTagNameNS(
                                                                            componentSettingsElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "Content");
                                                            if (contentElement != null) {
                                                                String contentInstance;
                                                                contentInstance = contentElement
                                                                        .getTextContent() != null ? new String(
                                                                                Base64.decode(contentElement
                                                                                        .getTextContent()))
                                                                                : null;
                                                                componentSettingInstance
                                                                        .setContent(contentInstance);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                Element hostNameElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "HostName");
                                if (hostNameElement2 != null) {
                                    String hostNameInstance2;
                                    hostNameInstance2 = hostNameElement2.getTextContent();
                                    configurationSetInstance.setHostName(hostNameInstance2);
                                }

                                Element userNameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "UserName");
                                if (userNameElement != null) {
                                    String userNameInstance;
                                    userNameInstance = userNameElement.getTextContent();
                                    configurationSetInstance.setUserName(userNameInstance);
                                }

                                Element userPasswordElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "UserPassword");
                                if (userPasswordElement != null) {
                                    String userPasswordInstance;
                                    userPasswordInstance = userPasswordElement.getTextContent();
                                    configurationSetInstance.setUserPassword(userPasswordInstance);
                                }

                                Element disableSshPasswordAuthenticationElement = XmlUtility
                                        .getElementByTagNameNS(configurationSetsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DisableSshPasswordAuthentication");
                                if (disableSshPasswordAuthenticationElement != null
                                        && disableSshPasswordAuthenticationElement.getTextContent() != null
                                        && !disableSshPasswordAuthenticationElement.getTextContent()
                                                .isEmpty()) {
                                    boolean disableSshPasswordAuthenticationInstance;
                                    disableSshPasswordAuthenticationInstance = DatatypeConverter
                                            .parseBoolean(disableSshPasswordAuthenticationElement
                                                    .getTextContent().toLowerCase());
                                    configurationSetInstance.setDisableSshPasswordAuthentication(
                                            disableSshPasswordAuthenticationInstance);
                                }

                                Element sSHElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                        "http://schemas.microsoft.com/windowsazure", "SSH");
                                if (sSHElement != null) {
                                    SshSettings sSHInstance = new SshSettings();
                                    configurationSetInstance.setSshSettings(sSHInstance);

                                    Element publicKeysSequenceElement = XmlUtility.getElementByTagNameNS(
                                            sSHElement, "http://schemas.microsoft.com/windowsazure",
                                            "PublicKeys");
                                    if (publicKeysSequenceElement != null) {
                                        for (int i26 = 0; i26 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(publicKeysSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "PublicKey")
                                                .size(); i26 = i26 + 1) {
                                            org.w3c.dom.Element publicKeysElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(publicKeysSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "PublicKey")
                                                    .get(i26));
                                            SshSettingPublicKey publicKeyInstance = new SshSettingPublicKey();
                                            sSHInstance.getPublicKeys().add(publicKeyInstance);

                                            Element fingerprintElement = XmlUtility.getElementByTagNameNS(
                                                    publicKeysElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fingerprint");
                                            if (fingerprintElement != null) {
                                                String fingerprintInstance;
                                                fingerprintInstance = fingerprintElement.getTextContent();
                                                publicKeyInstance.setFingerprint(fingerprintInstance);
                                            }

                                            Element pathElement2 = XmlUtility.getElementByTagNameNS(
                                                    publicKeysElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement2 != null) {
                                                String pathInstance2;
                                                pathInstance2 = pathElement2.getTextContent();
                                                publicKeyInstance.setPath(pathInstance2);
                                            }
                                        }
                                    }

                                    Element keyPairsSequenceElement = XmlUtility.getElementByTagNameNS(
                                            sSHElement, "http://schemas.microsoft.com/windowsazure",
                                            "KeyPairs");
                                    if (keyPairsSequenceElement != null) {
                                        for (int i27 = 0; i27 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(keyPairsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "KeyPair")
                                                .size(); i27 = i27 + 1) {
                                            org.w3c.dom.Element keyPairsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(keyPairsSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "KeyPair")
                                                    .get(i27));
                                            SshSettingKeyPair keyPairInstance = new SshSettingKeyPair();
                                            sSHInstance.getKeyPairs().add(keyPairInstance);

                                            Element fingerprintElement2 = XmlUtility.getElementByTagNameNS(
                                                    keyPairsElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fingerprint");
                                            if (fingerprintElement2 != null) {
                                                String fingerprintInstance2;
                                                fingerprintInstance2 = fingerprintElement2.getTextContent();
                                                keyPairInstance.setFingerprint(fingerprintInstance2);
                                            }

                                            Element pathElement3 = XmlUtility.getElementByTagNameNS(
                                                    keyPairsElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement3 != null) {
                                                String pathInstance3;
                                                pathInstance3 = pathElement3.getTextContent();
                                                keyPairInstance.setPath(pathInstance3);
                                            }
                                        }
                                    }
                                }

                                Element customDataElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "CustomData");
                                if (customDataElement != null) {
                                    String customDataInstance;
                                    customDataInstance = customDataElement.getTextContent();
                                    configurationSetInstance.setCustomData(customDataInstance);
                                }
                            }
                        }

                        Element resourceExtensionReferencesSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "ResourceExtensionReferences");
                        if (resourceExtensionReferencesSequenceElement != null) {
                            for (int i28 = 0; i28 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(resourceExtensionReferencesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ResourceExtensionReference")
                                    .size(); i28 = i28 + 1) {
                                org.w3c.dom.Element resourceExtensionReferencesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(resourceExtensionReferencesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionReference")
                                        .get(i28));
                                ResourceExtensionReference resourceExtensionReferenceInstance = new ResourceExtensionReference();
                                roleInstance.getResourceExtensionReferences()
                                        .add(resourceExtensionReferenceInstance);

                                Element referenceNameElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "ReferenceName");
                                if (referenceNameElement != null) {
                                    String referenceNameInstance;
                                    referenceNameInstance = referenceNameElement.getTextContent();
                                    resourceExtensionReferenceInstance.setReferenceName(referenceNameInstance);
                                }

                                Element publisherElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Publisher");
                                if (publisherElement != null) {
                                    String publisherInstance;
                                    publisherInstance = publisherElement.getTextContent();
                                    resourceExtensionReferenceInstance.setPublisher(publisherInstance);
                                }

                                Element nameElement10 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement10 != null) {
                                    String nameInstance10;
                                    nameInstance10 = nameElement10.getTextContent();
                                    resourceExtensionReferenceInstance.setName(nameInstance10);
                                }

                                Element versionElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Version");
                                if (versionElement2 != null) {
                                    String versionInstance2;
                                    versionInstance2 = versionElement2.getTextContent();
                                    resourceExtensionReferenceInstance.setVersion(versionInstance2);
                                }

                                Element resourceExtensionParameterValuesSequenceElement = XmlUtility
                                        .getElementByTagNameNS(resourceExtensionReferencesElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionParameterValues");
                                if (resourceExtensionParameterValuesSequenceElement != null) {
                                    for (int i29 = 0; i29 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(
                                                    resourceExtensionParameterValuesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "ResourceExtensionParameterValue")
                                            .size(); i29 = i29 + 1) {
                                        org.w3c.dom.Element resourceExtensionParameterValuesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(
                                                        resourceExtensionParameterValuesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "ResourceExtensionParameterValue")
                                                .get(i29));
                                        ResourceExtensionParameterValue resourceExtensionParameterValueInstance = new ResourceExtensionParameterValue();
                                        resourceExtensionReferenceInstance.getResourceExtensionParameterValues()
                                                .add(resourceExtensionParameterValueInstance);

                                        Element keyElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Key");
                                        if (keyElement != null) {
                                            String keyInstance;
                                            keyInstance = keyElement.getTextContent();
                                            resourceExtensionParameterValueInstance.setKey(keyInstance);
                                        }

                                        Element valueElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Value");
                                        if (valueElement != null) {
                                            String valueInstance;
                                            valueInstance = valueElement.getTextContent() != null
                                                    ? new String(Base64.decode(valueElement.getTextContent()))
                                                    : null;
                                            resourceExtensionParameterValueInstance.setValue(valueInstance);
                                        }

                                        Element typeElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Type");
                                        if (typeElement != null) {
                                            String typeInstance;
                                            typeInstance = typeElement.getTextContent();
                                            resourceExtensionParameterValueInstance.setType(typeInstance);
                                        }
                                    }
                                }

                                Element stateElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "State");
                                if (stateElement != null) {
                                    String stateInstance;
                                    stateInstance = stateElement.getTextContent();
                                    resourceExtensionReferenceInstance.setState(stateInstance);
                                }

                                Element forceUpdateElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "ForceUpdate");
                                if (forceUpdateElement != null && forceUpdateElement.getTextContent() != null
                                        && !forceUpdateElement.getTextContent().isEmpty()) {
                                    boolean forceUpdateInstance;
                                    forceUpdateInstance = DatatypeConverter
                                            .parseBoolean(forceUpdateElement.getTextContent().toLowerCase());
                                    resourceExtensionReferenceInstance.setForceUpdate(forceUpdateInstance);
                                }
                            }
                        }

                        Element vMImageNameElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "VMImageName");
                        if (vMImageNameElement != null) {
                            String vMImageNameInstance;
                            vMImageNameInstance = vMImageNameElement.getTextContent();
                            roleInstance.setVMImageName(vMImageNameInstance);
                        }

                        Element mediaLocationElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "MediaLocation");
                        if (mediaLocationElement != null) {
                            URI mediaLocationInstance;
                            mediaLocationInstance = new URI(mediaLocationElement.getTextContent());
                            roleInstance.setMediaLocation(mediaLocationInstance);
                        }

                        Element availabilitySetNameElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "AvailabilitySetName");
                        if (availabilitySetNameElement != null) {
                            String availabilitySetNameInstance;
                            availabilitySetNameInstance = availabilitySetNameElement.getTextContent();
                            roleInstance.setAvailabilitySetName(availabilitySetNameInstance);
                        }

                        Element dataVirtualHardDisksSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "DataVirtualHardDisks");
                        if (dataVirtualHardDisksSequenceElement != null) {
                            for (int i30 = 0; i30 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "DataVirtualHardDisk")
                                    .size(); i30 = i30 + 1) {
                                org.w3c.dom.Element dataVirtualHardDisksElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DataVirtualHardDisk")
                                        .get(i30));
                                DataVirtualHardDisk dataVirtualHardDiskInstance = new DataVirtualHardDisk();
                                roleInstance.getDataVirtualHardDisks().add(dataVirtualHardDiskInstance);

                                Element hostCachingElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "HostCaching");
                                if (hostCachingElement != null) {
                                    String hostCachingInstance;
                                    hostCachingInstance = hostCachingElement.getTextContent();
                                    dataVirtualHardDiskInstance.setHostCaching(hostCachingInstance);
                                }

                                Element diskLabelElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "DiskLabel");
                                if (diskLabelElement != null) {
                                    String diskLabelInstance;
                                    diskLabelInstance = diskLabelElement.getTextContent();
                                    dataVirtualHardDiskInstance.setLabel(diskLabelInstance);
                                }

                                Element diskNameElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "DiskName");
                                if (diskNameElement != null) {
                                    String diskNameInstance;
                                    diskNameInstance = diskNameElement.getTextContent();
                                    dataVirtualHardDiskInstance.setName(diskNameInstance);
                                }

                                Element lunElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "Lun");
                                if (lunElement != null && lunElement.getTextContent() != null
                                        && !lunElement.getTextContent().isEmpty()) {
                                    int lunInstance;
                                    lunInstance = DatatypeConverter.parseInt(lunElement.getTextContent());
                                    dataVirtualHardDiskInstance.setLogicalUnitNumber(lunInstance);
                                }

                                Element logicalDiskSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "LogicalDiskSizeInGB");
                                if (logicalDiskSizeInGBElement != null
                                        && logicalDiskSizeInGBElement.getTextContent() != null
                                        && !logicalDiskSizeInGBElement.getTextContent().isEmpty()) {
                                    int logicalDiskSizeInGBInstance;
                                    logicalDiskSizeInGBInstance = DatatypeConverter
                                            .parseInt(logicalDiskSizeInGBElement.getTextContent());
                                    dataVirtualHardDiskInstance
                                            .setLogicalDiskSizeInGB(logicalDiskSizeInGBInstance);
                                }

                                Element mediaLinkElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "MediaLink");
                                if (mediaLinkElement != null) {
                                    URI mediaLinkInstance;
                                    mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
                                    dataVirtualHardDiskInstance.setMediaLink(mediaLinkInstance);
                                }

                                Element sourceMediaLinkElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "SourceMediaLink");
                                if (sourceMediaLinkElement != null) {
                                    URI sourceMediaLinkInstance;
                                    sourceMediaLinkInstance = new URI(sourceMediaLinkElement.getTextContent());
                                    dataVirtualHardDiskInstance.setSourceMediaLink(sourceMediaLinkInstance);
                                }

                                Element iOTypeElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "IOType");
                                if (iOTypeElement != null) {
                                    String iOTypeInstance;
                                    iOTypeInstance = iOTypeElement.getTextContent();
                                    dataVirtualHardDiskInstance.setIOType(iOTypeInstance);
                                }
                            }
                        }

                        Element labelElement2 = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "Label");
                        if (labelElement2 != null) {
                            String labelInstance2;
                            labelInstance2 = labelElement2.getTextContent();
                            roleInstance.setLabel(labelInstance2);
                        }

                        Element oSVirtualHardDiskElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "OSVirtualHardDisk");
                        if (oSVirtualHardDiskElement != null) {
                            OSVirtualHardDisk oSVirtualHardDiskInstance = new OSVirtualHardDisk();
                            roleInstance.setOSVirtualHardDisk(oSVirtualHardDiskInstance);

                            Element hostCachingElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "HostCaching");
                            if (hostCachingElement2 != null) {
                                String hostCachingInstance2;
                                hostCachingInstance2 = hostCachingElement2.getTextContent();
                                oSVirtualHardDiskInstance.setHostCaching(hostCachingInstance2);
                            }

                            Element diskLabelElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "DiskLabel");
                            if (diskLabelElement2 != null) {
                                String diskLabelInstance2;
                                diskLabelInstance2 = diskLabelElement2.getTextContent();
                                oSVirtualHardDiskInstance.setLabel(diskLabelInstance2);
                            }

                            Element diskNameElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "DiskName");
                            if (diskNameElement2 != null) {
                                String diskNameInstance2;
                                diskNameInstance2 = diskNameElement2.getTextContent();
                                oSVirtualHardDiskInstance.setName(diskNameInstance2);
                            }

                            Element mediaLinkElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "MediaLink");
                            if (mediaLinkElement2 != null) {
                                URI mediaLinkInstance2;
                                mediaLinkInstance2 = new URI(mediaLinkElement2.getTextContent());
                                oSVirtualHardDiskInstance.setMediaLink(mediaLinkInstance2);
                            }

                            Element sourceImageNameElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "SourceImageName");
                            if (sourceImageNameElement != null) {
                                String sourceImageNameInstance;
                                sourceImageNameInstance = sourceImageNameElement.getTextContent();
                                oSVirtualHardDiskInstance.setSourceImageName(sourceImageNameInstance);
                            }

                            Element osElement = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                                    "http://schemas.microsoft.com/windowsazure", "OS");
                            if (osElement != null) {
                                String osInstance;
                                osInstance = osElement.getTextContent();
                                oSVirtualHardDiskInstance.setOperatingSystem(osInstance);
                            }

                            Element remoteSourceImageLinkElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "RemoteSourceImageLink");
                            if (remoteSourceImageLinkElement != null) {
                                URI remoteSourceImageLinkInstance;
                                remoteSourceImageLinkInstance = new URI(
                                        remoteSourceImageLinkElement.getTextContent());
                                oSVirtualHardDiskInstance
                                        .setRemoteSourceImageLink(remoteSourceImageLinkInstance);
                            }

                            Element iOTypeElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                                    "http://schemas.microsoft.com/windowsazure", "IOType");
                            if (iOTypeElement2 != null) {
                                String iOTypeInstance2;
                                iOTypeInstance2 = iOTypeElement2.getTextContent();
                                oSVirtualHardDiskInstance.setIOType(iOTypeInstance2);
                            }

                            Element resizedSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "ResizedSizeInGB");
                            if (resizedSizeInGBElement != null
                                    && resizedSizeInGBElement.getTextContent() != null
                                    && !resizedSizeInGBElement.getTextContent().isEmpty()) {
                                int resizedSizeInGBInstance;
                                resizedSizeInGBInstance = DatatypeConverter
                                        .parseInt(resizedSizeInGBElement.getTextContent());
                                oSVirtualHardDiskInstance.setResizedSizeInGB(resizedSizeInGBInstance);
                            }
                        }

                        Element roleSizeElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleSize");
                        if (roleSizeElement != null) {
                            String roleSizeInstance;
                            roleSizeInstance = roleSizeElement.getTextContent();
                            roleInstance.setRoleSize(roleSizeInstance);
                        }

                        Element defaultWinRmCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "DefaultWinRmCertificateThumbprint");
                        if (defaultWinRmCertificateThumbprintElement != null) {
                            String defaultWinRmCertificateThumbprintInstance;
                            defaultWinRmCertificateThumbprintInstance = defaultWinRmCertificateThumbprintElement
                                    .getTextContent();
                            roleInstance.setDefaultWinRmCertificateThumbprint(
                                    defaultWinRmCertificateThumbprintInstance);
                        }

                        Element provisionGuestAgentElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "ProvisionGuestAgent");
                        if (provisionGuestAgentElement != null
                                && provisionGuestAgentElement.getTextContent() != null
                                && !provisionGuestAgentElement.getTextContent().isEmpty()) {
                            boolean provisionGuestAgentInstance;
                            provisionGuestAgentInstance = DatatypeConverter
                                    .parseBoolean(provisionGuestAgentElement.getTextContent().toLowerCase());
                            roleInstance.setProvisionGuestAgent(provisionGuestAgentInstance);
                        }

                        Element vMImageInputElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "VMImageInput");
                        if (vMImageInputElement != null) {
                            VMImageInput vMImageInputInstance = new VMImageInput();
                            roleInstance.setVMImageInput(vMImageInputInstance);

                            Element oSDiskConfigurationElement = XmlUtility.getElementByTagNameNS(
                                    vMImageInputElement, "http://schemas.microsoft.com/windowsazure",
                                    "OSDiskConfiguration");
                            if (oSDiskConfigurationElement != null) {
                                OSDiskConfiguration oSDiskConfigurationInstance = new OSDiskConfiguration();
                                vMImageInputInstance.setOSDiskConfiguration(oSDiskConfigurationInstance);

                                Element resizedSizeInGBElement2 = XmlUtility.getElementByTagNameNS(
                                        oSDiskConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                        "ResizedSizeInGB");
                                if (resizedSizeInGBElement2 != null
                                        && resizedSizeInGBElement2.getTextContent() != null
                                        && !resizedSizeInGBElement2.getTextContent().isEmpty()) {
                                    int resizedSizeInGBInstance2;
                                    resizedSizeInGBInstance2 = DatatypeConverter
                                            .parseInt(resizedSizeInGBElement2.getTextContent());
                                    oSDiskConfigurationInstance.setResizedSizeInGB(resizedSizeInGBInstance2);
                                }
                            }

                            Element dataDiskConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                    vMImageInputElement, "http://schemas.microsoft.com/windowsazure",
                                    "DataDiskConfigurations");
                            if (dataDiskConfigurationsSequenceElement != null) {
                                for (int i31 = 0; i31 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(dataDiskConfigurationsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DataDiskConfiguration")
                                        .size(); i31 = i31 + 1) {
                                    org.w3c.dom.Element dataDiskConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(dataDiskConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "DataDiskConfiguration")
                                            .get(i31));
                                    DataDiskConfiguration dataDiskConfigurationInstance = new DataDiskConfiguration();
                                    vMImageInputInstance.getDataDiskConfigurations()
                                            .add(dataDiskConfigurationInstance);

                                    Element nameElement11 = XmlUtility.getElementByTagNameNS(
                                            dataDiskConfigurationsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement11 != null) {
                                        String nameInstance11;
                                        nameInstance11 = nameElement11.getTextContent();
                                        dataDiskConfigurationInstance.setDiskName(nameInstance11);
                                    }

                                    Element resizedSizeInGBElement3 = XmlUtility.getElementByTagNameNS(
                                            dataDiskConfigurationsElement,
                                            "http://schemas.microsoft.com/windowsazure", "ResizedSizeInGB");
                                    if (resizedSizeInGBElement3 != null
                                            && resizedSizeInGBElement3.getTextContent() != null
                                            && !resizedSizeInGBElement3.getTextContent().isEmpty()) {
                                        int resizedSizeInGBInstance3;
                                        resizedSizeInGBInstance3 = DatatypeConverter
                                                .parseInt(resizedSizeInGBElement3.getTextContent());
                                        dataDiskConfigurationInstance
                                                .setResizedSizeInGB(resizedSizeInGBInstance3);
                                    }
                                }
                            }
                        }
                    }
                }

                Element sdkVersionElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "SdkVersion");
                if (sdkVersionElement != null) {
                    String sdkVersionInstance;
                    sdkVersionInstance = sdkVersionElement.getTextContent();
                    result.setSdkVersion(sdkVersionInstance);
                }

                Element lockedElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Locked");
                if (lockedElement != null && lockedElement.getTextContent() != null
                        && !lockedElement.getTextContent().isEmpty()) {
                    boolean lockedInstance;
                    lockedInstance = DatatypeConverter
                            .parseBoolean(lockedElement.getTextContent().toLowerCase());
                    result.setLocked(lockedInstance);
                }

                Element rollbackAllowedElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RollbackAllowed");
                if (rollbackAllowedElement != null && rollbackAllowedElement.getTextContent() != null
                        && !rollbackAllowedElement.getTextContent().isEmpty()) {
                    boolean rollbackAllowedInstance;
                    rollbackAllowedInstance = DatatypeConverter
                            .parseBoolean(rollbackAllowedElement.getTextContent().toLowerCase());
                    result.setRollbackAllowed(rollbackAllowedInstance);
                }

                Element virtualNetworkNameElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "VirtualNetworkName");
                if (virtualNetworkNameElement != null) {
                    String virtualNetworkNameInstance;
                    virtualNetworkNameInstance = virtualNetworkNameElement.getTextContent();
                    result.setVirtualNetworkName(virtualNetworkNameInstance);
                }

                Element createdTimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "CreatedTime");
                if (createdTimeElement != null) {
                    Calendar createdTimeInstance;
                    createdTimeInstance = DatatypeConverter.parseDateTime(createdTimeElement.getTextContent());
                    result.setCreatedTime(createdTimeInstance);
                }

                Element lastModifiedTimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "LastModifiedTime");
                if (lastModifiedTimeElement != null) {
                    Calendar lastModifiedTimeInstance;
                    lastModifiedTimeInstance = DatatypeConverter
                            .parseDateTime(lastModifiedTimeElement.getTextContent());
                    result.setLastModifiedTime(lastModifiedTimeInstance);
                }

                Element extendedPropertiesSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ExtendedProperties");
                if (extendedPropertiesSequenceElement != null) {
                    for (int i32 = 0; i32 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(extendedPropertiesSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "ExtendedProperty")
                            .size(); i32 = i32 + 1) {
                        org.w3c.dom.Element extendedPropertiesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(extendedPropertiesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "ExtendedProperty")
                                .get(i32));
                        String extendedPropertiesKey = XmlUtility
                                .getElementByTagNameNS(extendedPropertiesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name")
                                .getTextContent();
                        String extendedPropertiesValue = XmlUtility
                                .getElementByTagNameNS(extendedPropertiesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Value")
                                .getTextContent();
                        result.getExtendedProperties().put(extendedPropertiesKey, extendedPropertiesValue);
                    }
                }

                Element dnsElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Dns");
                if (dnsElement != null) {
                    DnsSettings dnsInstance = new DnsSettings();
                    result.setDnsSettings(dnsInstance);

                    Element dnsServersSequenceElement = XmlUtility.getElementByTagNameNS(dnsElement,
                            "http://schemas.microsoft.com/windowsazure", "DnsServers");
                    if (dnsServersSequenceElement != null) {
                        for (int i33 = 0; i33 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(dnsServersSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "DnsServer")
                                .size(); i33 = i33 + 1) {
                            org.w3c.dom.Element dnsServersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(dnsServersSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "DnsServer")
                                    .get(i33));
                            DnsServer dnsServerInstance = new DnsServer();
                            dnsInstance.getDnsServers().add(dnsServerInstance);

                            Element nameElement12 = XmlUtility.getElementByTagNameNS(dnsServersElement,
                                    "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement12 != null) {
                                String nameInstance12;
                                nameInstance12 = nameElement12.getTextContent();
                                dnsServerInstance.setName(nameInstance12);
                            }

                            Element addressElement3 = XmlUtility.getElementByTagNameNS(dnsServersElement,
                                    "http://schemas.microsoft.com/windowsazure", "Address");
                            if (addressElement3 != null) {
                                InetAddress addressInstance3;
                                addressInstance3 = InetAddress.getByName(addressElement3.getTextContent());
                                dnsServerInstance.setAddress(addressInstance3);
                            }
                        }
                    }
                }

                Element persistentVMDowntimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "PersistentVMDowntime");
                if (persistentVMDowntimeElement != null) {
                    PersistentVMDowntime persistentVMDowntimeInstance = new PersistentVMDowntime();
                    result.setPersistentVMDowntime(persistentVMDowntimeInstance);

                    Element startTimeElement = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "StartTime");
                    if (startTimeElement != null) {
                        Calendar startTimeInstance;
                        startTimeInstance = DatatypeConverter.parseDateTime(startTimeElement.getTextContent());
                        persistentVMDowntimeInstance.setStartTime(startTimeInstance);
                    }

                    Element endTimeElement = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "EndTime");
                    if (endTimeElement != null) {
                        Calendar endTimeInstance;
                        endTimeInstance = DatatypeConverter.parseDateTime(endTimeElement.getTextContent());
                        persistentVMDowntimeInstance.setEndTime(endTimeInstance);
                    }

                    Element statusElement6 = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "Status");
                    if (statusElement6 != null) {
                        String statusInstance6;
                        statusInstance6 = statusElement6.getTextContent();
                        persistentVMDowntimeInstance.setStatus(statusInstance6);
                    }
                }

                Element virtualIPsSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "VirtualIPs");
                if (virtualIPsSequenceElement != null) {
                    for (int i34 = 0; i34 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(virtualIPsSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "VirtualIP")
                            .size(); i34 = i34 + 1) {
                        org.w3c.dom.Element virtualIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(virtualIPsSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "VirtualIP")
                                .get(i34));
                        VirtualIPAddress virtualIPInstance = new VirtualIPAddress();
                        result.getVirtualIPAddresses().add(virtualIPInstance);

                        Element addressElement4 = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "Address");
                        if (addressElement4 != null) {
                            InetAddress addressInstance4;
                            addressInstance4 = InetAddress.getByName(addressElement4.getTextContent());
                            virtualIPInstance.setAddress(addressInstance4);
                        }

                        Element isDnsProgrammedElement = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "IsDnsProgrammed");
                        if (isDnsProgrammedElement != null && isDnsProgrammedElement.getTextContent() != null
                                && !isDnsProgrammedElement.getTextContent().isEmpty()) {
                            boolean isDnsProgrammedInstance;
                            isDnsProgrammedInstance = DatatypeConverter
                                    .parseBoolean(isDnsProgrammedElement.getTextContent().toLowerCase());
                            virtualIPInstance.setIsDnsProgrammed(isDnsProgrammedInstance);
                        }

                        Element nameElement13 = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement13 != null) {
                            String nameInstance13;
                            nameInstance13 = nameElement13.getTextContent();
                            virtualIPInstance.setName(nameInstance13);
                        }

                        Element reservedIPNameElement = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "ReservedIPName");
                        if (reservedIPNameElement != null) {
                            String reservedIPNameInstance;
                            reservedIPNameInstance = reservedIPNameElement.getTextContent();
                            virtualIPInstance.setReservedIPName(reservedIPNameInstance);
                        }
                    }
                }

                Element extensionConfigurationElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ExtensionConfiguration");
                if (extensionConfigurationElement != null) {
                    ExtensionConfiguration extensionConfigurationInstance = new ExtensionConfiguration();
                    result.setExtensionConfiguration(extensionConfigurationInstance);

                    Element allRolesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                            "AllRoles");
                    if (allRolesSequenceElement != null) {
                        for (int i35 = 0; i35 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(allRolesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Extension")
                                .size(); i35 = i35 + 1) {
                            org.w3c.dom.Element allRolesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(allRolesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "Extension")
                                    .get(i35));
                            ExtensionConfiguration.Extension extensionInstance = new ExtensionConfiguration.Extension();
                            extensionConfigurationInstance.getAllRoles().add(extensionInstance);

                            Element idElement = XmlUtility.getElementByTagNameNS(allRolesElement,
                                    "http://schemas.microsoft.com/windowsazure", "Id");
                            if (idElement != null) {
                                String idInstance;
                                idInstance = idElement.getTextContent();
                                extensionInstance.setId(idInstance);
                            }
                        }
                    }

                    Element namedRolesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                            "NamedRoles");
                    if (namedRolesSequenceElement != null) {
                        for (int i36 = 0; i36 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(namedRolesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Role")
                                .size(); i36 = i36 + 1) {
                            org.w3c.dom.Element namedRolesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(namedRolesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "Role")
                                    .get(i36));
                            ExtensionConfiguration.NamedRole roleInstance2 = new ExtensionConfiguration.NamedRole();
                            extensionConfigurationInstance.getNamedRoles().add(roleInstance2);

                            Element roleNameElement3 = XmlUtility.getElementByTagNameNS(namedRolesElement,
                                    "http://schemas.microsoft.com/windowsazure", "RoleName");
                            if (roleNameElement3 != null) {
                                String roleNameInstance3;
                                roleNameInstance3 = roleNameElement3.getTextContent();
                                roleInstance2.setRoleName(roleNameInstance3);
                            }

                            Element extensionsSequenceElement = XmlUtility.getElementByTagNameNS(
                                    namedRolesElement, "http://schemas.microsoft.com/windowsazure",
                                    "Extensions");
                            if (extensionsSequenceElement != null) {
                                for (int i37 = 0; i37 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(extensionsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "Extension")
                                        .size(); i37 = i37 + 1) {
                                    org.w3c.dom.Element extensionsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(extensionsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Extension")
                                            .get(i37));
                                    ExtensionConfiguration.Extension extensionInstance2 = new ExtensionConfiguration.Extension();
                                    roleInstance2.getExtensions().add(extensionInstance2);

                                    Element idElement2 = XmlUtility.getElementByTagNameNS(extensionsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Id");
                                    if (idElement2 != null) {
                                        String idInstance2;
                                        idInstance2 = idElement2.getTextContent();
                                        extensionInstance2.setId(idInstance2);
                                    }
                                }
                            }
                        }
                    }
                }

                Element reservedIPNameElement2 = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ReservedIPName");
                if (reservedIPNameElement2 != null) {
                    String reservedIPNameInstance2;
                    reservedIPNameInstance2 = reservedIPNameElement2.getTextContent();
                    result.setReservedIPName(reservedIPNameInstance2);
                }

                Element loadBalancersSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "LoadBalancers");
                if (loadBalancersSequenceElement != null) {
                    for (int i38 = 0; i38 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(loadBalancersSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "LoadBalancer")
                            .size(); i38 = i38 + 1) {
                        org.w3c.dom.Element loadBalancersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(loadBalancersSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "LoadBalancer")
                                .get(i38));
                        LoadBalancer loadBalancerInstance = new LoadBalancer();
                        result.getLoadBalancers().add(loadBalancerInstance);

                        Element nameElement14 = XmlUtility.getElementByTagNameNS(loadBalancersElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement14 != null) {
                            String nameInstance14;
                            nameInstance14 = nameElement14.getTextContent();
                            loadBalancerInstance.setName(nameInstance14);
                        }

                        Element frontendIpConfigurationElement = XmlUtility.getElementByTagNameNS(
                                loadBalancersElement, "http://schemas.microsoft.com/windowsazure",
                                "FrontendIpConfiguration");
                        if (frontendIpConfigurationElement != null) {
                            FrontendIPConfiguration frontendIpConfigurationInstance = new FrontendIPConfiguration();
                            loadBalancerInstance.setFrontendIPConfiguration(frontendIpConfigurationInstance);

                            Element typeElement2 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "Type");
                            if (typeElement2 != null) {
                                String typeInstance2;
                                typeInstance2 = typeElement2.getTextContent();
                                frontendIpConfigurationInstance.setType(typeInstance2);
                            }

                            Element subnetNameElement3 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "SubnetName");
                            if (subnetNameElement3 != null) {
                                String subnetNameInstance3;
                                subnetNameInstance3 = subnetNameElement3.getTextContent();
                                frontendIpConfigurationInstance.setSubnetName(subnetNameInstance3);
                            }

                            Element staticVirtualNetworkIPAddressElement3 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "StaticVirtualNetworkIPAddress");
                            if (staticVirtualNetworkIPAddressElement3 != null) {
                                InetAddress staticVirtualNetworkIPAddressInstance3;
                                staticVirtualNetworkIPAddressInstance3 = InetAddress
                                        .getByName(staticVirtualNetworkIPAddressElement3.getTextContent());
                                frontendIpConfigurationInstance.setStaticVirtualNetworkIPAddress(
                                        staticVirtualNetworkIPAddressInstance3);
                            }
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.azure.management.sql.RecommendedElasticPoolOperationsImpl.java

/**
* Returns information about an recommended elastic pool metrics.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the server belongs./*from  ww  w  . ja  v a2 s.c o  m*/
* @param serverName Required. The name of the Azure SQL Database Server.
* @param recommendedElasticPoolName Required. The name of the Azure SQL
* Recommended Elastic Pool to be retrieved.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Represents the response to a List Azure Sql Recommended Elastic
* Pool metrics request.
*/
@Override
public RecommendedElasticPoolListMetricsResponse listMetrics(String resourceGroupName, String serverName,
        String recommendedElasticPoolName) throws IOException, ServiceException {
    // Validate
    if (resourceGroupName == null) {
        throw new NullPointerException("resourceGroupName");
    }
    if (serverName == null) {
        throw new NullPointerException("serverName");
    }
    if (recommendedElasticPoolName == null) {
        throw new NullPointerException("recommendedElasticPoolName");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("resourceGroupName", resourceGroupName);
        tracingParameters.put("serverName", serverName);
        tracingParameters.put("recommendedElasticPoolName", recommendedElasticPoolName);
        CloudTracing.enter(invocationId, this, "listMetricsAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/subscriptions/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/resourceGroups/";
    url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
    url = url + "/providers/";
    url = url + "Microsoft.Sql";
    url = url + "/servers/";
    url = url + URLEncoder.encode(serverName, "UTF-8");
    url = url + "/recommendedElasticPools/";
    url = url + URLEncoder.encode(recommendedElasticPoolName, "UTF-8");
    url = url + "/metrics";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2014-04-01");
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        RecommendedElasticPoolListMetricsResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new RecommendedElasticPoolListMetricsResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode valueArray = responseDoc.get("value");
                if (valueArray != null && valueArray instanceof NullNode == false) {
                    for (JsonNode valueValue : ((ArrayNode) valueArray)) {
                        RecommendedElasticPoolMetric recommendedElasticPoolMetricInstance = new RecommendedElasticPoolMetric();
                        result.getRecommendedElasticPoolsMetrics().add(recommendedElasticPoolMetricInstance);

                        JsonNode dateTimeValue = valueValue.get("dateTime");
                        if (dateTimeValue != null && dateTimeValue instanceof NullNode == false) {
                            Calendar dateTimeInstance;
                            dateTimeInstance = DatatypeConverter.parseDateTime(dateTimeValue.getTextValue());
                            recommendedElasticPoolMetricInstance.setDateTime(dateTimeInstance);
                        }

                        JsonNode dtuValue = valueValue.get("dtu");
                        if (dtuValue != null && dtuValue instanceof NullNode == false) {
                            double dtuInstance;
                            dtuInstance = dtuValue.getDoubleValue();
                            recommendedElasticPoolMetricInstance.setDtu(dtuInstance);
                        }

                        JsonNode sizeGBValue = valueValue.get("sizeGB");
                        if (sizeGBValue != null && sizeGBValue instanceof NullNode == false) {
                            double sizeGBInstance;
                            sizeGBInstance = sizeGBValue.getDoubleValue();
                            recommendedElasticPoolMetricInstance.setSizeGB(sizeGBInstance);
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.azure.management.sql.DatabaseOperationsImpl.java

/**
* Returns information about Azure SQL Databases.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the server belongs.//from  w  w  w .  j  a  va 2 s .co m
* @param serverName Required. The name of the Azure SQL Database Server in
* which the Azure SQL Databases are hosted.
* @param expand Required. The comma separated list of child objects that we
* want to expand on in response.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Represents the response to a List Azure Sql Database request.
*/
@Override
public DatabaseListResponse listExpanded(String resourceGroupName, String serverName, String expand)
        throws IOException, ServiceException {
    // Validate
    if (resourceGroupName == null) {
        throw new NullPointerException("resourceGroupName");
    }
    if (serverName == null) {
        throw new NullPointerException("serverName");
    }
    if (expand == null) {
        throw new NullPointerException("expand");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("resourceGroupName", resourceGroupName);
        tracingParameters.put("serverName", serverName);
        tracingParameters.put("expand", expand);
        CloudTracing.enter(invocationId, this, "listExpandedAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/subscriptions/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/resourceGroups/";
    url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
    url = url + "/providers/";
    url = url + "Microsoft.Sql";
    url = url + "/servers/";
    url = url + URLEncoder.encode(serverName, "UTF-8");
    url = url + "/databases";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2014-04-01");
    queryParameters.add("$expand=" + URLEncoder.encode(expand, "UTF-8"));
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        DatabaseListResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new DatabaseListResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode valueArray = responseDoc.get("value");
                if (valueArray != null && valueArray instanceof NullNode == false) {
                    for (JsonNode valueValue : ((ArrayNode) valueArray)) {
                        Database databaseInstance = new Database();
                        result.getDatabases().add(databaseInstance);

                        JsonNode propertiesValue = valueValue.get("properties");
                        if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
                            DatabaseProperties propertiesInstance = new DatabaseProperties();
                            databaseInstance.setProperties(propertiesInstance);

                            JsonNode collationValue = propertiesValue.get("collation");
                            if (collationValue != null && collationValue instanceof NullNode == false) {
                                String collationInstance;
                                collationInstance = collationValue.getTextValue();
                                propertiesInstance.setCollation(collationInstance);
                            }

                            JsonNode creationDateValue = propertiesValue.get("creationDate");
                            if (creationDateValue != null && creationDateValue instanceof NullNode == false) {
                                Calendar creationDateInstance;
                                creationDateInstance = DatatypeConverter
                                        .parseDateTime(creationDateValue.getTextValue());
                                propertiesInstance.setCreationDate(creationDateInstance);
                            }

                            JsonNode currentServiceObjectiveIdValue = propertiesValue
                                    .get("currentServiceObjectiveId");
                            if (currentServiceObjectiveIdValue != null
                                    && currentServiceObjectiveIdValue instanceof NullNode == false) {
                                String currentServiceObjectiveIdInstance;
                                currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue
                                        .getTextValue();
                                propertiesInstance
                                        .setCurrentServiceObjectiveId(currentServiceObjectiveIdInstance);
                            }

                            JsonNode databaseIdValue = propertiesValue.get("databaseId");
                            if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) {
                                String databaseIdInstance;
                                databaseIdInstance = databaseIdValue.getTextValue();
                                propertiesInstance.setDatabaseId(databaseIdInstance);
                            }

                            JsonNode earliestRestoreDateValue = propertiesValue.get("earliestRestoreDate");
                            if (earliestRestoreDateValue != null
                                    && earliestRestoreDateValue instanceof NullNode == false) {
                                Calendar earliestRestoreDateInstance;
                                earliestRestoreDateInstance = DatatypeConverter
                                        .parseDateTime(earliestRestoreDateValue.getTextValue());
                                propertiesInstance.setEarliestRestoreDate(earliestRestoreDateInstance);
                            }

                            JsonNode editionValue = propertiesValue.get("edition");
                            if (editionValue != null && editionValue instanceof NullNode == false) {
                                String editionInstance;
                                editionInstance = editionValue.getTextValue();
                                propertiesInstance.setEdition(editionInstance);
                            }

                            JsonNode maxSizeBytesValue = propertiesValue.get("maxSizeBytes");
                            if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) {
                                long maxSizeBytesInstance;
                                maxSizeBytesInstance = maxSizeBytesValue.getLongValue();
                                propertiesInstance.setMaxSizeBytes(maxSizeBytesInstance);
                            }

                            JsonNode requestedServiceObjectiveIdValue = propertiesValue
                                    .get("requestedServiceObjectiveId");
                            if (requestedServiceObjectiveIdValue != null
                                    && requestedServiceObjectiveIdValue instanceof NullNode == false) {
                                String requestedServiceObjectiveIdInstance;
                                requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue
                                        .getTextValue();
                                propertiesInstance
                                        .setRequestedServiceObjectiveId(requestedServiceObjectiveIdInstance);
                            }

                            JsonNode requestedServiceObjectiveNameValue = propertiesValue
                                    .get("requestedServiceObjectiveName");
                            if (requestedServiceObjectiveNameValue != null
                                    && requestedServiceObjectiveNameValue instanceof NullNode == false) {
                                String requestedServiceObjectiveNameInstance;
                                requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue
                                        .getTextValue();
                                propertiesInstance.setRequestedServiceObjectiveName(
                                        requestedServiceObjectiveNameInstance);
                            }

                            JsonNode serviceLevelObjectiveValue = propertiesValue.get("serviceLevelObjective");
                            if (serviceLevelObjectiveValue != null
                                    && serviceLevelObjectiveValue instanceof NullNode == false) {
                                String serviceLevelObjectiveInstance;
                                serviceLevelObjectiveInstance = serviceLevelObjectiveValue.getTextValue();
                                propertiesInstance.setServiceObjective(serviceLevelObjectiveInstance);
                            }

                            JsonNode statusValue = propertiesValue.get("status");
                            if (statusValue != null && statusValue instanceof NullNode == false) {
                                String statusInstance;
                                statusInstance = statusValue.getTextValue();
                                propertiesInstance.setStatus(statusInstance);
                            }

                            JsonNode elasticPoolNameValue = propertiesValue.get("elasticPoolName");
                            if (elasticPoolNameValue != null
                                    && elasticPoolNameValue instanceof NullNode == false) {
                                String elasticPoolNameInstance;
                                elasticPoolNameInstance = elasticPoolNameValue.getTextValue();
                                propertiesInstance.setElasticPoolName(elasticPoolNameInstance);
                            }

                            JsonNode serviceTierAdvisorsArray = propertiesValue.get("serviceTierAdvisors");
                            if (serviceTierAdvisorsArray != null
                                    && serviceTierAdvisorsArray instanceof NullNode == false) {
                                for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) {
                                    ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor();
                                    propertiesInstance.getServiceTierAdvisors().add(serviceTierAdvisorInstance);

                                    JsonNode propertiesValue2 = serviceTierAdvisorsValue.get("properties");
                                    if (propertiesValue2 != null
                                            && propertiesValue2 instanceof NullNode == false) {
                                        ServiceTierAdvisorProperties propertiesInstance2 = new ServiceTierAdvisorProperties();
                                        serviceTierAdvisorInstance.setProperties(propertiesInstance2);

                                        JsonNode observationPeriodStartValue = propertiesValue2
                                                .get("observationPeriodStart");
                                        if (observationPeriodStartValue != null
                                                && observationPeriodStartValue instanceof NullNode == false) {
                                            Calendar observationPeriodStartInstance;
                                            observationPeriodStartInstance = DatatypeConverter
                                                    .parseDateTime(observationPeriodStartValue.getTextValue());
                                            propertiesInstance2
                                                    .setObservationPeriodStart(observationPeriodStartInstance);
                                        }

                                        JsonNode observationPeriodEndValue = propertiesValue2
                                                .get("observationPeriodEnd");
                                        if (observationPeriodEndValue != null
                                                && observationPeriodEndValue instanceof NullNode == false) {
                                            Calendar observationPeriodEndInstance;
                                            observationPeriodEndInstance = DatatypeConverter
                                                    .parseDateTime(observationPeriodEndValue.getTextValue());
                                            propertiesInstance2
                                                    .setObservationPeriodEnd(observationPeriodEndInstance);
                                        }

                                        JsonNode activeTimeRatioValue = propertiesValue2.get("activeTimeRatio");
                                        if (activeTimeRatioValue != null
                                                && activeTimeRatioValue instanceof NullNode == false) {
                                            double activeTimeRatioInstance;
                                            activeTimeRatioInstance = activeTimeRatioValue.getDoubleValue();
                                            propertiesInstance2.setActiveTimeRatio(activeTimeRatioInstance);
                                        }

                                        JsonNode minDtuValue = propertiesValue2.get("minDtu");
                                        if (minDtuValue != null && minDtuValue instanceof NullNode == false) {
                                            double minDtuInstance;
                                            minDtuInstance = minDtuValue.getDoubleValue();
                                            propertiesInstance2.setMinDtu(minDtuInstance);
                                        }

                                        JsonNode avgDtuValue = propertiesValue2.get("avgDtu");
                                        if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) {
                                            double avgDtuInstance;
                                            avgDtuInstance = avgDtuValue.getDoubleValue();
                                            propertiesInstance2.setAvgDtu(avgDtuInstance);
                                        }

                                        JsonNode maxDtuValue = propertiesValue2.get("maxDtu");
                                        if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) {
                                            double maxDtuInstance;
                                            maxDtuInstance = maxDtuValue.getDoubleValue();
                                            propertiesInstance2.setMaxDtu(maxDtuInstance);
                                        }

                                        JsonNode maxSizeInGBValue = propertiesValue2.get("maxSizeInGB");
                                        if (maxSizeInGBValue != null
                                                && maxSizeInGBValue instanceof NullNode == false) {
                                            double maxSizeInGBInstance;
                                            maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue();
                                            propertiesInstance2.setMaxSizeInGB(maxSizeInGBInstance);
                                        }

                                        JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue2
                                                .get("serviceLevelObjectiveUsageMetrics");
                                        if (serviceLevelObjectiveUsageMetricsArray != null
                                                && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) {
                                            for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) {
                                                SloUsageMetric sloUsageMetricInstance = new SloUsageMetric();
                                                propertiesInstance2.getServiceLevelObjectiveUsageMetrics()
                                                        .add(sloUsageMetricInstance);

                                                JsonNode serviceLevelObjectiveValue2 = serviceLevelObjectiveUsageMetricsValue
                                                        .get("serviceLevelObjective");
                                                if (serviceLevelObjectiveValue2 != null
                                                        && serviceLevelObjectiveValue2 instanceof NullNode == false) {
                                                    String serviceLevelObjectiveInstance2;
                                                    serviceLevelObjectiveInstance2 = serviceLevelObjectiveValue2
                                                            .getTextValue();
                                                    sloUsageMetricInstance.setServiceLevelObjective(
                                                            serviceLevelObjectiveInstance2);
                                                }

                                                JsonNode serviceLevelObjectiveIdValue = serviceLevelObjectiveUsageMetricsValue
                                                        .get("serviceLevelObjectiveId");
                                                if (serviceLevelObjectiveIdValue != null
                                                        && serviceLevelObjectiveIdValue instanceof NullNode == false) {
                                                    String serviceLevelObjectiveIdInstance;
                                                    serviceLevelObjectiveIdInstance = serviceLevelObjectiveIdValue
                                                            .getTextValue();
                                                    sloUsageMetricInstance.setServiceLevelObjectiveId(
                                                            serviceLevelObjectiveIdInstance);
                                                }

                                                JsonNode inRangeTimeRatioValue = serviceLevelObjectiveUsageMetricsValue
                                                        .get("inRangeTimeRatio");
                                                if (inRangeTimeRatioValue != null
                                                        && inRangeTimeRatioValue instanceof NullNode == false) {
                                                    double inRangeTimeRatioInstance;
                                                    inRangeTimeRatioInstance = inRangeTimeRatioValue
                                                            .getDoubleValue();
                                                    sloUsageMetricInstance
                                                            .setInRangeTimeRatio(inRangeTimeRatioInstance);
                                                }

                                                JsonNode idValue = serviceLevelObjectiveUsageMetricsValue
                                                        .get("id");
                                                if (idValue != null && idValue instanceof NullNode == false) {
                                                    String idInstance;
                                                    idInstance = idValue.getTextValue();
                                                    sloUsageMetricInstance.setId(idInstance);
                                                }

                                                JsonNode nameValue = serviceLevelObjectiveUsageMetricsValue
                                                        .get("name");
                                                if (nameValue != null
                                                        && nameValue instanceof NullNode == false) {
                                                    String nameInstance;
                                                    nameInstance = nameValue.getTextValue();
                                                    sloUsageMetricInstance.setName(nameInstance);
                                                }

                                                JsonNode typeValue = serviceLevelObjectiveUsageMetricsValue
                                                        .get("type");
                                                if (typeValue != null
                                                        && typeValue instanceof NullNode == false) {
                                                    String typeInstance;
                                                    typeInstance = typeValue.getTextValue();
                                                    sloUsageMetricInstance.setType(typeInstance);
                                                }

                                                JsonNode locationValue = serviceLevelObjectiveUsageMetricsValue
                                                        .get("location");
                                                if (locationValue != null
                                                        && locationValue instanceof NullNode == false) {
                                                    String locationInstance;
                                                    locationInstance = locationValue.getTextValue();
                                                    sloUsageMetricInstance.setLocation(locationInstance);
                                                }

                                                JsonNode tagsSequenceElement = ((JsonNode) serviceLevelObjectiveUsageMetricsValue
                                                        .get("tags"));
                                                if (tagsSequenceElement != null
                                                        && tagsSequenceElement instanceof NullNode == false) {
                                                    Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement
                                                            .getFields();
                                                    while (itr.hasNext()) {
                                                        Map.Entry<String, JsonNode> property = itr.next();
                                                        String tagsKey = property.getKey();
                                                        String tagsValue = property.getValue().getTextValue();
                                                        sloUsageMetricInstance.getTags().put(tagsKey,
                                                                tagsValue);
                                                    }
                                                }
                                            }
                                        }

                                        JsonNode currentServiceLevelObjectiveValue = propertiesValue2
                                                .get("currentServiceLevelObjective");
                                        if (currentServiceLevelObjectiveValue != null
                                                && currentServiceLevelObjectiveValue instanceof NullNode == false) {
                                            String currentServiceLevelObjectiveInstance;
                                            currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue
                                                    .getTextValue();
                                            propertiesInstance2.setCurrentServiceLevelObjective(
                                                    currentServiceLevelObjectiveInstance);
                                        }

                                        JsonNode currentServiceLevelObjectiveIdValue = propertiesValue2
                                                .get("currentServiceLevelObjectiveId");
                                        if (currentServiceLevelObjectiveIdValue != null
                                                && currentServiceLevelObjectiveIdValue instanceof NullNode == false) {
                                            String currentServiceLevelObjectiveIdInstance;
                                            currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue
                                                    .getTextValue();
                                            propertiesInstance2.setCurrentServiceLevelObjectiveId(
                                                    currentServiceLevelObjectiveIdInstance);
                                        }

                                        JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue2
                                                .get("usageBasedRecommendationServiceLevelObjective");
                                        if (usageBasedRecommendationServiceLevelObjectiveValue != null
                                                && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
                                            String usageBasedRecommendationServiceLevelObjectiveInstance;
                                            usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue
                                                    .getTextValue();
                                            propertiesInstance2
                                                    .setUsageBasedRecommendationServiceLevelObjective(
                                                            usageBasedRecommendationServiceLevelObjectiveInstance);
                                        }

                                        JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2
                                                .get("usageBasedRecommendationServiceLevelObjectiveId");
                                        if (usageBasedRecommendationServiceLevelObjectiveIdValue != null
                                                && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
                                            String usageBasedRecommendationServiceLevelObjectiveIdInstance;
                                            usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue
                                                    .getTextValue();
                                            propertiesInstance2
                                                    .setUsageBasedRecommendationServiceLevelObjectiveId(
                                                            usageBasedRecommendationServiceLevelObjectiveIdInstance);
                                        }

                                        JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue2
                                                .get("databaseSizeBasedRecommendationServiceLevelObjective");
                                        if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null
                                                && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
                                            String databaseSizeBasedRecommendationServiceLevelObjectiveInstance;
                                            databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue
                                                    .getTextValue();
                                            propertiesInstance2
                                                    .setDatabaseSizeBasedRecommendationServiceLevelObjective(
                                                            databaseSizeBasedRecommendationServiceLevelObjectiveInstance);
                                        }

                                        JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2
                                                .get("databaseSizeBasedRecommendationServiceLevelObjectiveId");
                                        if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null
                                                && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
                                            String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance;
                                            databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue
                                                    .getTextValue();
                                            propertiesInstance2
                                                    .setDatabaseSizeBasedRecommendationServiceLevelObjectiveId(
                                                            databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance);
                                        }

                                        JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue2
                                                .get("disasterPlanBasedRecommendationServiceLevelObjective");
                                        if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null
                                                && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
                                            String disasterPlanBasedRecommendationServiceLevelObjectiveInstance;
                                            disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue
                                                    .getTextValue();
                                            propertiesInstance2
                                                    .setDisasterPlanBasedRecommendationServiceLevelObjective(
                                                            disasterPlanBasedRecommendationServiceLevelObjectiveInstance);
                                        }

                                        JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2
                                                .get("disasterPlanBasedRecommendationServiceLevelObjectiveId");
                                        if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null
                                                && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
                                            String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance;
                                            disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue
                                                    .getTextValue();
                                            propertiesInstance2
                                                    .setDisasterPlanBasedRecommendationServiceLevelObjectiveId(
                                                            disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance);
                                        }

                                        JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue2
                                                .get("overallRecommendationServiceLevelObjective");
                                        if (overallRecommendationServiceLevelObjectiveValue != null
                                                && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
                                            String overallRecommendationServiceLevelObjectiveInstance;
                                            overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue
                                                    .getTextValue();
                                            propertiesInstance2.setOverallRecommendationServiceLevelObjective(
                                                    overallRecommendationServiceLevelObjectiveInstance);
                                        }

                                        JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue2
                                                .get("overallRecommendationServiceLevelObjectiveId");
                                        if (overallRecommendationServiceLevelObjectiveIdValue != null
                                                && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
                                            String overallRecommendationServiceLevelObjectiveIdInstance;
                                            overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue
                                                    .getTextValue();
                                            propertiesInstance2.setOverallRecommendationServiceLevelObjectiveId(
                                                    overallRecommendationServiceLevelObjectiveIdInstance);
                                        }

                                        JsonNode confidenceValue = propertiesValue2.get("confidence");
                                        if (confidenceValue != null
                                                && confidenceValue instanceof NullNode == false) {
                                            double confidenceInstance;
                                            confidenceInstance = confidenceValue.getDoubleValue();
                                            propertiesInstance2.setConfidence(confidenceInstance);
                                        }
                                    }

                                    JsonNode idValue2 = serviceTierAdvisorsValue.get("id");
                                    if (idValue2 != null && idValue2 instanceof NullNode == false) {
                                        String idInstance2;
                                        idInstance2 = idValue2.getTextValue();
                                        serviceTierAdvisorInstance.setId(idInstance2);
                                    }

                                    JsonNode nameValue2 = serviceTierAdvisorsValue.get("name");
                                    if (nameValue2 != null && nameValue2 instanceof NullNode == false) {
                                        String nameInstance2;
                                        nameInstance2 = nameValue2.getTextValue();
                                        serviceTierAdvisorInstance.setName(nameInstance2);
                                    }

                                    JsonNode typeValue2 = serviceTierAdvisorsValue.get("type");
                                    if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
                                        String typeInstance2;
                                        typeInstance2 = typeValue2.getTextValue();
                                        serviceTierAdvisorInstance.setType(typeInstance2);
                                    }

                                    JsonNode locationValue2 = serviceTierAdvisorsValue.get("location");
                                    if (locationValue2 != null && locationValue2 instanceof NullNode == false) {
                                        String locationInstance2;
                                        locationInstance2 = locationValue2.getTextValue();
                                        serviceTierAdvisorInstance.setLocation(locationInstance2);
                                    }

                                    JsonNode tagsSequenceElement2 = ((JsonNode) serviceTierAdvisorsValue
                                            .get("tags"));
                                    if (tagsSequenceElement2 != null
                                            && tagsSequenceElement2 instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr2 = tagsSequenceElement2
                                                .getFields();
                                        while (itr2.hasNext()) {
                                            Map.Entry<String, JsonNode> property2 = itr2.next();
                                            String tagsKey2 = property2.getKey();
                                            String tagsValue2 = property2.getValue().getTextValue();
                                            serviceTierAdvisorInstance.getTags().put(tagsKey2, tagsValue2);
                                        }
                                    }
                                }
                            }

                            JsonNode upgradeHintValue = propertiesValue.get("upgradeHint");
                            if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) {
                                UpgradeHint upgradeHintInstance = new UpgradeHint();
                                propertiesInstance.setUpgradeHint(upgradeHintInstance);

                                JsonNode targetServiceLevelObjectiveValue = upgradeHintValue
                                        .get("targetServiceLevelObjective");
                                if (targetServiceLevelObjectiveValue != null
                                        && targetServiceLevelObjectiveValue instanceof NullNode == false) {
                                    String targetServiceLevelObjectiveInstance;
                                    targetServiceLevelObjectiveInstance = targetServiceLevelObjectiveValue
                                            .getTextValue();
                                    upgradeHintInstance.setTargetServiceLevelObjective(
                                            targetServiceLevelObjectiveInstance);
                                }

                                JsonNode targetServiceLevelObjectiveIdValue = upgradeHintValue
                                        .get("targetServiceLevelObjectiveId");
                                if (targetServiceLevelObjectiveIdValue != null
                                        && targetServiceLevelObjectiveIdValue instanceof NullNode == false) {
                                    String targetServiceLevelObjectiveIdInstance;
                                    targetServiceLevelObjectiveIdInstance = targetServiceLevelObjectiveIdValue
                                            .getTextValue();
                                    upgradeHintInstance.setTargetServiceLevelObjectiveId(
                                            targetServiceLevelObjectiveIdInstance);
                                }

                                JsonNode idValue3 = upgradeHintValue.get("id");
                                if (idValue3 != null && idValue3 instanceof NullNode == false) {
                                    String idInstance3;
                                    idInstance3 = idValue3.getTextValue();
                                    upgradeHintInstance.setId(idInstance3);
                                }

                                JsonNode nameValue3 = upgradeHintValue.get("name");
                                if (nameValue3 != null && nameValue3 instanceof NullNode == false) {
                                    String nameInstance3;
                                    nameInstance3 = nameValue3.getTextValue();
                                    upgradeHintInstance.setName(nameInstance3);
                                }

                                JsonNode typeValue3 = upgradeHintValue.get("type");
                                if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
                                    String typeInstance3;
                                    typeInstance3 = typeValue3.getTextValue();
                                    upgradeHintInstance.setType(typeInstance3);
                                }

                                JsonNode locationValue3 = upgradeHintValue.get("location");
                                if (locationValue3 != null && locationValue3 instanceof NullNode == false) {
                                    String locationInstance3;
                                    locationInstance3 = locationValue3.getTextValue();
                                    upgradeHintInstance.setLocation(locationInstance3);
                                }

                                JsonNode tagsSequenceElement3 = ((JsonNode) upgradeHintValue.get("tags"));
                                if (tagsSequenceElement3 != null
                                        && tagsSequenceElement3 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr3 = tagsSequenceElement3
                                            .getFields();
                                    while (itr3.hasNext()) {
                                        Map.Entry<String, JsonNode> property3 = itr3.next();
                                        String tagsKey3 = property3.getKey();
                                        String tagsValue3 = property3.getValue().getTextValue();
                                        upgradeHintInstance.getTags().put(tagsKey3, tagsValue3);
                                    }
                                }
                            }

                            JsonNode schemasArray = propertiesValue.get("schemas");
                            if (schemasArray != null && schemasArray instanceof NullNode == false) {
                                for (JsonNode schemasValue : ((ArrayNode) schemasArray)) {
                                    Schema schemaInstance = new Schema();
                                    propertiesInstance.getSchemas().add(schemaInstance);

                                    JsonNode propertiesValue3 = schemasValue.get("properties");
                                    if (propertiesValue3 != null
                                            && propertiesValue3 instanceof NullNode == false) {
                                        SchemaProperties propertiesInstance3 = new SchemaProperties();
                                        schemaInstance.setProperties(propertiesInstance3);

                                        JsonNode tablesArray = propertiesValue3.get("tables");
                                        if (tablesArray != null && tablesArray instanceof NullNode == false) {
                                            for (JsonNode tablesValue : ((ArrayNode) tablesArray)) {
                                                Table tableInstance = new Table();
                                                propertiesInstance3.getTables().add(tableInstance);

                                                JsonNode propertiesValue4 = tablesValue.get("properties");
                                                if (propertiesValue4 != null
                                                        && propertiesValue4 instanceof NullNode == false) {
                                                    TableProperties propertiesInstance4 = new TableProperties();
                                                    tableInstance.setProperties(propertiesInstance4);

                                                    JsonNode tableTypeValue = propertiesValue4.get("tableType");
                                                    if (tableTypeValue != null
                                                            && tableTypeValue instanceof NullNode == false) {
                                                        String tableTypeInstance;
                                                        tableTypeInstance = tableTypeValue.getTextValue();
                                                        propertiesInstance4.setTableType(tableTypeInstance);
                                                    }

                                                    JsonNode columnsArray = propertiesValue4.get("columns");
                                                    if (columnsArray != null
                                                            && columnsArray instanceof NullNode == false) {
                                                        for (JsonNode columnsValue : ((ArrayNode) columnsArray)) {
                                                            Column columnInstance = new Column();
                                                            propertiesInstance4.getColumns()
                                                                    .add(columnInstance);

                                                            JsonNode propertiesValue5 = columnsValue
                                                                    .get("properties");
                                                            if (propertiesValue5 != null
                                                                    && propertiesValue5 instanceof NullNode == false) {
                                                                ColumnProperties propertiesInstance5 = new ColumnProperties();
                                                                columnInstance
                                                                        .setProperties(propertiesInstance5);

                                                                JsonNode columnTypeValue = propertiesValue5
                                                                        .get("columnType");
                                                                if (columnTypeValue != null
                                                                        && columnTypeValue instanceof NullNode == false) {
                                                                    String columnTypeInstance;
                                                                    columnTypeInstance = columnTypeValue
                                                                            .getTextValue();
                                                                    propertiesInstance5
                                                                            .setColumnType(columnTypeInstance);
                                                                }
                                                            }

                                                            JsonNode idValue4 = columnsValue.get("id");
                                                            if (idValue4 != null
                                                                    && idValue4 instanceof NullNode == false) {
                                                                String idInstance4;
                                                                idInstance4 = idValue4.getTextValue();
                                                                columnInstance.setId(idInstance4);
                                                            }

                                                            JsonNode nameValue4 = columnsValue.get("name");
                                                            if (nameValue4 != null
                                                                    && nameValue4 instanceof NullNode == false) {
                                                                String nameInstance4;
                                                                nameInstance4 = nameValue4.getTextValue();
                                                                columnInstance.setName(nameInstance4);
                                                            }

                                                            JsonNode typeValue4 = columnsValue.get("type");
                                                            if (typeValue4 != null
                                                                    && typeValue4 instanceof NullNode == false) {
                                                                String typeInstance4;
                                                                typeInstance4 = typeValue4.getTextValue();
                                                                columnInstance.setType(typeInstance4);
                                                            }

                                                            JsonNode locationValue4 = columnsValue
                                                                    .get("location");
                                                            if (locationValue4 != null
                                                                    && locationValue4 instanceof NullNode == false) {
                                                                String locationInstance4;
                                                                locationInstance4 = locationValue4
                                                                        .getTextValue();
                                                                columnInstance.setLocation(locationInstance4);
                                                            }

                                                            JsonNode tagsSequenceElement4 = ((JsonNode) columnsValue
                                                                    .get("tags"));
                                                            if (tagsSequenceElement4 != null
                                                                    && tagsSequenceElement4 instanceof NullNode == false) {
                                                                Iterator<Map.Entry<String, JsonNode>> itr4 = tagsSequenceElement4
                                                                        .getFields();
                                                                while (itr4.hasNext()) {
                                                                    Map.Entry<String, JsonNode> property4 = itr4
                                                                            .next();
                                                                    String tagsKey4 = property4.getKey();
                                                                    String tagsValue4 = property4.getValue()
                                                                            .getTextValue();
                                                                    columnInstance.getTags().put(tagsKey4,
                                                                            tagsValue4);
                                                                }
                                                            }
                                                        }
                                                    }

                                                    JsonNode recommendedIndexesArray = propertiesValue4
                                                            .get("recommendedIndexes");
                                                    if (recommendedIndexesArray != null
                                                            && recommendedIndexesArray instanceof NullNode == false) {
                                                        for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) {
                                                            RecommendedIndex recommendedIndexInstance = new RecommendedIndex();
                                                            propertiesInstance4.getRecommendedIndexes()
                                                                    .add(recommendedIndexInstance);

                                                            JsonNode propertiesValue6 = recommendedIndexesValue
                                                                    .get("properties");
                                                            if (propertiesValue6 != null
                                                                    && propertiesValue6 instanceof NullNode == false) {
                                                                RecommendedIndexProperties propertiesInstance6 = new RecommendedIndexProperties();
                                                                recommendedIndexInstance
                                                                        .setProperties(propertiesInstance6);

                                                                JsonNode actionValue = propertiesValue6
                                                                        .get("action");
                                                                if (actionValue != null
                                                                        && actionValue instanceof NullNode == false) {
                                                                    String actionInstance;
                                                                    actionInstance = actionValue.getTextValue();
                                                                    propertiesInstance6
                                                                            .setAction(actionInstance);
                                                                }

                                                                JsonNode stateValue = propertiesValue6
                                                                        .get("state");
                                                                if (stateValue != null
                                                                        && stateValue instanceof NullNode == false) {
                                                                    String stateInstance;
                                                                    stateInstance = stateValue.getTextValue();
                                                                    propertiesInstance6.setState(stateInstance);
                                                                }

                                                                JsonNode createdValue = propertiesValue6
                                                                        .get("created");
                                                                if (createdValue != null
                                                                        && createdValue instanceof NullNode == false) {
                                                                    Calendar createdInstance;
                                                                    createdInstance = DatatypeConverter
                                                                            .parseDateTime(createdValue
                                                                                    .getTextValue());
                                                                    propertiesInstance6
                                                                            .setCreated(createdInstance);
                                                                }

                                                                JsonNode lastModifiedValue = propertiesValue6
                                                                        .get("lastModified");
                                                                if (lastModifiedValue != null
                                                                        && lastModifiedValue instanceof NullNode == false) {
                                                                    Calendar lastModifiedInstance;
                                                                    lastModifiedInstance = DatatypeConverter
                                                                            .parseDateTime(lastModifiedValue
                                                                                    .getTextValue());
                                                                    propertiesInstance6.setLastModified(
                                                                            lastModifiedInstance);
                                                                }

                                                                JsonNode indexTypeValue = propertiesValue6
                                                                        .get("indexType");
                                                                if (indexTypeValue != null
                                                                        && indexTypeValue instanceof NullNode == false) {
                                                                    String indexTypeInstance;
                                                                    indexTypeInstance = indexTypeValue
                                                                            .getTextValue();
                                                                    propertiesInstance6
                                                                            .setIndexType(indexTypeInstance);
                                                                }

                                                                JsonNode schemaValue = propertiesValue6
                                                                        .get("schema");
                                                                if (schemaValue != null
                                                                        && schemaValue instanceof NullNode == false) {
                                                                    String schemaInstance2;
                                                                    schemaInstance2 = schemaValue
                                                                            .getTextValue();
                                                                    propertiesInstance6
                                                                            .setSchema(schemaInstance2);
                                                                }

                                                                JsonNode tableValue = propertiesValue6
                                                                        .get("table");
                                                                if (tableValue != null
                                                                        && tableValue instanceof NullNode == false) {
                                                                    String tableInstance2;
                                                                    tableInstance2 = tableValue.getTextValue();
                                                                    propertiesInstance6
                                                                            .setTable(tableInstance2);
                                                                }

                                                                JsonNode columnsArray2 = propertiesValue6
                                                                        .get("columns");
                                                                if (columnsArray2 != null
                                                                        && columnsArray2 instanceof NullNode == false) {
                                                                    for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) {
                                                                        propertiesInstance6.getColumns().add(
                                                                                columnsValue2.getTextValue());
                                                                    }
                                                                }

                                                                JsonNode includedColumnsArray = propertiesValue6
                                                                        .get("includedColumns");
                                                                if (includedColumnsArray != null
                                                                        && includedColumnsArray instanceof NullNode == false) {
                                                                    for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) {
                                                                        propertiesInstance6.getIncludedColumns()
                                                                                .add(includedColumnsValue
                                                                                        .getTextValue());
                                                                    }
                                                                }

                                                                JsonNode indexScriptValue = propertiesValue6
                                                                        .get("indexScript");
                                                                if (indexScriptValue != null
                                                                        && indexScriptValue instanceof NullNode == false) {
                                                                    String indexScriptInstance;
                                                                    indexScriptInstance = indexScriptValue
                                                                            .getTextValue();
                                                                    propertiesInstance6.setIndexScript(
                                                                            indexScriptInstance);
                                                                }

                                                                JsonNode estimatedImpactArray = propertiesValue6
                                                                        .get("estimatedImpact");
                                                                if (estimatedImpactArray != null
                                                                        && estimatedImpactArray instanceof NullNode == false) {
                                                                    for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) {
                                                                        OperationImpact operationImpactInstance = new OperationImpact();
                                                                        propertiesInstance6.getEstimatedImpact()
                                                                                .add(operationImpactInstance);

                                                                        JsonNode nameValue5 = estimatedImpactValue
                                                                                .get("name");
                                                                        if (nameValue5 != null
                                                                                && nameValue5 instanceof NullNode == false) {
                                                                            String nameInstance5;
                                                                            nameInstance5 = nameValue5
                                                                                    .getTextValue();
                                                                            operationImpactInstance
                                                                                    .setName(nameInstance5);
                                                                        }

                                                                        JsonNode unitValue = estimatedImpactValue
                                                                                .get("unit");
                                                                        if (unitValue != null
                                                                                && unitValue instanceof NullNode == false) {
                                                                            String unitInstance;
                                                                            unitInstance = unitValue
                                                                                    .getTextValue();
                                                                            operationImpactInstance
                                                                                    .setUnit(unitInstance);
                                                                        }

                                                                        JsonNode changeValueAbsoluteValue = estimatedImpactValue
                                                                                .get("changeValueAbsolute");
                                                                        if (changeValueAbsoluteValue != null
                                                                                && changeValueAbsoluteValue instanceof NullNode == false) {
                                                                            double changeValueAbsoluteInstance;
                                                                            changeValueAbsoluteInstance = changeValueAbsoluteValue
                                                                                    .getDoubleValue();
                                                                            operationImpactInstance
                                                                                    .setChangeValueAbsolute(
                                                                                            changeValueAbsoluteInstance);
                                                                        }

                                                                        JsonNode changeValueRelativeValue = estimatedImpactValue
                                                                                .get("changeValueRelative");
                                                                        if (changeValueRelativeValue != null
                                                                                && changeValueRelativeValue instanceof NullNode == false) {
                                                                            double changeValueRelativeInstance;
                                                                            changeValueRelativeInstance = changeValueRelativeValue
                                                                                    .getDoubleValue();
                                                                            operationImpactInstance
                                                                                    .setChangeValueRelative(
                                                                                            changeValueRelativeInstance);
                                                                        }
                                                                    }
                                                                }

                                                                JsonNode reportedImpactArray = propertiesValue6
                                                                        .get("reportedImpact");
                                                                if (reportedImpactArray != null
                                                                        && reportedImpactArray instanceof NullNode == false) {
                                                                    for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) {
                                                                        OperationImpact operationImpactInstance2 = new OperationImpact();
                                                                        propertiesInstance6.getReportedImpact()
                                                                                .add(operationImpactInstance2);

                                                                        JsonNode nameValue6 = reportedImpactValue
                                                                                .get("name");
                                                                        if (nameValue6 != null
                                                                                && nameValue6 instanceof NullNode == false) {
                                                                            String nameInstance6;
                                                                            nameInstance6 = nameValue6
                                                                                    .getTextValue();
                                                                            operationImpactInstance2
                                                                                    .setName(nameInstance6);
                                                                        }

                                                                        JsonNode unitValue2 = reportedImpactValue
                                                                                .get("unit");
                                                                        if (unitValue2 != null
                                                                                && unitValue2 instanceof NullNode == false) {
                                                                            String unitInstance2;
                                                                            unitInstance2 = unitValue2
                                                                                    .getTextValue();
                                                                            operationImpactInstance2
                                                                                    .setUnit(unitInstance2);
                                                                        }

                                                                        JsonNode changeValueAbsoluteValue2 = reportedImpactValue
                                                                                .get("changeValueAbsolute");
                                                                        if (changeValueAbsoluteValue2 != null
                                                                                && changeValueAbsoluteValue2 instanceof NullNode == false) {
                                                                            double changeValueAbsoluteInstance2;
                                                                            changeValueAbsoluteInstance2 = changeValueAbsoluteValue2
                                                                                    .getDoubleValue();
                                                                            operationImpactInstance2
                                                                                    .setChangeValueAbsolute(
                                                                                            changeValueAbsoluteInstance2);
                                                                        }

                                                                        JsonNode changeValueRelativeValue2 = reportedImpactValue
                                                                                .get("changeValueRelative");
                                                                        if (changeValueRelativeValue2 != null
                                                                                && changeValueRelativeValue2 instanceof NullNode == false) {
                                                                            double changeValueRelativeInstance2;
                                                                            changeValueRelativeInstance2 = changeValueRelativeValue2
                                                                                    .getDoubleValue();
                                                                            operationImpactInstance2
                                                                                    .setChangeValueRelative(
                                                                                            changeValueRelativeInstance2);
                                                                        }
                                                                    }
                                                                }
                                                            }

                                                            JsonNode idValue5 = recommendedIndexesValue
                                                                    .get("id");
                                                            if (idValue5 != null
                                                                    && idValue5 instanceof NullNode == false) {
                                                                String idInstance5;
                                                                idInstance5 = idValue5.getTextValue();
                                                                recommendedIndexInstance.setId(idInstance5);
                                                            }

                                                            JsonNode nameValue7 = recommendedIndexesValue
                                                                    .get("name");
                                                            if (nameValue7 != null
                                                                    && nameValue7 instanceof NullNode == false) {
                                                                String nameInstance7;
                                                                nameInstance7 = nameValue7.getTextValue();
                                                                recommendedIndexInstance.setName(nameInstance7);
                                                            }

                                                            JsonNode typeValue5 = recommendedIndexesValue
                                                                    .get("type");
                                                            if (typeValue5 != null
                                                                    && typeValue5 instanceof NullNode == false) {
                                                                String typeInstance5;
                                                                typeInstance5 = typeValue5.getTextValue();
                                                                recommendedIndexInstance.setType(typeInstance5);
                                                            }

                                                            JsonNode locationValue5 = recommendedIndexesValue
                                                                    .get("location");
                                                            if (locationValue5 != null
                                                                    && locationValue5 instanceof NullNode == false) {
                                                                String locationInstance5;
                                                                locationInstance5 = locationValue5
                                                                        .getTextValue();
                                                                recommendedIndexInstance
                                                                        .setLocation(locationInstance5);
                                                            }

                                                            JsonNode tagsSequenceElement5 = ((JsonNode) recommendedIndexesValue
                                                                    .get("tags"));
                                                            if (tagsSequenceElement5 != null
                                                                    && tagsSequenceElement5 instanceof NullNode == false) {
                                                                Iterator<Map.Entry<String, JsonNode>> itr5 = tagsSequenceElement5
                                                                        .getFields();
                                                                while (itr5.hasNext()) {
                                                                    Map.Entry<String, JsonNode> property5 = itr5
                                                                            .next();
                                                                    String tagsKey5 = property5.getKey();
                                                                    String tagsValue5 = property5.getValue()
                                                                            .getTextValue();
                                                                    recommendedIndexInstance.getTags()
                                                                            .put(tagsKey5, tagsValue5);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }

                                                JsonNode idValue6 = tablesValue.get("id");
                                                if (idValue6 != null && idValue6 instanceof NullNode == false) {
                                                    String idInstance6;
                                                    idInstance6 = idValue6.getTextValue();
                                                    tableInstance.setId(idInstance6);
                                                }

                                                JsonNode nameValue8 = tablesValue.get("name");
                                                if (nameValue8 != null
                                                        && nameValue8 instanceof NullNode == false) {
                                                    String nameInstance8;
                                                    nameInstance8 = nameValue8.getTextValue();
                                                    tableInstance.setName(nameInstance8);
                                                }

                                                JsonNode typeValue6 = tablesValue.get("type");
                                                if (typeValue6 != null
                                                        && typeValue6 instanceof NullNode == false) {
                                                    String typeInstance6;
                                                    typeInstance6 = typeValue6.getTextValue();
                                                    tableInstance.setType(typeInstance6);
                                                }

                                                JsonNode locationValue6 = tablesValue.get("location");
                                                if (locationValue6 != null
                                                        && locationValue6 instanceof NullNode == false) {
                                                    String locationInstance6;
                                                    locationInstance6 = locationValue6.getTextValue();
                                                    tableInstance.setLocation(locationInstance6);
                                                }

                                                JsonNode tagsSequenceElement6 = ((JsonNode) tablesValue
                                                        .get("tags"));
                                                if (tagsSequenceElement6 != null
                                                        && tagsSequenceElement6 instanceof NullNode == false) {
                                                    Iterator<Map.Entry<String, JsonNode>> itr6 = tagsSequenceElement6
                                                            .getFields();
                                                    while (itr6.hasNext()) {
                                                        Map.Entry<String, JsonNode> property6 = itr6.next();
                                                        String tagsKey6 = property6.getKey();
                                                        String tagsValue6 = property6.getValue().getTextValue();
                                                        tableInstance.getTags().put(tagsKey6, tagsValue6);
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    JsonNode idValue7 = schemasValue.get("id");
                                    if (idValue7 != null && idValue7 instanceof NullNode == false) {
                                        String idInstance7;
                                        idInstance7 = idValue7.getTextValue();
                                        schemaInstance.setId(idInstance7);
                                    }

                                    JsonNode nameValue9 = schemasValue.get("name");
                                    if (nameValue9 != null && nameValue9 instanceof NullNode == false) {
                                        String nameInstance9;
                                        nameInstance9 = nameValue9.getTextValue();
                                        schemaInstance.setName(nameInstance9);
                                    }

                                    JsonNode typeValue7 = schemasValue.get("type");
                                    if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
                                        String typeInstance7;
                                        typeInstance7 = typeValue7.getTextValue();
                                        schemaInstance.setType(typeInstance7);
                                    }

                                    JsonNode locationValue7 = schemasValue.get("location");
                                    if (locationValue7 != null && locationValue7 instanceof NullNode == false) {
                                        String locationInstance7;
                                        locationInstance7 = locationValue7.getTextValue();
                                        schemaInstance.setLocation(locationInstance7);
                                    }

                                    JsonNode tagsSequenceElement7 = ((JsonNode) schemasValue.get("tags"));
                                    if (tagsSequenceElement7 != null
                                            && tagsSequenceElement7 instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr7 = tagsSequenceElement7
                                                .getFields();
                                        while (itr7.hasNext()) {
                                            Map.Entry<String, JsonNode> property7 = itr7.next();
                                            String tagsKey7 = property7.getKey();
                                            String tagsValue7 = property7.getValue().getTextValue();
                                            schemaInstance.getTags().put(tagsKey7, tagsValue7);
                                        }
                                    }
                                }
                            }

                            JsonNode defaultSecondaryLocationValue = propertiesValue
                                    .get("defaultSecondaryLocation");
                            if (defaultSecondaryLocationValue != null
                                    && defaultSecondaryLocationValue instanceof NullNode == false) {
                                String defaultSecondaryLocationInstance;
                                defaultSecondaryLocationInstance = defaultSecondaryLocationValue.getTextValue();
                                propertiesInstance
                                        .setDefaultSecondaryLocation(defaultSecondaryLocationInstance);
                            }
                        }

                        JsonNode idValue8 = valueValue.get("id");
                        if (idValue8 != null && idValue8 instanceof NullNode == false) {
                            String idInstance8;
                            idInstance8 = idValue8.getTextValue();
                            databaseInstance.setId(idInstance8);
                        }

                        JsonNode nameValue10 = valueValue.get("name");
                        if (nameValue10 != null && nameValue10 instanceof NullNode == false) {
                            String nameInstance10;
                            nameInstance10 = nameValue10.getTextValue();
                            databaseInstance.setName(nameInstance10);
                        }

                        JsonNode typeValue8 = valueValue.get("type");
                        if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
                            String typeInstance8;
                            typeInstance8 = typeValue8.getTextValue();
                            databaseInstance.setType(typeInstance8);
                        }

                        JsonNode locationValue8 = valueValue.get("location");
                        if (locationValue8 != null && locationValue8 instanceof NullNode == false) {
                            String locationInstance8;
                            locationInstance8 = locationValue8.getTextValue();
                            databaseInstance.setLocation(locationInstance8);
                        }

                        JsonNode tagsSequenceElement8 = ((JsonNode) valueValue.get("tags"));
                        if (tagsSequenceElement8 != null && tagsSequenceElement8 instanceof NullNode == false) {
                            Iterator<Map.Entry<String, JsonNode>> itr8 = tagsSequenceElement8.getFields();
                            while (itr8.hasNext()) {
                                Map.Entry<String, JsonNode> property8 = itr8.next();
                                String tagsKey8 = property8.getKey();
                                String tagsValue8 = property8.getValue().getTextValue();
                                databaseInstance.getTags().put(tagsKey8, tagsValue8);
                            }
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.azure.management.compute.VirtualMachineOperationsImpl.java

/**
* Gets the list of Virtual Machines in the subscription. Use nextLink
* property in the response to get the next page of Virtual Machines. Do
* this till nextLink is not null to fetch all the Virtual Machines.
*
* @param parameters Optional./* w  ww .ja  v a  2 s. c o m*/
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The List Virtual Machine operation response.
*/
@Override
public VirtualMachineListResponse listAll(ListParameters parameters)
        throws IOException, ServiceException, URISyntaxException {
    // Validate

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("parameters", parameters);
        CloudTracing.enter(invocationId, this, "listAllAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/subscriptions/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/providers/";
    url = url + "Microsoft.Compute";
    url = url + "/";
    url = url + "virtualMachines";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2015-06-15");
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("Content-Type", "application/json");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        VirtualMachineListResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new VirtualMachineListResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode valueArray = responseDoc.get("value");
                if (valueArray != null && valueArray instanceof NullNode == false) {
                    for (JsonNode valueValue : ((ArrayNode) valueArray)) {
                        VirtualMachine virtualMachineJsonInstance = new VirtualMachine();
                        result.getVirtualMachines().add(virtualMachineJsonInstance);

                        JsonNode planValue = valueValue.get("plan");
                        if (planValue != null && planValue instanceof NullNode == false) {
                            Plan planInstance = new Plan();
                            virtualMachineJsonInstance.setPlan(planInstance);

                            JsonNode nameValue = planValue.get("name");
                            if (nameValue != null && nameValue instanceof NullNode == false) {
                                String nameInstance;
                                nameInstance = nameValue.getTextValue();
                                planInstance.setName(nameInstance);
                            }

                            JsonNode publisherValue = planValue.get("publisher");
                            if (publisherValue != null && publisherValue instanceof NullNode == false) {
                                String publisherInstance;
                                publisherInstance = publisherValue.getTextValue();
                                planInstance.setPublisher(publisherInstance);
                            }

                            JsonNode productValue = planValue.get("product");
                            if (productValue != null && productValue instanceof NullNode == false) {
                                String productInstance;
                                productInstance = productValue.getTextValue();
                                planInstance.setProduct(productInstance);
                            }

                            JsonNode promotionCodeValue = planValue.get("promotionCode");
                            if (promotionCodeValue != null && promotionCodeValue instanceof NullNode == false) {
                                String promotionCodeInstance;
                                promotionCodeInstance = promotionCodeValue.getTextValue();
                                planInstance.setPromotionCode(promotionCodeInstance);
                            }
                        }

                        JsonNode propertiesValue = valueValue.get("properties");
                        if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
                            JsonNode hardwareProfileValue = propertiesValue.get("hardwareProfile");
                            if (hardwareProfileValue != null
                                    && hardwareProfileValue instanceof NullNode == false) {
                                HardwareProfile hardwareProfileInstance = new HardwareProfile();
                                virtualMachineJsonInstance.setHardwareProfile(hardwareProfileInstance);

                                JsonNode vmSizeValue = hardwareProfileValue.get("vmSize");
                                if (vmSizeValue != null && vmSizeValue instanceof NullNode == false) {
                                    String vmSizeInstance;
                                    vmSizeInstance = vmSizeValue.getTextValue();
                                    hardwareProfileInstance.setVirtualMachineSize(vmSizeInstance);
                                }
                            }

                            JsonNode storageProfileValue = propertiesValue.get("storageProfile");
                            if (storageProfileValue != null
                                    && storageProfileValue instanceof NullNode == false) {
                                StorageProfile storageProfileInstance = new StorageProfile();
                                virtualMachineJsonInstance.setStorageProfile(storageProfileInstance);

                                JsonNode imageReferenceValue = storageProfileValue.get("imageReference");
                                if (imageReferenceValue != null
                                        && imageReferenceValue instanceof NullNode == false) {
                                    ImageReference imageReferenceInstance = new ImageReference();
                                    storageProfileInstance.setImageReference(imageReferenceInstance);

                                    JsonNode publisherValue2 = imageReferenceValue.get("publisher");
                                    if (publisherValue2 != null
                                            && publisherValue2 instanceof NullNode == false) {
                                        String publisherInstance2;
                                        publisherInstance2 = publisherValue2.getTextValue();
                                        imageReferenceInstance.setPublisher(publisherInstance2);
                                    }

                                    JsonNode offerValue = imageReferenceValue.get("offer");
                                    if (offerValue != null && offerValue instanceof NullNode == false) {
                                        String offerInstance;
                                        offerInstance = offerValue.getTextValue();
                                        imageReferenceInstance.setOffer(offerInstance);
                                    }

                                    JsonNode skuValue = imageReferenceValue.get("sku");
                                    if (skuValue != null && skuValue instanceof NullNode == false) {
                                        String skuInstance;
                                        skuInstance = skuValue.getTextValue();
                                        imageReferenceInstance.setSku(skuInstance);
                                    }

                                    JsonNode versionValue = imageReferenceValue.get("version");
                                    if (versionValue != null && versionValue instanceof NullNode == false) {
                                        String versionInstance;
                                        versionInstance = versionValue.getTextValue();
                                        imageReferenceInstance.setVersion(versionInstance);
                                    }
                                }

                                JsonNode osDiskValue = storageProfileValue.get("osDisk");
                                if (osDiskValue != null && osDiskValue instanceof NullNode == false) {
                                    OSDisk osDiskInstance = new OSDisk();
                                    storageProfileInstance.setOSDisk(osDiskInstance);

                                    JsonNode osTypeValue = osDiskValue.get("osType");
                                    if (osTypeValue != null && osTypeValue instanceof NullNode == false) {
                                        String osTypeInstance;
                                        osTypeInstance = osTypeValue.getTextValue();
                                        osDiskInstance.setOperatingSystemType(osTypeInstance);
                                    }

                                    JsonNode nameValue2 = osDiskValue.get("name");
                                    if (nameValue2 != null && nameValue2 instanceof NullNode == false) {
                                        String nameInstance2;
                                        nameInstance2 = nameValue2.getTextValue();
                                        osDiskInstance.setName(nameInstance2);
                                    }

                                    JsonNode vhdValue = osDiskValue.get("vhd");
                                    if (vhdValue != null && vhdValue instanceof NullNode == false) {
                                        VirtualHardDisk vhdInstance = new VirtualHardDisk();
                                        osDiskInstance.setVirtualHardDisk(vhdInstance);

                                        JsonNode uriValue = vhdValue.get("uri");
                                        if (uriValue != null && uriValue instanceof NullNode == false) {
                                            String uriInstance;
                                            uriInstance = uriValue.getTextValue();
                                            vhdInstance.setUri(uriInstance);
                                        }
                                    }

                                    JsonNode imageValue = osDiskValue.get("image");
                                    if (imageValue != null && imageValue instanceof NullNode == false) {
                                        VirtualHardDisk imageInstance = new VirtualHardDisk();
                                        osDiskInstance.setSourceImage(imageInstance);

                                        JsonNode uriValue2 = imageValue.get("uri");
                                        if (uriValue2 != null && uriValue2 instanceof NullNode == false) {
                                            String uriInstance2;
                                            uriInstance2 = uriValue2.getTextValue();
                                            imageInstance.setUri(uriInstance2);
                                        }
                                    }

                                    JsonNode cachingValue = osDiskValue.get("caching");
                                    if (cachingValue != null && cachingValue instanceof NullNode == false) {
                                        String cachingInstance;
                                        cachingInstance = cachingValue.getTextValue();
                                        osDiskInstance.setCaching(cachingInstance);
                                    }

                                    JsonNode createOptionValue = osDiskValue.get("createOption");
                                    if (createOptionValue != null
                                            && createOptionValue instanceof NullNode == false) {
                                        String createOptionInstance;
                                        createOptionInstance = createOptionValue.getTextValue();
                                        osDiskInstance.setCreateOption(createOptionInstance);
                                    }

                                    JsonNode diskSizeGBValue = osDiskValue.get("diskSizeGB");
                                    if (diskSizeGBValue != null
                                            && diskSizeGBValue instanceof NullNode == false) {
                                        int diskSizeGBInstance;
                                        diskSizeGBInstance = diskSizeGBValue.getIntValue();
                                        osDiskInstance.setDiskSizeGB(diskSizeGBInstance);
                                    }
                                }

                                JsonNode dataDisksArray = storageProfileValue.get("dataDisks");
                                if (dataDisksArray != null && dataDisksArray instanceof NullNode == false) {
                                    for (JsonNode dataDisksValue : ((ArrayNode) dataDisksArray)) {
                                        DataDisk dataDiskInstance = new DataDisk();
                                        storageProfileInstance.getDataDisks().add(dataDiskInstance);

                                        JsonNode lunValue = dataDisksValue.get("lun");
                                        if (lunValue != null && lunValue instanceof NullNode == false) {
                                            int lunInstance;
                                            lunInstance = lunValue.getIntValue();
                                            dataDiskInstance.setLun(lunInstance);
                                        }

                                        JsonNode nameValue3 = dataDisksValue.get("name");
                                        if (nameValue3 != null && nameValue3 instanceof NullNode == false) {
                                            String nameInstance3;
                                            nameInstance3 = nameValue3.getTextValue();
                                            dataDiskInstance.setName(nameInstance3);
                                        }

                                        JsonNode vhdValue2 = dataDisksValue.get("vhd");
                                        if (vhdValue2 != null && vhdValue2 instanceof NullNode == false) {
                                            VirtualHardDisk vhdInstance2 = new VirtualHardDisk();
                                            dataDiskInstance.setVirtualHardDisk(vhdInstance2);

                                            JsonNode uriValue3 = vhdValue2.get("uri");
                                            if (uriValue3 != null && uriValue3 instanceof NullNode == false) {
                                                String uriInstance3;
                                                uriInstance3 = uriValue3.getTextValue();
                                                vhdInstance2.setUri(uriInstance3);
                                            }
                                        }

                                        JsonNode imageValue2 = dataDisksValue.get("image");
                                        if (imageValue2 != null && imageValue2 instanceof NullNode == false) {
                                            VirtualHardDisk imageInstance2 = new VirtualHardDisk();
                                            dataDiskInstance.setSourceImage(imageInstance2);

                                            JsonNode uriValue4 = imageValue2.get("uri");
                                            if (uriValue4 != null && uriValue4 instanceof NullNode == false) {
                                                String uriInstance4;
                                                uriInstance4 = uriValue4.getTextValue();
                                                imageInstance2.setUri(uriInstance4);
                                            }
                                        }

                                        JsonNode cachingValue2 = dataDisksValue.get("caching");
                                        if (cachingValue2 != null
                                                && cachingValue2 instanceof NullNode == false) {
                                            String cachingInstance2;
                                            cachingInstance2 = cachingValue2.getTextValue();
                                            dataDiskInstance.setCaching(cachingInstance2);
                                        }

                                        JsonNode createOptionValue2 = dataDisksValue.get("createOption");
                                        if (createOptionValue2 != null
                                                && createOptionValue2 instanceof NullNode == false) {
                                            String createOptionInstance2;
                                            createOptionInstance2 = createOptionValue2.getTextValue();
                                            dataDiskInstance.setCreateOption(createOptionInstance2);
                                        }

                                        JsonNode diskSizeGBValue2 = dataDisksValue.get("diskSizeGB");
                                        if (diskSizeGBValue2 != null
                                                && diskSizeGBValue2 instanceof NullNode == false) {
                                            int diskSizeGBInstance2;
                                            diskSizeGBInstance2 = diskSizeGBValue2.getIntValue();
                                            dataDiskInstance.setDiskSizeGB(diskSizeGBInstance2);
                                        }
                                    }
                                }
                            }

                            JsonNode osProfileValue = propertiesValue.get("osProfile");
                            if (osProfileValue != null && osProfileValue instanceof NullNode == false) {
                                OSProfile osProfileInstance = new OSProfile();
                                virtualMachineJsonInstance.setOSProfile(osProfileInstance);

                                JsonNode computerNameValue = osProfileValue.get("computerName");
                                if (computerNameValue != null
                                        && computerNameValue instanceof NullNode == false) {
                                    String computerNameInstance;
                                    computerNameInstance = computerNameValue.getTextValue();
                                    osProfileInstance.setComputerName(computerNameInstance);
                                }

                                JsonNode adminUsernameValue = osProfileValue.get("adminUsername");
                                if (adminUsernameValue != null
                                        && adminUsernameValue instanceof NullNode == false) {
                                    String adminUsernameInstance;
                                    adminUsernameInstance = adminUsernameValue.getTextValue();
                                    osProfileInstance.setAdminUsername(adminUsernameInstance);
                                }

                                JsonNode adminPasswordValue = osProfileValue.get("adminPassword");
                                if (adminPasswordValue != null
                                        && adminPasswordValue instanceof NullNode == false) {
                                    String adminPasswordInstance;
                                    adminPasswordInstance = adminPasswordValue.getTextValue();
                                    osProfileInstance.setAdminPassword(adminPasswordInstance);
                                }

                                JsonNode customDataValue = osProfileValue.get("customData");
                                if (customDataValue != null && customDataValue instanceof NullNode == false) {
                                    String customDataInstance;
                                    customDataInstance = customDataValue.getTextValue();
                                    osProfileInstance.setCustomData(customDataInstance);
                                }

                                JsonNode windowsConfigurationValue = osProfileValue.get("windowsConfiguration");
                                if (windowsConfigurationValue != null
                                        && windowsConfigurationValue instanceof NullNode == false) {
                                    WindowsConfiguration windowsConfigurationInstance = new WindowsConfiguration();
                                    osProfileInstance.setWindowsConfiguration(windowsConfigurationInstance);

                                    JsonNode provisionVMAgentValue = windowsConfigurationValue
                                            .get("provisionVMAgent");
                                    if (provisionVMAgentValue != null
                                            && provisionVMAgentValue instanceof NullNode == false) {
                                        boolean provisionVMAgentInstance;
                                        provisionVMAgentInstance = provisionVMAgentValue.getBooleanValue();
                                        windowsConfigurationInstance
                                                .setProvisionVMAgent(provisionVMAgentInstance);
                                    }

                                    JsonNode enableAutomaticUpdatesValue = windowsConfigurationValue
                                            .get("enableAutomaticUpdates");
                                    if (enableAutomaticUpdatesValue != null
                                            && enableAutomaticUpdatesValue instanceof NullNode == false) {
                                        boolean enableAutomaticUpdatesInstance;
                                        enableAutomaticUpdatesInstance = enableAutomaticUpdatesValue
                                                .getBooleanValue();
                                        windowsConfigurationInstance
                                                .setEnableAutomaticUpdates(enableAutomaticUpdatesInstance);
                                    }

                                    JsonNode timeZoneValue = windowsConfigurationValue.get("timeZone");
                                    if (timeZoneValue != null && timeZoneValue instanceof NullNode == false) {
                                        String timeZoneInstance;
                                        timeZoneInstance = timeZoneValue.getTextValue();
                                        windowsConfigurationInstance.setTimeZone(timeZoneInstance);
                                    }

                                    JsonNode additionalUnattendContentArray = windowsConfigurationValue
                                            .get("additionalUnattendContent");
                                    if (additionalUnattendContentArray != null
                                            && additionalUnattendContentArray instanceof NullNode == false) {
                                        for (JsonNode additionalUnattendContentValue : ((ArrayNode) additionalUnattendContentArray)) {
                                            AdditionalUnattendContent additionalUnattendContentInstance = new AdditionalUnattendContent();
                                            windowsConfigurationInstance.getAdditionalUnattendContents()
                                                    .add(additionalUnattendContentInstance);

                                            JsonNode passNameValue = additionalUnattendContentValue
                                                    .get("passName");
                                            if (passNameValue != null
                                                    && passNameValue instanceof NullNode == false) {
                                                String passNameInstance;
                                                passNameInstance = passNameValue.getTextValue();
                                                additionalUnattendContentInstance.setPassName(passNameInstance);
                                            }

                                            JsonNode componentNameValue = additionalUnattendContentValue
                                                    .get("componentName");
                                            if (componentNameValue != null
                                                    && componentNameValue instanceof NullNode == false) {
                                                String componentNameInstance;
                                                componentNameInstance = componentNameValue.getTextValue();
                                                additionalUnattendContentInstance
                                                        .setComponentName(componentNameInstance);
                                            }

                                            JsonNode settingNameValue = additionalUnattendContentValue
                                                    .get("settingName");
                                            if (settingNameValue != null
                                                    && settingNameValue instanceof NullNode == false) {
                                                String settingNameInstance;
                                                settingNameInstance = settingNameValue.getTextValue();
                                                additionalUnattendContentInstance
                                                        .setSettingName(settingNameInstance);
                                            }

                                            JsonNode contentValue = additionalUnattendContentValue
                                                    .get("content");
                                            if (contentValue != null
                                                    && contentValue instanceof NullNode == false) {
                                                String contentInstance;
                                                contentInstance = contentValue.getTextValue();
                                                additionalUnattendContentInstance.setContent(contentInstance);
                                            }
                                        }
                                    }

                                    JsonNode winRMValue = windowsConfigurationValue.get("winRM");
                                    if (winRMValue != null && winRMValue instanceof NullNode == false) {
                                        WinRMConfiguration winRMInstance = new WinRMConfiguration();
                                        windowsConfigurationInstance.setWinRMConfiguration(winRMInstance);

                                        JsonNode listenersArray = winRMValue.get("listeners");
                                        if (listenersArray != null
                                                && listenersArray instanceof NullNode == false) {
                                            for (JsonNode listenersValue : ((ArrayNode) listenersArray)) {
                                                WinRMListener winRMListenerInstance = new WinRMListener();
                                                winRMInstance.getListeners().add(winRMListenerInstance);

                                                JsonNode protocolValue = listenersValue.get("protocol");
                                                if (protocolValue != null
                                                        && protocolValue instanceof NullNode == false) {
                                                    String protocolInstance;
                                                    protocolInstance = protocolValue.getTextValue();
                                                    winRMListenerInstance.setProtocol(protocolInstance);
                                                }

                                                JsonNode certificateUrlValue = listenersValue
                                                        .get("certificateUrl");
                                                if (certificateUrlValue != null
                                                        && certificateUrlValue instanceof NullNode == false) {
                                                    URI certificateUrlInstance;
                                                    certificateUrlInstance = new URI(
                                                            certificateUrlValue.getTextValue());
                                                    winRMListenerInstance
                                                            .setCertificateUrl(certificateUrlInstance);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode linuxConfigurationValue = osProfileValue.get("linuxConfiguration");
                                if (linuxConfigurationValue != null
                                        && linuxConfigurationValue instanceof NullNode == false) {
                                    LinuxConfiguration linuxConfigurationInstance = new LinuxConfiguration();
                                    osProfileInstance.setLinuxConfiguration(linuxConfigurationInstance);

                                    JsonNode disablePasswordAuthenticationValue = linuxConfigurationValue
                                            .get("disablePasswordAuthentication");
                                    if (disablePasswordAuthenticationValue != null
                                            && disablePasswordAuthenticationValue instanceof NullNode == false) {
                                        boolean disablePasswordAuthenticationInstance;
                                        disablePasswordAuthenticationInstance = disablePasswordAuthenticationValue
                                                .getBooleanValue();
                                        linuxConfigurationInstance.setDisablePasswordAuthentication(
                                                disablePasswordAuthenticationInstance);
                                    }

                                    JsonNode sshValue = linuxConfigurationValue.get("ssh");
                                    if (sshValue != null && sshValue instanceof NullNode == false) {
                                        SshConfiguration sshInstance = new SshConfiguration();
                                        linuxConfigurationInstance.setSshConfiguration(sshInstance);

                                        JsonNode publicKeysArray = sshValue.get("publicKeys");
                                        if (publicKeysArray != null
                                                && publicKeysArray instanceof NullNode == false) {
                                            for (JsonNode publicKeysValue : ((ArrayNode) publicKeysArray)) {
                                                SshPublicKey sshPublicKeyInstance = new SshPublicKey();
                                                sshInstance.getPublicKeys().add(sshPublicKeyInstance);

                                                JsonNode pathValue = publicKeysValue.get("path");
                                                if (pathValue != null
                                                        && pathValue instanceof NullNode == false) {
                                                    String pathInstance;
                                                    pathInstance = pathValue.getTextValue();
                                                    sshPublicKeyInstance.setPath(pathInstance);
                                                }

                                                JsonNode keyDataValue = publicKeysValue.get("keyData");
                                                if (keyDataValue != null
                                                        && keyDataValue instanceof NullNode == false) {
                                                    String keyDataInstance;
                                                    keyDataInstance = keyDataValue.getTextValue();
                                                    sshPublicKeyInstance.setKeyData(keyDataInstance);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode secretsArray = osProfileValue.get("secrets");
                                if (secretsArray != null && secretsArray instanceof NullNode == false) {
                                    for (JsonNode secretsValue : ((ArrayNode) secretsArray)) {
                                        VaultSecretGroup vaultSecretGroupInstance = new VaultSecretGroup();
                                        osProfileInstance.getSecrets().add(vaultSecretGroupInstance);

                                        JsonNode sourceVaultValue = secretsValue.get("sourceVault");
                                        if (sourceVaultValue != null
                                                && sourceVaultValue instanceof NullNode == false) {
                                            SourceVaultReference sourceVaultInstance = new SourceVaultReference();
                                            vaultSecretGroupInstance.setSourceVault(sourceVaultInstance);

                                            JsonNode idValue = sourceVaultValue.get("id");
                                            if (idValue != null && idValue instanceof NullNode == false) {
                                                String idInstance;
                                                idInstance = idValue.getTextValue();
                                                sourceVaultInstance.setReferenceUri(idInstance);
                                            }
                                        }

                                        JsonNode vaultCertificatesArray = secretsValue.get("vaultCertificates");
                                        if (vaultCertificatesArray != null
                                                && vaultCertificatesArray instanceof NullNode == false) {
                                            for (JsonNode vaultCertificatesValue : ((ArrayNode) vaultCertificatesArray)) {
                                                VaultCertificate vaultCertificateInstance = new VaultCertificate();
                                                vaultSecretGroupInstance.getVaultCertificates()
                                                        .add(vaultCertificateInstance);

                                                JsonNode certificateUrlValue2 = vaultCertificatesValue
                                                        .get("certificateUrl");
                                                if (certificateUrlValue2 != null
                                                        && certificateUrlValue2 instanceof NullNode == false) {
                                                    String certificateUrlInstance2;
                                                    certificateUrlInstance2 = certificateUrlValue2
                                                            .getTextValue();
                                                    vaultCertificateInstance
                                                            .setCertificateUrl(certificateUrlInstance2);
                                                }

                                                JsonNode certificateStoreValue = vaultCertificatesValue
                                                        .get("certificateStore");
                                                if (certificateStoreValue != null
                                                        && certificateStoreValue instanceof NullNode == false) {
                                                    String certificateStoreInstance;
                                                    certificateStoreInstance = certificateStoreValue
                                                            .getTextValue();
                                                    vaultCertificateInstance
                                                            .setCertificateStore(certificateStoreInstance);
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            JsonNode networkProfileValue = propertiesValue.get("networkProfile");
                            if (networkProfileValue != null
                                    && networkProfileValue instanceof NullNode == false) {
                                NetworkProfile networkProfileInstance = new NetworkProfile();
                                virtualMachineJsonInstance.setNetworkProfile(networkProfileInstance);

                                JsonNode networkInterfacesArray = networkProfileValue.get("networkInterfaces");
                                if (networkInterfacesArray != null
                                        && networkInterfacesArray instanceof NullNode == false) {
                                    for (JsonNode networkInterfacesValue : ((ArrayNode) networkInterfacesArray)) {
                                        NetworkInterfaceReference networkInterfaceReferenceJsonInstance = new NetworkInterfaceReference();
                                        networkProfileInstance.getNetworkInterfaces()
                                                .add(networkInterfaceReferenceJsonInstance);

                                        JsonNode propertiesValue2 = networkInterfacesValue.get("properties");
                                        if (propertiesValue2 != null
                                                && propertiesValue2 instanceof NullNode == false) {
                                            JsonNode primaryValue = propertiesValue2.get("primary");
                                            if (primaryValue != null
                                                    && primaryValue instanceof NullNode == false) {
                                                boolean primaryInstance;
                                                primaryInstance = primaryValue.getBooleanValue();
                                                networkInterfaceReferenceJsonInstance
                                                        .setPrimary(primaryInstance);
                                            }
                                        }

                                        JsonNode idValue2 = networkInterfacesValue.get("id");
                                        if (idValue2 != null && idValue2 instanceof NullNode == false) {
                                            String idInstance2;
                                            idInstance2 = idValue2.getTextValue();
                                            networkInterfaceReferenceJsonInstance.setReferenceUri(idInstance2);
                                        }
                                    }
                                }
                            }

                            JsonNode diagnosticsProfileValue = propertiesValue.get("diagnosticsProfile");
                            if (diagnosticsProfileValue != null
                                    && diagnosticsProfileValue instanceof NullNode == false) {
                                DiagnosticsProfile diagnosticsProfileInstance = new DiagnosticsProfile();
                                virtualMachineJsonInstance.setDiagnosticsProfile(diagnosticsProfileInstance);

                                JsonNode bootDiagnosticsValue = diagnosticsProfileValue.get("bootDiagnostics");
                                if (bootDiagnosticsValue != null
                                        && bootDiagnosticsValue instanceof NullNode == false) {
                                    BootDiagnostics bootDiagnosticsInstance = new BootDiagnostics();
                                    diagnosticsProfileInstance.setBootDiagnostics(bootDiagnosticsInstance);

                                    JsonNode enabledValue = bootDiagnosticsValue.get("enabled");
                                    if (enabledValue != null && enabledValue instanceof NullNode == false) {
                                        boolean enabledInstance;
                                        enabledInstance = enabledValue.getBooleanValue();
                                        bootDiagnosticsInstance.setEnabled(enabledInstance);
                                    }

                                    JsonNode storageUriValue = bootDiagnosticsValue.get("storageUri");
                                    if (storageUriValue != null
                                            && storageUriValue instanceof NullNode == false) {
                                        URI storageUriInstance;
                                        storageUriInstance = new URI(storageUriValue.getTextValue());
                                        bootDiagnosticsInstance.setStorageUri(storageUriInstance);
                                    }
                                }
                            }

                            JsonNode availabilitySetValue = propertiesValue.get("availabilitySet");
                            if (availabilitySetValue != null
                                    && availabilitySetValue instanceof NullNode == false) {
                                AvailabilitySetReference availabilitySetInstance = new AvailabilitySetReference();
                                virtualMachineJsonInstance.setAvailabilitySetReference(availabilitySetInstance);

                                JsonNode idValue3 = availabilitySetValue.get("id");
                                if (idValue3 != null && idValue3 instanceof NullNode == false) {
                                    String idInstance3;
                                    idInstance3 = idValue3.getTextValue();
                                    availabilitySetInstance.setReferenceUri(idInstance3);
                                }
                            }

                            JsonNode provisioningStateValue = propertiesValue.get("provisioningState");
                            if (provisioningStateValue != null
                                    && provisioningStateValue instanceof NullNode == false) {
                                String provisioningStateInstance;
                                provisioningStateInstance = provisioningStateValue.getTextValue();
                                virtualMachineJsonInstance.setProvisioningState(provisioningStateInstance);
                            }

                            JsonNode instanceViewValue = propertiesValue.get("instanceView");
                            if (instanceViewValue != null && instanceViewValue instanceof NullNode == false) {
                                VirtualMachineInstanceView instanceViewInstance = new VirtualMachineInstanceView();
                                virtualMachineJsonInstance.setInstanceView(instanceViewInstance);

                                JsonNode platformUpdateDomainValue = instanceViewValue
                                        .get("platformUpdateDomain");
                                if (platformUpdateDomainValue != null
                                        && platformUpdateDomainValue instanceof NullNode == false) {
                                    int platformUpdateDomainInstance;
                                    platformUpdateDomainInstance = platformUpdateDomainValue.getIntValue();
                                    instanceViewInstance.setPlatformUpdateDomain(platformUpdateDomainInstance);
                                }

                                JsonNode platformFaultDomainValue = instanceViewValue
                                        .get("platformFaultDomain");
                                if (platformFaultDomainValue != null
                                        && platformFaultDomainValue instanceof NullNode == false) {
                                    int platformFaultDomainInstance;
                                    platformFaultDomainInstance = platformFaultDomainValue.getIntValue();
                                    instanceViewInstance.setPlatformFaultDomain(platformFaultDomainInstance);
                                }

                                JsonNode rdpThumbPrintValue = instanceViewValue.get("rdpThumbPrint");
                                if (rdpThumbPrintValue != null
                                        && rdpThumbPrintValue instanceof NullNode == false) {
                                    String rdpThumbPrintInstance;
                                    rdpThumbPrintInstance = rdpThumbPrintValue.getTextValue();
                                    instanceViewInstance.setRemoteDesktopThumbprint(rdpThumbPrintInstance);
                                }

                                JsonNode vmAgentValue = instanceViewValue.get("vmAgent");
                                if (vmAgentValue != null && vmAgentValue instanceof NullNode == false) {
                                    VirtualMachineAgentInstanceView vmAgentInstance = new VirtualMachineAgentInstanceView();
                                    instanceViewInstance.setVMAgent(vmAgentInstance);

                                    JsonNode vmAgentVersionValue = vmAgentValue.get("vmAgentVersion");
                                    if (vmAgentVersionValue != null
                                            && vmAgentVersionValue instanceof NullNode == false) {
                                        String vmAgentVersionInstance;
                                        vmAgentVersionInstance = vmAgentVersionValue.getTextValue();
                                        vmAgentInstance.setVMAgentVersion(vmAgentVersionInstance);
                                    }

                                    JsonNode extensionHandlersArray = vmAgentValue.get("extensionHandlers");
                                    if (extensionHandlersArray != null
                                            && extensionHandlersArray instanceof NullNode == false) {
                                        for (JsonNode extensionHandlersValue : ((ArrayNode) extensionHandlersArray)) {
                                            VirtualMachineExtensionHandlerInstanceView virtualMachineExtensionHandlerInstanceViewInstance = new VirtualMachineExtensionHandlerInstanceView();
                                            vmAgentInstance.getExtensionHandlers()
                                                    .add(virtualMachineExtensionHandlerInstanceViewInstance);

                                            JsonNode typeValue = extensionHandlersValue.get("type");
                                            if (typeValue != null && typeValue instanceof NullNode == false) {
                                                String typeInstance;
                                                typeInstance = typeValue.getTextValue();
                                                virtualMachineExtensionHandlerInstanceViewInstance
                                                        .setType(typeInstance);
                                            }

                                            JsonNode typeHandlerVersionValue = extensionHandlersValue
                                                    .get("typeHandlerVersion");
                                            if (typeHandlerVersionValue != null
                                                    && typeHandlerVersionValue instanceof NullNode == false) {
                                                String typeHandlerVersionInstance;
                                                typeHandlerVersionInstance = typeHandlerVersionValue
                                                        .getTextValue();
                                                virtualMachineExtensionHandlerInstanceViewInstance
                                                        .setTypeHandlerVersion(typeHandlerVersionInstance);
                                            }

                                            JsonNode statusValue = extensionHandlersValue.get("status");
                                            if (statusValue != null
                                                    && statusValue instanceof NullNode == false) {
                                                InstanceViewStatus statusInstance = new InstanceViewStatus();
                                                virtualMachineExtensionHandlerInstanceViewInstance
                                                        .setStatus(statusInstance);

                                                JsonNode codeValue = statusValue.get("code");
                                                if (codeValue != null
                                                        && codeValue instanceof NullNode == false) {
                                                    String codeInstance;
                                                    codeInstance = codeValue.getTextValue();
                                                    statusInstance.setCode(codeInstance);
                                                }

                                                JsonNode levelValue = statusValue.get("level");
                                                if (levelValue != null
                                                        && levelValue instanceof NullNode == false) {
                                                    String levelInstance;
                                                    levelInstance = levelValue.getTextValue();
                                                    statusInstance.setLevel(levelInstance);
                                                }

                                                JsonNode displayStatusValue = statusValue.get("displayStatus");
                                                if (displayStatusValue != null
                                                        && displayStatusValue instanceof NullNode == false) {
                                                    String displayStatusInstance;
                                                    displayStatusInstance = displayStatusValue.getTextValue();
                                                    statusInstance.setDisplayStatus(displayStatusInstance);
                                                }

                                                JsonNode messageValue = statusValue.get("message");
                                                if (messageValue != null
                                                        && messageValue instanceof NullNode == false) {
                                                    String messageInstance;
                                                    messageInstance = messageValue.getTextValue();
                                                    statusInstance.setMessage(messageInstance);
                                                }

                                                JsonNode timeValue = statusValue.get("time");
                                                if (timeValue != null
                                                        && timeValue instanceof NullNode == false) {
                                                    Calendar timeInstance;
                                                    timeInstance = DatatypeConverter
                                                            .parseDateTime(timeValue.getTextValue());
                                                    statusInstance.setTime(timeInstance);
                                                }
                                            }
                                        }
                                    }

                                    JsonNode statusesArray = vmAgentValue.get("statuses");
                                    if (statusesArray != null && statusesArray instanceof NullNode == false) {
                                        for (JsonNode statusesValue : ((ArrayNode) statusesArray)) {
                                            InstanceViewStatus instanceViewStatusInstance = new InstanceViewStatus();
                                            vmAgentInstance.getStatuses().add(instanceViewStatusInstance);

                                            JsonNode codeValue2 = statusesValue.get("code");
                                            if (codeValue2 != null && codeValue2 instanceof NullNode == false) {
                                                String codeInstance2;
                                                codeInstance2 = codeValue2.getTextValue();
                                                instanceViewStatusInstance.setCode(codeInstance2);
                                            }

                                            JsonNode levelValue2 = statusesValue.get("level");
                                            if (levelValue2 != null
                                                    && levelValue2 instanceof NullNode == false) {
                                                String levelInstance2;
                                                levelInstance2 = levelValue2.getTextValue();
                                                instanceViewStatusInstance.setLevel(levelInstance2);
                                            }

                                            JsonNode displayStatusValue2 = statusesValue.get("displayStatus");
                                            if (displayStatusValue2 != null
                                                    && displayStatusValue2 instanceof NullNode == false) {
                                                String displayStatusInstance2;
                                                displayStatusInstance2 = displayStatusValue2.getTextValue();
                                                instanceViewStatusInstance
                                                        .setDisplayStatus(displayStatusInstance2);
                                            }

                                            JsonNode messageValue2 = statusesValue.get("message");
                                            if (messageValue2 != null
                                                    && messageValue2 instanceof NullNode == false) {
                                                String messageInstance2;
                                                messageInstance2 = messageValue2.getTextValue();
                                                instanceViewStatusInstance.setMessage(messageInstance2);
                                            }

                                            JsonNode timeValue2 = statusesValue.get("time");
                                            if (timeValue2 != null && timeValue2 instanceof NullNode == false) {
                                                Calendar timeInstance2;
                                                timeInstance2 = DatatypeConverter
                                                        .parseDateTime(timeValue2.getTextValue());
                                                instanceViewStatusInstance.setTime(timeInstance2);
                                            }
                                        }
                                    }
                                }

                                JsonNode disksArray = instanceViewValue.get("disks");
                                if (disksArray != null && disksArray instanceof NullNode == false) {
                                    for (JsonNode disksValue : ((ArrayNode) disksArray)) {
                                        DiskInstanceView diskInstanceViewInstance = new DiskInstanceView();
                                        instanceViewInstance.getDisks().add(diskInstanceViewInstance);

                                        JsonNode nameValue4 = disksValue.get("name");
                                        if (nameValue4 != null && nameValue4 instanceof NullNode == false) {
                                            String nameInstance4;
                                            nameInstance4 = nameValue4.getTextValue();
                                            diskInstanceViewInstance.setName(nameInstance4);
                                        }

                                        JsonNode statusesArray2 = disksValue.get("statuses");
                                        if (statusesArray2 != null
                                                && statusesArray2 instanceof NullNode == false) {
                                            for (JsonNode statusesValue2 : ((ArrayNode) statusesArray2)) {
                                                InstanceViewStatus instanceViewStatusInstance2 = new InstanceViewStatus();
                                                diskInstanceViewInstance.getStatuses()
                                                        .add(instanceViewStatusInstance2);

                                                JsonNode codeValue3 = statusesValue2.get("code");
                                                if (codeValue3 != null
                                                        && codeValue3 instanceof NullNode == false) {
                                                    String codeInstance3;
                                                    codeInstance3 = codeValue3.getTextValue();
                                                    instanceViewStatusInstance2.setCode(codeInstance3);
                                                }

                                                JsonNode levelValue3 = statusesValue2.get("level");
                                                if (levelValue3 != null
                                                        && levelValue3 instanceof NullNode == false) {
                                                    String levelInstance3;
                                                    levelInstance3 = levelValue3.getTextValue();
                                                    instanceViewStatusInstance2.setLevel(levelInstance3);
                                                }

                                                JsonNode displayStatusValue3 = statusesValue2
                                                        .get("displayStatus");
                                                if (displayStatusValue3 != null
                                                        && displayStatusValue3 instanceof NullNode == false) {
                                                    String displayStatusInstance3;
                                                    displayStatusInstance3 = displayStatusValue3.getTextValue();
                                                    instanceViewStatusInstance2
                                                            .setDisplayStatus(displayStatusInstance3);
                                                }

                                                JsonNode messageValue3 = statusesValue2.get("message");
                                                if (messageValue3 != null
                                                        && messageValue3 instanceof NullNode == false) {
                                                    String messageInstance3;
                                                    messageInstance3 = messageValue3.getTextValue();
                                                    instanceViewStatusInstance2.setMessage(messageInstance3);
                                                }

                                                JsonNode timeValue3 = statusesValue2.get("time");
                                                if (timeValue3 != null
                                                        && timeValue3 instanceof NullNode == false) {
                                                    Calendar timeInstance3;
                                                    timeInstance3 = DatatypeConverter
                                                            .parseDateTime(timeValue3.getTextValue());
                                                    instanceViewStatusInstance2.setTime(timeInstance3);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode extensionsArray = instanceViewValue.get("extensions");
                                if (extensionsArray != null && extensionsArray instanceof NullNode == false) {
                                    for (JsonNode extensionsValue : ((ArrayNode) extensionsArray)) {
                                        VirtualMachineExtensionInstanceView virtualMachineExtensionInstanceViewInstance = new VirtualMachineExtensionInstanceView();
                                        instanceViewInstance.getExtensions()
                                                .add(virtualMachineExtensionInstanceViewInstance);

                                        JsonNode nameValue5 = extensionsValue.get("name");
                                        if (nameValue5 != null && nameValue5 instanceof NullNode == false) {
                                            String nameInstance5;
                                            nameInstance5 = nameValue5.getTextValue();
                                            virtualMachineExtensionInstanceViewInstance.setName(nameInstance5);
                                        }

                                        JsonNode typeValue2 = extensionsValue.get("type");
                                        if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
                                            String typeInstance2;
                                            typeInstance2 = typeValue2.getTextValue();
                                            virtualMachineExtensionInstanceViewInstance
                                                    .setExtensionType(typeInstance2);
                                        }

                                        JsonNode typeHandlerVersionValue2 = extensionsValue
                                                .get("typeHandlerVersion");
                                        if (typeHandlerVersionValue2 != null
                                                && typeHandlerVersionValue2 instanceof NullNode == false) {
                                            String typeHandlerVersionInstance2;
                                            typeHandlerVersionInstance2 = typeHandlerVersionValue2
                                                    .getTextValue();
                                            virtualMachineExtensionInstanceViewInstance
                                                    .setTypeHandlerVersion(typeHandlerVersionInstance2);
                                        }

                                        JsonNode substatusesArray = extensionsValue.get("substatuses");
                                        if (substatusesArray != null
                                                && substatusesArray instanceof NullNode == false) {
                                            for (JsonNode substatusesValue : ((ArrayNode) substatusesArray)) {
                                                InstanceViewStatus instanceViewStatusInstance3 = new InstanceViewStatus();
                                                virtualMachineExtensionInstanceViewInstance.getSubStatuses()
                                                        .add(instanceViewStatusInstance3);

                                                JsonNode codeValue4 = substatusesValue.get("code");
                                                if (codeValue4 != null
                                                        && codeValue4 instanceof NullNode == false) {
                                                    String codeInstance4;
                                                    codeInstance4 = codeValue4.getTextValue();
                                                    instanceViewStatusInstance3.setCode(codeInstance4);
                                                }

                                                JsonNode levelValue4 = substatusesValue.get("level");
                                                if (levelValue4 != null
                                                        && levelValue4 instanceof NullNode == false) {
                                                    String levelInstance4;
                                                    levelInstance4 = levelValue4.getTextValue();
                                                    instanceViewStatusInstance3.setLevel(levelInstance4);
                                                }

                                                JsonNode displayStatusValue4 = substatusesValue
                                                        .get("displayStatus");
                                                if (displayStatusValue4 != null
                                                        && displayStatusValue4 instanceof NullNode == false) {
                                                    String displayStatusInstance4;
                                                    displayStatusInstance4 = displayStatusValue4.getTextValue();
                                                    instanceViewStatusInstance3
                                                            .setDisplayStatus(displayStatusInstance4);
                                                }

                                                JsonNode messageValue4 = substatusesValue.get("message");
                                                if (messageValue4 != null
                                                        && messageValue4 instanceof NullNode == false) {
                                                    String messageInstance4;
                                                    messageInstance4 = messageValue4.getTextValue();
                                                    instanceViewStatusInstance3.setMessage(messageInstance4);
                                                }

                                                JsonNode timeValue4 = substatusesValue.get("time");
                                                if (timeValue4 != null
                                                        && timeValue4 instanceof NullNode == false) {
                                                    Calendar timeInstance4;
                                                    timeInstance4 = DatatypeConverter
                                                            .parseDateTime(timeValue4.getTextValue());
                                                    instanceViewStatusInstance3.setTime(timeInstance4);
                                                }
                                            }
                                        }

                                        JsonNode statusesArray3 = extensionsValue.get("statuses");
                                        if (statusesArray3 != null
                                                && statusesArray3 instanceof NullNode == false) {
                                            for (JsonNode statusesValue3 : ((ArrayNode) statusesArray3)) {
                                                InstanceViewStatus instanceViewStatusInstance4 = new InstanceViewStatus();
                                                virtualMachineExtensionInstanceViewInstance.getStatuses()
                                                        .add(instanceViewStatusInstance4);

                                                JsonNode codeValue5 = statusesValue3.get("code");
                                                if (codeValue5 != null
                                                        && codeValue5 instanceof NullNode == false) {
                                                    String codeInstance5;
                                                    codeInstance5 = codeValue5.getTextValue();
                                                    instanceViewStatusInstance4.setCode(codeInstance5);
                                                }

                                                JsonNode levelValue5 = statusesValue3.get("level");
                                                if (levelValue5 != null
                                                        && levelValue5 instanceof NullNode == false) {
                                                    String levelInstance5;
                                                    levelInstance5 = levelValue5.getTextValue();
                                                    instanceViewStatusInstance4.setLevel(levelInstance5);
                                                }

                                                JsonNode displayStatusValue5 = statusesValue3
                                                        .get("displayStatus");
                                                if (displayStatusValue5 != null
                                                        && displayStatusValue5 instanceof NullNode == false) {
                                                    String displayStatusInstance5;
                                                    displayStatusInstance5 = displayStatusValue5.getTextValue();
                                                    instanceViewStatusInstance4
                                                            .setDisplayStatus(displayStatusInstance5);
                                                }

                                                JsonNode messageValue5 = statusesValue3.get("message");
                                                if (messageValue5 != null
                                                        && messageValue5 instanceof NullNode == false) {
                                                    String messageInstance5;
                                                    messageInstance5 = messageValue5.getTextValue();
                                                    instanceViewStatusInstance4.setMessage(messageInstance5);
                                                }

                                                JsonNode timeValue5 = statusesValue3.get("time");
                                                if (timeValue5 != null
                                                        && timeValue5 instanceof NullNode == false) {
                                                    Calendar timeInstance5;
                                                    timeInstance5 = DatatypeConverter
                                                            .parseDateTime(timeValue5.getTextValue());
                                                    instanceViewStatusInstance4.setTime(timeInstance5);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode bootDiagnosticsValue2 = instanceViewValue.get("bootDiagnostics");
                                if (bootDiagnosticsValue2 != null
                                        && bootDiagnosticsValue2 instanceof NullNode == false) {
                                    BootDiagnosticsInstanceView bootDiagnosticsInstance2 = new BootDiagnosticsInstanceView();
                                    instanceViewInstance.setBootDiagnostics(bootDiagnosticsInstance2);

                                    JsonNode consoleScreenshotBlobUriValue = bootDiagnosticsValue2
                                            .get("consoleScreenshotBlobUri");
                                    if (consoleScreenshotBlobUriValue != null
                                            && consoleScreenshotBlobUriValue instanceof NullNode == false) {
                                        URI consoleScreenshotBlobUriInstance;
                                        consoleScreenshotBlobUriInstance = new URI(
                                                consoleScreenshotBlobUriValue.getTextValue());
                                        bootDiagnosticsInstance2
                                                .setConsoleScreenshotBlobUri(consoleScreenshotBlobUriInstance);
                                    }

                                    JsonNode serialConsoleLogBlobUriValue = bootDiagnosticsValue2
                                            .get("serialConsoleLogBlobUri");
                                    if (serialConsoleLogBlobUriValue != null
                                            && serialConsoleLogBlobUriValue instanceof NullNode == false) {
                                        URI serialConsoleLogBlobUriInstance;
                                        serialConsoleLogBlobUriInstance = new URI(
                                                serialConsoleLogBlobUriValue.getTextValue());
                                        bootDiagnosticsInstance2
                                                .setSerialConsoleLogBlobUri(serialConsoleLogBlobUriInstance);
                                    }
                                }

                                JsonNode statusesArray4 = instanceViewValue.get("statuses");
                                if (statusesArray4 != null && statusesArray4 instanceof NullNode == false) {
                                    for (JsonNode statusesValue4 : ((ArrayNode) statusesArray4)) {
                                        InstanceViewStatus instanceViewStatusInstance5 = new InstanceViewStatus();
                                        instanceViewInstance.getStatuses().add(instanceViewStatusInstance5);

                                        JsonNode codeValue6 = statusesValue4.get("code");
                                        if (codeValue6 != null && codeValue6 instanceof NullNode == false) {
                                            String codeInstance6;
                                            codeInstance6 = codeValue6.getTextValue();
                                            instanceViewStatusInstance5.setCode(codeInstance6);
                                        }

                                        JsonNode levelValue6 = statusesValue4.get("level");
                                        if (levelValue6 != null && levelValue6 instanceof NullNode == false) {
                                            String levelInstance6;
                                            levelInstance6 = levelValue6.getTextValue();
                                            instanceViewStatusInstance5.setLevel(levelInstance6);
                                        }

                                        JsonNode displayStatusValue6 = statusesValue4.get("displayStatus");
                                        if (displayStatusValue6 != null
                                                && displayStatusValue6 instanceof NullNode == false) {
                                            String displayStatusInstance6;
                                            displayStatusInstance6 = displayStatusValue6.getTextValue();
                                            instanceViewStatusInstance5
                                                    .setDisplayStatus(displayStatusInstance6);
                                        }

                                        JsonNode messageValue6 = statusesValue4.get("message");
                                        if (messageValue6 != null
                                                && messageValue6 instanceof NullNode == false) {
                                            String messageInstance6;
                                            messageInstance6 = messageValue6.getTextValue();
                                            instanceViewStatusInstance5.setMessage(messageInstance6);
                                        }

                                        JsonNode timeValue6 = statusesValue4.get("time");
                                        if (timeValue6 != null && timeValue6 instanceof NullNode == false) {
                                            Calendar timeInstance6;
                                            timeInstance6 = DatatypeConverter
                                                    .parseDateTime(timeValue6.getTextValue());
                                            instanceViewStatusInstance5.setTime(timeInstance6);
                                        }
                                    }
                                }
                            }
                        }

                        JsonNode resourcesArray = valueValue.get("resources");
                        if (resourcesArray != null && resourcesArray instanceof NullNode == false) {
                            virtualMachineJsonInstance.setExtensions(new ArrayList<VirtualMachineExtension>());
                            for (JsonNode resourcesValue : ((ArrayNode) resourcesArray)) {
                                VirtualMachineExtension virtualMachineExtensionJsonInstance = new VirtualMachineExtension();
                                virtualMachineJsonInstance.getExtensions()
                                        .add(virtualMachineExtensionJsonInstance);

                                JsonNode propertiesValue3 = resourcesValue.get("properties");
                                if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) {
                                    JsonNode publisherValue3 = propertiesValue3.get("publisher");
                                    if (publisherValue3 != null
                                            && publisherValue3 instanceof NullNode == false) {
                                        String publisherInstance3;
                                        publisherInstance3 = publisherValue3.getTextValue();
                                        virtualMachineExtensionJsonInstance.setPublisher(publisherInstance3);
                                    }

                                    JsonNode typeValue3 = propertiesValue3.get("type");
                                    if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
                                        String typeInstance3;
                                        typeInstance3 = typeValue3.getTextValue();
                                        virtualMachineExtensionJsonInstance.setExtensionType(typeInstance3);
                                    }

                                    JsonNode typeHandlerVersionValue3 = propertiesValue3
                                            .get("typeHandlerVersion");
                                    if (typeHandlerVersionValue3 != null
                                            && typeHandlerVersionValue3 instanceof NullNode == false) {
                                        String typeHandlerVersionInstance3;
                                        typeHandlerVersionInstance3 = typeHandlerVersionValue3.getTextValue();
                                        virtualMachineExtensionJsonInstance
                                                .setTypeHandlerVersion(typeHandlerVersionInstance3);
                                    }

                                    JsonNode autoUpgradeMinorVersionValue = propertiesValue3
                                            .get("autoUpgradeMinorVersion");
                                    if (autoUpgradeMinorVersionValue != null
                                            && autoUpgradeMinorVersionValue instanceof NullNode == false) {
                                        boolean autoUpgradeMinorVersionInstance;
                                        autoUpgradeMinorVersionInstance = autoUpgradeMinorVersionValue
                                                .getBooleanValue();
                                        virtualMachineExtensionJsonInstance
                                                .setAutoUpgradeMinorVersion(autoUpgradeMinorVersionInstance);
                                    }

                                    JsonNode settingsValue = propertiesValue3.get("settings");
                                    if (settingsValue != null && settingsValue instanceof NullNode == false) {
                                        String settingsInstance;
                                        settingsInstance = settingsValue.getTextValue();
                                        virtualMachineExtensionJsonInstance.setSettings(settingsInstance);
                                    }

                                    JsonNode protectedSettingsValue = propertiesValue3.get("protectedSettings");
                                    if (protectedSettingsValue != null
                                            && protectedSettingsValue instanceof NullNode == false) {
                                        String protectedSettingsInstance;
                                        protectedSettingsInstance = protectedSettingsValue.getTextValue();
                                        virtualMachineExtensionJsonInstance
                                                .setProtectedSettings(protectedSettingsInstance);
                                    }

                                    JsonNode provisioningStateValue2 = propertiesValue3
                                            .get("provisioningState");
                                    if (provisioningStateValue2 != null
                                            && provisioningStateValue2 instanceof NullNode == false) {
                                        String provisioningStateInstance2;
                                        provisioningStateInstance2 = provisioningStateValue2.getTextValue();
                                        virtualMachineExtensionJsonInstance
                                                .setProvisioningState(provisioningStateInstance2);
                                    }

                                    JsonNode instanceViewValue2 = propertiesValue3.get("instanceView");
                                    if (instanceViewValue2 != null
                                            && instanceViewValue2 instanceof NullNode == false) {
                                        VirtualMachineExtensionInstanceView instanceViewInstance2 = new VirtualMachineExtensionInstanceView();
                                        virtualMachineExtensionJsonInstance
                                                .setInstanceView(instanceViewInstance2);

                                        JsonNode nameValue6 = instanceViewValue2.get("name");
                                        if (nameValue6 != null && nameValue6 instanceof NullNode == false) {
                                            String nameInstance6;
                                            nameInstance6 = nameValue6.getTextValue();
                                            instanceViewInstance2.setName(nameInstance6);
                                        }

                                        JsonNode typeValue4 = instanceViewValue2.get("type");
                                        if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
                                            String typeInstance4;
                                            typeInstance4 = typeValue4.getTextValue();
                                            instanceViewInstance2.setExtensionType(typeInstance4);
                                        }

                                        JsonNode typeHandlerVersionValue4 = instanceViewValue2
                                                .get("typeHandlerVersion");
                                        if (typeHandlerVersionValue4 != null
                                                && typeHandlerVersionValue4 instanceof NullNode == false) {
                                            String typeHandlerVersionInstance4;
                                            typeHandlerVersionInstance4 = typeHandlerVersionValue4
                                                    .getTextValue();
                                            instanceViewInstance2
                                                    .setTypeHandlerVersion(typeHandlerVersionInstance4);
                                        }

                                        JsonNode substatusesArray2 = instanceViewValue2.get("substatuses");
                                        if (substatusesArray2 != null
                                                && substatusesArray2 instanceof NullNode == false) {
                                            for (JsonNode substatusesValue2 : ((ArrayNode) substatusesArray2)) {
                                                InstanceViewStatus instanceViewStatusInstance6 = new InstanceViewStatus();
                                                instanceViewInstance2.getSubStatuses()
                                                        .add(instanceViewStatusInstance6);

                                                JsonNode codeValue7 = substatusesValue2.get("code");
                                                if (codeValue7 != null
                                                        && codeValue7 instanceof NullNode == false) {
                                                    String codeInstance7;
                                                    codeInstance7 = codeValue7.getTextValue();
                                                    instanceViewStatusInstance6.setCode(codeInstance7);
                                                }

                                                JsonNode levelValue7 = substatusesValue2.get("level");
                                                if (levelValue7 != null
                                                        && levelValue7 instanceof NullNode == false) {
                                                    String levelInstance7;
                                                    levelInstance7 = levelValue7.getTextValue();
                                                    instanceViewStatusInstance6.setLevel(levelInstance7);
                                                }

                                                JsonNode displayStatusValue7 = substatusesValue2
                                                        .get("displayStatus");
                                                if (displayStatusValue7 != null
                                                        && displayStatusValue7 instanceof NullNode == false) {
                                                    String displayStatusInstance7;
                                                    displayStatusInstance7 = displayStatusValue7.getTextValue();
                                                    instanceViewStatusInstance6
                                                            .setDisplayStatus(displayStatusInstance7);
                                                }

                                                JsonNode messageValue7 = substatusesValue2.get("message");
                                                if (messageValue7 != null
                                                        && messageValue7 instanceof NullNode == false) {
                                                    String messageInstance7;
                                                    messageInstance7 = messageValue7.getTextValue();
                                                    instanceViewStatusInstance6.setMessage(messageInstance7);
                                                }

                                                JsonNode timeValue7 = substatusesValue2.get("time");
                                                if (timeValue7 != null
                                                        && timeValue7 instanceof NullNode == false) {
                                                    Calendar timeInstance7;
                                                    timeInstance7 = DatatypeConverter
                                                            .parseDateTime(timeValue7.getTextValue());
                                                    instanceViewStatusInstance6.setTime(timeInstance7);
                                                }
                                            }
                                        }

                                        JsonNode statusesArray5 = instanceViewValue2.get("statuses");
                                        if (statusesArray5 != null
                                                && statusesArray5 instanceof NullNode == false) {
                                            for (JsonNode statusesValue5 : ((ArrayNode) statusesArray5)) {
                                                InstanceViewStatus instanceViewStatusInstance7 = new InstanceViewStatus();
                                                instanceViewInstance2.getStatuses()
                                                        .add(instanceViewStatusInstance7);

                                                JsonNode codeValue8 = statusesValue5.get("code");
                                                if (codeValue8 != null
                                                        && codeValue8 instanceof NullNode == false) {
                                                    String codeInstance8;
                                                    codeInstance8 = codeValue8.getTextValue();
                                                    instanceViewStatusInstance7.setCode(codeInstance8);
                                                }

                                                JsonNode levelValue8 = statusesValue5.get("level");
                                                if (levelValue8 != null
                                                        && levelValue8 instanceof NullNode == false) {
                                                    String levelInstance8;
                                                    levelInstance8 = levelValue8.getTextValue();
                                                    instanceViewStatusInstance7.setLevel(levelInstance8);
                                                }

                                                JsonNode displayStatusValue8 = statusesValue5
                                                        .get("displayStatus");
                                                if (displayStatusValue8 != null
                                                        && displayStatusValue8 instanceof NullNode == false) {
                                                    String displayStatusInstance8;
                                                    displayStatusInstance8 = displayStatusValue8.getTextValue();
                                                    instanceViewStatusInstance7
                                                            .setDisplayStatus(displayStatusInstance8);
                                                }

                                                JsonNode messageValue8 = statusesValue5.get("message");
                                                if (messageValue8 != null
                                                        && messageValue8 instanceof NullNode == false) {
                                                    String messageInstance8;
                                                    messageInstance8 = messageValue8.getTextValue();
                                                    instanceViewStatusInstance7.setMessage(messageInstance8);
                                                }

                                                JsonNode timeValue8 = statusesValue5.get("time");
                                                if (timeValue8 != null
                                                        && timeValue8 instanceof NullNode == false) {
                                                    Calendar timeInstance8;
                                                    timeInstance8 = DatatypeConverter
                                                            .parseDateTime(timeValue8.getTextValue());
                                                    instanceViewStatusInstance7.setTime(timeInstance8);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode idValue4 = resourcesValue.get("id");
                                if (idValue4 != null && idValue4 instanceof NullNode == false) {
                                    String idInstance4;
                                    idInstance4 = idValue4.getTextValue();
                                    virtualMachineExtensionJsonInstance.setId(idInstance4);
                                }

                                JsonNode nameValue7 = resourcesValue.get("name");
                                if (nameValue7 != null && nameValue7 instanceof NullNode == false) {
                                    String nameInstance7;
                                    nameInstance7 = nameValue7.getTextValue();
                                    virtualMachineExtensionJsonInstance.setName(nameInstance7);
                                }

                                JsonNode typeValue5 = resourcesValue.get("type");
                                if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
                                    String typeInstance5;
                                    typeInstance5 = typeValue5.getTextValue();
                                    virtualMachineExtensionJsonInstance.setType(typeInstance5);
                                }

                                JsonNode locationValue = resourcesValue.get("location");
                                if (locationValue != null && locationValue instanceof NullNode == false) {
                                    String locationInstance;
                                    locationInstance = locationValue.getTextValue();
                                    virtualMachineExtensionJsonInstance.setLocation(locationInstance);
                                }

                                JsonNode tagsSequenceElement = ((JsonNode) resourcesValue.get("tags"));
                                if (tagsSequenceElement != null
                                        && tagsSequenceElement instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement.getFields();
                                    while (itr.hasNext()) {
                                        Map.Entry<String, JsonNode> property = itr.next();
                                        String tagsKey = property.getKey();
                                        String tagsValue = property.getValue().getTextValue();
                                        virtualMachineExtensionJsonInstance.getTags().put(tagsKey, tagsValue);
                                    }
                                }
                            }
                        }

                        JsonNode idValue5 = valueValue.get("id");
                        if (idValue5 != null && idValue5 instanceof NullNode == false) {
                            String idInstance5;
                            idInstance5 = idValue5.getTextValue();
                            virtualMachineJsonInstance.setId(idInstance5);
                        }

                        JsonNode nameValue8 = valueValue.get("name");
                        if (nameValue8 != null && nameValue8 instanceof NullNode == false) {
                            String nameInstance8;
                            nameInstance8 = nameValue8.getTextValue();
                            virtualMachineJsonInstance.setName(nameInstance8);
                        }

                        JsonNode typeValue6 = valueValue.get("type");
                        if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
                            String typeInstance6;
                            typeInstance6 = typeValue6.getTextValue();
                            virtualMachineJsonInstance.setType(typeInstance6);
                        }

                        JsonNode locationValue2 = valueValue.get("location");
                        if (locationValue2 != null && locationValue2 instanceof NullNode == false) {
                            String locationInstance2;
                            locationInstance2 = locationValue2.getTextValue();
                            virtualMachineJsonInstance.setLocation(locationInstance2);
                        }

                        JsonNode tagsSequenceElement2 = ((JsonNode) valueValue.get("tags"));
                        if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) {
                            Iterator<Map.Entry<String, JsonNode>> itr2 = tagsSequenceElement2.getFields();
                            while (itr2.hasNext()) {
                                Map.Entry<String, JsonNode> property2 = itr2.next();
                                String tagsKey2 = property2.getKey();
                                String tagsValue2 = property2.getValue().getTextValue();
                                virtualMachineJsonInstance.getTags().put(tagsKey2, tagsValue2);
                            }
                        }
                    }
                }

                JsonNode nextLinkValue = responseDoc.get("nextLink");
                if (nextLinkValue != null && nextLinkValue instanceof NullNode == false) {
                    String nextLinkInstance;
                    nextLinkInstance = nextLinkValue.getTextValue();
                    result.setNextLink(nextLinkInstance);
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.scheduler.JobOperationsImpl.java

/**
* Get the list of jobs in a job collection matching a filter on job state.
*
* @param parameters Required. Parameters supplied to the List Jobs with
* filter operation.// w  ww.j a v  a  2 s .  co m
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The List Jobs operation response.
*/
@Override
public JobListResponse listWithFilter(JobListWithFilterParameters parameters)
        throws IOException, ServiceException, URISyntaxException {
    // Validate
    if (parameters == null) {
        throw new NullPointerException("parameters");
    }
    if (parameters.getState() == null) {
        throw new NullPointerException("parameters.State");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("parameters", parameters);
        CloudTracing.enter(invocationId, this, "listWithFilterAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/cloudservices/";
    url = url + URLEncoder.encode(this.getClient().getCloudServiceName(), "UTF-8");
    url = url + "/resources/";
    url = url + "scheduler";
    url = url + "/~/";
    url = url + "JobCollections";
    url = url + "/";
    url = url + URLEncoder.encode(this.getClient().getJobCollectionName(), "UTF-8");
    url = url + "/jobs";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2014-04-01");
    ArrayList<String> odataFilter = new ArrayList<String>();
    odataFilter.add("state eq "
            + URLEncoder.encode(SchedulerClientImpl.jobStateToString(parameters.getState()), "UTF-8"));
    if (odataFilter.size() > 0) {
        queryParameters.add("$filter=" + CollectionStringBuilder.join(odataFilter, null));
    }
    if (parameters.getSkip() != null) {
        queryParameters.add("$skip=" + URLEncoder.encode(Integer.toString(parameters.getSkip()), "UTF-8"));
    }
    if (parameters.getTop() != null) {
        queryParameters.add("$top=" + URLEncoder.encode(Integer.toString(parameters.getTop()), "UTF-8"));
    }
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2013-03-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        JobListResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new JobListResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode jobsArray = responseDoc;
                if (jobsArray != null && jobsArray instanceof NullNode == false) {
                    for (JsonNode jobsValue : ((ArrayNode) jobsArray)) {
                        Job jobInstance = new Job();
                        result.getJobs().add(jobInstance);

                        JsonNode idValue = jobsValue.get("id");
                        if (idValue != null && idValue instanceof NullNode == false) {
                            String idInstance;
                            idInstance = idValue.getTextValue();
                            jobInstance.setId(idInstance);
                        }

                        JsonNode startTimeValue = jobsValue.get("startTime");
                        if (startTimeValue != null && startTimeValue instanceof NullNode == false) {
                            Calendar startTimeInstance;
                            startTimeInstance = DatatypeConverter.parseDateTime(startTimeValue.getTextValue());
                            jobInstance.setStartTime(startTimeInstance);
                        }

                        JsonNode actionValue = jobsValue.get("action");
                        if (actionValue != null && actionValue instanceof NullNode == false) {
                            JobAction actionInstance = new JobAction();
                            jobInstance.setAction(actionInstance);

                            JsonNode typeValue = actionValue.get("type");
                            if (typeValue != null && typeValue instanceof NullNode == false) {
                                JobActionType typeInstance;
                                typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue());
                                actionInstance.setType(typeInstance);
                            }

                            JsonNode retryPolicyValue = actionValue.get("retryPolicy");
                            if (retryPolicyValue != null && retryPolicyValue instanceof NullNode == false) {
                                RetryPolicy retryPolicyInstance = new RetryPolicy();
                                actionInstance.setRetryPolicy(retryPolicyInstance);

                                JsonNode retryTypeValue = retryPolicyValue.get("retryType");
                                if (retryTypeValue != null && retryTypeValue instanceof NullNode == false) {
                                    RetryType retryTypeInstance;
                                    retryTypeInstance = SchedulerClientImpl
                                            .parseRetryType(retryTypeValue.getTextValue());
                                    retryPolicyInstance.setRetryType(retryTypeInstance);
                                }

                                JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval");
                                if (retryIntervalValue != null
                                        && retryIntervalValue instanceof NullNode == false) {
                                    Duration retryIntervalInstance;
                                    retryIntervalInstance = TimeSpan8601Converter
                                            .parse(retryIntervalValue.getTextValue());
                                    retryPolicyInstance.setRetryInterval(retryIntervalInstance);
                                }

                                JsonNode retryCountValue = retryPolicyValue.get("retryCount");
                                if (retryCountValue != null && retryCountValue instanceof NullNode == false) {
                                    int retryCountInstance;
                                    retryCountInstance = retryCountValue.getIntValue();
                                    retryPolicyInstance.setRetryCount(retryCountInstance);
                                }
                            }

                            JsonNode errorActionValue = actionValue.get("errorAction");
                            if (errorActionValue != null && errorActionValue instanceof NullNode == false) {
                                JobErrorAction errorActionInstance = new JobErrorAction();
                                actionInstance.setErrorAction(errorActionInstance);

                                JsonNode typeValue2 = errorActionValue.get("type");
                                if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
                                    JobActionType typeInstance2;
                                    typeInstance2 = SchedulerClientImpl
                                            .parseJobActionType(typeValue2.getTextValue());
                                    errorActionInstance.setType(typeInstance2);
                                }

                                JsonNode requestValue = errorActionValue.get("request");
                                if (requestValue != null && requestValue instanceof NullNode == false) {
                                    JobHttpRequest requestInstance = new JobHttpRequest();
                                    errorActionInstance.setRequest(requestInstance);

                                    JsonNode uriValue = requestValue.get("uri");
                                    if (uriValue != null && uriValue instanceof NullNode == false) {
                                        URI uriInstance;
                                        uriInstance = new URI(uriValue.getTextValue());
                                        requestInstance.setUri(uriInstance);
                                    }

                                    JsonNode methodValue = requestValue.get("method");
                                    if (methodValue != null && methodValue instanceof NullNode == false) {
                                        String methodInstance;
                                        methodInstance = methodValue.getTextValue();
                                        requestInstance.setMethod(methodInstance);
                                    }

                                    JsonNode headersSequenceElement = ((JsonNode) requestValue.get("headers"));
                                    if (headersSequenceElement != null
                                            && headersSequenceElement instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr = headersSequenceElement
                                                .getFields();
                                        while (itr.hasNext()) {
                                            Map.Entry<String, JsonNode> property = itr.next();
                                            String headersKey = property.getKey();
                                            String headersValue = property.getValue().getTextValue();
                                            requestInstance.getHeaders().put(headersKey, headersValue);
                                        }
                                    }

                                    JsonNode bodyValue = requestValue.get("body");
                                    if (bodyValue != null && bodyValue instanceof NullNode == false) {
                                        String bodyInstance;
                                        bodyInstance = bodyValue.getTextValue();
                                        requestInstance.setBody(bodyInstance);
                                    }

                                    JsonNode authenticationValue = requestValue.get("authentication");
                                    if (authenticationValue != null
                                            && authenticationValue instanceof NullNode == false) {
                                        String typeName = authenticationValue.get("type").getTextValue();
                                        if ("ClientCertificate".equals(typeName)) {
                                            ClientCertAuthentication clientCertAuthenticationInstance = new ClientCertAuthentication();

                                            JsonNode passwordValue = authenticationValue.get("password");
                                            if (passwordValue != null
                                                    && passwordValue instanceof NullNode == false) {
                                                String passwordInstance;
                                                passwordInstance = passwordValue.getTextValue();
                                                clientCertAuthenticationInstance.setPassword(passwordInstance);
                                            }

                                            JsonNode pfxValue = authenticationValue.get("pfx");
                                            if (pfxValue != null && pfxValue instanceof NullNode == false) {
                                                String pfxInstance;
                                                pfxInstance = pfxValue.getTextValue();
                                                clientCertAuthenticationInstance.setPfx(pfxInstance);
                                            }

                                            JsonNode certificateThumbprintValue = authenticationValue
                                                    .get("certificateThumbprint");
                                            if (certificateThumbprintValue != null
                                                    && certificateThumbprintValue instanceof NullNode == false) {
                                                String certificateThumbprintInstance;
                                                certificateThumbprintInstance = certificateThumbprintValue
                                                        .getTextValue();
                                                clientCertAuthenticationInstance.setCertificateThumbprint(
                                                        certificateThumbprintInstance);
                                            }

                                            JsonNode certificateExpirationValue = authenticationValue
                                                    .get("certificateExpiration");
                                            if (certificateExpirationValue != null
                                                    && certificateExpirationValue instanceof NullNode == false) {
                                                Calendar certificateExpirationInstance;
                                                certificateExpirationInstance = DatatypeConverter.parseDateTime(
                                                        certificateExpirationValue.getTextValue());
                                                clientCertAuthenticationInstance.setCertificateExpiration(
                                                        certificateExpirationInstance);
                                            }

                                            JsonNode certificateSubjectNameValue = authenticationValue
                                                    .get("certificateSubjectName");
                                            if (certificateSubjectNameValue != null
                                                    && certificateSubjectNameValue instanceof NullNode == false) {
                                                String certificateSubjectNameInstance;
                                                certificateSubjectNameInstance = certificateSubjectNameValue
                                                        .getTextValue();
                                                clientCertAuthenticationInstance.setCertificateSubjectName(
                                                        certificateSubjectNameInstance);
                                            }

                                            JsonNode typeValue3 = authenticationValue.get("type");
                                            if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance3;
                                                typeInstance3 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue3.getTextValue());
                                                clientCertAuthenticationInstance.setType(typeInstance3);
                                            }
                                            requestInstance.setAuthentication(clientCertAuthenticationInstance);
                                        }
                                        if ("ActiveDirectoryOAuth".equals(typeName)) {
                                            AADOAuthAuthentication aADOAuthAuthenticationInstance = new AADOAuthAuthentication();

                                            JsonNode secretValue = authenticationValue.get("secret");
                                            if (secretValue != null
                                                    && secretValue instanceof NullNode == false) {
                                                String secretInstance;
                                                secretInstance = secretValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setSecret(secretInstance);
                                            }

                                            JsonNode tenantValue = authenticationValue.get("tenant");
                                            if (tenantValue != null
                                                    && tenantValue instanceof NullNode == false) {
                                                String tenantInstance;
                                                tenantInstance = tenantValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setTenant(tenantInstance);
                                            }

                                            JsonNode audienceValue = authenticationValue.get("audience");
                                            if (audienceValue != null
                                                    && audienceValue instanceof NullNode == false) {
                                                String audienceInstance;
                                                audienceInstance = audienceValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setAudience(audienceInstance);
                                            }

                                            JsonNode clientIdValue = authenticationValue.get("clientId");
                                            if (clientIdValue != null
                                                    && clientIdValue instanceof NullNode == false) {
                                                String clientIdInstance;
                                                clientIdInstance = clientIdValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setClientId(clientIdInstance);
                                            }

                                            JsonNode typeValue4 = authenticationValue.get("type");
                                            if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance4;
                                                typeInstance4 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue4.getTextValue());
                                                aADOAuthAuthenticationInstance.setType(typeInstance4);
                                            }
                                            requestInstance.setAuthentication(aADOAuthAuthenticationInstance);
                                        }
                                        if ("Basic".equals(typeName)) {
                                            BasicAuthentication basicAuthenticationInstance = new BasicAuthentication();

                                            JsonNode usernameValue = authenticationValue.get("username");
                                            if (usernameValue != null
                                                    && usernameValue instanceof NullNode == false) {
                                                String usernameInstance;
                                                usernameInstance = usernameValue.getTextValue();
                                                basicAuthenticationInstance.setUsername(usernameInstance);
                                            }

                                            JsonNode passwordValue2 = authenticationValue.get("password");
                                            if (passwordValue2 != null
                                                    && passwordValue2 instanceof NullNode == false) {
                                                String passwordInstance2;
                                                passwordInstance2 = passwordValue2.getTextValue();
                                                basicAuthenticationInstance.setPassword(passwordInstance2);
                                            }

                                            JsonNode typeValue5 = authenticationValue.get("type");
                                            if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance5;
                                                typeInstance5 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue5.getTextValue());
                                                basicAuthenticationInstance.setType(typeInstance5);
                                            }
                                            requestInstance.setAuthentication(basicAuthenticationInstance);
                                        }
                                    }
                                }

                                JsonNode queueMessageValue = errorActionValue.get("queueMessage");
                                if (queueMessageValue != null
                                        && queueMessageValue instanceof NullNode == false) {
                                    JobQueueMessage queueMessageInstance = new JobQueueMessage();
                                    errorActionInstance.setQueueMessage(queueMessageInstance);

                                    JsonNode storageAccountValue = queueMessageValue.get("storageAccount");
                                    if (storageAccountValue != null
                                            && storageAccountValue instanceof NullNode == false) {
                                        String storageAccountInstance;
                                        storageAccountInstance = storageAccountValue.getTextValue();
                                        queueMessageInstance.setStorageAccountName(storageAccountInstance);
                                    }

                                    JsonNode queueNameValue = queueMessageValue.get("queueName");
                                    if (queueNameValue != null && queueNameValue instanceof NullNode == false) {
                                        String queueNameInstance;
                                        queueNameInstance = queueNameValue.getTextValue();
                                        queueMessageInstance.setQueueName(queueNameInstance);
                                    }

                                    JsonNode sasTokenValue = queueMessageValue.get("sasToken");
                                    if (sasTokenValue != null && sasTokenValue instanceof NullNode == false) {
                                        String sasTokenInstance;
                                        sasTokenInstance = sasTokenValue.getTextValue();
                                        queueMessageInstance.setSasToken(sasTokenInstance);
                                    }

                                    JsonNode messageValue = queueMessageValue.get("message");
                                    if (messageValue != null && messageValue instanceof NullNode == false) {
                                        String messageInstance;
                                        messageInstance = messageValue.getTextValue();
                                        queueMessageInstance.setMessage(messageInstance);
                                    }
                                }

                                JsonNode serviceBusTopicMessageValue = errorActionValue
                                        .get("serviceBusTopicMessage");
                                if (serviceBusTopicMessageValue != null
                                        && serviceBusTopicMessageValue instanceof NullNode == false) {
                                    JobServiceBusTopicMessage serviceBusTopicMessageInstance = new JobServiceBusTopicMessage();
                                    errorActionInstance
                                            .setServiceBusTopicMessage(serviceBusTopicMessageInstance);

                                    JsonNode topicPathValue = serviceBusTopicMessageValue.get("topicPath");
                                    if (topicPathValue != null && topicPathValue instanceof NullNode == false) {
                                        String topicPathInstance;
                                        topicPathInstance = topicPathValue.getTextValue();
                                        serviceBusTopicMessageInstance.setTopicPath(topicPathInstance);
                                    }

                                    JsonNode namespaceValue = serviceBusTopicMessageValue.get("namespace");
                                    if (namespaceValue != null && namespaceValue instanceof NullNode == false) {
                                        String namespaceInstance;
                                        namespaceInstance = namespaceValue.getTextValue();
                                        serviceBusTopicMessageInstance.setNamespace(namespaceInstance);
                                    }

                                    JsonNode transportTypeValue = serviceBusTopicMessageValue
                                            .get("transportType");
                                    if (transportTypeValue != null
                                            && transportTypeValue instanceof NullNode == false) {
                                        JobServiceBusTransportType transportTypeInstance;
                                        transportTypeInstance = SchedulerClientImpl
                                                .parseJobServiceBusTransportType(
                                                        transportTypeValue.getTextValue());
                                        serviceBusTopicMessageInstance.setTransportType(transportTypeInstance);
                                    }

                                    JsonNode authenticationValue2 = serviceBusTopicMessageValue
                                            .get("authentication");
                                    if (authenticationValue2 != null
                                            && authenticationValue2 instanceof NullNode == false) {
                                        JobServiceBusAuthentication authenticationInstance = new JobServiceBusAuthentication();
                                        serviceBusTopicMessageInstance
                                                .setAuthentication(authenticationInstance);

                                        JsonNode sasKeyNameValue = authenticationValue2.get("sasKeyName");
                                        if (sasKeyNameValue != null
                                                && sasKeyNameValue instanceof NullNode == false) {
                                            String sasKeyNameInstance;
                                            sasKeyNameInstance = sasKeyNameValue.getTextValue();
                                            authenticationInstance.setSasKeyName(sasKeyNameInstance);
                                        }

                                        JsonNode sasKeyValue = authenticationValue2.get("sasKey");
                                        if (sasKeyValue != null && sasKeyValue instanceof NullNode == false) {
                                            String sasKeyInstance;
                                            sasKeyInstance = sasKeyValue.getTextValue();
                                            authenticationInstance.setSasKey(sasKeyInstance);
                                        }

                                        JsonNode typeValue6 = authenticationValue2.get("type");
                                        if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
                                            JobServiceBusAuthenticationType typeInstance6;
                                            typeInstance6 = SchedulerClientImpl
                                                    .parseJobServiceBusAuthenticationType(
                                                            typeValue6.getTextValue());
                                            authenticationInstance.setType(typeInstance6);
                                        }
                                    }

                                    JsonNode messageValue2 = serviceBusTopicMessageValue.get("message");
                                    if (messageValue2 != null && messageValue2 instanceof NullNode == false) {
                                        String messageInstance2;
                                        messageInstance2 = messageValue2.getTextValue();
                                        serviceBusTopicMessageInstance.setMessage(messageInstance2);
                                    }

                                    JsonNode brokeredMessagePropertiesValue = serviceBusTopicMessageValue
                                            .get("brokeredMessageProperties");
                                    if (brokeredMessagePropertiesValue != null
                                            && brokeredMessagePropertiesValue instanceof NullNode == false) {
                                        JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance = new JobServiceBusBrokeredMessageProperties();
                                        serviceBusTopicMessageInstance.setBrokeredMessageProperties(
                                                brokeredMessagePropertiesInstance);

                                        JsonNode contentTypeValue = brokeredMessagePropertiesValue
                                                .get("contentType");
                                        if (contentTypeValue != null
                                                && contentTypeValue instanceof NullNode == false) {
                                            String contentTypeInstance;
                                            contentTypeInstance = contentTypeValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setContentType(contentTypeInstance);
                                        }

                                        JsonNode correlationIdValue = brokeredMessagePropertiesValue
                                                .get("correlationId");
                                        if (correlationIdValue != null
                                                && correlationIdValue instanceof NullNode == false) {
                                            String correlationIdInstance;
                                            correlationIdInstance = correlationIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setCorrelationId(correlationIdInstance);
                                        }

                                        JsonNode forcePersistenceValue = brokeredMessagePropertiesValue
                                                .get("forcePersistence");
                                        if (forcePersistenceValue != null
                                                && forcePersistenceValue instanceof NullNode == false) {
                                            boolean forcePersistenceInstance;
                                            forcePersistenceInstance = forcePersistenceValue.getBooleanValue();
                                            brokeredMessagePropertiesInstance
                                                    .setForcePersistence(forcePersistenceInstance);
                                        }

                                        JsonNode labelValue = brokeredMessagePropertiesValue.get("label");
                                        if (labelValue != null && labelValue instanceof NullNode == false) {
                                            String labelInstance;
                                            labelInstance = labelValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setLabel(labelInstance);
                                        }

                                        JsonNode messageIdValue = brokeredMessagePropertiesValue
                                                .get("messageId");
                                        if (messageIdValue != null
                                                && messageIdValue instanceof NullNode == false) {
                                            String messageIdInstance;
                                            messageIdInstance = messageIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setMessageId(messageIdInstance);
                                        }

                                        JsonNode partitionKeyValue = brokeredMessagePropertiesValue
                                                .get("partitionKey");
                                        if (partitionKeyValue != null
                                                && partitionKeyValue instanceof NullNode == false) {
                                            String partitionKeyInstance;
                                            partitionKeyInstance = partitionKeyValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setPartitionKey(partitionKeyInstance);
                                        }

                                        JsonNode replyToValue = brokeredMessagePropertiesValue.get("replyTo");
                                        if (replyToValue != null && replyToValue instanceof NullNode == false) {
                                            String replyToInstance;
                                            replyToInstance = replyToValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setReplyTo(replyToInstance);
                                        }

                                        JsonNode replyToSessionIdValue = brokeredMessagePropertiesValue
                                                .get("replyToSessionId");
                                        if (replyToSessionIdValue != null
                                                && replyToSessionIdValue instanceof NullNode == false) {
                                            String replyToSessionIdInstance;
                                            replyToSessionIdInstance = replyToSessionIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setReplyToSessionId(replyToSessionIdInstance);
                                        }

                                        JsonNode scheduledEnqueueTimeUtcValue = brokeredMessagePropertiesValue
                                                .get("scheduledEnqueueTimeUtc");
                                        if (scheduledEnqueueTimeUtcValue != null
                                                && scheduledEnqueueTimeUtcValue instanceof NullNode == false) {
                                            Calendar scheduledEnqueueTimeUtcInstance;
                                            scheduledEnqueueTimeUtcInstance = DatatypeConverter
                                                    .parseDateTime(scheduledEnqueueTimeUtcValue.getTextValue());
                                            brokeredMessagePropertiesInstance.setScheduledEnqueueTimeUtc(
                                                    scheduledEnqueueTimeUtcInstance);
                                        }

                                        JsonNode sessionIdValue = brokeredMessagePropertiesValue
                                                .get("sessionId");
                                        if (sessionIdValue != null
                                                && sessionIdValue instanceof NullNode == false) {
                                            String sessionIdInstance;
                                            sessionIdInstance = sessionIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setSessionId(sessionIdInstance);
                                        }

                                        JsonNode timeToLiveValue = brokeredMessagePropertiesValue
                                                .get("timeToLive");
                                        if (timeToLiveValue != null
                                                && timeToLiveValue instanceof NullNode == false) {
                                            Calendar timeToLiveInstance;
                                            timeToLiveInstance = DatatypeConverter
                                                    .parseDateTime(timeToLiveValue.getTextValue());
                                            brokeredMessagePropertiesInstance.setTimeToLive(timeToLiveInstance);
                                        }

                                        JsonNode toValue = brokeredMessagePropertiesValue.get("to");
                                        if (toValue != null && toValue instanceof NullNode == false) {
                                            String toInstance;
                                            toInstance = toValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setTo(toInstance);
                                        }

                                        JsonNode viaPartitionKeyValue = brokeredMessagePropertiesValue
                                                .get("viaPartitionKey");
                                        if (viaPartitionKeyValue != null
                                                && viaPartitionKeyValue instanceof NullNode == false) {
                                            String viaPartitionKeyInstance;
                                            viaPartitionKeyInstance = viaPartitionKeyValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setViaPartitionKey(viaPartitionKeyInstance);
                                        }
                                    }

                                    JsonNode customMessagePropertiesSequenceElement = ((JsonNode) serviceBusTopicMessageValue
                                            .get("customMessageProperties"));
                                    if (customMessagePropertiesSequenceElement != null
                                            && customMessagePropertiesSequenceElement instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr2 = customMessagePropertiesSequenceElement
                                                .getFields();
                                        while (itr2.hasNext()) {
                                            Map.Entry<String, JsonNode> property2 = itr2.next();
                                            String customMessagePropertiesKey = property2.getKey();
                                            String customMessagePropertiesValue = property2.getValue()
                                                    .getTextValue();
                                            serviceBusTopicMessageInstance.getCustomMessageProperties().put(
                                                    customMessagePropertiesKey, customMessagePropertiesValue);
                                        }
                                    }
                                }

                                JsonNode serviceBusQueueMessageValue = errorActionValue
                                        .get("serviceBusQueueMessage");
                                if (serviceBusQueueMessageValue != null
                                        && serviceBusQueueMessageValue instanceof NullNode == false) {
                                    JobServiceBusQueueMessage serviceBusQueueMessageInstance = new JobServiceBusQueueMessage();
                                    errorActionInstance
                                            .setServiceBusQueueMessage(serviceBusQueueMessageInstance);

                                    JsonNode queueNameValue2 = serviceBusQueueMessageValue.get("queueName");
                                    if (queueNameValue2 != null
                                            && queueNameValue2 instanceof NullNode == false) {
                                        String queueNameInstance2;
                                        queueNameInstance2 = queueNameValue2.getTextValue();
                                        serviceBusQueueMessageInstance.setQueueName(queueNameInstance2);
                                    }

                                    JsonNode namespaceValue2 = serviceBusQueueMessageValue.get("namespace");
                                    if (namespaceValue2 != null
                                            && namespaceValue2 instanceof NullNode == false) {
                                        String namespaceInstance2;
                                        namespaceInstance2 = namespaceValue2.getTextValue();
                                        serviceBusQueueMessageInstance.setNamespace(namespaceInstance2);
                                    }

                                    JsonNode transportTypeValue2 = serviceBusQueueMessageValue
                                            .get("transportType");
                                    if (transportTypeValue2 != null
                                            && transportTypeValue2 instanceof NullNode == false) {
                                        JobServiceBusTransportType transportTypeInstance2;
                                        transportTypeInstance2 = SchedulerClientImpl
                                                .parseJobServiceBusTransportType(
                                                        transportTypeValue2.getTextValue());
                                        serviceBusQueueMessageInstance.setTransportType(transportTypeInstance2);
                                    }

                                    JsonNode authenticationValue3 = serviceBusQueueMessageValue
                                            .get("authentication");
                                    if (authenticationValue3 != null
                                            && authenticationValue3 instanceof NullNode == false) {
                                        JobServiceBusAuthentication authenticationInstance2 = new JobServiceBusAuthentication();
                                        serviceBusQueueMessageInstance
                                                .setAuthentication(authenticationInstance2);

                                        JsonNode sasKeyNameValue2 = authenticationValue3.get("sasKeyName");
                                        if (sasKeyNameValue2 != null
                                                && sasKeyNameValue2 instanceof NullNode == false) {
                                            String sasKeyNameInstance2;
                                            sasKeyNameInstance2 = sasKeyNameValue2.getTextValue();
                                            authenticationInstance2.setSasKeyName(sasKeyNameInstance2);
                                        }

                                        JsonNode sasKeyValue2 = authenticationValue3.get("sasKey");
                                        if (sasKeyValue2 != null && sasKeyValue2 instanceof NullNode == false) {
                                            String sasKeyInstance2;
                                            sasKeyInstance2 = sasKeyValue2.getTextValue();
                                            authenticationInstance2.setSasKey(sasKeyInstance2);
                                        }

                                        JsonNode typeValue7 = authenticationValue3.get("type");
                                        if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
                                            JobServiceBusAuthenticationType typeInstance7;
                                            typeInstance7 = SchedulerClientImpl
                                                    .parseJobServiceBusAuthenticationType(
                                                            typeValue7.getTextValue());
                                            authenticationInstance2.setType(typeInstance7);
                                        }
                                    }

                                    JsonNode messageValue3 = serviceBusQueueMessageValue.get("message");
                                    if (messageValue3 != null && messageValue3 instanceof NullNode == false) {
                                        String messageInstance3;
                                        messageInstance3 = messageValue3.getTextValue();
                                        serviceBusQueueMessageInstance.setMessage(messageInstance3);
                                    }

                                    JsonNode brokeredMessagePropertiesValue2 = serviceBusQueueMessageValue
                                            .get("brokeredMessageProperties");
                                    if (brokeredMessagePropertiesValue2 != null
                                            && brokeredMessagePropertiesValue2 instanceof NullNode == false) {
                                        JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance2 = new JobServiceBusBrokeredMessageProperties();
                                        serviceBusQueueMessageInstance.setBrokeredMessageProperties(
                                                brokeredMessagePropertiesInstance2);

                                        JsonNode contentTypeValue2 = brokeredMessagePropertiesValue2
                                                .get("contentType");
                                        if (contentTypeValue2 != null
                                                && contentTypeValue2 instanceof NullNode == false) {
                                            String contentTypeInstance2;
                                            contentTypeInstance2 = contentTypeValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setContentType(contentTypeInstance2);
                                        }

                                        JsonNode correlationIdValue2 = brokeredMessagePropertiesValue2
                                                .get("correlationId");
                                        if (correlationIdValue2 != null
                                                && correlationIdValue2 instanceof NullNode == false) {
                                            String correlationIdInstance2;
                                            correlationIdInstance2 = correlationIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setCorrelationId(correlationIdInstance2);
                                        }

                                        JsonNode forcePersistenceValue2 = brokeredMessagePropertiesValue2
                                                .get("forcePersistence");
                                        if (forcePersistenceValue2 != null
                                                && forcePersistenceValue2 instanceof NullNode == false) {
                                            boolean forcePersistenceInstance2;
                                            forcePersistenceInstance2 = forcePersistenceValue2
                                                    .getBooleanValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setForcePersistence(forcePersistenceInstance2);
                                        }

                                        JsonNode labelValue2 = brokeredMessagePropertiesValue2.get("label");
                                        if (labelValue2 != null && labelValue2 instanceof NullNode == false) {
                                            String labelInstance2;
                                            labelInstance2 = labelValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setLabel(labelInstance2);
                                        }

                                        JsonNode messageIdValue2 = brokeredMessagePropertiesValue2
                                                .get("messageId");
                                        if (messageIdValue2 != null
                                                && messageIdValue2 instanceof NullNode == false) {
                                            String messageIdInstance2;
                                            messageIdInstance2 = messageIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setMessageId(messageIdInstance2);
                                        }

                                        JsonNode partitionKeyValue2 = brokeredMessagePropertiesValue2
                                                .get("partitionKey");
                                        if (partitionKeyValue2 != null
                                                && partitionKeyValue2 instanceof NullNode == false) {
                                            String partitionKeyInstance2;
                                            partitionKeyInstance2 = partitionKeyValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setPartitionKey(partitionKeyInstance2);
                                        }

                                        JsonNode replyToValue2 = brokeredMessagePropertiesValue2.get("replyTo");
                                        if (replyToValue2 != null
                                                && replyToValue2 instanceof NullNode == false) {
                                            String replyToInstance2;
                                            replyToInstance2 = replyToValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setReplyTo(replyToInstance2);
                                        }

                                        JsonNode replyToSessionIdValue2 = brokeredMessagePropertiesValue2
                                                .get("replyToSessionId");
                                        if (replyToSessionIdValue2 != null
                                                && replyToSessionIdValue2 instanceof NullNode == false) {
                                            String replyToSessionIdInstance2;
                                            replyToSessionIdInstance2 = replyToSessionIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setReplyToSessionId(replyToSessionIdInstance2);
                                        }

                                        JsonNode scheduledEnqueueTimeUtcValue2 = brokeredMessagePropertiesValue2
                                                .get("scheduledEnqueueTimeUtc");
                                        if (scheduledEnqueueTimeUtcValue2 != null
                                                && scheduledEnqueueTimeUtcValue2 instanceof NullNode == false) {
                                            Calendar scheduledEnqueueTimeUtcInstance2;
                                            scheduledEnqueueTimeUtcInstance2 = DatatypeConverter.parseDateTime(
                                                    scheduledEnqueueTimeUtcValue2.getTextValue());
                                            brokeredMessagePropertiesInstance2.setScheduledEnqueueTimeUtc(
                                                    scheduledEnqueueTimeUtcInstance2);
                                        }

                                        JsonNode sessionIdValue2 = brokeredMessagePropertiesValue2
                                                .get("sessionId");
                                        if (sessionIdValue2 != null
                                                && sessionIdValue2 instanceof NullNode == false) {
                                            String sessionIdInstance2;
                                            sessionIdInstance2 = sessionIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setSessionId(sessionIdInstance2);
                                        }

                                        JsonNode timeToLiveValue2 = brokeredMessagePropertiesValue2
                                                .get("timeToLive");
                                        if (timeToLiveValue2 != null
                                                && timeToLiveValue2 instanceof NullNode == false) {
                                            Calendar timeToLiveInstance2;
                                            timeToLiveInstance2 = DatatypeConverter
                                                    .parseDateTime(timeToLiveValue2.getTextValue());
                                            brokeredMessagePropertiesInstance2
                                                    .setTimeToLive(timeToLiveInstance2);
                                        }

                                        JsonNode toValue2 = brokeredMessagePropertiesValue2.get("to");
                                        if (toValue2 != null && toValue2 instanceof NullNode == false) {
                                            String toInstance2;
                                            toInstance2 = toValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setTo(toInstance2);
                                        }

                                        JsonNode viaPartitionKeyValue2 = brokeredMessagePropertiesValue2
                                                .get("viaPartitionKey");
                                        if (viaPartitionKeyValue2 != null
                                                && viaPartitionKeyValue2 instanceof NullNode == false) {
                                            String viaPartitionKeyInstance2;
                                            viaPartitionKeyInstance2 = viaPartitionKeyValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setViaPartitionKey(viaPartitionKeyInstance2);
                                        }
                                    }

                                    JsonNode customMessagePropertiesSequenceElement2 = ((JsonNode) serviceBusQueueMessageValue
                                            .get("customMessageProperties"));
                                    if (customMessagePropertiesSequenceElement2 != null
                                            && customMessagePropertiesSequenceElement2 instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr3 = customMessagePropertiesSequenceElement2
                                                .getFields();
                                        while (itr3.hasNext()) {
                                            Map.Entry<String, JsonNode> property3 = itr3.next();
                                            String customMessagePropertiesKey2 = property3.getKey();
                                            String customMessagePropertiesValue2 = property3.getValue()
                                                    .getTextValue();
                                            serviceBusQueueMessageInstance.getCustomMessageProperties().put(
                                                    customMessagePropertiesKey2, customMessagePropertiesValue2);
                                        }
                                    }
                                }
                            }

                            JsonNode requestValue2 = actionValue.get("request");
                            if (requestValue2 != null && requestValue2 instanceof NullNode == false) {
                                JobHttpRequest requestInstance2 = new JobHttpRequest();
                                actionInstance.setRequest(requestInstance2);

                                JsonNode uriValue2 = requestValue2.get("uri");
                                if (uriValue2 != null && uriValue2 instanceof NullNode == false) {
                                    URI uriInstance2;
                                    uriInstance2 = new URI(uriValue2.getTextValue());
                                    requestInstance2.setUri(uriInstance2);
                                }

                                JsonNode methodValue2 = requestValue2.get("method");
                                if (methodValue2 != null && methodValue2 instanceof NullNode == false) {
                                    String methodInstance2;
                                    methodInstance2 = methodValue2.getTextValue();
                                    requestInstance2.setMethod(methodInstance2);
                                }

                                JsonNode headersSequenceElement2 = ((JsonNode) requestValue2.get("headers"));
                                if (headersSequenceElement2 != null
                                        && headersSequenceElement2 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr4 = headersSequenceElement2
                                            .getFields();
                                    while (itr4.hasNext()) {
                                        Map.Entry<String, JsonNode> property4 = itr4.next();
                                        String headersKey2 = property4.getKey();
                                        String headersValue2 = property4.getValue().getTextValue();
                                        requestInstance2.getHeaders().put(headersKey2, headersValue2);
                                    }
                                }

                                JsonNode bodyValue2 = requestValue2.get("body");
                                if (bodyValue2 != null && bodyValue2 instanceof NullNode == false) {
                                    String bodyInstance2;
                                    bodyInstance2 = bodyValue2.getTextValue();
                                    requestInstance2.setBody(bodyInstance2);
                                }

                                JsonNode authenticationValue4 = requestValue2.get("authentication");
                                if (authenticationValue4 != null
                                        && authenticationValue4 instanceof NullNode == false) {
                                    String typeName2 = authenticationValue4.get("type").getTextValue();
                                    if ("ClientCertificate".equals(typeName2)) {
                                        ClientCertAuthentication clientCertAuthenticationInstance2 = new ClientCertAuthentication();

                                        JsonNode passwordValue3 = authenticationValue4.get("password");
                                        if (passwordValue3 != null
                                                && passwordValue3 instanceof NullNode == false) {
                                            String passwordInstance3;
                                            passwordInstance3 = passwordValue3.getTextValue();
                                            clientCertAuthenticationInstance2.setPassword(passwordInstance3);
                                        }

                                        JsonNode pfxValue2 = authenticationValue4.get("pfx");
                                        if (pfxValue2 != null && pfxValue2 instanceof NullNode == false) {
                                            String pfxInstance2;
                                            pfxInstance2 = pfxValue2.getTextValue();
                                            clientCertAuthenticationInstance2.setPfx(pfxInstance2);
                                        }

                                        JsonNode certificateThumbprintValue2 = authenticationValue4
                                                .get("certificateThumbprint");
                                        if (certificateThumbprintValue2 != null
                                                && certificateThumbprintValue2 instanceof NullNode == false) {
                                            String certificateThumbprintInstance2;
                                            certificateThumbprintInstance2 = certificateThumbprintValue2
                                                    .getTextValue();
                                            clientCertAuthenticationInstance2
                                                    .setCertificateThumbprint(certificateThumbprintInstance2);
                                        }

                                        JsonNode certificateExpirationValue2 = authenticationValue4
                                                .get("certificateExpiration");
                                        if (certificateExpirationValue2 != null
                                                && certificateExpirationValue2 instanceof NullNode == false) {
                                            Calendar certificateExpirationInstance2;
                                            certificateExpirationInstance2 = DatatypeConverter
                                                    .parseDateTime(certificateExpirationValue2.getTextValue());
                                            clientCertAuthenticationInstance2
                                                    .setCertificateExpiration(certificateExpirationInstance2);
                                        }

                                        JsonNode certificateSubjectNameValue2 = authenticationValue4
                                                .get("certificateSubjectName");
                                        if (certificateSubjectNameValue2 != null
                                                && certificateSubjectNameValue2 instanceof NullNode == false) {
                                            String certificateSubjectNameInstance2;
                                            certificateSubjectNameInstance2 = certificateSubjectNameValue2
                                                    .getTextValue();
                                            clientCertAuthenticationInstance2
                                                    .setCertificateSubjectName(certificateSubjectNameInstance2);
                                        }

                                        JsonNode typeValue8 = authenticationValue4.get("type");
                                        if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance8;
                                            typeInstance8 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue8.getTextValue());
                                            clientCertAuthenticationInstance2.setType(typeInstance8);
                                        }
                                        requestInstance2.setAuthentication(clientCertAuthenticationInstance2);
                                    }
                                    if ("ActiveDirectoryOAuth".equals(typeName2)) {
                                        AADOAuthAuthentication aADOAuthAuthenticationInstance2 = new AADOAuthAuthentication();

                                        JsonNode secretValue2 = authenticationValue4.get("secret");
                                        if (secretValue2 != null && secretValue2 instanceof NullNode == false) {
                                            String secretInstance2;
                                            secretInstance2 = secretValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setSecret(secretInstance2);
                                        }

                                        JsonNode tenantValue2 = authenticationValue4.get("tenant");
                                        if (tenantValue2 != null && tenantValue2 instanceof NullNode == false) {
                                            String tenantInstance2;
                                            tenantInstance2 = tenantValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setTenant(tenantInstance2);
                                        }

                                        JsonNode audienceValue2 = authenticationValue4.get("audience");
                                        if (audienceValue2 != null
                                                && audienceValue2 instanceof NullNode == false) {
                                            String audienceInstance2;
                                            audienceInstance2 = audienceValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setAudience(audienceInstance2);
                                        }

                                        JsonNode clientIdValue2 = authenticationValue4.get("clientId");
                                        if (clientIdValue2 != null
                                                && clientIdValue2 instanceof NullNode == false) {
                                            String clientIdInstance2;
                                            clientIdInstance2 = clientIdValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setClientId(clientIdInstance2);
                                        }

                                        JsonNode typeValue9 = authenticationValue4.get("type");
                                        if (typeValue9 != null && typeValue9 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance9;
                                            typeInstance9 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue9.getTextValue());
                                            aADOAuthAuthenticationInstance2.setType(typeInstance9);
                                        }
                                        requestInstance2.setAuthentication(aADOAuthAuthenticationInstance2);
                                    }
                                    if ("Basic".equals(typeName2)) {
                                        BasicAuthentication basicAuthenticationInstance2 = new BasicAuthentication();

                                        JsonNode usernameValue2 = authenticationValue4.get("username");
                                        if (usernameValue2 != null
                                                && usernameValue2 instanceof NullNode == false) {
                                            String usernameInstance2;
                                            usernameInstance2 = usernameValue2.getTextValue();
                                            basicAuthenticationInstance2.setUsername(usernameInstance2);
                                        }

                                        JsonNode passwordValue4 = authenticationValue4.get("password");
                                        if (passwordValue4 != null
                                                && passwordValue4 instanceof NullNode == false) {
                                            String passwordInstance4;
                                            passwordInstance4 = passwordValue4.getTextValue();
                                            basicAuthenticationInstance2.setPassword(passwordInstance4);
                                        }

                                        JsonNode typeValue10 = authenticationValue4.get("type");
                                        if (typeValue10 != null && typeValue10 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance10;
                                            typeInstance10 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue10.getTextValue());
                                            basicAuthenticationInstance2.setType(typeInstance10);
                                        }
                                        requestInstance2.setAuthentication(basicAuthenticationInstance2);
                                    }
                                }
                            }

                            JsonNode queueMessageValue2 = actionValue.get("queueMessage");
                            if (queueMessageValue2 != null && queueMessageValue2 instanceof NullNode == false) {
                                JobQueueMessage queueMessageInstance2 = new JobQueueMessage();
                                actionInstance.setQueueMessage(queueMessageInstance2);

                                JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount");
                                if (storageAccountValue2 != null
                                        && storageAccountValue2 instanceof NullNode == false) {
                                    String storageAccountInstance2;
                                    storageAccountInstance2 = storageAccountValue2.getTextValue();
                                    queueMessageInstance2.setStorageAccountName(storageAccountInstance2);
                                }

                                JsonNode queueNameValue3 = queueMessageValue2.get("queueName");
                                if (queueNameValue3 != null && queueNameValue3 instanceof NullNode == false) {
                                    String queueNameInstance3;
                                    queueNameInstance3 = queueNameValue3.getTextValue();
                                    queueMessageInstance2.setQueueName(queueNameInstance3);
                                }

                                JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken");
                                if (sasTokenValue2 != null && sasTokenValue2 instanceof NullNode == false) {
                                    String sasTokenInstance2;
                                    sasTokenInstance2 = sasTokenValue2.getTextValue();
                                    queueMessageInstance2.setSasToken(sasTokenInstance2);
                                }

                                JsonNode messageValue4 = queueMessageValue2.get("message");
                                if (messageValue4 != null && messageValue4 instanceof NullNode == false) {
                                    String messageInstance4;
                                    messageInstance4 = messageValue4.getTextValue();
                                    queueMessageInstance2.setMessage(messageInstance4);
                                }
                            }

                            JsonNode serviceBusTopicMessageValue2 = actionValue.get("serviceBusTopicMessage");
                            if (serviceBusTopicMessageValue2 != null
                                    && serviceBusTopicMessageValue2 instanceof NullNode == false) {
                                JobServiceBusTopicMessage serviceBusTopicMessageInstance2 = new JobServiceBusTopicMessage();
                                actionInstance.setServiceBusTopicMessage(serviceBusTopicMessageInstance2);

                                JsonNode topicPathValue2 = serviceBusTopicMessageValue2.get("topicPath");
                                if (topicPathValue2 != null && topicPathValue2 instanceof NullNode == false) {
                                    String topicPathInstance2;
                                    topicPathInstance2 = topicPathValue2.getTextValue();
                                    serviceBusTopicMessageInstance2.setTopicPath(topicPathInstance2);
                                }

                                JsonNode namespaceValue3 = serviceBusTopicMessageValue2.get("namespace");
                                if (namespaceValue3 != null && namespaceValue3 instanceof NullNode == false) {
                                    String namespaceInstance3;
                                    namespaceInstance3 = namespaceValue3.getTextValue();
                                    serviceBusTopicMessageInstance2.setNamespace(namespaceInstance3);
                                }

                                JsonNode transportTypeValue3 = serviceBusTopicMessageValue2
                                        .get("transportType");
                                if (transportTypeValue3 != null
                                        && transportTypeValue3 instanceof NullNode == false) {
                                    JobServiceBusTransportType transportTypeInstance3;
                                    transportTypeInstance3 = SchedulerClientImpl
                                            .parseJobServiceBusTransportType(
                                                    transportTypeValue3.getTextValue());
                                    serviceBusTopicMessageInstance2.setTransportType(transportTypeInstance3);
                                }

                                JsonNode authenticationValue5 = serviceBusTopicMessageValue2
                                        .get("authentication");
                                if (authenticationValue5 != null
                                        && authenticationValue5 instanceof NullNode == false) {
                                    JobServiceBusAuthentication authenticationInstance3 = new JobServiceBusAuthentication();
                                    serviceBusTopicMessageInstance2.setAuthentication(authenticationInstance3);

                                    JsonNode sasKeyNameValue3 = authenticationValue5.get("sasKeyName");
                                    if (sasKeyNameValue3 != null
                                            && sasKeyNameValue3 instanceof NullNode == false) {
                                        String sasKeyNameInstance3;
                                        sasKeyNameInstance3 = sasKeyNameValue3.getTextValue();
                                        authenticationInstance3.setSasKeyName(sasKeyNameInstance3);
                                    }

                                    JsonNode sasKeyValue3 = authenticationValue5.get("sasKey");
                                    if (sasKeyValue3 != null && sasKeyValue3 instanceof NullNode == false) {
                                        String sasKeyInstance3;
                                        sasKeyInstance3 = sasKeyValue3.getTextValue();
                                        authenticationInstance3.setSasKey(sasKeyInstance3);
                                    }

                                    JsonNode typeValue11 = authenticationValue5.get("type");
                                    if (typeValue11 != null && typeValue11 instanceof NullNode == false) {
                                        JobServiceBusAuthenticationType typeInstance11;
                                        typeInstance11 = SchedulerClientImpl
                                                .parseJobServiceBusAuthenticationType(
                                                        typeValue11.getTextValue());
                                        authenticationInstance3.setType(typeInstance11);
                                    }
                                }

                                JsonNode messageValue5 = serviceBusTopicMessageValue2.get("message");
                                if (messageValue5 != null && messageValue5 instanceof NullNode == false) {
                                    String messageInstance5;
                                    messageInstance5 = messageValue5.getTextValue();
                                    serviceBusTopicMessageInstance2.setMessage(messageInstance5);
                                }

                                JsonNode brokeredMessagePropertiesValue3 = serviceBusTopicMessageValue2
                                        .get("brokeredMessageProperties");
                                if (brokeredMessagePropertiesValue3 != null
                                        && brokeredMessagePropertiesValue3 instanceof NullNode == false) {
                                    JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance3 = new JobServiceBusBrokeredMessageProperties();
                                    serviceBusTopicMessageInstance2
                                            .setBrokeredMessageProperties(brokeredMessagePropertiesInstance3);

                                    JsonNode contentTypeValue3 = brokeredMessagePropertiesValue3
                                            .get("contentType");
                                    if (contentTypeValue3 != null
                                            && contentTypeValue3 instanceof NullNode == false) {
                                        String contentTypeInstance3;
                                        contentTypeInstance3 = contentTypeValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setContentType(contentTypeInstance3);
                                    }

                                    JsonNode correlationIdValue3 = brokeredMessagePropertiesValue3
                                            .get("correlationId");
                                    if (correlationIdValue3 != null
                                            && correlationIdValue3 instanceof NullNode == false) {
                                        String correlationIdInstance3;
                                        correlationIdInstance3 = correlationIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setCorrelationId(correlationIdInstance3);
                                    }

                                    JsonNode forcePersistenceValue3 = brokeredMessagePropertiesValue3
                                            .get("forcePersistence");
                                    if (forcePersistenceValue3 != null
                                            && forcePersistenceValue3 instanceof NullNode == false) {
                                        boolean forcePersistenceInstance3;
                                        forcePersistenceInstance3 = forcePersistenceValue3.getBooleanValue();
                                        brokeredMessagePropertiesInstance3
                                                .setForcePersistence(forcePersistenceInstance3);
                                    }

                                    JsonNode labelValue3 = brokeredMessagePropertiesValue3.get("label");
                                    if (labelValue3 != null && labelValue3 instanceof NullNode == false) {
                                        String labelInstance3;
                                        labelInstance3 = labelValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setLabel(labelInstance3);
                                    }

                                    JsonNode messageIdValue3 = brokeredMessagePropertiesValue3.get("messageId");
                                    if (messageIdValue3 != null
                                            && messageIdValue3 instanceof NullNode == false) {
                                        String messageIdInstance3;
                                        messageIdInstance3 = messageIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setMessageId(messageIdInstance3);
                                    }

                                    JsonNode partitionKeyValue3 = brokeredMessagePropertiesValue3
                                            .get("partitionKey");
                                    if (partitionKeyValue3 != null
                                            && partitionKeyValue3 instanceof NullNode == false) {
                                        String partitionKeyInstance3;
                                        partitionKeyInstance3 = partitionKeyValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setPartitionKey(partitionKeyInstance3);
                                    }

                                    JsonNode replyToValue3 = brokeredMessagePropertiesValue3.get("replyTo");
                                    if (replyToValue3 != null && replyToValue3 instanceof NullNode == false) {
                                        String replyToInstance3;
                                        replyToInstance3 = replyToValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setReplyTo(replyToInstance3);
                                    }

                                    JsonNode replyToSessionIdValue3 = brokeredMessagePropertiesValue3
                                            .get("replyToSessionId");
                                    if (replyToSessionIdValue3 != null
                                            && replyToSessionIdValue3 instanceof NullNode == false) {
                                        String replyToSessionIdInstance3;
                                        replyToSessionIdInstance3 = replyToSessionIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setReplyToSessionId(replyToSessionIdInstance3);
                                    }

                                    JsonNode scheduledEnqueueTimeUtcValue3 = brokeredMessagePropertiesValue3
                                            .get("scheduledEnqueueTimeUtc");
                                    if (scheduledEnqueueTimeUtcValue3 != null
                                            && scheduledEnqueueTimeUtcValue3 instanceof NullNode == false) {
                                        Calendar scheduledEnqueueTimeUtcInstance3;
                                        scheduledEnqueueTimeUtcInstance3 = DatatypeConverter
                                                .parseDateTime(scheduledEnqueueTimeUtcValue3.getTextValue());
                                        brokeredMessagePropertiesInstance3
                                                .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance3);
                                    }

                                    JsonNode sessionIdValue3 = brokeredMessagePropertiesValue3.get("sessionId");
                                    if (sessionIdValue3 != null
                                            && sessionIdValue3 instanceof NullNode == false) {
                                        String sessionIdInstance3;
                                        sessionIdInstance3 = sessionIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setSessionId(sessionIdInstance3);
                                    }

                                    JsonNode timeToLiveValue3 = brokeredMessagePropertiesValue3
                                            .get("timeToLive");
                                    if (timeToLiveValue3 != null
                                            && timeToLiveValue3 instanceof NullNode == false) {
                                        Calendar timeToLiveInstance3;
                                        timeToLiveInstance3 = DatatypeConverter
                                                .parseDateTime(timeToLiveValue3.getTextValue());
                                        brokeredMessagePropertiesInstance3.setTimeToLive(timeToLiveInstance3);
                                    }

                                    JsonNode toValue3 = brokeredMessagePropertiesValue3.get("to");
                                    if (toValue3 != null && toValue3 instanceof NullNode == false) {
                                        String toInstance3;
                                        toInstance3 = toValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setTo(toInstance3);
                                    }

                                    JsonNode viaPartitionKeyValue3 = brokeredMessagePropertiesValue3
                                            .get("viaPartitionKey");
                                    if (viaPartitionKeyValue3 != null
                                            && viaPartitionKeyValue3 instanceof NullNode == false) {
                                        String viaPartitionKeyInstance3;
                                        viaPartitionKeyInstance3 = viaPartitionKeyValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setViaPartitionKey(viaPartitionKeyInstance3);
                                    }
                                }

                                JsonNode customMessagePropertiesSequenceElement3 = ((JsonNode) serviceBusTopicMessageValue2
                                        .get("customMessageProperties"));
                                if (customMessagePropertiesSequenceElement3 != null
                                        && customMessagePropertiesSequenceElement3 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr5 = customMessagePropertiesSequenceElement3
                                            .getFields();
                                    while (itr5.hasNext()) {
                                        Map.Entry<String, JsonNode> property5 = itr5.next();
                                        String customMessagePropertiesKey3 = property5.getKey();
                                        String customMessagePropertiesValue3 = property5.getValue()
                                                .getTextValue();
                                        serviceBusTopicMessageInstance2.getCustomMessageProperties().put(
                                                customMessagePropertiesKey3, customMessagePropertiesValue3);
                                    }
                                }
                            }

                            JsonNode serviceBusQueueMessageValue2 = actionValue.get("serviceBusQueueMessage");
                            if (serviceBusQueueMessageValue2 != null
                                    && serviceBusQueueMessageValue2 instanceof NullNode == false) {
                                JobServiceBusQueueMessage serviceBusQueueMessageInstance2 = new JobServiceBusQueueMessage();
                                actionInstance.setServiceBusQueueMessage(serviceBusQueueMessageInstance2);

                                JsonNode queueNameValue4 = serviceBusQueueMessageValue2.get("queueName");
                                if (queueNameValue4 != null && queueNameValue4 instanceof NullNode == false) {
                                    String queueNameInstance4;
                                    queueNameInstance4 = queueNameValue4.getTextValue();
                                    serviceBusQueueMessageInstance2.setQueueName(queueNameInstance4);
                                }

                                JsonNode namespaceValue4 = serviceBusQueueMessageValue2.get("namespace");
                                if (namespaceValue4 != null && namespaceValue4 instanceof NullNode == false) {
                                    String namespaceInstance4;
                                    namespaceInstance4 = namespaceValue4.getTextValue();
                                    serviceBusQueueMessageInstance2.setNamespace(namespaceInstance4);
                                }

                                JsonNode transportTypeValue4 = serviceBusQueueMessageValue2
                                        .get("transportType");
                                if (transportTypeValue4 != null
                                        && transportTypeValue4 instanceof NullNode == false) {
                                    JobServiceBusTransportType transportTypeInstance4;
                                    transportTypeInstance4 = SchedulerClientImpl
                                            .parseJobServiceBusTransportType(
                                                    transportTypeValue4.getTextValue());
                                    serviceBusQueueMessageInstance2.setTransportType(transportTypeInstance4);
                                }

                                JsonNode authenticationValue6 = serviceBusQueueMessageValue2
                                        .get("authentication");
                                if (authenticationValue6 != null
                                        && authenticationValue6 instanceof NullNode == false) {
                                    JobServiceBusAuthentication authenticationInstance4 = new JobServiceBusAuthentication();
                                    serviceBusQueueMessageInstance2.setAuthentication(authenticationInstance4);

                                    JsonNode sasKeyNameValue4 = authenticationValue6.get("sasKeyName");
                                    if (sasKeyNameValue4 != null
                                            && sasKeyNameValue4 instanceof NullNode == false) {
                                        String sasKeyNameInstance4;
                                        sasKeyNameInstance4 = sasKeyNameValue4.getTextValue();
                                        authenticationInstance4.setSasKeyName(sasKeyNameInstance4);
                                    }

                                    JsonNode sasKeyValue4 = authenticationValue6.get("sasKey");
                                    if (sasKeyValue4 != null && sasKeyValue4 instanceof NullNode == false) {
                                        String sasKeyInstance4;
                                        sasKeyInstance4 = sasKeyValue4.getTextValue();
                                        authenticationInstance4.setSasKey(sasKeyInstance4);
                                    }

                                    JsonNode typeValue12 = authenticationValue6.get("type");
                                    if (typeValue12 != null && typeValue12 instanceof NullNode == false) {
                                        JobServiceBusAuthenticationType typeInstance12;
                                        typeInstance12 = SchedulerClientImpl
                                                .parseJobServiceBusAuthenticationType(
                                                        typeValue12.getTextValue());
                                        authenticationInstance4.setType(typeInstance12);
                                    }
                                }

                                JsonNode messageValue6 = serviceBusQueueMessageValue2.get("message");
                                if (messageValue6 != null && messageValue6 instanceof NullNode == false) {
                                    String messageInstance6;
                                    messageInstance6 = messageValue6.getTextValue();
                                    serviceBusQueueMessageInstance2.setMessage(messageInstance6);
                                }

                                JsonNode brokeredMessagePropertiesValue4 = serviceBusQueueMessageValue2
                                        .get("brokeredMessageProperties");
                                if (brokeredMessagePropertiesValue4 != null
                                        && brokeredMessagePropertiesValue4 instanceof NullNode == false) {
                                    JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance4 = new JobServiceBusBrokeredMessageProperties();
                                    serviceBusQueueMessageInstance2
                                            .setBrokeredMessageProperties(brokeredMessagePropertiesInstance4);

                                    JsonNode contentTypeValue4 = brokeredMessagePropertiesValue4
                                            .get("contentType");
                                    if (contentTypeValue4 != null
                                            && contentTypeValue4 instanceof NullNode == false) {
                                        String contentTypeInstance4;
                                        contentTypeInstance4 = contentTypeValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setContentType(contentTypeInstance4);
                                    }

                                    JsonNode correlationIdValue4 = brokeredMessagePropertiesValue4
                                            .get("correlationId");
                                    if (correlationIdValue4 != null
                                            && correlationIdValue4 instanceof NullNode == false) {
                                        String correlationIdInstance4;
                                        correlationIdInstance4 = correlationIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setCorrelationId(correlationIdInstance4);
                                    }

                                    JsonNode forcePersistenceValue4 = brokeredMessagePropertiesValue4
                                            .get("forcePersistence");
                                    if (forcePersistenceValue4 != null
                                            && forcePersistenceValue4 instanceof NullNode == false) {
                                        boolean forcePersistenceInstance4;
                                        forcePersistenceInstance4 = forcePersistenceValue4.getBooleanValue();
                                        brokeredMessagePropertiesInstance4
                                                .setForcePersistence(forcePersistenceInstance4);
                                    }

                                    JsonNode labelValue4 = brokeredMessagePropertiesValue4.get("label");
                                    if (labelValue4 != null && labelValue4 instanceof NullNode == false) {
                                        String labelInstance4;
                                        labelInstance4 = labelValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setLabel(labelInstance4);
                                    }

                                    JsonNode messageIdValue4 = brokeredMessagePropertiesValue4.get("messageId");
                                    if (messageIdValue4 != null
                                            && messageIdValue4 instanceof NullNode == false) {
                                        String messageIdInstance4;
                                        messageIdInstance4 = messageIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setMessageId(messageIdInstance4);
                                    }

                                    JsonNode partitionKeyValue4 = brokeredMessagePropertiesValue4
                                            .get("partitionKey");
                                    if (partitionKeyValue4 != null
                                            && partitionKeyValue4 instanceof NullNode == false) {
                                        String partitionKeyInstance4;
                                        partitionKeyInstance4 = partitionKeyValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setPartitionKey(partitionKeyInstance4);
                                    }

                                    JsonNode replyToValue4 = brokeredMessagePropertiesValue4.get("replyTo");
                                    if (replyToValue4 != null && replyToValue4 instanceof NullNode == false) {
                                        String replyToInstance4;
                                        replyToInstance4 = replyToValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setReplyTo(replyToInstance4);
                                    }

                                    JsonNode replyToSessionIdValue4 = brokeredMessagePropertiesValue4
                                            .get("replyToSessionId");
                                    if (replyToSessionIdValue4 != null
                                            && replyToSessionIdValue4 instanceof NullNode == false) {
                                        String replyToSessionIdInstance4;
                                        replyToSessionIdInstance4 = replyToSessionIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setReplyToSessionId(replyToSessionIdInstance4);
                                    }

                                    JsonNode scheduledEnqueueTimeUtcValue4 = brokeredMessagePropertiesValue4
                                            .get("scheduledEnqueueTimeUtc");
                                    if (scheduledEnqueueTimeUtcValue4 != null
                                            && scheduledEnqueueTimeUtcValue4 instanceof NullNode == false) {
                                        Calendar scheduledEnqueueTimeUtcInstance4;
                                        scheduledEnqueueTimeUtcInstance4 = DatatypeConverter
                                                .parseDateTime(scheduledEnqueueTimeUtcValue4.getTextValue());
                                        brokeredMessagePropertiesInstance4
                                                .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance4);
                                    }

                                    JsonNode sessionIdValue4 = brokeredMessagePropertiesValue4.get("sessionId");
                                    if (sessionIdValue4 != null
                                            && sessionIdValue4 instanceof NullNode == false) {
                                        String sessionIdInstance4;
                                        sessionIdInstance4 = sessionIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setSessionId(sessionIdInstance4);
                                    }

                                    JsonNode timeToLiveValue4 = brokeredMessagePropertiesValue4
                                            .get("timeToLive");
                                    if (timeToLiveValue4 != null
                                            && timeToLiveValue4 instanceof NullNode == false) {
                                        Calendar timeToLiveInstance4;
                                        timeToLiveInstance4 = DatatypeConverter
                                                .parseDateTime(timeToLiveValue4.getTextValue());
                                        brokeredMessagePropertiesInstance4.setTimeToLive(timeToLiveInstance4);
                                    }

                                    JsonNode toValue4 = brokeredMessagePropertiesValue4.get("to");
                                    if (toValue4 != null && toValue4 instanceof NullNode == false) {
                                        String toInstance4;
                                        toInstance4 = toValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setTo(toInstance4);
                                    }

                                    JsonNode viaPartitionKeyValue4 = brokeredMessagePropertiesValue4
                                            .get("viaPartitionKey");
                                    if (viaPartitionKeyValue4 != null
                                            && viaPartitionKeyValue4 instanceof NullNode == false) {
                                        String viaPartitionKeyInstance4;
                                        viaPartitionKeyInstance4 = viaPartitionKeyValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setViaPartitionKey(viaPartitionKeyInstance4);
                                    }
                                }

                                JsonNode customMessagePropertiesSequenceElement4 = ((JsonNode) serviceBusQueueMessageValue2
                                        .get("customMessageProperties"));
                                if (customMessagePropertiesSequenceElement4 != null
                                        && customMessagePropertiesSequenceElement4 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr6 = customMessagePropertiesSequenceElement4
                                            .getFields();
                                    while (itr6.hasNext()) {
                                        Map.Entry<String, JsonNode> property6 = itr6.next();
                                        String customMessagePropertiesKey4 = property6.getKey();
                                        String customMessagePropertiesValue4 = property6.getValue()
                                                .getTextValue();
                                        serviceBusQueueMessageInstance2.getCustomMessageProperties().put(
                                                customMessagePropertiesKey4, customMessagePropertiesValue4);
                                    }
                                }
                            }
                        }

                        JsonNode recurrenceValue = jobsValue.get("recurrence");
                        if (recurrenceValue != null && recurrenceValue instanceof NullNode == false) {
                            JobRecurrence recurrenceInstance = new JobRecurrence();
                            jobInstance.setRecurrence(recurrenceInstance);

                            JsonNode frequencyValue = recurrenceValue.get("frequency");
                            if (frequencyValue != null && frequencyValue instanceof NullNode == false) {
                                JobRecurrenceFrequency frequencyInstance;
                                frequencyInstance = SchedulerClientImpl
                                        .parseJobRecurrenceFrequency(frequencyValue.getTextValue());
                                recurrenceInstance.setFrequency(frequencyInstance);
                            }

                            JsonNode intervalValue = recurrenceValue.get("interval");
                            if (intervalValue != null && intervalValue instanceof NullNode == false) {
                                int intervalInstance;
                                intervalInstance = intervalValue.getIntValue();
                                recurrenceInstance.setInterval(intervalInstance);
                            }

                            JsonNode countValue = recurrenceValue.get("count");
                            if (countValue != null && countValue instanceof NullNode == false) {
                                int countInstance;
                                countInstance = countValue.getIntValue();
                                recurrenceInstance.setCount(countInstance);
                            }

                            JsonNode endTimeValue = recurrenceValue.get("endTime");
                            if (endTimeValue != null && endTimeValue instanceof NullNode == false) {
                                Calendar endTimeInstance;
                                endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue());
                                recurrenceInstance.setEndTime(endTimeInstance);
                            }

                            JsonNode scheduleValue = recurrenceValue.get("schedule");
                            if (scheduleValue != null && scheduleValue instanceof NullNode == false) {
                                JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule();
                                recurrenceInstance.setSchedule(scheduleInstance);

                                JsonNode minutesArray = scheduleValue.get("minutes");
                                if (minutesArray != null && minutesArray instanceof NullNode == false) {
                                    scheduleInstance.setMinutes(new ArrayList<Integer>());
                                    for (JsonNode minutesValue : ((ArrayNode) minutesArray)) {
                                        scheduleInstance.getMinutes().add(minutesValue.getIntValue());
                                    }
                                }

                                JsonNode hoursArray = scheduleValue.get("hours");
                                if (hoursArray != null && hoursArray instanceof NullNode == false) {
                                    scheduleInstance.setHours(new ArrayList<Integer>());
                                    for (JsonNode hoursValue : ((ArrayNode) hoursArray)) {
                                        scheduleInstance.getHours().add(hoursValue.getIntValue());
                                    }
                                }

                                JsonNode weekDaysArray = scheduleValue.get("weekDays");
                                if (weekDaysArray != null && weekDaysArray instanceof NullNode == false) {
                                    scheduleInstance.setDays(new ArrayList<JobScheduleDay>());
                                    for (JsonNode weekDaysValue : ((ArrayNode) weekDaysArray)) {
                                        scheduleInstance.getDays().add(SchedulerClientImpl
                                                .parseJobScheduleDay(weekDaysValue.getTextValue()));
                                    }
                                }

                                JsonNode monthsArray = scheduleValue.get("months");
                                if (monthsArray != null && monthsArray instanceof NullNode == false) {
                                    scheduleInstance.setMonths(new ArrayList<Integer>());
                                    for (JsonNode monthsValue : ((ArrayNode) monthsArray)) {
                                        scheduleInstance.getMonths().add(monthsValue.getIntValue());
                                    }
                                }

                                JsonNode monthDaysArray = scheduleValue.get("monthDays");
                                if (monthDaysArray != null && monthDaysArray instanceof NullNode == false) {
                                    scheduleInstance.setMonthDays(new ArrayList<Integer>());
                                    for (JsonNode monthDaysValue : ((ArrayNode) monthDaysArray)) {
                                        scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue());
                                    }
                                }

                                JsonNode monthlyOccurrencesArray = scheduleValue.get("monthlyOccurrences");
                                if (monthlyOccurrencesArray != null
                                        && monthlyOccurrencesArray instanceof NullNode == false) {
                                    scheduleInstance.setMonthlyOccurrences(
                                            new ArrayList<JobScheduleMonthlyOccurrence>());
                                    for (JsonNode monthlyOccurrencesValue : ((ArrayNode) monthlyOccurrencesArray)) {
                                        JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence();
                                        scheduleInstance.getMonthlyOccurrences()
                                                .add(jobScheduleMonthlyOccurrenceInstance);

                                        JsonNode dayValue = monthlyOccurrencesValue.get("day");
                                        if (dayValue != null && dayValue instanceof NullNode == false) {
                                            JobScheduleDay dayInstance;
                                            dayInstance = SchedulerClientImpl
                                                    .parseJobScheduleDay(dayValue.getTextValue());
                                            jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance);
                                        }

                                        JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence");
                                        if (occurrenceValue != null
                                                && occurrenceValue instanceof NullNode == false) {
                                            int occurrenceInstance;
                                            occurrenceInstance = occurrenceValue.getIntValue();
                                            jobScheduleMonthlyOccurrenceInstance
                                                    .setOccurrence(occurrenceInstance);
                                        }
                                    }
                                }
                            }
                        }

                        JsonNode statusValue = jobsValue.get("status");
                        if (statusValue != null && statusValue instanceof NullNode == false) {
                            JobStatus statusInstance = new JobStatus();
                            jobInstance.setStatus(statusInstance);

                            JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime");
                            if (lastExecutionTimeValue != null
                                    && lastExecutionTimeValue instanceof NullNode == false) {
                                Calendar lastExecutionTimeInstance;
                                lastExecutionTimeInstance = DatatypeConverter
                                        .parseDateTime(lastExecutionTimeValue.getTextValue());
                                statusInstance.setLastExecutionTime(lastExecutionTimeInstance);
                            }

                            JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime");
                            if (nextExecutionTimeValue != null
                                    && nextExecutionTimeValue instanceof NullNode == false) {
                                Calendar nextExecutionTimeInstance;
                                nextExecutionTimeInstance = DatatypeConverter
                                        .parseDateTime(nextExecutionTimeValue.getTextValue());
                                statusInstance.setNextExecutionTime(nextExecutionTimeInstance);
                            }

                            JsonNode executionCountValue = statusValue.get("executionCount");
                            if (executionCountValue != null
                                    && executionCountValue instanceof NullNode == false) {
                                int executionCountInstance;
                                executionCountInstance = executionCountValue.getIntValue();
                                statusInstance.setExecutionCount(executionCountInstance);
                            }

                            JsonNode failureCountValue = statusValue.get("failureCount");
                            if (failureCountValue != null && failureCountValue instanceof NullNode == false) {
                                int failureCountInstance;
                                failureCountInstance = failureCountValue.getIntValue();
                                statusInstance.setFailureCount(failureCountInstance);
                            }

                            JsonNode faultedCountValue = statusValue.get("faultedCount");
                            if (faultedCountValue != null && faultedCountValue instanceof NullNode == false) {
                                int faultedCountInstance;
                                faultedCountInstance = faultedCountValue.getIntValue();
                                statusInstance.setFaultedCount(faultedCountInstance);
                            }
                        }

                        JsonNode stateValue = jobsValue.get("state");
                        if (stateValue != null && stateValue instanceof NullNode == false) {
                            JobState stateInstance;
                            stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue());
                            jobInstance.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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.azure.management.sql.DatabaseOperationsImpl.java

/**
* Returns information about Azure SQL Database usages.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the server belongs./*from  w ww . ja  v a2s  .c om*/
* @param serverName Required. The name of the Azure SQL Database Server in
* which the Azure SQL Databases are hosted.
* @param databaseName Required. The name of the Azure SQL Database.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Represents the response to a List Azure Sql Database metrics
* request.
*/
@Override
public DatabaseMetricListResponse listUsages(String resourceGroupName, String serverName, String databaseName)
        throws IOException, ServiceException {
    // Validate
    if (resourceGroupName == null) {
        throw new NullPointerException("resourceGroupName");
    }
    if (serverName == null) {
        throw new NullPointerException("serverName");
    }
    if (databaseName == null) {
        throw new NullPointerException("databaseName");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("resourceGroupName", resourceGroupName);
        tracingParameters.put("serverName", serverName);
        tracingParameters.put("databaseName", databaseName);
        CloudTracing.enter(invocationId, this, "listUsagesAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/subscriptions/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/resourceGroups/";
    url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
    url = url + "/providers/";
    url = url + "Microsoft.Sql";
    url = url + "/servers/";
    url = url + URLEncoder.encode(serverName, "UTF-8");
    url = url + "/databases/";
    url = url + URLEncoder.encode(databaseName, "UTF-8");
    url = url + "/usages";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2014-04-01");
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        DatabaseMetricListResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new DatabaseMetricListResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode valueArray = responseDoc.get("value");
                if (valueArray != null && valueArray instanceof NullNode == false) {
                    for (JsonNode valueValue : ((ArrayNode) valueArray)) {
                        DatabaseMetric databaseMetricInstance = new DatabaseMetric();
                        result.getMetrics().add(databaseMetricInstance);

                        JsonNode resourceNameValue = valueValue.get("resourceName");
                        if (resourceNameValue != null && resourceNameValue instanceof NullNode == false) {
                            String resourceNameInstance;
                            resourceNameInstance = resourceNameValue.getTextValue();
                            databaseMetricInstance.setResourceName(resourceNameInstance);
                        }

                        JsonNode displayNameValue = valueValue.get("displayName");
                        if (displayNameValue != null && displayNameValue instanceof NullNode == false) {
                            String displayNameInstance;
                            displayNameInstance = displayNameValue.getTextValue();
                            databaseMetricInstance.setDisplayName(displayNameInstance);
                        }

                        JsonNode currentValueValue = valueValue.get("currentValue");
                        if (currentValueValue != null && currentValueValue instanceof NullNode == false) {
                            double currentValueInstance;
                            currentValueInstance = currentValueValue.getDoubleValue();
                            databaseMetricInstance.setCurrentValue(currentValueInstance);
                        }

                        JsonNode limitValue = valueValue.get("limit");
                        if (limitValue != null && limitValue instanceof NullNode == false) {
                            double limitInstance;
                            limitInstance = limitValue.getDoubleValue();
                            databaseMetricInstance.setLimit(limitInstance);
                        }

                        JsonNode unitValue = valueValue.get("unit");
                        if (unitValue != null && unitValue instanceof NullNode == false) {
                            String unitInstance;
                            unitInstance = unitValue.getTextValue();
                            databaseMetricInstance.setUnit(unitInstance);
                        }

                        JsonNode nextResetTimeValue = valueValue.get("nextResetTime");
                        if (nextResetTimeValue != null && nextResetTimeValue instanceof NullNode == false) {
                            Calendar nextResetTimeInstance;
                            nextResetTimeInstance = DatatypeConverter
                                    .parseDateTime(nextResetTimeValue.getTextValue());
                            databaseMetricInstance.setNextResetTime(nextResetTimeInstance);
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.azure.management.compute.VirtualMachineOperationsImpl.java

/**
* Gets the next page of Virtual Machines. NextLink is obtained by making a
* ListAll() callwhich fetches the first page of Virtual Machines and a
* link to fetch the next page.//from   ww w  .ja  v  a2s .co m
*
* @param nextLink Required. NextLink from the previous successful call to
* ListVirtualMachines operation.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The List Virtual Machine operation response.
*/
@Override
public VirtualMachineListResponse listNext(String nextLink)
        throws IOException, ServiceException, URISyntaxException {
    // Validate
    if (nextLink == null) {
        throw new NullPointerException("nextLink");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("nextLink", nextLink);
        CloudTracing.enter(invocationId, this, "listNextAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + nextLink;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("Content-Type", "application/json; charset=utf-8");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        VirtualMachineListResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new VirtualMachineListResponse();
            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode valueArray = responseDoc.get("value");
                if (valueArray != null && valueArray instanceof NullNode == false) {
                    for (JsonNode valueValue : ((ArrayNode) valueArray)) {
                        VirtualMachine virtualMachineJsonInstance = new VirtualMachine();
                        result.getVirtualMachines().add(virtualMachineJsonInstance);

                        JsonNode planValue = valueValue.get("plan");
                        if (planValue != null && planValue instanceof NullNode == false) {
                            Plan planInstance = new Plan();
                            virtualMachineJsonInstance.setPlan(planInstance);

                            JsonNode nameValue = planValue.get("name");
                            if (nameValue != null && nameValue instanceof NullNode == false) {
                                String nameInstance;
                                nameInstance = nameValue.getTextValue();
                                planInstance.setName(nameInstance);
                            }

                            JsonNode publisherValue = planValue.get("publisher");
                            if (publisherValue != null && publisherValue instanceof NullNode == false) {
                                String publisherInstance;
                                publisherInstance = publisherValue.getTextValue();
                                planInstance.setPublisher(publisherInstance);
                            }

                            JsonNode productValue = planValue.get("product");
                            if (productValue != null && productValue instanceof NullNode == false) {
                                String productInstance;
                                productInstance = productValue.getTextValue();
                                planInstance.setProduct(productInstance);
                            }

                            JsonNode promotionCodeValue = planValue.get("promotionCode");
                            if (promotionCodeValue != null && promotionCodeValue instanceof NullNode == false) {
                                String promotionCodeInstance;
                                promotionCodeInstance = promotionCodeValue.getTextValue();
                                planInstance.setPromotionCode(promotionCodeInstance);
                            }
                        }

                        JsonNode propertiesValue = valueValue.get("properties");
                        if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
                            JsonNode hardwareProfileValue = propertiesValue.get("hardwareProfile");
                            if (hardwareProfileValue != null
                                    && hardwareProfileValue instanceof NullNode == false) {
                                HardwareProfile hardwareProfileInstance = new HardwareProfile();
                                virtualMachineJsonInstance.setHardwareProfile(hardwareProfileInstance);

                                JsonNode vmSizeValue = hardwareProfileValue.get("vmSize");
                                if (vmSizeValue != null && vmSizeValue instanceof NullNode == false) {
                                    String vmSizeInstance;
                                    vmSizeInstance = vmSizeValue.getTextValue();
                                    hardwareProfileInstance.setVirtualMachineSize(vmSizeInstance);
                                }
                            }

                            JsonNode storageProfileValue = propertiesValue.get("storageProfile");
                            if (storageProfileValue != null
                                    && storageProfileValue instanceof NullNode == false) {
                                StorageProfile storageProfileInstance = new StorageProfile();
                                virtualMachineJsonInstance.setStorageProfile(storageProfileInstance);

                                JsonNode imageReferenceValue = storageProfileValue.get("imageReference");
                                if (imageReferenceValue != null
                                        && imageReferenceValue instanceof NullNode == false) {
                                    ImageReference imageReferenceInstance = new ImageReference();
                                    storageProfileInstance.setImageReference(imageReferenceInstance);

                                    JsonNode publisherValue2 = imageReferenceValue.get("publisher");
                                    if (publisherValue2 != null
                                            && publisherValue2 instanceof NullNode == false) {
                                        String publisherInstance2;
                                        publisherInstance2 = publisherValue2.getTextValue();
                                        imageReferenceInstance.setPublisher(publisherInstance2);
                                    }

                                    JsonNode offerValue = imageReferenceValue.get("offer");
                                    if (offerValue != null && offerValue instanceof NullNode == false) {
                                        String offerInstance;
                                        offerInstance = offerValue.getTextValue();
                                        imageReferenceInstance.setOffer(offerInstance);
                                    }

                                    JsonNode skuValue = imageReferenceValue.get("sku");
                                    if (skuValue != null && skuValue instanceof NullNode == false) {
                                        String skuInstance;
                                        skuInstance = skuValue.getTextValue();
                                        imageReferenceInstance.setSku(skuInstance);
                                    }

                                    JsonNode versionValue = imageReferenceValue.get("version");
                                    if (versionValue != null && versionValue instanceof NullNode == false) {
                                        String versionInstance;
                                        versionInstance = versionValue.getTextValue();
                                        imageReferenceInstance.setVersion(versionInstance);
                                    }
                                }

                                JsonNode osDiskValue = storageProfileValue.get("osDisk");
                                if (osDiskValue != null && osDiskValue instanceof NullNode == false) {
                                    OSDisk osDiskInstance = new OSDisk();
                                    storageProfileInstance.setOSDisk(osDiskInstance);

                                    JsonNode osTypeValue = osDiskValue.get("osType");
                                    if (osTypeValue != null && osTypeValue instanceof NullNode == false) {
                                        String osTypeInstance;
                                        osTypeInstance = osTypeValue.getTextValue();
                                        osDiskInstance.setOperatingSystemType(osTypeInstance);
                                    }

                                    JsonNode nameValue2 = osDiskValue.get("name");
                                    if (nameValue2 != null && nameValue2 instanceof NullNode == false) {
                                        String nameInstance2;
                                        nameInstance2 = nameValue2.getTextValue();
                                        osDiskInstance.setName(nameInstance2);
                                    }

                                    JsonNode vhdValue = osDiskValue.get("vhd");
                                    if (vhdValue != null && vhdValue instanceof NullNode == false) {
                                        VirtualHardDisk vhdInstance = new VirtualHardDisk();
                                        osDiskInstance.setVirtualHardDisk(vhdInstance);

                                        JsonNode uriValue = vhdValue.get("uri");
                                        if (uriValue != null && uriValue instanceof NullNode == false) {
                                            String uriInstance;
                                            uriInstance = uriValue.getTextValue();
                                            vhdInstance.setUri(uriInstance);
                                        }
                                    }

                                    JsonNode imageValue = osDiskValue.get("image");
                                    if (imageValue != null && imageValue instanceof NullNode == false) {
                                        VirtualHardDisk imageInstance = new VirtualHardDisk();
                                        osDiskInstance.setSourceImage(imageInstance);

                                        JsonNode uriValue2 = imageValue.get("uri");
                                        if (uriValue2 != null && uriValue2 instanceof NullNode == false) {
                                            String uriInstance2;
                                            uriInstance2 = uriValue2.getTextValue();
                                            imageInstance.setUri(uriInstance2);
                                        }
                                    }

                                    JsonNode cachingValue = osDiskValue.get("caching");
                                    if (cachingValue != null && cachingValue instanceof NullNode == false) {
                                        String cachingInstance;
                                        cachingInstance = cachingValue.getTextValue();
                                        osDiskInstance.setCaching(cachingInstance);
                                    }

                                    JsonNode createOptionValue = osDiskValue.get("createOption");
                                    if (createOptionValue != null
                                            && createOptionValue instanceof NullNode == false) {
                                        String createOptionInstance;
                                        createOptionInstance = createOptionValue.getTextValue();
                                        osDiskInstance.setCreateOption(createOptionInstance);
                                    }

                                    JsonNode diskSizeGBValue = osDiskValue.get("diskSizeGB");
                                    if (diskSizeGBValue != null
                                            && diskSizeGBValue instanceof NullNode == false) {
                                        int diskSizeGBInstance;
                                        diskSizeGBInstance = diskSizeGBValue.getIntValue();
                                        osDiskInstance.setDiskSizeGB(diskSizeGBInstance);
                                    }
                                }

                                JsonNode dataDisksArray = storageProfileValue.get("dataDisks");
                                if (dataDisksArray != null && dataDisksArray instanceof NullNode == false) {
                                    for (JsonNode dataDisksValue : ((ArrayNode) dataDisksArray)) {
                                        DataDisk dataDiskInstance = new DataDisk();
                                        storageProfileInstance.getDataDisks().add(dataDiskInstance);

                                        JsonNode lunValue = dataDisksValue.get("lun");
                                        if (lunValue != null && lunValue instanceof NullNode == false) {
                                            int lunInstance;
                                            lunInstance = lunValue.getIntValue();
                                            dataDiskInstance.setLun(lunInstance);
                                        }

                                        JsonNode nameValue3 = dataDisksValue.get("name");
                                        if (nameValue3 != null && nameValue3 instanceof NullNode == false) {
                                            String nameInstance3;
                                            nameInstance3 = nameValue3.getTextValue();
                                            dataDiskInstance.setName(nameInstance3);
                                        }

                                        JsonNode vhdValue2 = dataDisksValue.get("vhd");
                                        if (vhdValue2 != null && vhdValue2 instanceof NullNode == false) {
                                            VirtualHardDisk vhdInstance2 = new VirtualHardDisk();
                                            dataDiskInstance.setVirtualHardDisk(vhdInstance2);

                                            JsonNode uriValue3 = vhdValue2.get("uri");
                                            if (uriValue3 != null && uriValue3 instanceof NullNode == false) {
                                                String uriInstance3;
                                                uriInstance3 = uriValue3.getTextValue();
                                                vhdInstance2.setUri(uriInstance3);
                                            }
                                        }

                                        JsonNode imageValue2 = dataDisksValue.get("image");
                                        if (imageValue2 != null && imageValue2 instanceof NullNode == false) {
                                            VirtualHardDisk imageInstance2 = new VirtualHardDisk();
                                            dataDiskInstance.setSourceImage(imageInstance2);

                                            JsonNode uriValue4 = imageValue2.get("uri");
                                            if (uriValue4 != null && uriValue4 instanceof NullNode == false) {
                                                String uriInstance4;
                                                uriInstance4 = uriValue4.getTextValue();
                                                imageInstance2.setUri(uriInstance4);
                                            }
                                        }

                                        JsonNode cachingValue2 = dataDisksValue.get("caching");
                                        if (cachingValue2 != null
                                                && cachingValue2 instanceof NullNode == false) {
                                            String cachingInstance2;
                                            cachingInstance2 = cachingValue2.getTextValue();
                                            dataDiskInstance.setCaching(cachingInstance2);
                                        }

                                        JsonNode createOptionValue2 = dataDisksValue.get("createOption");
                                        if (createOptionValue2 != null
                                                && createOptionValue2 instanceof NullNode == false) {
                                            String createOptionInstance2;
                                            createOptionInstance2 = createOptionValue2.getTextValue();
                                            dataDiskInstance.setCreateOption(createOptionInstance2);
                                        }

                                        JsonNode diskSizeGBValue2 = dataDisksValue.get("diskSizeGB");
                                        if (diskSizeGBValue2 != null
                                                && diskSizeGBValue2 instanceof NullNode == false) {
                                            int diskSizeGBInstance2;
                                            diskSizeGBInstance2 = diskSizeGBValue2.getIntValue();
                                            dataDiskInstance.setDiskSizeGB(diskSizeGBInstance2);
                                        }
                                    }
                                }
                            }

                            JsonNode osProfileValue = propertiesValue.get("osProfile");
                            if (osProfileValue != null && osProfileValue instanceof NullNode == false) {
                                OSProfile osProfileInstance = new OSProfile();
                                virtualMachineJsonInstance.setOSProfile(osProfileInstance);

                                JsonNode computerNameValue = osProfileValue.get("computerName");
                                if (computerNameValue != null
                                        && computerNameValue instanceof NullNode == false) {
                                    String computerNameInstance;
                                    computerNameInstance = computerNameValue.getTextValue();
                                    osProfileInstance.setComputerName(computerNameInstance);
                                }

                                JsonNode adminUsernameValue = osProfileValue.get("adminUsername");
                                if (adminUsernameValue != null
                                        && adminUsernameValue instanceof NullNode == false) {
                                    String adminUsernameInstance;
                                    adminUsernameInstance = adminUsernameValue.getTextValue();
                                    osProfileInstance.setAdminUsername(adminUsernameInstance);
                                }

                                JsonNode adminPasswordValue = osProfileValue.get("adminPassword");
                                if (adminPasswordValue != null
                                        && adminPasswordValue instanceof NullNode == false) {
                                    String adminPasswordInstance;
                                    adminPasswordInstance = adminPasswordValue.getTextValue();
                                    osProfileInstance.setAdminPassword(adminPasswordInstance);
                                }

                                JsonNode customDataValue = osProfileValue.get("customData");
                                if (customDataValue != null && customDataValue instanceof NullNode == false) {
                                    String customDataInstance;
                                    customDataInstance = customDataValue.getTextValue();
                                    osProfileInstance.setCustomData(customDataInstance);
                                }

                                JsonNode windowsConfigurationValue = osProfileValue.get("windowsConfiguration");
                                if (windowsConfigurationValue != null
                                        && windowsConfigurationValue instanceof NullNode == false) {
                                    WindowsConfiguration windowsConfigurationInstance = new WindowsConfiguration();
                                    osProfileInstance.setWindowsConfiguration(windowsConfigurationInstance);

                                    JsonNode provisionVMAgentValue = windowsConfigurationValue
                                            .get("provisionVMAgent");
                                    if (provisionVMAgentValue != null
                                            && provisionVMAgentValue instanceof NullNode == false) {
                                        boolean provisionVMAgentInstance;
                                        provisionVMAgentInstance = provisionVMAgentValue.getBooleanValue();
                                        windowsConfigurationInstance
                                                .setProvisionVMAgent(provisionVMAgentInstance);
                                    }

                                    JsonNode enableAutomaticUpdatesValue = windowsConfigurationValue
                                            .get("enableAutomaticUpdates");
                                    if (enableAutomaticUpdatesValue != null
                                            && enableAutomaticUpdatesValue instanceof NullNode == false) {
                                        boolean enableAutomaticUpdatesInstance;
                                        enableAutomaticUpdatesInstance = enableAutomaticUpdatesValue
                                                .getBooleanValue();
                                        windowsConfigurationInstance
                                                .setEnableAutomaticUpdates(enableAutomaticUpdatesInstance);
                                    }

                                    JsonNode timeZoneValue = windowsConfigurationValue.get("timeZone");
                                    if (timeZoneValue != null && timeZoneValue instanceof NullNode == false) {
                                        String timeZoneInstance;
                                        timeZoneInstance = timeZoneValue.getTextValue();
                                        windowsConfigurationInstance.setTimeZone(timeZoneInstance);
                                    }

                                    JsonNode additionalUnattendContentArray = windowsConfigurationValue
                                            .get("additionalUnattendContent");
                                    if (additionalUnattendContentArray != null
                                            && additionalUnattendContentArray instanceof NullNode == false) {
                                        for (JsonNode additionalUnattendContentValue : ((ArrayNode) additionalUnattendContentArray)) {
                                            AdditionalUnattendContent additionalUnattendContentInstance = new AdditionalUnattendContent();
                                            windowsConfigurationInstance.getAdditionalUnattendContents()
                                                    .add(additionalUnattendContentInstance);

                                            JsonNode passNameValue = additionalUnattendContentValue
                                                    .get("passName");
                                            if (passNameValue != null
                                                    && passNameValue instanceof NullNode == false) {
                                                String passNameInstance;
                                                passNameInstance = passNameValue.getTextValue();
                                                additionalUnattendContentInstance.setPassName(passNameInstance);
                                            }

                                            JsonNode componentNameValue = additionalUnattendContentValue
                                                    .get("componentName");
                                            if (componentNameValue != null
                                                    && componentNameValue instanceof NullNode == false) {
                                                String componentNameInstance;
                                                componentNameInstance = componentNameValue.getTextValue();
                                                additionalUnattendContentInstance
                                                        .setComponentName(componentNameInstance);
                                            }

                                            JsonNode settingNameValue = additionalUnattendContentValue
                                                    .get("settingName");
                                            if (settingNameValue != null
                                                    && settingNameValue instanceof NullNode == false) {
                                                String settingNameInstance;
                                                settingNameInstance = settingNameValue.getTextValue();
                                                additionalUnattendContentInstance
                                                        .setSettingName(settingNameInstance);
                                            }

                                            JsonNode contentValue = additionalUnattendContentValue
                                                    .get("content");
                                            if (contentValue != null
                                                    && contentValue instanceof NullNode == false) {
                                                String contentInstance;
                                                contentInstance = contentValue.getTextValue();
                                                additionalUnattendContentInstance.setContent(contentInstance);
                                            }
                                        }
                                    }

                                    JsonNode winRMValue = windowsConfigurationValue.get("winRM");
                                    if (winRMValue != null && winRMValue instanceof NullNode == false) {
                                        WinRMConfiguration winRMInstance = new WinRMConfiguration();
                                        windowsConfigurationInstance.setWinRMConfiguration(winRMInstance);

                                        JsonNode listenersArray = winRMValue.get("listeners");
                                        if (listenersArray != null
                                                && listenersArray instanceof NullNode == false) {
                                            for (JsonNode listenersValue : ((ArrayNode) listenersArray)) {
                                                WinRMListener winRMListenerInstance = new WinRMListener();
                                                winRMInstance.getListeners().add(winRMListenerInstance);

                                                JsonNode protocolValue = listenersValue.get("protocol");
                                                if (protocolValue != null
                                                        && protocolValue instanceof NullNode == false) {
                                                    String protocolInstance;
                                                    protocolInstance = protocolValue.getTextValue();
                                                    winRMListenerInstance.setProtocol(protocolInstance);
                                                }

                                                JsonNode certificateUrlValue = listenersValue
                                                        .get("certificateUrl");
                                                if (certificateUrlValue != null
                                                        && certificateUrlValue instanceof NullNode == false) {
                                                    URI certificateUrlInstance;
                                                    certificateUrlInstance = new URI(
                                                            certificateUrlValue.getTextValue());
                                                    winRMListenerInstance
                                                            .setCertificateUrl(certificateUrlInstance);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode linuxConfigurationValue = osProfileValue.get("linuxConfiguration");
                                if (linuxConfigurationValue != null
                                        && linuxConfigurationValue instanceof NullNode == false) {
                                    LinuxConfiguration linuxConfigurationInstance = new LinuxConfiguration();
                                    osProfileInstance.setLinuxConfiguration(linuxConfigurationInstance);

                                    JsonNode disablePasswordAuthenticationValue = linuxConfigurationValue
                                            .get("disablePasswordAuthentication");
                                    if (disablePasswordAuthenticationValue != null
                                            && disablePasswordAuthenticationValue instanceof NullNode == false) {
                                        boolean disablePasswordAuthenticationInstance;
                                        disablePasswordAuthenticationInstance = disablePasswordAuthenticationValue
                                                .getBooleanValue();
                                        linuxConfigurationInstance.setDisablePasswordAuthentication(
                                                disablePasswordAuthenticationInstance);
                                    }

                                    JsonNode sshValue = linuxConfigurationValue.get("ssh");
                                    if (sshValue != null && sshValue instanceof NullNode == false) {
                                        SshConfiguration sshInstance = new SshConfiguration();
                                        linuxConfigurationInstance.setSshConfiguration(sshInstance);

                                        JsonNode publicKeysArray = sshValue.get("publicKeys");
                                        if (publicKeysArray != null
                                                && publicKeysArray instanceof NullNode == false) {
                                            for (JsonNode publicKeysValue : ((ArrayNode) publicKeysArray)) {
                                                SshPublicKey sshPublicKeyInstance = new SshPublicKey();
                                                sshInstance.getPublicKeys().add(sshPublicKeyInstance);

                                                JsonNode pathValue = publicKeysValue.get("path");
                                                if (pathValue != null
                                                        && pathValue instanceof NullNode == false) {
                                                    String pathInstance;
                                                    pathInstance = pathValue.getTextValue();
                                                    sshPublicKeyInstance.setPath(pathInstance);
                                                }

                                                JsonNode keyDataValue = publicKeysValue.get("keyData");
                                                if (keyDataValue != null
                                                        && keyDataValue instanceof NullNode == false) {
                                                    String keyDataInstance;
                                                    keyDataInstance = keyDataValue.getTextValue();
                                                    sshPublicKeyInstance.setKeyData(keyDataInstance);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode secretsArray = osProfileValue.get("secrets");
                                if (secretsArray != null && secretsArray instanceof NullNode == false) {
                                    for (JsonNode secretsValue : ((ArrayNode) secretsArray)) {
                                        VaultSecretGroup vaultSecretGroupInstance = new VaultSecretGroup();
                                        osProfileInstance.getSecrets().add(vaultSecretGroupInstance);

                                        JsonNode sourceVaultValue = secretsValue.get("sourceVault");
                                        if (sourceVaultValue != null
                                                && sourceVaultValue instanceof NullNode == false) {
                                            SourceVaultReference sourceVaultInstance = new SourceVaultReference();
                                            vaultSecretGroupInstance.setSourceVault(sourceVaultInstance);

                                            JsonNode idValue = sourceVaultValue.get("id");
                                            if (idValue != null && idValue instanceof NullNode == false) {
                                                String idInstance;
                                                idInstance = idValue.getTextValue();
                                                sourceVaultInstance.setReferenceUri(idInstance);
                                            }
                                        }

                                        JsonNode vaultCertificatesArray = secretsValue.get("vaultCertificates");
                                        if (vaultCertificatesArray != null
                                                && vaultCertificatesArray instanceof NullNode == false) {
                                            for (JsonNode vaultCertificatesValue : ((ArrayNode) vaultCertificatesArray)) {
                                                VaultCertificate vaultCertificateInstance = new VaultCertificate();
                                                vaultSecretGroupInstance.getVaultCertificates()
                                                        .add(vaultCertificateInstance);

                                                JsonNode certificateUrlValue2 = vaultCertificatesValue
                                                        .get("certificateUrl");
                                                if (certificateUrlValue2 != null
                                                        && certificateUrlValue2 instanceof NullNode == false) {
                                                    String certificateUrlInstance2;
                                                    certificateUrlInstance2 = certificateUrlValue2
                                                            .getTextValue();
                                                    vaultCertificateInstance
                                                            .setCertificateUrl(certificateUrlInstance2);
                                                }

                                                JsonNode certificateStoreValue = vaultCertificatesValue
                                                        .get("certificateStore");
                                                if (certificateStoreValue != null
                                                        && certificateStoreValue instanceof NullNode == false) {
                                                    String certificateStoreInstance;
                                                    certificateStoreInstance = certificateStoreValue
                                                            .getTextValue();
                                                    vaultCertificateInstance
                                                            .setCertificateStore(certificateStoreInstance);
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            JsonNode networkProfileValue = propertiesValue.get("networkProfile");
                            if (networkProfileValue != null
                                    && networkProfileValue instanceof NullNode == false) {
                                NetworkProfile networkProfileInstance = new NetworkProfile();
                                virtualMachineJsonInstance.setNetworkProfile(networkProfileInstance);

                                JsonNode networkInterfacesArray = networkProfileValue.get("networkInterfaces");
                                if (networkInterfacesArray != null
                                        && networkInterfacesArray instanceof NullNode == false) {
                                    for (JsonNode networkInterfacesValue : ((ArrayNode) networkInterfacesArray)) {
                                        NetworkInterfaceReference networkInterfaceReferenceJsonInstance = new NetworkInterfaceReference();
                                        networkProfileInstance.getNetworkInterfaces()
                                                .add(networkInterfaceReferenceJsonInstance);

                                        JsonNode propertiesValue2 = networkInterfacesValue.get("properties");
                                        if (propertiesValue2 != null
                                                && propertiesValue2 instanceof NullNode == false) {
                                            JsonNode primaryValue = propertiesValue2.get("primary");
                                            if (primaryValue != null
                                                    && primaryValue instanceof NullNode == false) {
                                                boolean primaryInstance;
                                                primaryInstance = primaryValue.getBooleanValue();
                                                networkInterfaceReferenceJsonInstance
                                                        .setPrimary(primaryInstance);
                                            }
                                        }

                                        JsonNode idValue2 = networkInterfacesValue.get("id");
                                        if (idValue2 != null && idValue2 instanceof NullNode == false) {
                                            String idInstance2;
                                            idInstance2 = idValue2.getTextValue();
                                            networkInterfaceReferenceJsonInstance.setReferenceUri(idInstance2);
                                        }
                                    }
                                }
                            }

                            JsonNode diagnosticsProfileValue = propertiesValue.get("diagnosticsProfile");
                            if (diagnosticsProfileValue != null
                                    && diagnosticsProfileValue instanceof NullNode == false) {
                                DiagnosticsProfile diagnosticsProfileInstance = new DiagnosticsProfile();
                                virtualMachineJsonInstance.setDiagnosticsProfile(diagnosticsProfileInstance);

                                JsonNode bootDiagnosticsValue = diagnosticsProfileValue.get("bootDiagnostics");
                                if (bootDiagnosticsValue != null
                                        && bootDiagnosticsValue instanceof NullNode == false) {
                                    BootDiagnostics bootDiagnosticsInstance = new BootDiagnostics();
                                    diagnosticsProfileInstance.setBootDiagnostics(bootDiagnosticsInstance);

                                    JsonNode enabledValue = bootDiagnosticsValue.get("enabled");
                                    if (enabledValue != null && enabledValue instanceof NullNode == false) {
                                        boolean enabledInstance;
                                        enabledInstance = enabledValue.getBooleanValue();
                                        bootDiagnosticsInstance.setEnabled(enabledInstance);
                                    }

                                    JsonNode storageUriValue = bootDiagnosticsValue.get("storageUri");
                                    if (storageUriValue != null
                                            && storageUriValue instanceof NullNode == false) {
                                        URI storageUriInstance;
                                        storageUriInstance = new URI(storageUriValue.getTextValue());
                                        bootDiagnosticsInstance.setStorageUri(storageUriInstance);
                                    }
                                }
                            }

                            JsonNode availabilitySetValue = propertiesValue.get("availabilitySet");
                            if (availabilitySetValue != null
                                    && availabilitySetValue instanceof NullNode == false) {
                                AvailabilitySetReference availabilitySetInstance = new AvailabilitySetReference();
                                virtualMachineJsonInstance.setAvailabilitySetReference(availabilitySetInstance);

                                JsonNode idValue3 = availabilitySetValue.get("id");
                                if (idValue3 != null && idValue3 instanceof NullNode == false) {
                                    String idInstance3;
                                    idInstance3 = idValue3.getTextValue();
                                    availabilitySetInstance.setReferenceUri(idInstance3);
                                }
                            }

                            JsonNode provisioningStateValue = propertiesValue.get("provisioningState");
                            if (provisioningStateValue != null
                                    && provisioningStateValue instanceof NullNode == false) {
                                String provisioningStateInstance;
                                provisioningStateInstance = provisioningStateValue.getTextValue();
                                virtualMachineJsonInstance.setProvisioningState(provisioningStateInstance);
                            }

                            JsonNode instanceViewValue = propertiesValue.get("instanceView");
                            if (instanceViewValue != null && instanceViewValue instanceof NullNode == false) {
                                VirtualMachineInstanceView instanceViewInstance = new VirtualMachineInstanceView();
                                virtualMachineJsonInstance.setInstanceView(instanceViewInstance);

                                JsonNode platformUpdateDomainValue = instanceViewValue
                                        .get("platformUpdateDomain");
                                if (platformUpdateDomainValue != null
                                        && platformUpdateDomainValue instanceof NullNode == false) {
                                    int platformUpdateDomainInstance;
                                    platformUpdateDomainInstance = platformUpdateDomainValue.getIntValue();
                                    instanceViewInstance.setPlatformUpdateDomain(platformUpdateDomainInstance);
                                }

                                JsonNode platformFaultDomainValue = instanceViewValue
                                        .get("platformFaultDomain");
                                if (platformFaultDomainValue != null
                                        && platformFaultDomainValue instanceof NullNode == false) {
                                    int platformFaultDomainInstance;
                                    platformFaultDomainInstance = platformFaultDomainValue.getIntValue();
                                    instanceViewInstance.setPlatformFaultDomain(platformFaultDomainInstance);
                                }

                                JsonNode rdpThumbPrintValue = instanceViewValue.get("rdpThumbPrint");
                                if (rdpThumbPrintValue != null
                                        && rdpThumbPrintValue instanceof NullNode == false) {
                                    String rdpThumbPrintInstance;
                                    rdpThumbPrintInstance = rdpThumbPrintValue.getTextValue();
                                    instanceViewInstance.setRemoteDesktopThumbprint(rdpThumbPrintInstance);
                                }

                                JsonNode vmAgentValue = instanceViewValue.get("vmAgent");
                                if (vmAgentValue != null && vmAgentValue instanceof NullNode == false) {
                                    VirtualMachineAgentInstanceView vmAgentInstance = new VirtualMachineAgentInstanceView();
                                    instanceViewInstance.setVMAgent(vmAgentInstance);

                                    JsonNode vmAgentVersionValue = vmAgentValue.get("vmAgentVersion");
                                    if (vmAgentVersionValue != null
                                            && vmAgentVersionValue instanceof NullNode == false) {
                                        String vmAgentVersionInstance;
                                        vmAgentVersionInstance = vmAgentVersionValue.getTextValue();
                                        vmAgentInstance.setVMAgentVersion(vmAgentVersionInstance);
                                    }

                                    JsonNode extensionHandlersArray = vmAgentValue.get("extensionHandlers");
                                    if (extensionHandlersArray != null
                                            && extensionHandlersArray instanceof NullNode == false) {
                                        for (JsonNode extensionHandlersValue : ((ArrayNode) extensionHandlersArray)) {
                                            VirtualMachineExtensionHandlerInstanceView virtualMachineExtensionHandlerInstanceViewInstance = new VirtualMachineExtensionHandlerInstanceView();
                                            vmAgentInstance.getExtensionHandlers()
                                                    .add(virtualMachineExtensionHandlerInstanceViewInstance);

                                            JsonNode typeValue = extensionHandlersValue.get("type");
                                            if (typeValue != null && typeValue instanceof NullNode == false) {
                                                String typeInstance;
                                                typeInstance = typeValue.getTextValue();
                                                virtualMachineExtensionHandlerInstanceViewInstance
                                                        .setType(typeInstance);
                                            }

                                            JsonNode typeHandlerVersionValue = extensionHandlersValue
                                                    .get("typeHandlerVersion");
                                            if (typeHandlerVersionValue != null
                                                    && typeHandlerVersionValue instanceof NullNode == false) {
                                                String typeHandlerVersionInstance;
                                                typeHandlerVersionInstance = typeHandlerVersionValue
                                                        .getTextValue();
                                                virtualMachineExtensionHandlerInstanceViewInstance
                                                        .setTypeHandlerVersion(typeHandlerVersionInstance);
                                            }

                                            JsonNode statusValue = extensionHandlersValue.get("status");
                                            if (statusValue != null
                                                    && statusValue instanceof NullNode == false) {
                                                InstanceViewStatus statusInstance = new InstanceViewStatus();
                                                virtualMachineExtensionHandlerInstanceViewInstance
                                                        .setStatus(statusInstance);

                                                JsonNode codeValue = statusValue.get("code");
                                                if (codeValue != null
                                                        && codeValue instanceof NullNode == false) {
                                                    String codeInstance;
                                                    codeInstance = codeValue.getTextValue();
                                                    statusInstance.setCode(codeInstance);
                                                }

                                                JsonNode levelValue = statusValue.get("level");
                                                if (levelValue != null
                                                        && levelValue instanceof NullNode == false) {
                                                    String levelInstance;
                                                    levelInstance = levelValue.getTextValue();
                                                    statusInstance.setLevel(levelInstance);
                                                }

                                                JsonNode displayStatusValue = statusValue.get("displayStatus");
                                                if (displayStatusValue != null
                                                        && displayStatusValue instanceof NullNode == false) {
                                                    String displayStatusInstance;
                                                    displayStatusInstance = displayStatusValue.getTextValue();
                                                    statusInstance.setDisplayStatus(displayStatusInstance);
                                                }

                                                JsonNode messageValue = statusValue.get("message");
                                                if (messageValue != null
                                                        && messageValue instanceof NullNode == false) {
                                                    String messageInstance;
                                                    messageInstance = messageValue.getTextValue();
                                                    statusInstance.setMessage(messageInstance);
                                                }

                                                JsonNode timeValue = statusValue.get("time");
                                                if (timeValue != null
                                                        && timeValue instanceof NullNode == false) {
                                                    Calendar timeInstance;
                                                    timeInstance = DatatypeConverter
                                                            .parseDateTime(timeValue.getTextValue());
                                                    statusInstance.setTime(timeInstance);
                                                }
                                            }
                                        }
                                    }

                                    JsonNode statusesArray = vmAgentValue.get("statuses");
                                    if (statusesArray != null && statusesArray instanceof NullNode == false) {
                                        for (JsonNode statusesValue : ((ArrayNode) statusesArray)) {
                                            InstanceViewStatus instanceViewStatusInstance = new InstanceViewStatus();
                                            vmAgentInstance.getStatuses().add(instanceViewStatusInstance);

                                            JsonNode codeValue2 = statusesValue.get("code");
                                            if (codeValue2 != null && codeValue2 instanceof NullNode == false) {
                                                String codeInstance2;
                                                codeInstance2 = codeValue2.getTextValue();
                                                instanceViewStatusInstance.setCode(codeInstance2);
                                            }

                                            JsonNode levelValue2 = statusesValue.get("level");
                                            if (levelValue2 != null
                                                    && levelValue2 instanceof NullNode == false) {
                                                String levelInstance2;
                                                levelInstance2 = levelValue2.getTextValue();
                                                instanceViewStatusInstance.setLevel(levelInstance2);
                                            }

                                            JsonNode displayStatusValue2 = statusesValue.get("displayStatus");
                                            if (displayStatusValue2 != null
                                                    && displayStatusValue2 instanceof NullNode == false) {
                                                String displayStatusInstance2;
                                                displayStatusInstance2 = displayStatusValue2.getTextValue();
                                                instanceViewStatusInstance
                                                        .setDisplayStatus(displayStatusInstance2);
                                            }

                                            JsonNode messageValue2 = statusesValue.get("message");
                                            if (messageValue2 != null
                                                    && messageValue2 instanceof NullNode == false) {
                                                String messageInstance2;
                                                messageInstance2 = messageValue2.getTextValue();
                                                instanceViewStatusInstance.setMessage(messageInstance2);
                                            }

                                            JsonNode timeValue2 = statusesValue.get("time");
                                            if (timeValue2 != null && timeValue2 instanceof NullNode == false) {
                                                Calendar timeInstance2;
                                                timeInstance2 = DatatypeConverter
                                                        .parseDateTime(timeValue2.getTextValue());
                                                instanceViewStatusInstance.setTime(timeInstance2);
                                            }
                                        }
                                    }
                                }

                                JsonNode disksArray = instanceViewValue.get("disks");
                                if (disksArray != null && disksArray instanceof NullNode == false) {
                                    for (JsonNode disksValue : ((ArrayNode) disksArray)) {
                                        DiskInstanceView diskInstanceViewInstance = new DiskInstanceView();
                                        instanceViewInstance.getDisks().add(diskInstanceViewInstance);

                                        JsonNode nameValue4 = disksValue.get("name");
                                        if (nameValue4 != null && nameValue4 instanceof NullNode == false) {
                                            String nameInstance4;
                                            nameInstance4 = nameValue4.getTextValue();
                                            diskInstanceViewInstance.setName(nameInstance4);
                                        }

                                        JsonNode statusesArray2 = disksValue.get("statuses");
                                        if (statusesArray2 != null
                                                && statusesArray2 instanceof NullNode == false) {
                                            for (JsonNode statusesValue2 : ((ArrayNode) statusesArray2)) {
                                                InstanceViewStatus instanceViewStatusInstance2 = new InstanceViewStatus();
                                                diskInstanceViewInstance.getStatuses()
                                                        .add(instanceViewStatusInstance2);

                                                JsonNode codeValue3 = statusesValue2.get("code");
                                                if (codeValue3 != null
                                                        && codeValue3 instanceof NullNode == false) {
                                                    String codeInstance3;
                                                    codeInstance3 = codeValue3.getTextValue();
                                                    instanceViewStatusInstance2.setCode(codeInstance3);
                                                }

                                                JsonNode levelValue3 = statusesValue2.get("level");
                                                if (levelValue3 != null
                                                        && levelValue3 instanceof NullNode == false) {
                                                    String levelInstance3;
                                                    levelInstance3 = levelValue3.getTextValue();
                                                    instanceViewStatusInstance2.setLevel(levelInstance3);
                                                }

                                                JsonNode displayStatusValue3 = statusesValue2
                                                        .get("displayStatus");
                                                if (displayStatusValue3 != null
                                                        && displayStatusValue3 instanceof NullNode == false) {
                                                    String displayStatusInstance3;
                                                    displayStatusInstance3 = displayStatusValue3.getTextValue();
                                                    instanceViewStatusInstance2
                                                            .setDisplayStatus(displayStatusInstance3);
                                                }

                                                JsonNode messageValue3 = statusesValue2.get("message");
                                                if (messageValue3 != null
                                                        && messageValue3 instanceof NullNode == false) {
                                                    String messageInstance3;
                                                    messageInstance3 = messageValue3.getTextValue();
                                                    instanceViewStatusInstance2.setMessage(messageInstance3);
                                                }

                                                JsonNode timeValue3 = statusesValue2.get("time");
                                                if (timeValue3 != null
                                                        && timeValue3 instanceof NullNode == false) {
                                                    Calendar timeInstance3;
                                                    timeInstance3 = DatatypeConverter
                                                            .parseDateTime(timeValue3.getTextValue());
                                                    instanceViewStatusInstance2.setTime(timeInstance3);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode extensionsArray = instanceViewValue.get("extensions");
                                if (extensionsArray != null && extensionsArray instanceof NullNode == false) {
                                    for (JsonNode extensionsValue : ((ArrayNode) extensionsArray)) {
                                        VirtualMachineExtensionInstanceView virtualMachineExtensionInstanceViewInstance = new VirtualMachineExtensionInstanceView();
                                        instanceViewInstance.getExtensions()
                                                .add(virtualMachineExtensionInstanceViewInstance);

                                        JsonNode nameValue5 = extensionsValue.get("name");
                                        if (nameValue5 != null && nameValue5 instanceof NullNode == false) {
                                            String nameInstance5;
                                            nameInstance5 = nameValue5.getTextValue();
                                            virtualMachineExtensionInstanceViewInstance.setName(nameInstance5);
                                        }

                                        JsonNode typeValue2 = extensionsValue.get("type");
                                        if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
                                            String typeInstance2;
                                            typeInstance2 = typeValue2.getTextValue();
                                            virtualMachineExtensionInstanceViewInstance
                                                    .setExtensionType(typeInstance2);
                                        }

                                        JsonNode typeHandlerVersionValue2 = extensionsValue
                                                .get("typeHandlerVersion");
                                        if (typeHandlerVersionValue2 != null
                                                && typeHandlerVersionValue2 instanceof NullNode == false) {
                                            String typeHandlerVersionInstance2;
                                            typeHandlerVersionInstance2 = typeHandlerVersionValue2
                                                    .getTextValue();
                                            virtualMachineExtensionInstanceViewInstance
                                                    .setTypeHandlerVersion(typeHandlerVersionInstance2);
                                        }

                                        JsonNode substatusesArray = extensionsValue.get("substatuses");
                                        if (substatusesArray != null
                                                && substatusesArray instanceof NullNode == false) {
                                            for (JsonNode substatusesValue : ((ArrayNode) substatusesArray)) {
                                                InstanceViewStatus instanceViewStatusInstance3 = new InstanceViewStatus();
                                                virtualMachineExtensionInstanceViewInstance.getSubStatuses()
                                                        .add(instanceViewStatusInstance3);

                                                JsonNode codeValue4 = substatusesValue.get("code");
                                                if (codeValue4 != null
                                                        && codeValue4 instanceof NullNode == false) {
                                                    String codeInstance4;
                                                    codeInstance4 = codeValue4.getTextValue();
                                                    instanceViewStatusInstance3.setCode(codeInstance4);
                                                }

                                                JsonNode levelValue4 = substatusesValue.get("level");
                                                if (levelValue4 != null
                                                        && levelValue4 instanceof NullNode == false) {
                                                    String levelInstance4;
                                                    levelInstance4 = levelValue4.getTextValue();
                                                    instanceViewStatusInstance3.setLevel(levelInstance4);
                                                }

                                                JsonNode displayStatusValue4 = substatusesValue
                                                        .get("displayStatus");
                                                if (displayStatusValue4 != null
                                                        && displayStatusValue4 instanceof NullNode == false) {
                                                    String displayStatusInstance4;
                                                    displayStatusInstance4 = displayStatusValue4.getTextValue();
                                                    instanceViewStatusInstance3
                                                            .setDisplayStatus(displayStatusInstance4);
                                                }

                                                JsonNode messageValue4 = substatusesValue.get("message");
                                                if (messageValue4 != null
                                                        && messageValue4 instanceof NullNode == false) {
                                                    String messageInstance4;
                                                    messageInstance4 = messageValue4.getTextValue();
                                                    instanceViewStatusInstance3.setMessage(messageInstance4);
                                                }

                                                JsonNode timeValue4 = substatusesValue.get("time");
                                                if (timeValue4 != null
                                                        && timeValue4 instanceof NullNode == false) {
                                                    Calendar timeInstance4;
                                                    timeInstance4 = DatatypeConverter
                                                            .parseDateTime(timeValue4.getTextValue());
                                                    instanceViewStatusInstance3.setTime(timeInstance4);
                                                }
                                            }
                                        }

                                        JsonNode statusesArray3 = extensionsValue.get("statuses");
                                        if (statusesArray3 != null
                                                && statusesArray3 instanceof NullNode == false) {
                                            for (JsonNode statusesValue3 : ((ArrayNode) statusesArray3)) {
                                                InstanceViewStatus instanceViewStatusInstance4 = new InstanceViewStatus();
                                                virtualMachineExtensionInstanceViewInstance.getStatuses()
                                                        .add(instanceViewStatusInstance4);

                                                JsonNode codeValue5 = statusesValue3.get("code");
                                                if (codeValue5 != null
                                                        && codeValue5 instanceof NullNode == false) {
                                                    String codeInstance5;
                                                    codeInstance5 = codeValue5.getTextValue();
                                                    instanceViewStatusInstance4.setCode(codeInstance5);
                                                }

                                                JsonNode levelValue5 = statusesValue3.get("level");
                                                if (levelValue5 != null
                                                        && levelValue5 instanceof NullNode == false) {
                                                    String levelInstance5;
                                                    levelInstance5 = levelValue5.getTextValue();
                                                    instanceViewStatusInstance4.setLevel(levelInstance5);
                                                }

                                                JsonNode displayStatusValue5 = statusesValue3
                                                        .get("displayStatus");
                                                if (displayStatusValue5 != null
                                                        && displayStatusValue5 instanceof NullNode == false) {
                                                    String displayStatusInstance5;
                                                    displayStatusInstance5 = displayStatusValue5.getTextValue();
                                                    instanceViewStatusInstance4
                                                            .setDisplayStatus(displayStatusInstance5);
                                                }

                                                JsonNode messageValue5 = statusesValue3.get("message");
                                                if (messageValue5 != null
                                                        && messageValue5 instanceof NullNode == false) {
                                                    String messageInstance5;
                                                    messageInstance5 = messageValue5.getTextValue();
                                                    instanceViewStatusInstance4.setMessage(messageInstance5);
                                                }

                                                JsonNode timeValue5 = statusesValue3.get("time");
                                                if (timeValue5 != null
                                                        && timeValue5 instanceof NullNode == false) {
                                                    Calendar timeInstance5;
                                                    timeInstance5 = DatatypeConverter
                                                            .parseDateTime(timeValue5.getTextValue());
                                                    instanceViewStatusInstance4.setTime(timeInstance5);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode bootDiagnosticsValue2 = instanceViewValue.get("bootDiagnostics");
                                if (bootDiagnosticsValue2 != null
                                        && bootDiagnosticsValue2 instanceof NullNode == false) {
                                    BootDiagnosticsInstanceView bootDiagnosticsInstance2 = new BootDiagnosticsInstanceView();
                                    instanceViewInstance.setBootDiagnostics(bootDiagnosticsInstance2);

                                    JsonNode consoleScreenshotBlobUriValue = bootDiagnosticsValue2
                                            .get("consoleScreenshotBlobUri");
                                    if (consoleScreenshotBlobUriValue != null
                                            && consoleScreenshotBlobUriValue instanceof NullNode == false) {
                                        URI consoleScreenshotBlobUriInstance;
                                        consoleScreenshotBlobUriInstance = new URI(
                                                consoleScreenshotBlobUriValue.getTextValue());
                                        bootDiagnosticsInstance2
                                                .setConsoleScreenshotBlobUri(consoleScreenshotBlobUriInstance);
                                    }

                                    JsonNode serialConsoleLogBlobUriValue = bootDiagnosticsValue2
                                            .get("serialConsoleLogBlobUri");
                                    if (serialConsoleLogBlobUriValue != null
                                            && serialConsoleLogBlobUriValue instanceof NullNode == false) {
                                        URI serialConsoleLogBlobUriInstance;
                                        serialConsoleLogBlobUriInstance = new URI(
                                                serialConsoleLogBlobUriValue.getTextValue());
                                        bootDiagnosticsInstance2
                                                .setSerialConsoleLogBlobUri(serialConsoleLogBlobUriInstance);
                                    }
                                }

                                JsonNode statusesArray4 = instanceViewValue.get("statuses");
                                if (statusesArray4 != null && statusesArray4 instanceof NullNode == false) {
                                    for (JsonNode statusesValue4 : ((ArrayNode) statusesArray4)) {
                                        InstanceViewStatus instanceViewStatusInstance5 = new InstanceViewStatus();
                                        instanceViewInstance.getStatuses().add(instanceViewStatusInstance5);

                                        JsonNode codeValue6 = statusesValue4.get("code");
                                        if (codeValue6 != null && codeValue6 instanceof NullNode == false) {
                                            String codeInstance6;
                                            codeInstance6 = codeValue6.getTextValue();
                                            instanceViewStatusInstance5.setCode(codeInstance6);
                                        }

                                        JsonNode levelValue6 = statusesValue4.get("level");
                                        if (levelValue6 != null && levelValue6 instanceof NullNode == false) {
                                            String levelInstance6;
                                            levelInstance6 = levelValue6.getTextValue();
                                            instanceViewStatusInstance5.setLevel(levelInstance6);
                                        }

                                        JsonNode displayStatusValue6 = statusesValue4.get("displayStatus");
                                        if (displayStatusValue6 != null
                                                && displayStatusValue6 instanceof NullNode == false) {
                                            String displayStatusInstance6;
                                            displayStatusInstance6 = displayStatusValue6.getTextValue();
                                            instanceViewStatusInstance5
                                                    .setDisplayStatus(displayStatusInstance6);
                                        }

                                        JsonNode messageValue6 = statusesValue4.get("message");
                                        if (messageValue6 != null
                                                && messageValue6 instanceof NullNode == false) {
                                            String messageInstance6;
                                            messageInstance6 = messageValue6.getTextValue();
                                            instanceViewStatusInstance5.setMessage(messageInstance6);
                                        }

                                        JsonNode timeValue6 = statusesValue4.get("time");
                                        if (timeValue6 != null && timeValue6 instanceof NullNode == false) {
                                            Calendar timeInstance6;
                                            timeInstance6 = DatatypeConverter
                                                    .parseDateTime(timeValue6.getTextValue());
                                            instanceViewStatusInstance5.setTime(timeInstance6);
                                        }
                                    }
                                }
                            }
                        }

                        JsonNode resourcesArray = valueValue.get("resources");
                        if (resourcesArray != null && resourcesArray instanceof NullNode == false) {
                            virtualMachineJsonInstance.setExtensions(new ArrayList<VirtualMachineExtension>());
                            for (JsonNode resourcesValue : ((ArrayNode) resourcesArray)) {
                                VirtualMachineExtension virtualMachineExtensionJsonInstance = new VirtualMachineExtension();
                                virtualMachineJsonInstance.getExtensions()
                                        .add(virtualMachineExtensionJsonInstance);

                                JsonNode propertiesValue3 = resourcesValue.get("properties");
                                if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) {
                                    JsonNode publisherValue3 = propertiesValue3.get("publisher");
                                    if (publisherValue3 != null
                                            && publisherValue3 instanceof NullNode == false) {
                                        String publisherInstance3;
                                        publisherInstance3 = publisherValue3.getTextValue();
                                        virtualMachineExtensionJsonInstance.setPublisher(publisherInstance3);
                                    }

                                    JsonNode typeValue3 = propertiesValue3.get("type");
                                    if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
                                        String typeInstance3;
                                        typeInstance3 = typeValue3.getTextValue();
                                        virtualMachineExtensionJsonInstance.setExtensionType(typeInstance3);
                                    }

                                    JsonNode typeHandlerVersionValue3 = propertiesValue3
                                            .get("typeHandlerVersion");
                                    if (typeHandlerVersionValue3 != null
                                            && typeHandlerVersionValue3 instanceof NullNode == false) {
                                        String typeHandlerVersionInstance3;
                                        typeHandlerVersionInstance3 = typeHandlerVersionValue3.getTextValue();
                                        virtualMachineExtensionJsonInstance
                                                .setTypeHandlerVersion(typeHandlerVersionInstance3);
                                    }

                                    JsonNode autoUpgradeMinorVersionValue = propertiesValue3
                                            .get("autoUpgradeMinorVersion");
                                    if (autoUpgradeMinorVersionValue != null
                                            && autoUpgradeMinorVersionValue instanceof NullNode == false) {
                                        boolean autoUpgradeMinorVersionInstance;
                                        autoUpgradeMinorVersionInstance = autoUpgradeMinorVersionValue
                                                .getBooleanValue();
                                        virtualMachineExtensionJsonInstance
                                                .setAutoUpgradeMinorVersion(autoUpgradeMinorVersionInstance);
                                    }

                                    JsonNode settingsValue = propertiesValue3.get("settings");
                                    if (settingsValue != null && settingsValue instanceof NullNode == false) {
                                        String settingsInstance;
                                        settingsInstance = settingsValue.getTextValue();
                                        virtualMachineExtensionJsonInstance.setSettings(settingsInstance);
                                    }

                                    JsonNode protectedSettingsValue = propertiesValue3.get("protectedSettings");
                                    if (protectedSettingsValue != null
                                            && protectedSettingsValue instanceof NullNode == false) {
                                        String protectedSettingsInstance;
                                        protectedSettingsInstance = protectedSettingsValue.getTextValue();
                                        virtualMachineExtensionJsonInstance
                                                .setProtectedSettings(protectedSettingsInstance);
                                    }

                                    JsonNode provisioningStateValue2 = propertiesValue3
                                            .get("provisioningState");
                                    if (provisioningStateValue2 != null
                                            && provisioningStateValue2 instanceof NullNode == false) {
                                        String provisioningStateInstance2;
                                        provisioningStateInstance2 = provisioningStateValue2.getTextValue();
                                        virtualMachineExtensionJsonInstance
                                                .setProvisioningState(provisioningStateInstance2);
                                    }

                                    JsonNode instanceViewValue2 = propertiesValue3.get("instanceView");
                                    if (instanceViewValue2 != null
                                            && instanceViewValue2 instanceof NullNode == false) {
                                        VirtualMachineExtensionInstanceView instanceViewInstance2 = new VirtualMachineExtensionInstanceView();
                                        virtualMachineExtensionJsonInstance
                                                .setInstanceView(instanceViewInstance2);

                                        JsonNode nameValue6 = instanceViewValue2.get("name");
                                        if (nameValue6 != null && nameValue6 instanceof NullNode == false) {
                                            String nameInstance6;
                                            nameInstance6 = nameValue6.getTextValue();
                                            instanceViewInstance2.setName(nameInstance6);
                                        }

                                        JsonNode typeValue4 = instanceViewValue2.get("type");
                                        if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
                                            String typeInstance4;
                                            typeInstance4 = typeValue4.getTextValue();
                                            instanceViewInstance2.setExtensionType(typeInstance4);
                                        }

                                        JsonNode typeHandlerVersionValue4 = instanceViewValue2
                                                .get("typeHandlerVersion");
                                        if (typeHandlerVersionValue4 != null
                                                && typeHandlerVersionValue4 instanceof NullNode == false) {
                                            String typeHandlerVersionInstance4;
                                            typeHandlerVersionInstance4 = typeHandlerVersionValue4
                                                    .getTextValue();
                                            instanceViewInstance2
                                                    .setTypeHandlerVersion(typeHandlerVersionInstance4);
                                        }

                                        JsonNode substatusesArray2 = instanceViewValue2.get("substatuses");
                                        if (substatusesArray2 != null
                                                && substatusesArray2 instanceof NullNode == false) {
                                            for (JsonNode substatusesValue2 : ((ArrayNode) substatusesArray2)) {
                                                InstanceViewStatus instanceViewStatusInstance6 = new InstanceViewStatus();
                                                instanceViewInstance2.getSubStatuses()
                                                        .add(instanceViewStatusInstance6);

                                                JsonNode codeValue7 = substatusesValue2.get("code");
                                                if (codeValue7 != null
                                                        && codeValue7 instanceof NullNode == false) {
                                                    String codeInstance7;
                                                    codeInstance7 = codeValue7.getTextValue();
                                                    instanceViewStatusInstance6.setCode(codeInstance7);
                                                }

                                                JsonNode levelValue7 = substatusesValue2.get("level");
                                                if (levelValue7 != null
                                                        && levelValue7 instanceof NullNode == false) {
                                                    String levelInstance7;
                                                    levelInstance7 = levelValue7.getTextValue();
                                                    instanceViewStatusInstance6.setLevel(levelInstance7);
                                                }

                                                JsonNode displayStatusValue7 = substatusesValue2
                                                        .get("displayStatus");
                                                if (displayStatusValue7 != null
                                                        && displayStatusValue7 instanceof NullNode == false) {
                                                    String displayStatusInstance7;
                                                    displayStatusInstance7 = displayStatusValue7.getTextValue();
                                                    instanceViewStatusInstance6
                                                            .setDisplayStatus(displayStatusInstance7);
                                                }

                                                JsonNode messageValue7 = substatusesValue2.get("message");
                                                if (messageValue7 != null
                                                        && messageValue7 instanceof NullNode == false) {
                                                    String messageInstance7;
                                                    messageInstance7 = messageValue7.getTextValue();
                                                    instanceViewStatusInstance6.setMessage(messageInstance7);
                                                }

                                                JsonNode timeValue7 = substatusesValue2.get("time");
                                                if (timeValue7 != null
                                                        && timeValue7 instanceof NullNode == false) {
                                                    Calendar timeInstance7;
                                                    timeInstance7 = DatatypeConverter
                                                            .parseDateTime(timeValue7.getTextValue());
                                                    instanceViewStatusInstance6.setTime(timeInstance7);
                                                }
                                            }
                                        }

                                        JsonNode statusesArray5 = instanceViewValue2.get("statuses");
                                        if (statusesArray5 != null
                                                && statusesArray5 instanceof NullNode == false) {
                                            for (JsonNode statusesValue5 : ((ArrayNode) statusesArray5)) {
                                                InstanceViewStatus instanceViewStatusInstance7 = new InstanceViewStatus();
                                                instanceViewInstance2.getStatuses()
                                                        .add(instanceViewStatusInstance7);

                                                JsonNode codeValue8 = statusesValue5.get("code");
                                                if (codeValue8 != null
                                                        && codeValue8 instanceof NullNode == false) {
                                                    String codeInstance8;
                                                    codeInstance8 = codeValue8.getTextValue();
                                                    instanceViewStatusInstance7.setCode(codeInstance8);
                                                }

                                                JsonNode levelValue8 = statusesValue5.get("level");
                                                if (levelValue8 != null
                                                        && levelValue8 instanceof NullNode == false) {
                                                    String levelInstance8;
                                                    levelInstance8 = levelValue8.getTextValue();
                                                    instanceViewStatusInstance7.setLevel(levelInstance8);
                                                }

                                                JsonNode displayStatusValue8 = statusesValue5
                                                        .get("displayStatus");
                                                if (displayStatusValue8 != null
                                                        && displayStatusValue8 instanceof NullNode == false) {
                                                    String displayStatusInstance8;
                                                    displayStatusInstance8 = displayStatusValue8.getTextValue();
                                                    instanceViewStatusInstance7
                                                            .setDisplayStatus(displayStatusInstance8);
                                                }

                                                JsonNode messageValue8 = statusesValue5.get("message");
                                                if (messageValue8 != null
                                                        && messageValue8 instanceof NullNode == false) {
                                                    String messageInstance8;
                                                    messageInstance8 = messageValue8.getTextValue();
                                                    instanceViewStatusInstance7.setMessage(messageInstance8);
                                                }

                                                JsonNode timeValue8 = statusesValue5.get("time");
                                                if (timeValue8 != null
                                                        && timeValue8 instanceof NullNode == false) {
                                                    Calendar timeInstance8;
                                                    timeInstance8 = DatatypeConverter
                                                            .parseDateTime(timeValue8.getTextValue());
                                                    instanceViewStatusInstance7.setTime(timeInstance8);
                                                }
                                            }
                                        }
                                    }
                                }

                                JsonNode idValue4 = resourcesValue.get("id");
                                if (idValue4 != null && idValue4 instanceof NullNode == false) {
                                    String idInstance4;
                                    idInstance4 = idValue4.getTextValue();
                                    virtualMachineExtensionJsonInstance.setId(idInstance4);
                                }

                                JsonNode nameValue7 = resourcesValue.get("name");
                                if (nameValue7 != null && nameValue7 instanceof NullNode == false) {
                                    String nameInstance7;
                                    nameInstance7 = nameValue7.getTextValue();
                                    virtualMachineExtensionJsonInstance.setName(nameInstance7);
                                }

                                JsonNode typeValue5 = resourcesValue.get("type");
                                if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
                                    String typeInstance5;
                                    typeInstance5 = typeValue5.getTextValue();
                                    virtualMachineExtensionJsonInstance.setType(typeInstance5);
                                }

                                JsonNode locationValue = resourcesValue.get("location");
                                if (locationValue != null && locationValue instanceof NullNode == false) {
                                    String locationInstance;
                                    locationInstance = locationValue.getTextValue();
                                    virtualMachineExtensionJsonInstance.setLocation(locationInstance);
                                }

                                JsonNode tagsSequenceElement = ((JsonNode) resourcesValue.get("tags"));
                                if (tagsSequenceElement != null
                                        && tagsSequenceElement instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement.getFields();
                                    while (itr.hasNext()) {
                                        Map.Entry<String, JsonNode> property = itr.next();
                                        String tagsKey = property.getKey();
                                        String tagsValue = property.getValue().getTextValue();
                                        virtualMachineExtensionJsonInstance.getTags().put(tagsKey, tagsValue);
                                    }
                                }
                            }
                        }

                        JsonNode idValue5 = valueValue.get("id");
                        if (idValue5 != null && idValue5 instanceof NullNode == false) {
                            String idInstance5;
                            idInstance5 = idValue5.getTextValue();
                            virtualMachineJsonInstance.setId(idInstance5);
                        }

                        JsonNode nameValue8 = valueValue.get("name");
                        if (nameValue8 != null && nameValue8 instanceof NullNode == false) {
                            String nameInstance8;
                            nameInstance8 = nameValue8.getTextValue();
                            virtualMachineJsonInstance.setName(nameInstance8);
                        }

                        JsonNode typeValue6 = valueValue.get("type");
                        if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
                            String typeInstance6;
                            typeInstance6 = typeValue6.getTextValue();
                            virtualMachineJsonInstance.setType(typeInstance6);
                        }

                        JsonNode locationValue2 = valueValue.get("location");
                        if (locationValue2 != null && locationValue2 instanceof NullNode == false) {
                            String locationInstance2;
                            locationInstance2 = locationValue2.getTextValue();
                            virtualMachineJsonInstance.setLocation(locationInstance2);
                        }

                        JsonNode tagsSequenceElement2 = ((JsonNode) valueValue.get("tags"));
                        if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) {
                            Iterator<Map.Entry<String, JsonNode>> itr2 = tagsSequenceElement2.getFields();
                            while (itr2.hasNext()) {
                                Map.Entry<String, JsonNode> property2 = itr2.next();
                                String tagsKey2 = property2.getKey();
                                String tagsValue2 = property2.getValue().getTextValue();
                                virtualMachineJsonInstance.getTags().put(tagsKey2, tagsValue2);
                            }
                        }
                    }
                }

                JsonNode nextLinkValue = responseDoc.get("nextLink");
                if (nextLinkValue != null && nextLinkValue instanceof NullNode == false) {
                    String nextLinkInstance;
                    nextLinkInstance = nextLinkValue.getTextValue();
                    result.setNextLink(nextLinkInstance);
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.scheduler.JobOperationsImpl.java

/**
* Update the state of all jobs in a job collections.
*
* @param parameters Required. Parameters supplied to the Update Jobs State
* operation.//from  www .j  a v a  2  s .  c  om
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The Update Jobs State operation response.
*/
@Override
public JobCollectionJobsUpdateStateResponse updateJobCollectionState(
        JobCollectionJobsUpdateStateParameters parameters)
        throws IOException, ServiceException, URISyntaxException {
    // Validate
    if (parameters == null) {
        throw new NullPointerException("parameters");
    }
    if (parameters.getState() == null) {
        throw new NullPointerException("parameters.State");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("parameters", parameters);
        CloudTracing.enter(invocationId, this, "updateJobCollectionStateAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/cloudservices/";
    url = url + URLEncoder.encode(this.getClient().getCloudServiceName(), "UTF-8");
    url = url + "/resources/";
    url = url + "scheduler";
    url = url + "/~/";
    url = url + "JobCollections";
    url = url + "/";
    url = url + URLEncoder.encode(this.getClient().getJobCollectionName(), "UTF-8");
    url = url + "/jobs";
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpPatch httpRequest = new HttpPatch(url);

    // Set Headers
    httpRequest.setHeader("Content-Type", "application/json; charset=utf-8");
    httpRequest.setHeader("x-ms-version", "2013-03-01");

    // Serialize Request
    String requestContent = null;
    JsonNode requestDoc = null;

    ObjectMapper objectMapper = new ObjectMapper();
    ObjectNode jobCollectionJobsUpdateStateParametersValue = objectMapper.createObjectNode();
    requestDoc = jobCollectionJobsUpdateStateParametersValue;

    ((ObjectNode) jobCollectionJobsUpdateStateParametersValue).put("state",
            SchedulerClientImpl.jobStateToString(parameters.getState()));

    StringWriter stringWriter = new StringWriter();
    objectMapper.writeValue(stringWriter, requestDoc);
    requestContent = stringWriter.toString();
    StringEntity entity = new StringEntity(requestContent);
    httpRequest.setEntity(entity);
    httpRequest.setHeader("Content-Type", "application/json; charset=utf-8");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        JobCollectionJobsUpdateStateResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new JobCollectionJobsUpdateStateResponse();
            JsonNode responseDoc = null;
            String responseDocContent = IOUtils.toString(responseContent);
            if (responseDocContent == null == false && responseDocContent.length() > 0) {
                responseDoc = objectMapper.readTree(responseDocContent);
            }

            if (responseDoc != null && responseDoc instanceof NullNode == false) {
                JsonNode jobsArray = responseDoc;
                if (jobsArray != null && jobsArray instanceof NullNode == false) {
                    for (JsonNode jobsValue : ((ArrayNode) jobsArray)) {
                        Job jobInstance = new Job();
                        result.getJobs().add(jobInstance);

                        JsonNode idValue = jobsValue.get("id");
                        if (idValue != null && idValue instanceof NullNode == false) {
                            String idInstance;
                            idInstance = idValue.getTextValue();
                            jobInstance.setId(idInstance);
                        }

                        JsonNode startTimeValue = jobsValue.get("startTime");
                        if (startTimeValue != null && startTimeValue instanceof NullNode == false) {
                            Calendar startTimeInstance;
                            startTimeInstance = DatatypeConverter.parseDateTime(startTimeValue.getTextValue());
                            jobInstance.setStartTime(startTimeInstance);
                        }

                        JsonNode actionValue = jobsValue.get("action");
                        if (actionValue != null && actionValue instanceof NullNode == false) {
                            JobAction actionInstance = new JobAction();
                            jobInstance.setAction(actionInstance);

                            JsonNode typeValue = actionValue.get("type");
                            if (typeValue != null && typeValue instanceof NullNode == false) {
                                JobActionType typeInstance;
                                typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue());
                                actionInstance.setType(typeInstance);
                            }

                            JsonNode retryPolicyValue = actionValue.get("retryPolicy");
                            if (retryPolicyValue != null && retryPolicyValue instanceof NullNode == false) {
                                RetryPolicy retryPolicyInstance = new RetryPolicy();
                                actionInstance.setRetryPolicy(retryPolicyInstance);

                                JsonNode retryTypeValue = retryPolicyValue.get("retryType");
                                if (retryTypeValue != null && retryTypeValue instanceof NullNode == false) {
                                    RetryType retryTypeInstance;
                                    retryTypeInstance = SchedulerClientImpl
                                            .parseRetryType(retryTypeValue.getTextValue());
                                    retryPolicyInstance.setRetryType(retryTypeInstance);
                                }

                                JsonNode retryIntervalValue = retryPolicyValue.get("retryInterval");
                                if (retryIntervalValue != null
                                        && retryIntervalValue instanceof NullNode == false) {
                                    Duration retryIntervalInstance;
                                    retryIntervalInstance = TimeSpan8601Converter
                                            .parse(retryIntervalValue.getTextValue());
                                    retryPolicyInstance.setRetryInterval(retryIntervalInstance);
                                }

                                JsonNode retryCountValue = retryPolicyValue.get("retryCount");
                                if (retryCountValue != null && retryCountValue instanceof NullNode == false) {
                                    int retryCountInstance;
                                    retryCountInstance = retryCountValue.getIntValue();
                                    retryPolicyInstance.setRetryCount(retryCountInstance);
                                }
                            }

                            JsonNode errorActionValue = actionValue.get("errorAction");
                            if (errorActionValue != null && errorActionValue instanceof NullNode == false) {
                                JobErrorAction errorActionInstance = new JobErrorAction();
                                actionInstance.setErrorAction(errorActionInstance);

                                JsonNode typeValue2 = errorActionValue.get("type");
                                if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
                                    JobActionType typeInstance2;
                                    typeInstance2 = SchedulerClientImpl
                                            .parseJobActionType(typeValue2.getTextValue());
                                    errorActionInstance.setType(typeInstance2);
                                }

                                JsonNode requestValue = errorActionValue.get("request");
                                if (requestValue != null && requestValue instanceof NullNode == false) {
                                    JobHttpRequest requestInstance = new JobHttpRequest();
                                    errorActionInstance.setRequest(requestInstance);

                                    JsonNode uriValue = requestValue.get("uri");
                                    if (uriValue != null && uriValue instanceof NullNode == false) {
                                        URI uriInstance;
                                        uriInstance = new URI(uriValue.getTextValue());
                                        requestInstance.setUri(uriInstance);
                                    }

                                    JsonNode methodValue = requestValue.get("method");
                                    if (methodValue != null && methodValue instanceof NullNode == false) {
                                        String methodInstance;
                                        methodInstance = methodValue.getTextValue();
                                        requestInstance.setMethod(methodInstance);
                                    }

                                    JsonNode headersSequenceElement = ((JsonNode) requestValue.get("headers"));
                                    if (headersSequenceElement != null
                                            && headersSequenceElement instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr = headersSequenceElement
                                                .getFields();
                                        while (itr.hasNext()) {
                                            Map.Entry<String, JsonNode> property = itr.next();
                                            String headersKey = property.getKey();
                                            String headersValue = property.getValue().getTextValue();
                                            requestInstance.getHeaders().put(headersKey, headersValue);
                                        }
                                    }

                                    JsonNode bodyValue = requestValue.get("body");
                                    if (bodyValue != null && bodyValue instanceof NullNode == false) {
                                        String bodyInstance;
                                        bodyInstance = bodyValue.getTextValue();
                                        requestInstance.setBody(bodyInstance);
                                    }

                                    JsonNode authenticationValue = requestValue.get("authentication");
                                    if (authenticationValue != null
                                            && authenticationValue instanceof NullNode == false) {
                                        String typeName = authenticationValue.get("type").getTextValue();
                                        if ("ClientCertificate".equals(typeName)) {
                                            ClientCertAuthentication clientCertAuthenticationInstance = new ClientCertAuthentication();

                                            JsonNode passwordValue = authenticationValue.get("password");
                                            if (passwordValue != null
                                                    && passwordValue instanceof NullNode == false) {
                                                String passwordInstance;
                                                passwordInstance = passwordValue.getTextValue();
                                                clientCertAuthenticationInstance.setPassword(passwordInstance);
                                            }

                                            JsonNode pfxValue = authenticationValue.get("pfx");
                                            if (pfxValue != null && pfxValue instanceof NullNode == false) {
                                                String pfxInstance;
                                                pfxInstance = pfxValue.getTextValue();
                                                clientCertAuthenticationInstance.setPfx(pfxInstance);
                                            }

                                            JsonNode certificateThumbprintValue = authenticationValue
                                                    .get("certificateThumbprint");
                                            if (certificateThumbprintValue != null
                                                    && certificateThumbprintValue instanceof NullNode == false) {
                                                String certificateThumbprintInstance;
                                                certificateThumbprintInstance = certificateThumbprintValue
                                                        .getTextValue();
                                                clientCertAuthenticationInstance.setCertificateThumbprint(
                                                        certificateThumbprintInstance);
                                            }

                                            JsonNode certificateExpirationValue = authenticationValue
                                                    .get("certificateExpiration");
                                            if (certificateExpirationValue != null
                                                    && certificateExpirationValue instanceof NullNode == false) {
                                                Calendar certificateExpirationInstance;
                                                certificateExpirationInstance = DatatypeConverter.parseDateTime(
                                                        certificateExpirationValue.getTextValue());
                                                clientCertAuthenticationInstance.setCertificateExpiration(
                                                        certificateExpirationInstance);
                                            }

                                            JsonNode certificateSubjectNameValue = authenticationValue
                                                    .get("certificateSubjectName");
                                            if (certificateSubjectNameValue != null
                                                    && certificateSubjectNameValue instanceof NullNode == false) {
                                                String certificateSubjectNameInstance;
                                                certificateSubjectNameInstance = certificateSubjectNameValue
                                                        .getTextValue();
                                                clientCertAuthenticationInstance.setCertificateSubjectName(
                                                        certificateSubjectNameInstance);
                                            }

                                            JsonNode typeValue3 = authenticationValue.get("type");
                                            if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance3;
                                                typeInstance3 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue3.getTextValue());
                                                clientCertAuthenticationInstance.setType(typeInstance3);
                                            }
                                            requestInstance.setAuthentication(clientCertAuthenticationInstance);
                                        }
                                        if ("ActiveDirectoryOAuth".equals(typeName)) {
                                            AADOAuthAuthentication aADOAuthAuthenticationInstance = new AADOAuthAuthentication();

                                            JsonNode secretValue = authenticationValue.get("secret");
                                            if (secretValue != null
                                                    && secretValue instanceof NullNode == false) {
                                                String secretInstance;
                                                secretInstance = secretValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setSecret(secretInstance);
                                            }

                                            JsonNode tenantValue = authenticationValue.get("tenant");
                                            if (tenantValue != null
                                                    && tenantValue instanceof NullNode == false) {
                                                String tenantInstance;
                                                tenantInstance = tenantValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setTenant(tenantInstance);
                                            }

                                            JsonNode audienceValue = authenticationValue.get("audience");
                                            if (audienceValue != null
                                                    && audienceValue instanceof NullNode == false) {
                                                String audienceInstance;
                                                audienceInstance = audienceValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setAudience(audienceInstance);
                                            }

                                            JsonNode clientIdValue = authenticationValue.get("clientId");
                                            if (clientIdValue != null
                                                    && clientIdValue instanceof NullNode == false) {
                                                String clientIdInstance;
                                                clientIdInstance = clientIdValue.getTextValue();
                                                aADOAuthAuthenticationInstance.setClientId(clientIdInstance);
                                            }

                                            JsonNode typeValue4 = authenticationValue.get("type");
                                            if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance4;
                                                typeInstance4 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue4.getTextValue());
                                                aADOAuthAuthenticationInstance.setType(typeInstance4);
                                            }
                                            requestInstance.setAuthentication(aADOAuthAuthenticationInstance);
                                        }
                                        if ("Basic".equals(typeName)) {
                                            BasicAuthentication basicAuthenticationInstance = new BasicAuthentication();

                                            JsonNode usernameValue = authenticationValue.get("username");
                                            if (usernameValue != null
                                                    && usernameValue instanceof NullNode == false) {
                                                String usernameInstance;
                                                usernameInstance = usernameValue.getTextValue();
                                                basicAuthenticationInstance.setUsername(usernameInstance);
                                            }

                                            JsonNode passwordValue2 = authenticationValue.get("password");
                                            if (passwordValue2 != null
                                                    && passwordValue2 instanceof NullNode == false) {
                                                String passwordInstance2;
                                                passwordInstance2 = passwordValue2.getTextValue();
                                                basicAuthenticationInstance.setPassword(passwordInstance2);
                                            }

                                            JsonNode typeValue5 = authenticationValue.get("type");
                                            if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
                                                HttpAuthenticationType typeInstance5;
                                                typeInstance5 = SchedulerClientImpl
                                                        .parseHttpAuthenticationType(typeValue5.getTextValue());
                                                basicAuthenticationInstance.setType(typeInstance5);
                                            }
                                            requestInstance.setAuthentication(basicAuthenticationInstance);
                                        }
                                    }
                                }

                                JsonNode queueMessageValue = errorActionValue.get("queueMessage");
                                if (queueMessageValue != null
                                        && queueMessageValue instanceof NullNode == false) {
                                    JobQueueMessage queueMessageInstance = new JobQueueMessage();
                                    errorActionInstance.setQueueMessage(queueMessageInstance);

                                    JsonNode storageAccountValue = queueMessageValue.get("storageAccount");
                                    if (storageAccountValue != null
                                            && storageAccountValue instanceof NullNode == false) {
                                        String storageAccountInstance;
                                        storageAccountInstance = storageAccountValue.getTextValue();
                                        queueMessageInstance.setStorageAccountName(storageAccountInstance);
                                    }

                                    JsonNode queueNameValue = queueMessageValue.get("queueName");
                                    if (queueNameValue != null && queueNameValue instanceof NullNode == false) {
                                        String queueNameInstance;
                                        queueNameInstance = queueNameValue.getTextValue();
                                        queueMessageInstance.setQueueName(queueNameInstance);
                                    }

                                    JsonNode sasTokenValue = queueMessageValue.get("sasToken");
                                    if (sasTokenValue != null && sasTokenValue instanceof NullNode == false) {
                                        String sasTokenInstance;
                                        sasTokenInstance = sasTokenValue.getTextValue();
                                        queueMessageInstance.setSasToken(sasTokenInstance);
                                    }

                                    JsonNode messageValue = queueMessageValue.get("message");
                                    if (messageValue != null && messageValue instanceof NullNode == false) {
                                        String messageInstance;
                                        messageInstance = messageValue.getTextValue();
                                        queueMessageInstance.setMessage(messageInstance);
                                    }
                                }

                                JsonNode serviceBusTopicMessageValue = errorActionValue
                                        .get("serviceBusTopicMessage");
                                if (serviceBusTopicMessageValue != null
                                        && serviceBusTopicMessageValue instanceof NullNode == false) {
                                    JobServiceBusTopicMessage serviceBusTopicMessageInstance = new JobServiceBusTopicMessage();
                                    errorActionInstance
                                            .setServiceBusTopicMessage(serviceBusTopicMessageInstance);

                                    JsonNode topicPathValue = serviceBusTopicMessageValue.get("topicPath");
                                    if (topicPathValue != null && topicPathValue instanceof NullNode == false) {
                                        String topicPathInstance;
                                        topicPathInstance = topicPathValue.getTextValue();
                                        serviceBusTopicMessageInstance.setTopicPath(topicPathInstance);
                                    }

                                    JsonNode namespaceValue = serviceBusTopicMessageValue.get("namespace");
                                    if (namespaceValue != null && namespaceValue instanceof NullNode == false) {
                                        String namespaceInstance;
                                        namespaceInstance = namespaceValue.getTextValue();
                                        serviceBusTopicMessageInstance.setNamespace(namespaceInstance);
                                    }

                                    JsonNode transportTypeValue = serviceBusTopicMessageValue
                                            .get("transportType");
                                    if (transportTypeValue != null
                                            && transportTypeValue instanceof NullNode == false) {
                                        JobServiceBusTransportType transportTypeInstance;
                                        transportTypeInstance = SchedulerClientImpl
                                                .parseJobServiceBusTransportType(
                                                        transportTypeValue.getTextValue());
                                        serviceBusTopicMessageInstance.setTransportType(transportTypeInstance);
                                    }

                                    JsonNode authenticationValue2 = serviceBusTopicMessageValue
                                            .get("authentication");
                                    if (authenticationValue2 != null
                                            && authenticationValue2 instanceof NullNode == false) {
                                        JobServiceBusAuthentication authenticationInstance = new JobServiceBusAuthentication();
                                        serviceBusTopicMessageInstance
                                                .setAuthentication(authenticationInstance);

                                        JsonNode sasKeyNameValue = authenticationValue2.get("sasKeyName");
                                        if (sasKeyNameValue != null
                                                && sasKeyNameValue instanceof NullNode == false) {
                                            String sasKeyNameInstance;
                                            sasKeyNameInstance = sasKeyNameValue.getTextValue();
                                            authenticationInstance.setSasKeyName(sasKeyNameInstance);
                                        }

                                        JsonNode sasKeyValue = authenticationValue2.get("sasKey");
                                        if (sasKeyValue != null && sasKeyValue instanceof NullNode == false) {
                                            String sasKeyInstance;
                                            sasKeyInstance = sasKeyValue.getTextValue();
                                            authenticationInstance.setSasKey(sasKeyInstance);
                                        }

                                        JsonNode typeValue6 = authenticationValue2.get("type");
                                        if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
                                            JobServiceBusAuthenticationType typeInstance6;
                                            typeInstance6 = SchedulerClientImpl
                                                    .parseJobServiceBusAuthenticationType(
                                                            typeValue6.getTextValue());
                                            authenticationInstance.setType(typeInstance6);
                                        }
                                    }

                                    JsonNode messageValue2 = serviceBusTopicMessageValue.get("message");
                                    if (messageValue2 != null && messageValue2 instanceof NullNode == false) {
                                        String messageInstance2;
                                        messageInstance2 = messageValue2.getTextValue();
                                        serviceBusTopicMessageInstance.setMessage(messageInstance2);
                                    }

                                    JsonNode brokeredMessagePropertiesValue = serviceBusTopicMessageValue
                                            .get("brokeredMessageProperties");
                                    if (brokeredMessagePropertiesValue != null
                                            && brokeredMessagePropertiesValue instanceof NullNode == false) {
                                        JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance = new JobServiceBusBrokeredMessageProperties();
                                        serviceBusTopicMessageInstance.setBrokeredMessageProperties(
                                                brokeredMessagePropertiesInstance);

                                        JsonNode contentTypeValue = brokeredMessagePropertiesValue
                                                .get("contentType");
                                        if (contentTypeValue != null
                                                && contentTypeValue instanceof NullNode == false) {
                                            String contentTypeInstance;
                                            contentTypeInstance = contentTypeValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setContentType(contentTypeInstance);
                                        }

                                        JsonNode correlationIdValue = brokeredMessagePropertiesValue
                                                .get("correlationId");
                                        if (correlationIdValue != null
                                                && correlationIdValue instanceof NullNode == false) {
                                            String correlationIdInstance;
                                            correlationIdInstance = correlationIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setCorrelationId(correlationIdInstance);
                                        }

                                        JsonNode forcePersistenceValue = brokeredMessagePropertiesValue
                                                .get("forcePersistence");
                                        if (forcePersistenceValue != null
                                                && forcePersistenceValue instanceof NullNode == false) {
                                            boolean forcePersistenceInstance;
                                            forcePersistenceInstance = forcePersistenceValue.getBooleanValue();
                                            brokeredMessagePropertiesInstance
                                                    .setForcePersistence(forcePersistenceInstance);
                                        }

                                        JsonNode labelValue = brokeredMessagePropertiesValue.get("label");
                                        if (labelValue != null && labelValue instanceof NullNode == false) {
                                            String labelInstance;
                                            labelInstance = labelValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setLabel(labelInstance);
                                        }

                                        JsonNode messageIdValue = brokeredMessagePropertiesValue
                                                .get("messageId");
                                        if (messageIdValue != null
                                                && messageIdValue instanceof NullNode == false) {
                                            String messageIdInstance;
                                            messageIdInstance = messageIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setMessageId(messageIdInstance);
                                        }

                                        JsonNode partitionKeyValue = brokeredMessagePropertiesValue
                                                .get("partitionKey");
                                        if (partitionKeyValue != null
                                                && partitionKeyValue instanceof NullNode == false) {
                                            String partitionKeyInstance;
                                            partitionKeyInstance = partitionKeyValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setPartitionKey(partitionKeyInstance);
                                        }

                                        JsonNode replyToValue = brokeredMessagePropertiesValue.get("replyTo");
                                        if (replyToValue != null && replyToValue instanceof NullNode == false) {
                                            String replyToInstance;
                                            replyToInstance = replyToValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setReplyTo(replyToInstance);
                                        }

                                        JsonNode replyToSessionIdValue = brokeredMessagePropertiesValue
                                                .get("replyToSessionId");
                                        if (replyToSessionIdValue != null
                                                && replyToSessionIdValue instanceof NullNode == false) {
                                            String replyToSessionIdInstance;
                                            replyToSessionIdInstance = replyToSessionIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setReplyToSessionId(replyToSessionIdInstance);
                                        }

                                        JsonNode scheduledEnqueueTimeUtcValue = brokeredMessagePropertiesValue
                                                .get("scheduledEnqueueTimeUtc");
                                        if (scheduledEnqueueTimeUtcValue != null
                                                && scheduledEnqueueTimeUtcValue instanceof NullNode == false) {
                                            Calendar scheduledEnqueueTimeUtcInstance;
                                            scheduledEnqueueTimeUtcInstance = DatatypeConverter
                                                    .parseDateTime(scheduledEnqueueTimeUtcValue.getTextValue());
                                            brokeredMessagePropertiesInstance.setScheduledEnqueueTimeUtc(
                                                    scheduledEnqueueTimeUtcInstance);
                                        }

                                        JsonNode sessionIdValue = brokeredMessagePropertiesValue
                                                .get("sessionId");
                                        if (sessionIdValue != null
                                                && sessionIdValue instanceof NullNode == false) {
                                            String sessionIdInstance;
                                            sessionIdInstance = sessionIdValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setSessionId(sessionIdInstance);
                                        }

                                        JsonNode timeToLiveValue = brokeredMessagePropertiesValue
                                                .get("timeToLive");
                                        if (timeToLiveValue != null
                                                && timeToLiveValue instanceof NullNode == false) {
                                            Calendar timeToLiveInstance;
                                            timeToLiveInstance = DatatypeConverter
                                                    .parseDateTime(timeToLiveValue.getTextValue());
                                            brokeredMessagePropertiesInstance.setTimeToLive(timeToLiveInstance);
                                        }

                                        JsonNode toValue = brokeredMessagePropertiesValue.get("to");
                                        if (toValue != null && toValue instanceof NullNode == false) {
                                            String toInstance;
                                            toInstance = toValue.getTextValue();
                                            brokeredMessagePropertiesInstance.setTo(toInstance);
                                        }

                                        JsonNode viaPartitionKeyValue = brokeredMessagePropertiesValue
                                                .get("viaPartitionKey");
                                        if (viaPartitionKeyValue != null
                                                && viaPartitionKeyValue instanceof NullNode == false) {
                                            String viaPartitionKeyInstance;
                                            viaPartitionKeyInstance = viaPartitionKeyValue.getTextValue();
                                            brokeredMessagePropertiesInstance
                                                    .setViaPartitionKey(viaPartitionKeyInstance);
                                        }
                                    }

                                    JsonNode customMessagePropertiesSequenceElement = ((JsonNode) serviceBusTopicMessageValue
                                            .get("customMessageProperties"));
                                    if (customMessagePropertiesSequenceElement != null
                                            && customMessagePropertiesSequenceElement instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr2 = customMessagePropertiesSequenceElement
                                                .getFields();
                                        while (itr2.hasNext()) {
                                            Map.Entry<String, JsonNode> property2 = itr2.next();
                                            String customMessagePropertiesKey = property2.getKey();
                                            String customMessagePropertiesValue = property2.getValue()
                                                    .getTextValue();
                                            serviceBusTopicMessageInstance.getCustomMessageProperties().put(
                                                    customMessagePropertiesKey, customMessagePropertiesValue);
                                        }
                                    }
                                }

                                JsonNode serviceBusQueueMessageValue = errorActionValue
                                        .get("serviceBusQueueMessage");
                                if (serviceBusQueueMessageValue != null
                                        && serviceBusQueueMessageValue instanceof NullNode == false) {
                                    JobServiceBusQueueMessage serviceBusQueueMessageInstance = new JobServiceBusQueueMessage();
                                    errorActionInstance
                                            .setServiceBusQueueMessage(serviceBusQueueMessageInstance);

                                    JsonNode queueNameValue2 = serviceBusQueueMessageValue.get("queueName");
                                    if (queueNameValue2 != null
                                            && queueNameValue2 instanceof NullNode == false) {
                                        String queueNameInstance2;
                                        queueNameInstance2 = queueNameValue2.getTextValue();
                                        serviceBusQueueMessageInstance.setQueueName(queueNameInstance2);
                                    }

                                    JsonNode namespaceValue2 = serviceBusQueueMessageValue.get("namespace");
                                    if (namespaceValue2 != null
                                            && namespaceValue2 instanceof NullNode == false) {
                                        String namespaceInstance2;
                                        namespaceInstance2 = namespaceValue2.getTextValue();
                                        serviceBusQueueMessageInstance.setNamespace(namespaceInstance2);
                                    }

                                    JsonNode transportTypeValue2 = serviceBusQueueMessageValue
                                            .get("transportType");
                                    if (transportTypeValue2 != null
                                            && transportTypeValue2 instanceof NullNode == false) {
                                        JobServiceBusTransportType transportTypeInstance2;
                                        transportTypeInstance2 = SchedulerClientImpl
                                                .parseJobServiceBusTransportType(
                                                        transportTypeValue2.getTextValue());
                                        serviceBusQueueMessageInstance.setTransportType(transportTypeInstance2);
                                    }

                                    JsonNode authenticationValue3 = serviceBusQueueMessageValue
                                            .get("authentication");
                                    if (authenticationValue3 != null
                                            && authenticationValue3 instanceof NullNode == false) {
                                        JobServiceBusAuthentication authenticationInstance2 = new JobServiceBusAuthentication();
                                        serviceBusQueueMessageInstance
                                                .setAuthentication(authenticationInstance2);

                                        JsonNode sasKeyNameValue2 = authenticationValue3.get("sasKeyName");
                                        if (sasKeyNameValue2 != null
                                                && sasKeyNameValue2 instanceof NullNode == false) {
                                            String sasKeyNameInstance2;
                                            sasKeyNameInstance2 = sasKeyNameValue2.getTextValue();
                                            authenticationInstance2.setSasKeyName(sasKeyNameInstance2);
                                        }

                                        JsonNode sasKeyValue2 = authenticationValue3.get("sasKey");
                                        if (sasKeyValue2 != null && sasKeyValue2 instanceof NullNode == false) {
                                            String sasKeyInstance2;
                                            sasKeyInstance2 = sasKeyValue2.getTextValue();
                                            authenticationInstance2.setSasKey(sasKeyInstance2);
                                        }

                                        JsonNode typeValue7 = authenticationValue3.get("type");
                                        if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
                                            JobServiceBusAuthenticationType typeInstance7;
                                            typeInstance7 = SchedulerClientImpl
                                                    .parseJobServiceBusAuthenticationType(
                                                            typeValue7.getTextValue());
                                            authenticationInstance2.setType(typeInstance7);
                                        }
                                    }

                                    JsonNode messageValue3 = serviceBusQueueMessageValue.get("message");
                                    if (messageValue3 != null && messageValue3 instanceof NullNode == false) {
                                        String messageInstance3;
                                        messageInstance3 = messageValue3.getTextValue();
                                        serviceBusQueueMessageInstance.setMessage(messageInstance3);
                                    }

                                    JsonNode brokeredMessagePropertiesValue2 = serviceBusQueueMessageValue
                                            .get("brokeredMessageProperties");
                                    if (brokeredMessagePropertiesValue2 != null
                                            && brokeredMessagePropertiesValue2 instanceof NullNode == false) {
                                        JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance2 = new JobServiceBusBrokeredMessageProperties();
                                        serviceBusQueueMessageInstance.setBrokeredMessageProperties(
                                                brokeredMessagePropertiesInstance2);

                                        JsonNode contentTypeValue2 = brokeredMessagePropertiesValue2
                                                .get("contentType");
                                        if (contentTypeValue2 != null
                                                && contentTypeValue2 instanceof NullNode == false) {
                                            String contentTypeInstance2;
                                            contentTypeInstance2 = contentTypeValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setContentType(contentTypeInstance2);
                                        }

                                        JsonNode correlationIdValue2 = brokeredMessagePropertiesValue2
                                                .get("correlationId");
                                        if (correlationIdValue2 != null
                                                && correlationIdValue2 instanceof NullNode == false) {
                                            String correlationIdInstance2;
                                            correlationIdInstance2 = correlationIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setCorrelationId(correlationIdInstance2);
                                        }

                                        JsonNode forcePersistenceValue2 = brokeredMessagePropertiesValue2
                                                .get("forcePersistence");
                                        if (forcePersistenceValue2 != null
                                                && forcePersistenceValue2 instanceof NullNode == false) {
                                            boolean forcePersistenceInstance2;
                                            forcePersistenceInstance2 = forcePersistenceValue2
                                                    .getBooleanValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setForcePersistence(forcePersistenceInstance2);
                                        }

                                        JsonNode labelValue2 = brokeredMessagePropertiesValue2.get("label");
                                        if (labelValue2 != null && labelValue2 instanceof NullNode == false) {
                                            String labelInstance2;
                                            labelInstance2 = labelValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setLabel(labelInstance2);
                                        }

                                        JsonNode messageIdValue2 = brokeredMessagePropertiesValue2
                                                .get("messageId");
                                        if (messageIdValue2 != null
                                                && messageIdValue2 instanceof NullNode == false) {
                                            String messageIdInstance2;
                                            messageIdInstance2 = messageIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setMessageId(messageIdInstance2);
                                        }

                                        JsonNode partitionKeyValue2 = brokeredMessagePropertiesValue2
                                                .get("partitionKey");
                                        if (partitionKeyValue2 != null
                                                && partitionKeyValue2 instanceof NullNode == false) {
                                            String partitionKeyInstance2;
                                            partitionKeyInstance2 = partitionKeyValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setPartitionKey(partitionKeyInstance2);
                                        }

                                        JsonNode replyToValue2 = brokeredMessagePropertiesValue2.get("replyTo");
                                        if (replyToValue2 != null
                                                && replyToValue2 instanceof NullNode == false) {
                                            String replyToInstance2;
                                            replyToInstance2 = replyToValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setReplyTo(replyToInstance2);
                                        }

                                        JsonNode replyToSessionIdValue2 = brokeredMessagePropertiesValue2
                                                .get("replyToSessionId");
                                        if (replyToSessionIdValue2 != null
                                                && replyToSessionIdValue2 instanceof NullNode == false) {
                                            String replyToSessionIdInstance2;
                                            replyToSessionIdInstance2 = replyToSessionIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setReplyToSessionId(replyToSessionIdInstance2);
                                        }

                                        JsonNode scheduledEnqueueTimeUtcValue2 = brokeredMessagePropertiesValue2
                                                .get("scheduledEnqueueTimeUtc");
                                        if (scheduledEnqueueTimeUtcValue2 != null
                                                && scheduledEnqueueTimeUtcValue2 instanceof NullNode == false) {
                                            Calendar scheduledEnqueueTimeUtcInstance2;
                                            scheduledEnqueueTimeUtcInstance2 = DatatypeConverter.parseDateTime(
                                                    scheduledEnqueueTimeUtcValue2.getTextValue());
                                            brokeredMessagePropertiesInstance2.setScheduledEnqueueTimeUtc(
                                                    scheduledEnqueueTimeUtcInstance2);
                                        }

                                        JsonNode sessionIdValue2 = brokeredMessagePropertiesValue2
                                                .get("sessionId");
                                        if (sessionIdValue2 != null
                                                && sessionIdValue2 instanceof NullNode == false) {
                                            String sessionIdInstance2;
                                            sessionIdInstance2 = sessionIdValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setSessionId(sessionIdInstance2);
                                        }

                                        JsonNode timeToLiveValue2 = brokeredMessagePropertiesValue2
                                                .get("timeToLive");
                                        if (timeToLiveValue2 != null
                                                && timeToLiveValue2 instanceof NullNode == false) {
                                            Calendar timeToLiveInstance2;
                                            timeToLiveInstance2 = DatatypeConverter
                                                    .parseDateTime(timeToLiveValue2.getTextValue());
                                            brokeredMessagePropertiesInstance2
                                                    .setTimeToLive(timeToLiveInstance2);
                                        }

                                        JsonNode toValue2 = brokeredMessagePropertiesValue2.get("to");
                                        if (toValue2 != null && toValue2 instanceof NullNode == false) {
                                            String toInstance2;
                                            toInstance2 = toValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2.setTo(toInstance2);
                                        }

                                        JsonNode viaPartitionKeyValue2 = brokeredMessagePropertiesValue2
                                                .get("viaPartitionKey");
                                        if (viaPartitionKeyValue2 != null
                                                && viaPartitionKeyValue2 instanceof NullNode == false) {
                                            String viaPartitionKeyInstance2;
                                            viaPartitionKeyInstance2 = viaPartitionKeyValue2.getTextValue();
                                            brokeredMessagePropertiesInstance2
                                                    .setViaPartitionKey(viaPartitionKeyInstance2);
                                        }
                                    }

                                    JsonNode customMessagePropertiesSequenceElement2 = ((JsonNode) serviceBusQueueMessageValue
                                            .get("customMessageProperties"));
                                    if (customMessagePropertiesSequenceElement2 != null
                                            && customMessagePropertiesSequenceElement2 instanceof NullNode == false) {
                                        Iterator<Map.Entry<String, JsonNode>> itr3 = customMessagePropertiesSequenceElement2
                                                .getFields();
                                        while (itr3.hasNext()) {
                                            Map.Entry<String, JsonNode> property3 = itr3.next();
                                            String customMessagePropertiesKey2 = property3.getKey();
                                            String customMessagePropertiesValue2 = property3.getValue()
                                                    .getTextValue();
                                            serviceBusQueueMessageInstance.getCustomMessageProperties().put(
                                                    customMessagePropertiesKey2, customMessagePropertiesValue2);
                                        }
                                    }
                                }
                            }

                            JsonNode requestValue2 = actionValue.get("request");
                            if (requestValue2 != null && requestValue2 instanceof NullNode == false) {
                                JobHttpRequest requestInstance2 = new JobHttpRequest();
                                actionInstance.setRequest(requestInstance2);

                                JsonNode uriValue2 = requestValue2.get("uri");
                                if (uriValue2 != null && uriValue2 instanceof NullNode == false) {
                                    URI uriInstance2;
                                    uriInstance2 = new URI(uriValue2.getTextValue());
                                    requestInstance2.setUri(uriInstance2);
                                }

                                JsonNode methodValue2 = requestValue2.get("method");
                                if (methodValue2 != null && methodValue2 instanceof NullNode == false) {
                                    String methodInstance2;
                                    methodInstance2 = methodValue2.getTextValue();
                                    requestInstance2.setMethod(methodInstance2);
                                }

                                JsonNode headersSequenceElement2 = ((JsonNode) requestValue2.get("headers"));
                                if (headersSequenceElement2 != null
                                        && headersSequenceElement2 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr4 = headersSequenceElement2
                                            .getFields();
                                    while (itr4.hasNext()) {
                                        Map.Entry<String, JsonNode> property4 = itr4.next();
                                        String headersKey2 = property4.getKey();
                                        String headersValue2 = property4.getValue().getTextValue();
                                        requestInstance2.getHeaders().put(headersKey2, headersValue2);
                                    }
                                }

                                JsonNode bodyValue2 = requestValue2.get("body");
                                if (bodyValue2 != null && bodyValue2 instanceof NullNode == false) {
                                    String bodyInstance2;
                                    bodyInstance2 = bodyValue2.getTextValue();
                                    requestInstance2.setBody(bodyInstance2);
                                }

                                JsonNode authenticationValue4 = requestValue2.get("authentication");
                                if (authenticationValue4 != null
                                        && authenticationValue4 instanceof NullNode == false) {
                                    String typeName2 = authenticationValue4.get("type").getTextValue();
                                    if ("ClientCertificate".equals(typeName2)) {
                                        ClientCertAuthentication clientCertAuthenticationInstance2 = new ClientCertAuthentication();

                                        JsonNode passwordValue3 = authenticationValue4.get("password");
                                        if (passwordValue3 != null
                                                && passwordValue3 instanceof NullNode == false) {
                                            String passwordInstance3;
                                            passwordInstance3 = passwordValue3.getTextValue();
                                            clientCertAuthenticationInstance2.setPassword(passwordInstance3);
                                        }

                                        JsonNode pfxValue2 = authenticationValue4.get("pfx");
                                        if (pfxValue2 != null && pfxValue2 instanceof NullNode == false) {
                                            String pfxInstance2;
                                            pfxInstance2 = pfxValue2.getTextValue();
                                            clientCertAuthenticationInstance2.setPfx(pfxInstance2);
                                        }

                                        JsonNode certificateThumbprintValue2 = authenticationValue4
                                                .get("certificateThumbprint");
                                        if (certificateThumbprintValue2 != null
                                                && certificateThumbprintValue2 instanceof NullNode == false) {
                                            String certificateThumbprintInstance2;
                                            certificateThumbprintInstance2 = certificateThumbprintValue2
                                                    .getTextValue();
                                            clientCertAuthenticationInstance2
                                                    .setCertificateThumbprint(certificateThumbprintInstance2);
                                        }

                                        JsonNode certificateExpirationValue2 = authenticationValue4
                                                .get("certificateExpiration");
                                        if (certificateExpirationValue2 != null
                                                && certificateExpirationValue2 instanceof NullNode == false) {
                                            Calendar certificateExpirationInstance2;
                                            certificateExpirationInstance2 = DatatypeConverter
                                                    .parseDateTime(certificateExpirationValue2.getTextValue());
                                            clientCertAuthenticationInstance2
                                                    .setCertificateExpiration(certificateExpirationInstance2);
                                        }

                                        JsonNode certificateSubjectNameValue2 = authenticationValue4
                                                .get("certificateSubjectName");
                                        if (certificateSubjectNameValue2 != null
                                                && certificateSubjectNameValue2 instanceof NullNode == false) {
                                            String certificateSubjectNameInstance2;
                                            certificateSubjectNameInstance2 = certificateSubjectNameValue2
                                                    .getTextValue();
                                            clientCertAuthenticationInstance2
                                                    .setCertificateSubjectName(certificateSubjectNameInstance2);
                                        }

                                        JsonNode typeValue8 = authenticationValue4.get("type");
                                        if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance8;
                                            typeInstance8 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue8.getTextValue());
                                            clientCertAuthenticationInstance2.setType(typeInstance8);
                                        }
                                        requestInstance2.setAuthentication(clientCertAuthenticationInstance2);
                                    }
                                    if ("ActiveDirectoryOAuth".equals(typeName2)) {
                                        AADOAuthAuthentication aADOAuthAuthenticationInstance2 = new AADOAuthAuthentication();

                                        JsonNode secretValue2 = authenticationValue4.get("secret");
                                        if (secretValue2 != null && secretValue2 instanceof NullNode == false) {
                                            String secretInstance2;
                                            secretInstance2 = secretValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setSecret(secretInstance2);
                                        }

                                        JsonNode tenantValue2 = authenticationValue4.get("tenant");
                                        if (tenantValue2 != null && tenantValue2 instanceof NullNode == false) {
                                            String tenantInstance2;
                                            tenantInstance2 = tenantValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setTenant(tenantInstance2);
                                        }

                                        JsonNode audienceValue2 = authenticationValue4.get("audience");
                                        if (audienceValue2 != null
                                                && audienceValue2 instanceof NullNode == false) {
                                            String audienceInstance2;
                                            audienceInstance2 = audienceValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setAudience(audienceInstance2);
                                        }

                                        JsonNode clientIdValue2 = authenticationValue4.get("clientId");
                                        if (clientIdValue2 != null
                                                && clientIdValue2 instanceof NullNode == false) {
                                            String clientIdInstance2;
                                            clientIdInstance2 = clientIdValue2.getTextValue();
                                            aADOAuthAuthenticationInstance2.setClientId(clientIdInstance2);
                                        }

                                        JsonNode typeValue9 = authenticationValue4.get("type");
                                        if (typeValue9 != null && typeValue9 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance9;
                                            typeInstance9 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue9.getTextValue());
                                            aADOAuthAuthenticationInstance2.setType(typeInstance9);
                                        }
                                        requestInstance2.setAuthentication(aADOAuthAuthenticationInstance2);
                                    }
                                    if ("Basic".equals(typeName2)) {
                                        BasicAuthentication basicAuthenticationInstance2 = new BasicAuthentication();

                                        JsonNode usernameValue2 = authenticationValue4.get("username");
                                        if (usernameValue2 != null
                                                && usernameValue2 instanceof NullNode == false) {
                                            String usernameInstance2;
                                            usernameInstance2 = usernameValue2.getTextValue();
                                            basicAuthenticationInstance2.setUsername(usernameInstance2);
                                        }

                                        JsonNode passwordValue4 = authenticationValue4.get("password");
                                        if (passwordValue4 != null
                                                && passwordValue4 instanceof NullNode == false) {
                                            String passwordInstance4;
                                            passwordInstance4 = passwordValue4.getTextValue();
                                            basicAuthenticationInstance2.setPassword(passwordInstance4);
                                        }

                                        JsonNode typeValue10 = authenticationValue4.get("type");
                                        if (typeValue10 != null && typeValue10 instanceof NullNode == false) {
                                            HttpAuthenticationType typeInstance10;
                                            typeInstance10 = SchedulerClientImpl
                                                    .parseHttpAuthenticationType(typeValue10.getTextValue());
                                            basicAuthenticationInstance2.setType(typeInstance10);
                                        }
                                        requestInstance2.setAuthentication(basicAuthenticationInstance2);
                                    }
                                }
                            }

                            JsonNode queueMessageValue2 = actionValue.get("queueMessage");
                            if (queueMessageValue2 != null && queueMessageValue2 instanceof NullNode == false) {
                                JobQueueMessage queueMessageInstance2 = new JobQueueMessage();
                                actionInstance.setQueueMessage(queueMessageInstance2);

                                JsonNode storageAccountValue2 = queueMessageValue2.get("storageAccount");
                                if (storageAccountValue2 != null
                                        && storageAccountValue2 instanceof NullNode == false) {
                                    String storageAccountInstance2;
                                    storageAccountInstance2 = storageAccountValue2.getTextValue();
                                    queueMessageInstance2.setStorageAccountName(storageAccountInstance2);
                                }

                                JsonNode queueNameValue3 = queueMessageValue2.get("queueName");
                                if (queueNameValue3 != null && queueNameValue3 instanceof NullNode == false) {
                                    String queueNameInstance3;
                                    queueNameInstance3 = queueNameValue3.getTextValue();
                                    queueMessageInstance2.setQueueName(queueNameInstance3);
                                }

                                JsonNode sasTokenValue2 = queueMessageValue2.get("sasToken");
                                if (sasTokenValue2 != null && sasTokenValue2 instanceof NullNode == false) {
                                    String sasTokenInstance2;
                                    sasTokenInstance2 = sasTokenValue2.getTextValue();
                                    queueMessageInstance2.setSasToken(sasTokenInstance2);
                                }

                                JsonNode messageValue4 = queueMessageValue2.get("message");
                                if (messageValue4 != null && messageValue4 instanceof NullNode == false) {
                                    String messageInstance4;
                                    messageInstance4 = messageValue4.getTextValue();
                                    queueMessageInstance2.setMessage(messageInstance4);
                                }
                            }

                            JsonNode serviceBusTopicMessageValue2 = actionValue.get("serviceBusTopicMessage");
                            if (serviceBusTopicMessageValue2 != null
                                    && serviceBusTopicMessageValue2 instanceof NullNode == false) {
                                JobServiceBusTopicMessage serviceBusTopicMessageInstance2 = new JobServiceBusTopicMessage();
                                actionInstance.setServiceBusTopicMessage(serviceBusTopicMessageInstance2);

                                JsonNode topicPathValue2 = serviceBusTopicMessageValue2.get("topicPath");
                                if (topicPathValue2 != null && topicPathValue2 instanceof NullNode == false) {
                                    String topicPathInstance2;
                                    topicPathInstance2 = topicPathValue2.getTextValue();
                                    serviceBusTopicMessageInstance2.setTopicPath(topicPathInstance2);
                                }

                                JsonNode namespaceValue3 = serviceBusTopicMessageValue2.get("namespace");
                                if (namespaceValue3 != null && namespaceValue3 instanceof NullNode == false) {
                                    String namespaceInstance3;
                                    namespaceInstance3 = namespaceValue3.getTextValue();
                                    serviceBusTopicMessageInstance2.setNamespace(namespaceInstance3);
                                }

                                JsonNode transportTypeValue3 = serviceBusTopicMessageValue2
                                        .get("transportType");
                                if (transportTypeValue3 != null
                                        && transportTypeValue3 instanceof NullNode == false) {
                                    JobServiceBusTransportType transportTypeInstance3;
                                    transportTypeInstance3 = SchedulerClientImpl
                                            .parseJobServiceBusTransportType(
                                                    transportTypeValue3.getTextValue());
                                    serviceBusTopicMessageInstance2.setTransportType(transportTypeInstance3);
                                }

                                JsonNode authenticationValue5 = serviceBusTopicMessageValue2
                                        .get("authentication");
                                if (authenticationValue5 != null
                                        && authenticationValue5 instanceof NullNode == false) {
                                    JobServiceBusAuthentication authenticationInstance3 = new JobServiceBusAuthentication();
                                    serviceBusTopicMessageInstance2.setAuthentication(authenticationInstance3);

                                    JsonNode sasKeyNameValue3 = authenticationValue5.get("sasKeyName");
                                    if (sasKeyNameValue3 != null
                                            && sasKeyNameValue3 instanceof NullNode == false) {
                                        String sasKeyNameInstance3;
                                        sasKeyNameInstance3 = sasKeyNameValue3.getTextValue();
                                        authenticationInstance3.setSasKeyName(sasKeyNameInstance3);
                                    }

                                    JsonNode sasKeyValue3 = authenticationValue5.get("sasKey");
                                    if (sasKeyValue3 != null && sasKeyValue3 instanceof NullNode == false) {
                                        String sasKeyInstance3;
                                        sasKeyInstance3 = sasKeyValue3.getTextValue();
                                        authenticationInstance3.setSasKey(sasKeyInstance3);
                                    }

                                    JsonNode typeValue11 = authenticationValue5.get("type");
                                    if (typeValue11 != null && typeValue11 instanceof NullNode == false) {
                                        JobServiceBusAuthenticationType typeInstance11;
                                        typeInstance11 = SchedulerClientImpl
                                                .parseJobServiceBusAuthenticationType(
                                                        typeValue11.getTextValue());
                                        authenticationInstance3.setType(typeInstance11);
                                    }
                                }

                                JsonNode messageValue5 = serviceBusTopicMessageValue2.get("message");
                                if (messageValue5 != null && messageValue5 instanceof NullNode == false) {
                                    String messageInstance5;
                                    messageInstance5 = messageValue5.getTextValue();
                                    serviceBusTopicMessageInstance2.setMessage(messageInstance5);
                                }

                                JsonNode brokeredMessagePropertiesValue3 = serviceBusTopicMessageValue2
                                        .get("brokeredMessageProperties");
                                if (brokeredMessagePropertiesValue3 != null
                                        && brokeredMessagePropertiesValue3 instanceof NullNode == false) {
                                    JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance3 = new JobServiceBusBrokeredMessageProperties();
                                    serviceBusTopicMessageInstance2
                                            .setBrokeredMessageProperties(brokeredMessagePropertiesInstance3);

                                    JsonNode contentTypeValue3 = brokeredMessagePropertiesValue3
                                            .get("contentType");
                                    if (contentTypeValue3 != null
                                            && contentTypeValue3 instanceof NullNode == false) {
                                        String contentTypeInstance3;
                                        contentTypeInstance3 = contentTypeValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setContentType(contentTypeInstance3);
                                    }

                                    JsonNode correlationIdValue3 = brokeredMessagePropertiesValue3
                                            .get("correlationId");
                                    if (correlationIdValue3 != null
                                            && correlationIdValue3 instanceof NullNode == false) {
                                        String correlationIdInstance3;
                                        correlationIdInstance3 = correlationIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setCorrelationId(correlationIdInstance3);
                                    }

                                    JsonNode forcePersistenceValue3 = brokeredMessagePropertiesValue3
                                            .get("forcePersistence");
                                    if (forcePersistenceValue3 != null
                                            && forcePersistenceValue3 instanceof NullNode == false) {
                                        boolean forcePersistenceInstance3;
                                        forcePersistenceInstance3 = forcePersistenceValue3.getBooleanValue();
                                        brokeredMessagePropertiesInstance3
                                                .setForcePersistence(forcePersistenceInstance3);
                                    }

                                    JsonNode labelValue3 = brokeredMessagePropertiesValue3.get("label");
                                    if (labelValue3 != null && labelValue3 instanceof NullNode == false) {
                                        String labelInstance3;
                                        labelInstance3 = labelValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setLabel(labelInstance3);
                                    }

                                    JsonNode messageIdValue3 = brokeredMessagePropertiesValue3.get("messageId");
                                    if (messageIdValue3 != null
                                            && messageIdValue3 instanceof NullNode == false) {
                                        String messageIdInstance3;
                                        messageIdInstance3 = messageIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setMessageId(messageIdInstance3);
                                    }

                                    JsonNode partitionKeyValue3 = brokeredMessagePropertiesValue3
                                            .get("partitionKey");
                                    if (partitionKeyValue3 != null
                                            && partitionKeyValue3 instanceof NullNode == false) {
                                        String partitionKeyInstance3;
                                        partitionKeyInstance3 = partitionKeyValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setPartitionKey(partitionKeyInstance3);
                                    }

                                    JsonNode replyToValue3 = brokeredMessagePropertiesValue3.get("replyTo");
                                    if (replyToValue3 != null && replyToValue3 instanceof NullNode == false) {
                                        String replyToInstance3;
                                        replyToInstance3 = replyToValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setReplyTo(replyToInstance3);
                                    }

                                    JsonNode replyToSessionIdValue3 = brokeredMessagePropertiesValue3
                                            .get("replyToSessionId");
                                    if (replyToSessionIdValue3 != null
                                            && replyToSessionIdValue3 instanceof NullNode == false) {
                                        String replyToSessionIdInstance3;
                                        replyToSessionIdInstance3 = replyToSessionIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setReplyToSessionId(replyToSessionIdInstance3);
                                    }

                                    JsonNode scheduledEnqueueTimeUtcValue3 = brokeredMessagePropertiesValue3
                                            .get("scheduledEnqueueTimeUtc");
                                    if (scheduledEnqueueTimeUtcValue3 != null
                                            && scheduledEnqueueTimeUtcValue3 instanceof NullNode == false) {
                                        Calendar scheduledEnqueueTimeUtcInstance3;
                                        scheduledEnqueueTimeUtcInstance3 = DatatypeConverter
                                                .parseDateTime(scheduledEnqueueTimeUtcValue3.getTextValue());
                                        brokeredMessagePropertiesInstance3
                                                .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance3);
                                    }

                                    JsonNode sessionIdValue3 = brokeredMessagePropertiesValue3.get("sessionId");
                                    if (sessionIdValue3 != null
                                            && sessionIdValue3 instanceof NullNode == false) {
                                        String sessionIdInstance3;
                                        sessionIdInstance3 = sessionIdValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setSessionId(sessionIdInstance3);
                                    }

                                    JsonNode timeToLiveValue3 = brokeredMessagePropertiesValue3
                                            .get("timeToLive");
                                    if (timeToLiveValue3 != null
                                            && timeToLiveValue3 instanceof NullNode == false) {
                                        Calendar timeToLiveInstance3;
                                        timeToLiveInstance3 = DatatypeConverter
                                                .parseDateTime(timeToLiveValue3.getTextValue());
                                        brokeredMessagePropertiesInstance3.setTimeToLive(timeToLiveInstance3);
                                    }

                                    JsonNode toValue3 = brokeredMessagePropertiesValue3.get("to");
                                    if (toValue3 != null && toValue3 instanceof NullNode == false) {
                                        String toInstance3;
                                        toInstance3 = toValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3.setTo(toInstance3);
                                    }

                                    JsonNode viaPartitionKeyValue3 = brokeredMessagePropertiesValue3
                                            .get("viaPartitionKey");
                                    if (viaPartitionKeyValue3 != null
                                            && viaPartitionKeyValue3 instanceof NullNode == false) {
                                        String viaPartitionKeyInstance3;
                                        viaPartitionKeyInstance3 = viaPartitionKeyValue3.getTextValue();
                                        brokeredMessagePropertiesInstance3
                                                .setViaPartitionKey(viaPartitionKeyInstance3);
                                    }
                                }

                                JsonNode customMessagePropertiesSequenceElement3 = ((JsonNode) serviceBusTopicMessageValue2
                                        .get("customMessageProperties"));
                                if (customMessagePropertiesSequenceElement3 != null
                                        && customMessagePropertiesSequenceElement3 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr5 = customMessagePropertiesSequenceElement3
                                            .getFields();
                                    while (itr5.hasNext()) {
                                        Map.Entry<String, JsonNode> property5 = itr5.next();
                                        String customMessagePropertiesKey3 = property5.getKey();
                                        String customMessagePropertiesValue3 = property5.getValue()
                                                .getTextValue();
                                        serviceBusTopicMessageInstance2.getCustomMessageProperties().put(
                                                customMessagePropertiesKey3, customMessagePropertiesValue3);
                                    }
                                }
                            }

                            JsonNode serviceBusQueueMessageValue2 = actionValue.get("serviceBusQueueMessage");
                            if (serviceBusQueueMessageValue2 != null
                                    && serviceBusQueueMessageValue2 instanceof NullNode == false) {
                                JobServiceBusQueueMessage serviceBusQueueMessageInstance2 = new JobServiceBusQueueMessage();
                                actionInstance.setServiceBusQueueMessage(serviceBusQueueMessageInstance2);

                                JsonNode queueNameValue4 = serviceBusQueueMessageValue2.get("queueName");
                                if (queueNameValue4 != null && queueNameValue4 instanceof NullNode == false) {
                                    String queueNameInstance4;
                                    queueNameInstance4 = queueNameValue4.getTextValue();
                                    serviceBusQueueMessageInstance2.setQueueName(queueNameInstance4);
                                }

                                JsonNode namespaceValue4 = serviceBusQueueMessageValue2.get("namespace");
                                if (namespaceValue4 != null && namespaceValue4 instanceof NullNode == false) {
                                    String namespaceInstance4;
                                    namespaceInstance4 = namespaceValue4.getTextValue();
                                    serviceBusQueueMessageInstance2.setNamespace(namespaceInstance4);
                                }

                                JsonNode transportTypeValue4 = serviceBusQueueMessageValue2
                                        .get("transportType");
                                if (transportTypeValue4 != null
                                        && transportTypeValue4 instanceof NullNode == false) {
                                    JobServiceBusTransportType transportTypeInstance4;
                                    transportTypeInstance4 = SchedulerClientImpl
                                            .parseJobServiceBusTransportType(
                                                    transportTypeValue4.getTextValue());
                                    serviceBusQueueMessageInstance2.setTransportType(transportTypeInstance4);
                                }

                                JsonNode authenticationValue6 = serviceBusQueueMessageValue2
                                        .get("authentication");
                                if (authenticationValue6 != null
                                        && authenticationValue6 instanceof NullNode == false) {
                                    JobServiceBusAuthentication authenticationInstance4 = new JobServiceBusAuthentication();
                                    serviceBusQueueMessageInstance2.setAuthentication(authenticationInstance4);

                                    JsonNode sasKeyNameValue4 = authenticationValue6.get("sasKeyName");
                                    if (sasKeyNameValue4 != null
                                            && sasKeyNameValue4 instanceof NullNode == false) {
                                        String sasKeyNameInstance4;
                                        sasKeyNameInstance4 = sasKeyNameValue4.getTextValue();
                                        authenticationInstance4.setSasKeyName(sasKeyNameInstance4);
                                    }

                                    JsonNode sasKeyValue4 = authenticationValue6.get("sasKey");
                                    if (sasKeyValue4 != null && sasKeyValue4 instanceof NullNode == false) {
                                        String sasKeyInstance4;
                                        sasKeyInstance4 = sasKeyValue4.getTextValue();
                                        authenticationInstance4.setSasKey(sasKeyInstance4);
                                    }

                                    JsonNode typeValue12 = authenticationValue6.get("type");
                                    if (typeValue12 != null && typeValue12 instanceof NullNode == false) {
                                        JobServiceBusAuthenticationType typeInstance12;
                                        typeInstance12 = SchedulerClientImpl
                                                .parseJobServiceBusAuthenticationType(
                                                        typeValue12.getTextValue());
                                        authenticationInstance4.setType(typeInstance12);
                                    }
                                }

                                JsonNode messageValue6 = serviceBusQueueMessageValue2.get("message");
                                if (messageValue6 != null && messageValue6 instanceof NullNode == false) {
                                    String messageInstance6;
                                    messageInstance6 = messageValue6.getTextValue();
                                    serviceBusQueueMessageInstance2.setMessage(messageInstance6);
                                }

                                JsonNode brokeredMessagePropertiesValue4 = serviceBusQueueMessageValue2
                                        .get("brokeredMessageProperties");
                                if (brokeredMessagePropertiesValue4 != null
                                        && brokeredMessagePropertiesValue4 instanceof NullNode == false) {
                                    JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance4 = new JobServiceBusBrokeredMessageProperties();
                                    serviceBusQueueMessageInstance2
                                            .setBrokeredMessageProperties(brokeredMessagePropertiesInstance4);

                                    JsonNode contentTypeValue4 = brokeredMessagePropertiesValue4
                                            .get("contentType");
                                    if (contentTypeValue4 != null
                                            && contentTypeValue4 instanceof NullNode == false) {
                                        String contentTypeInstance4;
                                        contentTypeInstance4 = contentTypeValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setContentType(contentTypeInstance4);
                                    }

                                    JsonNode correlationIdValue4 = brokeredMessagePropertiesValue4
                                            .get("correlationId");
                                    if (correlationIdValue4 != null
                                            && correlationIdValue4 instanceof NullNode == false) {
                                        String correlationIdInstance4;
                                        correlationIdInstance4 = correlationIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setCorrelationId(correlationIdInstance4);
                                    }

                                    JsonNode forcePersistenceValue4 = brokeredMessagePropertiesValue4
                                            .get("forcePersistence");
                                    if (forcePersistenceValue4 != null
                                            && forcePersistenceValue4 instanceof NullNode == false) {
                                        boolean forcePersistenceInstance4;
                                        forcePersistenceInstance4 = forcePersistenceValue4.getBooleanValue();
                                        brokeredMessagePropertiesInstance4
                                                .setForcePersistence(forcePersistenceInstance4);
                                    }

                                    JsonNode labelValue4 = brokeredMessagePropertiesValue4.get("label");
                                    if (labelValue4 != null && labelValue4 instanceof NullNode == false) {
                                        String labelInstance4;
                                        labelInstance4 = labelValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setLabel(labelInstance4);
                                    }

                                    JsonNode messageIdValue4 = brokeredMessagePropertiesValue4.get("messageId");
                                    if (messageIdValue4 != null
                                            && messageIdValue4 instanceof NullNode == false) {
                                        String messageIdInstance4;
                                        messageIdInstance4 = messageIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setMessageId(messageIdInstance4);
                                    }

                                    JsonNode partitionKeyValue4 = brokeredMessagePropertiesValue4
                                            .get("partitionKey");
                                    if (partitionKeyValue4 != null
                                            && partitionKeyValue4 instanceof NullNode == false) {
                                        String partitionKeyInstance4;
                                        partitionKeyInstance4 = partitionKeyValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setPartitionKey(partitionKeyInstance4);
                                    }

                                    JsonNode replyToValue4 = brokeredMessagePropertiesValue4.get("replyTo");
                                    if (replyToValue4 != null && replyToValue4 instanceof NullNode == false) {
                                        String replyToInstance4;
                                        replyToInstance4 = replyToValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setReplyTo(replyToInstance4);
                                    }

                                    JsonNode replyToSessionIdValue4 = brokeredMessagePropertiesValue4
                                            .get("replyToSessionId");
                                    if (replyToSessionIdValue4 != null
                                            && replyToSessionIdValue4 instanceof NullNode == false) {
                                        String replyToSessionIdInstance4;
                                        replyToSessionIdInstance4 = replyToSessionIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setReplyToSessionId(replyToSessionIdInstance4);
                                    }

                                    JsonNode scheduledEnqueueTimeUtcValue4 = brokeredMessagePropertiesValue4
                                            .get("scheduledEnqueueTimeUtc");
                                    if (scheduledEnqueueTimeUtcValue4 != null
                                            && scheduledEnqueueTimeUtcValue4 instanceof NullNode == false) {
                                        Calendar scheduledEnqueueTimeUtcInstance4;
                                        scheduledEnqueueTimeUtcInstance4 = DatatypeConverter
                                                .parseDateTime(scheduledEnqueueTimeUtcValue4.getTextValue());
                                        brokeredMessagePropertiesInstance4
                                                .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance4);
                                    }

                                    JsonNode sessionIdValue4 = brokeredMessagePropertiesValue4.get("sessionId");
                                    if (sessionIdValue4 != null
                                            && sessionIdValue4 instanceof NullNode == false) {
                                        String sessionIdInstance4;
                                        sessionIdInstance4 = sessionIdValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setSessionId(sessionIdInstance4);
                                    }

                                    JsonNode timeToLiveValue4 = brokeredMessagePropertiesValue4
                                            .get("timeToLive");
                                    if (timeToLiveValue4 != null
                                            && timeToLiveValue4 instanceof NullNode == false) {
                                        Calendar timeToLiveInstance4;
                                        timeToLiveInstance4 = DatatypeConverter
                                                .parseDateTime(timeToLiveValue4.getTextValue());
                                        brokeredMessagePropertiesInstance4.setTimeToLive(timeToLiveInstance4);
                                    }

                                    JsonNode toValue4 = brokeredMessagePropertiesValue4.get("to");
                                    if (toValue4 != null && toValue4 instanceof NullNode == false) {
                                        String toInstance4;
                                        toInstance4 = toValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4.setTo(toInstance4);
                                    }

                                    JsonNode viaPartitionKeyValue4 = brokeredMessagePropertiesValue4
                                            .get("viaPartitionKey");
                                    if (viaPartitionKeyValue4 != null
                                            && viaPartitionKeyValue4 instanceof NullNode == false) {
                                        String viaPartitionKeyInstance4;
                                        viaPartitionKeyInstance4 = viaPartitionKeyValue4.getTextValue();
                                        brokeredMessagePropertiesInstance4
                                                .setViaPartitionKey(viaPartitionKeyInstance4);
                                    }
                                }

                                JsonNode customMessagePropertiesSequenceElement4 = ((JsonNode) serviceBusQueueMessageValue2
                                        .get("customMessageProperties"));
                                if (customMessagePropertiesSequenceElement4 != null
                                        && customMessagePropertiesSequenceElement4 instanceof NullNode == false) {
                                    Iterator<Map.Entry<String, JsonNode>> itr6 = customMessagePropertiesSequenceElement4
                                            .getFields();
                                    while (itr6.hasNext()) {
                                        Map.Entry<String, JsonNode> property6 = itr6.next();
                                        String customMessagePropertiesKey4 = property6.getKey();
                                        String customMessagePropertiesValue4 = property6.getValue()
                                                .getTextValue();
                                        serviceBusQueueMessageInstance2.getCustomMessageProperties().put(
                                                customMessagePropertiesKey4, customMessagePropertiesValue4);
                                    }
                                }
                            }
                        }

                        JsonNode recurrenceValue = jobsValue.get("recurrence");
                        if (recurrenceValue != null && recurrenceValue instanceof NullNode == false) {
                            JobRecurrence recurrenceInstance = new JobRecurrence();
                            jobInstance.setRecurrence(recurrenceInstance);

                            JsonNode frequencyValue = recurrenceValue.get("frequency");
                            if (frequencyValue != null && frequencyValue instanceof NullNode == false) {
                                JobRecurrenceFrequency frequencyInstance;
                                frequencyInstance = SchedulerClientImpl
                                        .parseJobRecurrenceFrequency(frequencyValue.getTextValue());
                                recurrenceInstance.setFrequency(frequencyInstance);
                            }

                            JsonNode intervalValue = recurrenceValue.get("interval");
                            if (intervalValue != null && intervalValue instanceof NullNode == false) {
                                int intervalInstance;
                                intervalInstance = intervalValue.getIntValue();
                                recurrenceInstance.setInterval(intervalInstance);
                            }

                            JsonNode countValue = recurrenceValue.get("count");
                            if (countValue != null && countValue instanceof NullNode == false) {
                                int countInstance;
                                countInstance = countValue.getIntValue();
                                recurrenceInstance.setCount(countInstance);
                            }

                            JsonNode endTimeValue = recurrenceValue.get("endTime");
                            if (endTimeValue != null && endTimeValue instanceof NullNode == false) {
                                Calendar endTimeInstance;
                                endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue());
                                recurrenceInstance.setEndTime(endTimeInstance);
                            }

                            JsonNode scheduleValue = recurrenceValue.get("schedule");
                            if (scheduleValue != null && scheduleValue instanceof NullNode == false) {
                                JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule();
                                recurrenceInstance.setSchedule(scheduleInstance);

                                JsonNode minutesArray = scheduleValue.get("minutes");
                                if (minutesArray != null && minutesArray instanceof NullNode == false) {
                                    scheduleInstance.setMinutes(new ArrayList<Integer>());
                                    for (JsonNode minutesValue : ((ArrayNode) minutesArray)) {
                                        scheduleInstance.getMinutes().add(minutesValue.getIntValue());
                                    }
                                }

                                JsonNode hoursArray = scheduleValue.get("hours");
                                if (hoursArray != null && hoursArray instanceof NullNode == false) {
                                    scheduleInstance.setHours(new ArrayList<Integer>());
                                    for (JsonNode hoursValue : ((ArrayNode) hoursArray)) {
                                        scheduleInstance.getHours().add(hoursValue.getIntValue());
                                    }
                                }

                                JsonNode weekDaysArray = scheduleValue.get("weekDays");
                                if (weekDaysArray != null && weekDaysArray instanceof NullNode == false) {
                                    scheduleInstance.setDays(new ArrayList<JobScheduleDay>());
                                    for (JsonNode weekDaysValue : ((ArrayNode) weekDaysArray)) {
                                        scheduleInstance.getDays().add(SchedulerClientImpl
                                                .parseJobScheduleDay(weekDaysValue.getTextValue()));
                                    }
                                }

                                JsonNode monthsArray = scheduleValue.get("months");
                                if (monthsArray != null && monthsArray instanceof NullNode == false) {
                                    scheduleInstance.setMonths(new ArrayList<Integer>());
                                    for (JsonNode monthsValue : ((ArrayNode) monthsArray)) {
                                        scheduleInstance.getMonths().add(monthsValue.getIntValue());
                                    }
                                }

                                JsonNode monthDaysArray = scheduleValue.get("monthDays");
                                if (monthDaysArray != null && monthDaysArray instanceof NullNode == false) {
                                    scheduleInstance.setMonthDays(new ArrayList<Integer>());
                                    for (JsonNode monthDaysValue : ((ArrayNode) monthDaysArray)) {
                                        scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue());
                                    }
                                }

                                JsonNode monthlyOccurrencesArray = scheduleValue.get("monthlyOccurrences");
                                if (monthlyOccurrencesArray != null
                                        && monthlyOccurrencesArray instanceof NullNode == false) {
                                    scheduleInstance.setMonthlyOccurrences(
                                            new ArrayList<JobScheduleMonthlyOccurrence>());
                                    for (JsonNode monthlyOccurrencesValue : ((ArrayNode) monthlyOccurrencesArray)) {
                                        JobScheduleMonthlyOccurrence jobScheduleMonthlyOccurrenceInstance = new JobScheduleMonthlyOccurrence();
                                        scheduleInstance.getMonthlyOccurrences()
                                                .add(jobScheduleMonthlyOccurrenceInstance);

                                        JsonNode dayValue = monthlyOccurrencesValue.get("day");
                                        if (dayValue != null && dayValue instanceof NullNode == false) {
                                            JobScheduleDay dayInstance;
                                            dayInstance = SchedulerClientImpl
                                                    .parseJobScheduleDay(dayValue.getTextValue());
                                            jobScheduleMonthlyOccurrenceInstance.setDay(dayInstance);
                                        }

                                        JsonNode occurrenceValue = monthlyOccurrencesValue.get("occurrence");
                                        if (occurrenceValue != null
                                                && occurrenceValue instanceof NullNode == false) {
                                            int occurrenceInstance;
                                            occurrenceInstance = occurrenceValue.getIntValue();
                                            jobScheduleMonthlyOccurrenceInstance
                                                    .setOccurrence(occurrenceInstance);
                                        }
                                    }
                                }
                            }
                        }

                        JsonNode statusValue = jobsValue.get("status");
                        if (statusValue != null && statusValue instanceof NullNode == false) {
                            JobStatus statusInstance = new JobStatus();
                            jobInstance.setStatus(statusInstance);

                            JsonNode lastExecutionTimeValue = statusValue.get("lastExecutionTime");
                            if (lastExecutionTimeValue != null
                                    && lastExecutionTimeValue instanceof NullNode == false) {
                                Calendar lastExecutionTimeInstance;
                                lastExecutionTimeInstance = DatatypeConverter
                                        .parseDateTime(lastExecutionTimeValue.getTextValue());
                                statusInstance.setLastExecutionTime(lastExecutionTimeInstance);
                            }

                            JsonNode nextExecutionTimeValue = statusValue.get("nextExecutionTime");
                            if (nextExecutionTimeValue != null
                                    && nextExecutionTimeValue instanceof NullNode == false) {
                                Calendar nextExecutionTimeInstance;
                                nextExecutionTimeInstance = DatatypeConverter
                                        .parseDateTime(nextExecutionTimeValue.getTextValue());
                                statusInstance.setNextExecutionTime(nextExecutionTimeInstance);
                            }

                            JsonNode executionCountValue = statusValue.get("executionCount");
                            if (executionCountValue != null
                                    && executionCountValue instanceof NullNode == false) {
                                int executionCountInstance;
                                executionCountInstance = executionCountValue.getIntValue();
                                statusInstance.setExecutionCount(executionCountInstance);
                            }

                            JsonNode failureCountValue = statusValue.get("failureCount");
                            if (failureCountValue != null && failureCountValue instanceof NullNode == false) {
                                int failureCountInstance;
                                failureCountInstance = failureCountValue.getIntValue();
                                statusInstance.setFailureCount(failureCountInstance);
                            }

                            JsonNode faultedCountValue = statusValue.get("faultedCount");
                            if (faultedCountValue != null && faultedCountValue instanceof NullNode == false) {
                                int faultedCountInstance;
                                faultedCountInstance = faultedCountValue.getIntValue();
                                statusInstance.setFaultedCount(faultedCountInstance);
                            }
                        }

                        JsonNode stateValue = jobsValue.get("state");
                        if (stateValue != null && stateValue instanceof NullNode == false) {
                            JobState stateInstance;
                            stateInstance = SchedulerClientImpl.parseJobState(stateValue.getTextValue());
                            jobInstance.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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}