List of usage examples for javax.xml.bind DatatypeConverter parseDateTime
public static java.util.Calendar parseDateTime(String lexicalXSDDateTime)
Converts the string argument into a Calendar value.
From source file:com.microsoft.azure.management.websites.WebSiteOperationsImpl.java
/** * Gets a schedule configuration for site backups. * * @param resourceGroupName Required. The name of the web space. * @param webSiteName Required. The name of the web site. * @param slotName Optional. The name of the 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.//from w w w.j a v a 2 s. c o m * @throws ServiceException Thrown if an unexpected response is found. * @return Scheduled backup definition. */ @Override public WebSiteGetBackupConfigurationResponse getBackupConfiguration(String resourceGroupName, String webSiteName, String slotName) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (webSiteName == null) { throw new NullPointerException("webSiteName"); } // 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("webSiteName", webSiteName); tracingParameters.put("slotName", slotName); CloudTracing.enter(invocationId, this, "getBackupConfigurationAsync", 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.Web"; url = url + "/"; url = url + "sites"; url = url + "/"; url = url + URLEncoder.encode(webSiteName, "UTF-8"); if (slotName != null) { url = url + "/slots/" + URLEncoder.encode(slotName, "UTF-8"); } url = url + "/backup/config"; ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-06-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 httpRequest.setHeader("x-ms-version", "2014-06-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 WebSiteGetBackupConfigurationResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetBackupConfigurationResponse(); 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) { BackupScheduleRequestEnvelope backupScheduleInstance = new BackupScheduleRequestEnvelope(); result.setBackupSchedule(backupScheduleInstance); JsonNode propertiesValue = responseDoc.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { BackupScheduleRequestResponse propertiesInstance = new BackupScheduleRequestResponse(); backupScheduleInstance.setProperties(propertiesInstance); JsonNode enabledValue = propertiesValue.get("enabled"); if (enabledValue != null && enabledValue instanceof NullNode == false) { boolean enabledInstance; enabledInstance = enabledValue.getBooleanValue(); propertiesInstance.setEnabled(enabledInstance); } JsonNode nameValue = propertiesValue.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); propertiesInstance.setName(nameInstance); } JsonNode storageAccountUrlValue = propertiesValue.get("storageAccountUrl"); if (storageAccountUrlValue != null && storageAccountUrlValue instanceof NullNode == false) { String storageAccountUrlInstance; storageAccountUrlInstance = storageAccountUrlValue.getTextValue(); propertiesInstance.setStorageAccountUrl(storageAccountUrlInstance); } JsonNode backupScheduleValue = propertiesValue.get("backupSchedule"); if (backupScheduleValue != null && backupScheduleValue instanceof NullNode == false) { BackupSchedule backupScheduleInstance2 = new BackupSchedule(); propertiesInstance.setBackupSchedule(backupScheduleInstance2); JsonNode frequencyIntervalValue = backupScheduleValue.get("frequencyInterval"); if (frequencyIntervalValue != null && frequencyIntervalValue instanceof NullNode == false) { int frequencyIntervalInstance; frequencyIntervalInstance = frequencyIntervalValue.getIntValue(); backupScheduleInstance2.setFrequencyInterval(frequencyIntervalInstance); } JsonNode frequencyUnitValue = backupScheduleValue.get("frequencyUnit"); if (frequencyUnitValue != null && frequencyUnitValue instanceof NullNode == false) { FrequencyUnit frequencyUnitInstance; frequencyUnitInstance = Enum.valueOf(FrequencyUnit.class, frequencyUnitValue.getTextValue()); backupScheduleInstance2.setFrequencyUnit(frequencyUnitInstance); } JsonNode keepAtLeastOneBackupValue = backupScheduleValue.get("keepAtLeastOneBackup"); if (keepAtLeastOneBackupValue != null && keepAtLeastOneBackupValue instanceof NullNode == false) { boolean keepAtLeastOneBackupInstance; keepAtLeastOneBackupInstance = keepAtLeastOneBackupValue.getBooleanValue(); backupScheduleInstance2.setKeepAtLeastOneBackup(keepAtLeastOneBackupInstance); } JsonNode lastExecutionTimeValue = backupScheduleValue.get("lastExecutionTime"); if (lastExecutionTimeValue != null && lastExecutionTimeValue instanceof NullNode == false) { Calendar lastExecutionTimeInstance; lastExecutionTimeInstance = DatatypeConverter .parseDateTime(lastExecutionTimeValue.getTextValue()); backupScheduleInstance2.setLastExecutionTime(lastExecutionTimeInstance); } JsonNode retentionPeriodInDaysValue = backupScheduleValue.get("retentionPeriodInDays"); if (retentionPeriodInDaysValue != null && retentionPeriodInDaysValue instanceof NullNode == false) { int retentionPeriodInDaysInstance; retentionPeriodInDaysInstance = retentionPeriodInDaysValue.getIntValue(); backupScheduleInstance2.setRetentionPeriodInDays(retentionPeriodInDaysInstance); } JsonNode startTimeValue = backupScheduleValue.get("startTime"); if (startTimeValue != null && startTimeValue instanceof NullNode == false) { Calendar startTimeInstance; startTimeInstance = DatatypeConverter.parseDateTime(startTimeValue.getTextValue()); backupScheduleInstance2.setStartTime(startTimeInstance); } } JsonNode databasesArray = propertiesValue.get("databases"); if (databasesArray != null && databasesArray instanceof NullNode == false) { for (JsonNode databasesValue : ((ArrayNode) databasesArray)) { DatabaseBackupSetting databaseBackupSettingInstance = new DatabaseBackupSetting(); propertiesInstance.getDatabases().add(databaseBackupSettingInstance); JsonNode connectionStringValue = databasesValue.get("connectionString"); if (connectionStringValue != null && connectionStringValue instanceof NullNode == false) { String connectionStringInstance; connectionStringInstance = connectionStringValue.getTextValue(); databaseBackupSettingInstance.setConnectionString(connectionStringInstance); } JsonNode connectionStringNameValue = databasesValue.get("connectionStringName"); if (connectionStringNameValue != null && connectionStringNameValue instanceof NullNode == false) { String connectionStringNameInstance; connectionStringNameInstance = connectionStringNameValue.getTextValue(); databaseBackupSettingInstance .setConnectionStringName(connectionStringNameInstance); } JsonNode databaseTypeValue = databasesValue.get("databaseType"); if (databaseTypeValue != null && databaseTypeValue instanceof NullNode == false) { String databaseTypeInstance; databaseTypeInstance = databaseTypeValue.getTextValue(); databaseBackupSettingInstance.setDatabaseType(databaseTypeInstance); } JsonNode nameValue2 = databasesValue.get("name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); databaseBackupSettingInstance.setName(nameInstance2); } } } } JsonNode idValue = responseDoc.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); backupScheduleInstance.setId(idInstance); } JsonNode nameValue3 = responseDoc.get("name"); if (nameValue3 != null && nameValue3 instanceof NullNode == false) { String nameInstance3; nameInstance3 = nameValue3.getTextValue(); backupScheduleInstance.setName(nameInstance3); } JsonNode locationValue = responseDoc.get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); backupScheduleInstance.setLocation(locationInstance); } JsonNode tagsSequenceElement = ((JsonNode) responseDoc.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(); backupScheduleInstance.getTags().put(tagsKey, tagsValue); } } JsonNode typeValue = responseDoc.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); backupScheduleInstance.setType(typeInstance); } } } 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.websites.WebSiteOperationsImpl.java
/** * You can retrieve historical usage metrics for a site by issuing an HTTP * GET request. (see/*from w ww . ja v a 2 s .com*/ * http://msdn.microsoft.com/en-us/library/windowsazure/dn166964.aspx for * more information) * * @param webSpaceName Required. The name of the web space. * @param webSiteName Required. The name of the web site. * @param parameters Required. Parameters supplied to the Get Historical * Usage Metrics Web Site 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 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. * @return The Get Historical Usage Metrics Web Site operation response. */ @Override public WebSiteGetHistoricalUsageMetricsResponse getHistoricalUsageMetrics(String webSpaceName, String webSiteName, WebSiteGetHistoricalUsageMetricsParameters parameters) throws IOException, ServiceException, ParserConfigurationException, SAXException { // Validate if (webSpaceName == null) { throw new NullPointerException("webSpaceName"); } if (webSiteName == null) { throw new NullPointerException("webSiteName"); } 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("webSpaceName", webSpaceName); tracingParameters.put("webSiteName", webSiteName); tracingParameters.put("parameters", parameters); CloudTracing.enter(invocationId, this, "getHistoricalUsageMetricsAsync", 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/WebSpaces/"; url = url + URLEncoder.encode(webSpaceName, "UTF-8"); url = url + "/sites/"; url = url + URLEncoder.encode(webSiteName, "UTF-8"); url = url + "/metrics"; ArrayList<String> queryParameters = new ArrayList<String>(); if (parameters.getMetricNames() != null && parameters.getMetricNames().size() > 0) { queryParameters.add("names=" + URLEncoder.encode(CollectionStringBuilder.join(parameters.getMetricNames(), ","), "UTF-8")); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); if (parameters.getStartTime() != null) { queryParameters.add("StartTime=" + URLEncoder.encode(simpleDateFormat.format(parameters.getStartTime().getTime()), "UTF-8")); } SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); if (parameters.getEndTime() != null) { queryParameters.add("EndTime=" + URLEncoder.encode(simpleDateFormat2.format(parameters.getEndTime().getTime()), "UTF-8")); } if (parameters.getTimeGrain() != null) { queryParameters.add("timeGrain=" + URLEncoder.encode(parameters.getTimeGrain(), "UTF-8")); } queryParameters.add("details=" + URLEncoder .encode(Boolean.toString(parameters.isIncludeInstanceBreakdown()).toLowerCase(), "UTF-8")); queryParameters.add( "slotView=" + URLEncoder.encode(Boolean.toString(parameters.isSlotView()).toLowerCase(), "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", "2014-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 WebSiteGetHistoricalUsageMetricsResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetHistoricalUsageMetricsResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent)); Element metricResponsesElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "MetricResponses"); if (metricResponsesElement != null) { if (metricResponsesElement != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(metricResponsesElement, "http://schemas.microsoft.com/windowsazure", "MetricResponse") .size(); i1 = i1 + 1) { org.w3c.dom.Element usageMetricsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(metricResponsesElement, "http://schemas.microsoft.com/windowsazure", "MetricResponse") .get(i1)); HistoricalUsageMetric metricResponseInstance = new HistoricalUsageMetric(); result.getUsageMetrics().add(metricResponseInstance); Element codeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Code"); if (codeElement != null) { String codeInstance; codeInstance = codeElement.getTextContent(); metricResponseInstance.setCode(codeInstance); } Element dataElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Data"); if (dataElement != null) { HistoricalUsageMetricData dataInstance = new HistoricalUsageMetricData(); metricResponseInstance.setData(dataInstance); Element displayNameElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "DisplayName"); if (displayNameElement != null) { String displayNameInstance; displayNameInstance = displayNameElement.getTextContent(); dataInstance.setDisplayName(displayNameInstance); } Element endTimeElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "EndTime"); if (endTimeElement != null) { Calendar endTimeInstance; endTimeInstance = DatatypeConverter .parseDateTime(endTimeElement.getTextContent()); dataInstance.setEndTime(endTimeInstance); } Element nameElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "Name"); if (nameElement != null) { String nameInstance; nameInstance = nameElement.getTextContent(); dataInstance.setName(nameInstance); } Element primaryAggregationTypeElement = XmlUtility.getElementByTagNameNS( dataElement, "http://schemas.microsoft.com/windowsazure", "PrimaryAggregationType"); if (primaryAggregationTypeElement != null) { String primaryAggregationTypeInstance; primaryAggregationTypeInstance = primaryAggregationTypeElement.getTextContent(); dataInstance.setPrimaryAggregationType(primaryAggregationTypeInstance); } Element startTimeElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "StartTime"); if (startTimeElement != null) { Calendar startTimeInstance; startTimeInstance = DatatypeConverter .parseDateTime(startTimeElement.getTextContent()); dataInstance.setStartTime(startTimeInstance); } Element timeGrainElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "TimeGrain"); if (timeGrainElement != null) { String timeGrainInstance; timeGrainInstance = timeGrainElement.getTextContent(); dataInstance.setTimeGrain(timeGrainInstance); } Element unitElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "Unit"); if (unitElement != null) { String unitInstance; unitInstance = unitElement.getTextContent(); dataInstance.setUnit(unitInstance); } Element valuesSequenceElement = XmlUtility.getElementByTagNameNS(dataElement, "http://schemas.microsoft.com/windowsazure", "Values"); if (valuesSequenceElement != null) { for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(valuesSequenceElement, "http://schemas.microsoft.com/windowsazure", "MetricSample") .size(); i2 = i2 + 1) { org.w3c.dom.Element valuesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(valuesSequenceElement, "http://schemas.microsoft.com/windowsazure", "MetricSample") .get(i2)); HistoricalUsageMetricSample metricSampleInstance = new HistoricalUsageMetricSample(); dataInstance.getValues().add(metricSampleInstance); Element countElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Count"); if (countElement != null) { int countInstance; countInstance = DatatypeConverter .parseInt(countElement.getTextContent()); metricSampleInstance.setCount(countInstance); } Element maximumElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Maximum"); if (maximumElement != null) { boolean isNil = false; Attr nilAttribute = maximumElement.getAttributeNodeNS( "http://www.w3.org/2001/XMLSchema-instance", "nil"); if (nilAttribute != null) { isNil = "true".equals(nilAttribute.getValue()); } if (isNil == false) { String maximumInstance; maximumInstance = maximumElement.getTextContent(); metricSampleInstance.setMaximum(maximumInstance); } } Element minimumElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Minimum"); if (minimumElement != null) { boolean isNil2 = false; Attr nilAttribute2 = minimumElement.getAttributeNodeNS( "http://www.w3.org/2001/XMLSchema-instance", "nil"); if (nilAttribute2 != null) { isNil2 = "true".equals(nilAttribute2.getValue()); } if (isNil2 == false) { String minimumInstance; minimumInstance = minimumElement.getTextContent(); metricSampleInstance.setMinimum(minimumInstance); } } Element timeCreatedElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "TimeCreated"); if (timeCreatedElement != null) { Calendar timeCreatedInstance; timeCreatedInstance = DatatypeConverter .parseDateTime(timeCreatedElement.getTextContent()); metricSampleInstance.setTimeCreated(timeCreatedInstance); } Element totalElement = XmlUtility.getElementByTagNameNS(valuesElement, "http://schemas.microsoft.com/windowsazure", "Total"); if (totalElement != null) { String totalInstance; totalInstance = totalElement.getTextContent(); metricSampleInstance.setTotal(totalInstance); } Element instanceNameElement = XmlUtility.getElementByTagNameNS( valuesElement, "http://schemas.microsoft.com/windowsazure", "InstanceName"); if (instanceNameElement != null) { String instanceNameInstance; instanceNameInstance = instanceNameElement.getTextContent(); metricSampleInstance.setInstanceName(instanceNameInstance); } } } } Element messageElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Message"); if (messageElement != null) { String messageInstance; messageInstance = messageElement.getTextContent(); metricResponseInstance.setMessage(messageInstance); } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
From source file:com.microsoft.azure.management.websites.WebSiteOperationsImpl.java
/** * You can retrieve the config settings for a web site by issuing an HTTP * GET request, or update them by using HTTP PUT with a request body that * contains the settings to be updated. (see * http://msdn.microsoft.com/en-us/library/windowsazure/dn166985.aspx for * more information)/* w w w. j a v a 2 s . c o m*/ * * @param resourceGroupName Required. The name of the resource group. * @param webSiteName Required. The name of the web site. * @param slotName Optional. The name of the slot. * @param parameters Optional. Additional parameters. * @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 Config for the website. */ @Override public WebSiteGetConfigurationResult getConfiguration(String resourceGroupName, String webSiteName, String slotName, WebSiteGetConfigurationParameters parameters) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (webSiteName == null) { throw new NullPointerException("webSiteName"); } // 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("webSiteName", webSiteName); tracingParameters.put("slotName", slotName); tracingParameters.put("parameters", parameters); CloudTracing.enter(invocationId, this, "getConfigurationAsync", 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.Web"; url = url + "/"; url = url + "sites"; url = url + "/"; url = url + URLEncoder.encode(webSiteName, "UTF-8"); if (slotName != null) { url = url + "/slots/" + URLEncoder.encode(slotName, "UTF-8"); } url = url + "/config/web"; ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-06-01"); if (parameters != null && parameters.getPropertiesToInclude() != null && parameters.getPropertiesToInclude().size() > 0) { queryParameters.add("propertiesToInclude=" + URLEncoder .encode(CollectionStringBuilder.join(parameters.getPropertiesToInclude(), ","), "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 WebSiteGetConfigurationResult result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetConfigurationResult(); 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) { WebSiteConfigurationEnvelope resourceInstance = new WebSiteConfigurationEnvelope(); result.setResource(resourceInstance); JsonNode propertiesValue = responseDoc.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { WebSiteConfiguration propertiesInstance = new WebSiteConfiguration(); resourceInstance.setProperties(propertiesInstance); JsonNode appSettingsSequenceElement = ((JsonNode) propertiesValue.get("appSettings")); if (appSettingsSequenceElement != null && appSettingsSequenceElement instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr = appSettingsSequenceElement.getFields(); while (itr.hasNext()) { Map.Entry<String, JsonNode> property = itr.next(); String appSettingsKey = property.getKey(); String appSettingsValue = property.getValue().getTextValue(); propertiesInstance.getAppSettings().put(appSettingsKey, appSettingsValue); } } JsonNode connectionStringsArray = propertiesValue.get("connectionStrings"); if (connectionStringsArray != null && connectionStringsArray instanceof NullNode == false) { for (JsonNode connectionStringsValue : ((ArrayNode) connectionStringsArray)) { ConnectionStringInfo connStringInfoInstance = new ConnectionStringInfo(); propertiesInstance.getConnectionStrings().add(connStringInfoInstance); JsonNode connectionStringValue = connectionStringsValue.get("connectionString"); if (connectionStringValue != null && connectionStringValue instanceof NullNode == false) { String connectionStringInstance; connectionStringInstance = connectionStringValue.getTextValue(); connStringInfoInstance.setConnectionString(connectionStringInstance); } JsonNode nameValue = connectionStringsValue.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); connStringInfoInstance.setName(nameInstance); } JsonNode typeValue = connectionStringsValue.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { DatabaseServerType typeInstance; typeInstance = Enum.valueOf(DatabaseServerType.class, typeValue.getTextValue()); connStringInfoInstance.setType(typeInstance); } } } JsonNode defaultDocumentsArray = propertiesValue.get("defaultDocuments"); if (defaultDocumentsArray != null && defaultDocumentsArray instanceof NullNode == false) { for (JsonNode defaultDocumentsValue : ((ArrayNode) defaultDocumentsArray)) { propertiesInstance.getDefaultDocuments().add(defaultDocumentsValue.getTextValue()); } } JsonNode detailedErrorLoggingEnabledValue = propertiesValue .get("detailedErrorLoggingEnabled"); if (detailedErrorLoggingEnabledValue != null && detailedErrorLoggingEnabledValue instanceof NullNode == false) { boolean detailedErrorLoggingEnabledInstance; detailedErrorLoggingEnabledInstance = detailedErrorLoggingEnabledValue .getBooleanValue(); propertiesInstance.setDetailedErrorLoggingEnabled(detailedErrorLoggingEnabledInstance); } JsonNode documentRootValue = propertiesValue.get("documentRoot"); if (documentRootValue != null && documentRootValue instanceof NullNode == false) { String documentRootInstance; documentRootInstance = documentRootValue.getTextValue(); propertiesInstance.setDocumentRoot(documentRootInstance); } JsonNode handlerMappingsArray = propertiesValue.get("handlerMappings"); if (handlerMappingsArray != null && handlerMappingsArray instanceof NullNode == false) { for (JsonNode handlerMappingsValue : ((ArrayNode) handlerMappingsArray)) { WebSiteConfiguration.HandlerMapping handlerMappingInstance = new WebSiteConfiguration.HandlerMapping(); propertiesInstance.getHandlerMappings().add(handlerMappingInstance); JsonNode argumentsValue = handlerMappingsValue.get("arguments"); if (argumentsValue != null && argumentsValue instanceof NullNode == false) { String argumentsInstance; argumentsInstance = argumentsValue.getTextValue(); handlerMappingInstance.setArguments(argumentsInstance); } JsonNode extensionValue = handlerMappingsValue.get("extension"); if (extensionValue != null && extensionValue instanceof NullNode == false) { String extensionInstance; extensionInstance = extensionValue.getTextValue(); handlerMappingInstance.setExtension(extensionInstance); } JsonNode scriptProcessorValue = handlerMappingsValue.get("scriptProcessor"); if (scriptProcessorValue != null && scriptProcessorValue instanceof NullNode == false) { String scriptProcessorInstance; scriptProcessorInstance = scriptProcessorValue.getTextValue(); handlerMappingInstance.setScriptProcessor(scriptProcessorInstance); } } } JsonNode httpLoggingEnabledValue = propertiesValue.get("httpLoggingEnabled"); if (httpLoggingEnabledValue != null && httpLoggingEnabledValue instanceof NullNode == false) { boolean httpLoggingEnabledInstance; httpLoggingEnabledInstance = httpLoggingEnabledValue.getBooleanValue(); propertiesInstance.setHttpLoggingEnabled(httpLoggingEnabledInstance); } JsonNode logsDirectorySizeLimitValue = propertiesValue.get("logsDirectorySizeLimit"); if (logsDirectorySizeLimitValue != null && logsDirectorySizeLimitValue instanceof NullNode == false) { int logsDirectorySizeLimitInstance; logsDirectorySizeLimitInstance = logsDirectorySizeLimitValue.getIntValue(); propertiesInstance.setLogsDirectorySizeLimit(logsDirectorySizeLimitInstance); } JsonNode managedPipelineModeValue = propertiesValue.get("managedPipelineMode"); if (managedPipelineModeValue != null && managedPipelineModeValue instanceof NullNode == false) { ManagedPipelineMode managedPipelineModeInstance; managedPipelineModeInstance = Enum.valueOf(ManagedPipelineMode.class, managedPipelineModeValue.getTextValue()); propertiesInstance.setManagedPipelineMode(managedPipelineModeInstance); } JsonNode metadataSequenceElement = ((JsonNode) propertiesValue.get("metadata")); if (metadataSequenceElement != null && metadataSequenceElement instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr2 = metadataSequenceElement.getFields(); while (itr2.hasNext()) { Map.Entry<String, JsonNode> property2 = itr2.next(); String metadataKey = property2.getKey(); String metadataValue = property2.getValue().getTextValue(); propertiesInstance.getMetadata().put(metadataKey, metadataValue); } } JsonNode netFrameworkVersionValue = propertiesValue.get("netFrameworkVersion"); if (netFrameworkVersionValue != null && netFrameworkVersionValue instanceof NullNode == false) { String netFrameworkVersionInstance; netFrameworkVersionInstance = netFrameworkVersionValue.getTextValue(); propertiesInstance.setNetFrameworkVersion(netFrameworkVersionInstance); } JsonNode numberOfWorkersValue = propertiesValue.get("numberOfWorkers"); if (numberOfWorkersValue != null && numberOfWorkersValue instanceof NullNode == false) { int numberOfWorkersInstance; numberOfWorkersInstance = numberOfWorkersValue.getIntValue(); propertiesInstance.setNumberOfWorkers(numberOfWorkersInstance); } JsonNode phpVersionValue = propertiesValue.get("phpVersion"); if (phpVersionValue != null && phpVersionValue instanceof NullNode == false) { String phpVersionInstance; phpVersionInstance = phpVersionValue.getTextValue(); propertiesInstance.setPhpVersion(phpVersionInstance); } JsonNode pythonVersionValue = propertiesValue.get("pythonVersion"); if (pythonVersionValue != null && pythonVersionValue instanceof NullNode == false) { String pythonVersionInstance; pythonVersionInstance = pythonVersionValue.getTextValue(); propertiesInstance.setPythonVersion(pythonVersionInstance); } JsonNode publishingPasswordValue = propertiesValue.get("publishingPassword"); if (publishingPasswordValue != null && publishingPasswordValue instanceof NullNode == false) { String publishingPasswordInstance; publishingPasswordInstance = publishingPasswordValue.getTextValue(); propertiesInstance.setPublishingPassword(publishingPasswordInstance); } JsonNode publishingUsernameValue = propertiesValue.get("publishingUsername"); if (publishingUsernameValue != null && publishingUsernameValue instanceof NullNode == false) { String publishingUsernameInstance; publishingUsernameInstance = publishingUsernameValue.getTextValue(); propertiesInstance.setPublishingUserName(publishingUsernameInstance); } JsonNode remoteDebuggingEnabledValue = propertiesValue.get("RemoteDebuggingEnabled"); if (remoteDebuggingEnabledValue != null && remoteDebuggingEnabledValue instanceof NullNode == false) { boolean remoteDebuggingEnabledInstance; remoteDebuggingEnabledInstance = remoteDebuggingEnabledValue.getBooleanValue(); propertiesInstance.setRemoteDebuggingEnabled(remoteDebuggingEnabledInstance); } JsonNode remoteDebuggingVersionValue = propertiesValue.get("remoteDebuggingVersion"); if (remoteDebuggingVersionValue != null && remoteDebuggingVersionValue instanceof NullNode == false) { RemoteDebuggingVersion remoteDebuggingVersionInstance; remoteDebuggingVersionInstance = Enum.valueOf(RemoteDebuggingVersion.class, remoteDebuggingVersionValue.getTextValue()); propertiesInstance.setRemoteDebuggingVersion(remoteDebuggingVersionInstance); } JsonNode requestTracingEnabledValue = propertiesValue.get("requestTracingEnabled"); if (requestTracingEnabledValue != null && requestTracingEnabledValue instanceof NullNode == false) { boolean requestTracingEnabledInstance; requestTracingEnabledInstance = requestTracingEnabledValue.getBooleanValue(); propertiesInstance.setRequestTracingEnabled(requestTracingEnabledInstance); } JsonNode requestTracingExpirationTimeValue = propertiesValue .get("requestTracingExpirationTime"); if (requestTracingExpirationTimeValue != null && requestTracingExpirationTimeValue instanceof NullNode == false) { Calendar requestTracingExpirationTimeInstance; requestTracingExpirationTimeInstance = DatatypeConverter .parseDateTime(requestTracingExpirationTimeValue.getTextValue()); propertiesInstance .setRequestTracingExpirationTime(requestTracingExpirationTimeInstance); } JsonNode scmTypeValue = propertiesValue.get("scmType"); if (scmTypeValue != null && scmTypeValue instanceof NullNode == false) { String scmTypeInstance; scmTypeInstance = scmTypeValue.getTextValue(); propertiesInstance.setScmType(scmTypeInstance); } JsonNode autoSwapSlotNameValue = propertiesValue.get("autoSwapSlotName"); if (autoSwapSlotNameValue != null && autoSwapSlotNameValue instanceof NullNode == false) { String autoSwapSlotNameInstance; autoSwapSlotNameInstance = autoSwapSlotNameValue.getTextValue(); propertiesInstance.setAutoSwapSlotName(autoSwapSlotNameInstance); } JsonNode use32BitWorkerProcessValue = propertiesValue.get("use32BitWorkerProcess"); if (use32BitWorkerProcessValue != null && use32BitWorkerProcessValue instanceof NullNode == false) { boolean use32BitWorkerProcessInstance; use32BitWorkerProcessInstance = use32BitWorkerProcessValue.getBooleanValue(); propertiesInstance.setUse32BitWorkerProcess(use32BitWorkerProcessInstance); } JsonNode webSocketsEnabledValue = propertiesValue.get("webSocketsEnabled"); if (webSocketsEnabledValue != null && webSocketsEnabledValue instanceof NullNode == false) { boolean webSocketsEnabledInstance; webSocketsEnabledInstance = webSocketsEnabledValue.getBooleanValue(); propertiesInstance.setWebSocketsEnabled(webSocketsEnabledInstance); } JsonNode limitsValue = propertiesValue.get("limits"); if (limitsValue != null && limitsValue instanceof NullNode == false) { SiteLimits limitsInstance = new SiteLimits(); propertiesInstance.setLimits(limitsInstance); JsonNode maxPercentageCpuValue = limitsValue.get("maxPercentageCpu"); if (maxPercentageCpuValue != null && maxPercentageCpuValue instanceof NullNode == false) { double maxPercentageCpuInstance; maxPercentageCpuInstance = maxPercentageCpuValue.getDoubleValue(); limitsInstance.setMaxPercentageCpu(maxPercentageCpuInstance); } JsonNode maxMemoryInMbValue = limitsValue.get("maxMemoryInMb"); if (maxMemoryInMbValue != null && maxMemoryInMbValue instanceof NullNode == false) { long maxMemoryInMbInstance; maxMemoryInMbInstance = maxMemoryInMbValue.getLongValue(); limitsInstance.setMaxMemoryInMb(maxMemoryInMbInstance); } JsonNode maxDiskSizeInMbValue = limitsValue.get("maxDiskSizeInMb"); if (maxDiskSizeInMbValue != null && maxDiskSizeInMbValue instanceof NullNode == false) { long maxDiskSizeInMbInstance; maxDiskSizeInMbInstance = maxDiskSizeInMbValue.getLongValue(); limitsInstance.setMaxDiskSizeInMb(maxDiskSizeInMbInstance); } } } JsonNode idValue = responseDoc.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); resourceInstance.setId(idInstance); } JsonNode nameValue2 = responseDoc.get("name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); resourceInstance.setName(nameInstance2); } JsonNode locationValue = responseDoc.get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); resourceInstance.setLocation(locationInstance); } JsonNode tagsSequenceElement = ((JsonNode) responseDoc.get("tags")); if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr3 = tagsSequenceElement.getFields(); while (itr3.hasNext()) { Map.Entry<String, JsonNode> property3 = itr3.next(); String tagsKey = property3.getKey(); String tagsValue = property3.getValue().getTextValue(); resourceInstance.getTags().put(tagsKey, tagsValue); } } JsonNode typeValue2 = responseDoc.get("type"); if (typeValue2 != null && typeValue2 instanceof NullNode == false) { String typeInstance2; typeInstance2 = typeValue2.getTextValue(); resourceInstance.setType(typeInstance2); } } } 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.notificationhubs.NotificationHubOperationsImpl.java
/** * Creates a new NotificationHub in a namespace. (see * http://msdn.microsoft.com/en-us/library/windowsazure/jj856303.aspx for * more information)/*from w w w.ja v a2 s. c o m*/ * * @param resourceGroupName Required. The name of the resource group. * @param namespaceName Required. The namespace name. * @param notificationHubName Required. The notification hub name. * @param parameters Required. Parameters supplied to the create a Namespace * Resource. * @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 Response of the CreateOrUpdate operation on the NotificationHub */ @Override public NotificationHubCreateOrUpdateResponse update(String resourceGroupName, String namespaceName, String notificationHubName, NotificationHubCreateOrUpdateParameters parameters) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (namespaceName == null) { throw new NullPointerException("namespaceName"); } if (notificationHubName == null) { throw new NullPointerException("notificationHubName"); } if (parameters == null) { throw new NullPointerException("parameters"); } if (parameters.getLocation() == null) { throw new NullPointerException("parameters.Location"); } if (parameters.getProperties() == null) { throw new NullPointerException("parameters.Properties"); } // 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("namespaceName", namespaceName); tracingParameters.put("notificationHubName", notificationHubName); tracingParameters.put("parameters", parameters); CloudTracing.enter(invocationId, this, "updateAsync", 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.NotificationHubs"; url = url + "/namespaces/"; url = url + URLEncoder.encode(namespaceName, "UTF-8"); url = url + "/notificationHubs/"; url = url + URLEncoder.encode(notificationHubName, "UTF-8"); ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-09-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 HttpPut httpRequest = new HttpPut(url); // Set Headers httpRequest.setHeader("Content-Type", "application/json"); httpRequest.setHeader("if-match", "*"); // Serialize Request String requestContent = null; JsonNode requestDoc = null; ObjectMapper objectMapper = new ObjectMapper(); ObjectNode notificationHubCreateOrUpdateParametersValue = objectMapper.createObjectNode(); requestDoc = notificationHubCreateOrUpdateParametersValue; ((ObjectNode) notificationHubCreateOrUpdateParametersValue).put("location", parameters.getLocation()); if (parameters.getTags() != null) { if (parameters.getTags() instanceof LazyCollection == false || ((LazyCollection) parameters.getTags()).isInitialized()) { ObjectNode tagsDictionary = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry : parameters.getTags().entrySet()) { String tagsKey = entry.getKey(); String tagsValue = entry.getValue(); ((ObjectNode) tagsDictionary).put(tagsKey, tagsValue); } ((ObjectNode) notificationHubCreateOrUpdateParametersValue).put("tags", tagsDictionary); } } ObjectNode propertiesValue = objectMapper.createObjectNode(); ((ObjectNode) notificationHubCreateOrUpdateParametersValue).put("properties", propertiesValue); if (parameters.getProperties().getName() != null) { ((ObjectNode) propertiesValue).put("name", parameters.getProperties().getName()); } if (parameters.getProperties().getRegistrationTtl() != null) { ((ObjectNode) propertiesValue).put("registrationTtl", parameters.getProperties().getRegistrationTtl()); } if (parameters.getProperties().getAuthorizationRules() != null) { if (parameters.getProperties().getAuthorizationRules() instanceof LazyCollection == false || ((LazyCollection) parameters.getProperties().getAuthorizationRules()).isInitialized()) { ArrayNode authorizationRulesArray = objectMapper.createArrayNode(); for (SharedAccessAuthorizationRuleProperties authorizationRulesItem : parameters.getProperties() .getAuthorizationRules()) { if (authorizationRulesItem.getPrimaryKey() != null) { requestDoc = authorizationRulesItem.getPrimaryKey(); } if (authorizationRulesItem.getSecondaryKey() != null) { requestDoc = authorizationRulesItem.getSecondaryKey(); } if (authorizationRulesItem.getKeyName() != null) { requestDoc = authorizationRulesItem.getKeyName(); } if (authorizationRulesItem.getClaimType() != null) { requestDoc = authorizationRulesItem.getClaimType(); } if (authorizationRulesItem.getClaimValue() != null) { requestDoc = authorizationRulesItem.getClaimValue(); } if (authorizationRulesItem.getRights() != null) { ArrayNode rightsArray = objectMapper.createArrayNode(); for (AccessRights rightsItem : authorizationRulesItem.getRights()) { rightsArray.add(rightsItem.toString()); } requestDoc = rightsArray; } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); requestDoc = simpleDateFormat.format(authorizationRulesItem.getCreatedTime().getTime()); SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); requestDoc = simpleDateFormat2.format(authorizationRulesItem.getModifiedTime().getTime()); requestDoc = authorizationRulesItem.getRevision(); } ((ObjectNode) propertiesValue).put("authorizationRules", authorizationRulesArray); } } if (parameters.getProperties().getApnsCredential() != null) { ObjectNode apnsCredentialValue = objectMapper.createObjectNode(); ((ObjectNode) propertiesValue).put("apnsCredential", apnsCredentialValue); if (parameters.getProperties().getApnsCredential().getProperties() != null) { ObjectNode propertiesValue2 = objectMapper.createObjectNode(); ((ObjectNode) apnsCredentialValue).put("properties", propertiesValue2); if (parameters.getProperties().getApnsCredential().getProperties().getApnsCertificate() != null) { ((ObjectNode) propertiesValue2).put("apnsCertificate", parameters.getProperties().getApnsCredential().getProperties().getApnsCertificate()); } if (parameters.getProperties().getApnsCredential().getProperties().getCertificateKey() != null) { ((ObjectNode) propertiesValue2).put("certificateKey", parameters.getProperties().getApnsCredential().getProperties().getCertificateKey()); } if (parameters.getProperties().getApnsCredential().getProperties().getEndpoint() != null) { ((ObjectNode) propertiesValue2).put("endpoint", parameters.getProperties().getApnsCredential().getProperties().getEndpoint()); } if (parameters.getProperties().getApnsCredential().getProperties().getThumbprint() != null) { ((ObjectNode) propertiesValue2).put("thumbprint", parameters.getProperties().getApnsCredential().getProperties().getThumbprint()); } } } if (parameters.getProperties().getWnsCredential() != null) { ObjectNode wnsCredentialValue = objectMapper.createObjectNode(); ((ObjectNode) propertiesValue).put("wnsCredential", wnsCredentialValue); if (parameters.getProperties().getWnsCredential().getProperties() != null) { ObjectNode propertiesValue3 = objectMapper.createObjectNode(); ((ObjectNode) wnsCredentialValue).put("properties", propertiesValue3); if (parameters.getProperties().getWnsCredential().getProperties().getPackageSid() != null) { ((ObjectNode) propertiesValue3).put("packageSid", parameters.getProperties().getWnsCredential().getProperties().getPackageSid()); } if (parameters.getProperties().getWnsCredential().getProperties().getSecretKey() != null) { ((ObjectNode) propertiesValue3).put("secretKey", parameters.getProperties().getWnsCredential().getProperties().getSecretKey()); } if (parameters.getProperties().getWnsCredential().getProperties() .getWindowsLiveEndpoint() != null) { ((ObjectNode) propertiesValue3).put("windowsLiveEndpoint", parameters.getProperties().getWnsCredential().getProperties().getWindowsLiveEndpoint()); } } } if (parameters.getProperties().getGcmCredential() != null) { ObjectNode gcmCredentialValue = objectMapper.createObjectNode(); ((ObjectNode) propertiesValue).put("gcmCredential", gcmCredentialValue); if (parameters.getProperties().getGcmCredential().getProperties() != null) { ObjectNode propertiesValue4 = objectMapper.createObjectNode(); ((ObjectNode) gcmCredentialValue).put("properties", propertiesValue4); if (parameters.getProperties().getGcmCredential().getProperties().getGcmEndpoint() != null) { ((ObjectNode) propertiesValue4).put("gcmEndpoint", parameters.getProperties().getGcmCredential().getProperties().getGcmEndpoint()); } if (parameters.getProperties().getGcmCredential().getProperties().getGoogleApiKey() != null) { ((ObjectNode) propertiesValue4).put("googleApiKey", parameters.getProperties().getGcmCredential().getProperties().getGoogleApiKey()); } } } if (parameters.getProperties().getMpnsCredential() != null) { ObjectNode mpnsCredentialValue = objectMapper.createObjectNode(); ((ObjectNode) propertiesValue).put("mpnsCredential", mpnsCredentialValue); if (parameters.getProperties().getMpnsCredential().getProperties() != null) { ObjectNode propertiesValue5 = objectMapper.createObjectNode(); ((ObjectNode) mpnsCredentialValue).put("properties", propertiesValue5); if (parameters.getProperties().getMpnsCredential().getProperties().getMpnsCertificate() != null) { ((ObjectNode) propertiesValue5).put("mpnsCertificate", parameters.getProperties().getMpnsCredential().getProperties().getMpnsCertificate()); } if (parameters.getProperties().getMpnsCredential().getProperties().getCertificateKey() != null) { ((ObjectNode) propertiesValue5).put("certificateKey", parameters.getProperties().getMpnsCredential().getProperties().getCertificateKey()); } if (parameters.getProperties().getMpnsCredential().getProperties().getThumbprint() != null) { ((ObjectNode) propertiesValue5).put("thumbprint", parameters.getProperties().getMpnsCredential().getProperties().getThumbprint()); } } } if (parameters.getProperties().getAdmCredential() != null) { ObjectNode admCredentialValue = objectMapper.createObjectNode(); ((ObjectNode) propertiesValue).put("admCredential", admCredentialValue); if (parameters.getProperties().getAdmCredential().getProperties() != null) { ObjectNode propertiesValue6 = objectMapper.createObjectNode(); ((ObjectNode) admCredentialValue).put("properties", propertiesValue6); if (parameters.getProperties().getAdmCredential().getProperties().getClientId() != null) { ((ObjectNode) propertiesValue6).put("clientId", parameters.getProperties().getAdmCredential().getProperties().getClientId()); } if (parameters.getProperties().getAdmCredential().getProperties().getClientSecret() != null) { ((ObjectNode) propertiesValue6).put("clientSecret", parameters.getProperties().getAdmCredential().getProperties().getClientSecret()); } if (parameters.getProperties().getAdmCredential().getProperties().getAuthTokenUrl() != null) { ((ObjectNode) propertiesValue6).put("authTokenUrl", parameters.getProperties().getAdmCredential().getProperties().getAuthTokenUrl()); } } } if (parameters.getProperties().getBaiduCredential() != null) { ObjectNode baiduCredentialValue = objectMapper.createObjectNode(); ((ObjectNode) propertiesValue).put("baiduCredential", baiduCredentialValue); if (parameters.getProperties().getBaiduCredential().getProperties() != null) { ObjectNode propertiesValue7 = objectMapper.createObjectNode(); ((ObjectNode) baiduCredentialValue).put("properties", propertiesValue7); if (parameters.getProperties().getBaiduCredential().getProperties().getBaiduApiKey() != null) { ((ObjectNode) propertiesValue7).put("baiduApiKey", parameters.getProperties().getBaiduCredential().getProperties().getBaiduApiKey()); } if (parameters.getProperties().getBaiduCredential().getProperties().getBaiduEndPoint() != null) { ((ObjectNode) propertiesValue7).put("baiduEndPoint", parameters.getProperties().getBaiduCredential().getProperties().getBaiduEndPoint()); } if (parameters.getProperties().getBaiduCredential().getProperties().getBaiduSecretKey() != null) { ((ObjectNode) propertiesValue7).put("baiduSecretKey", parameters.getProperties().getBaiduCredential().getProperties().getBaiduSecretKey()); } } } 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"); // 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 && statusCode != HttpStatus.SC_CREATED) { ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result NotificationHubCreateOrUpdateResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_CREATED) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new NotificationHubCreateOrUpdateResponse(); 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) { NotificationHubResource valueInstance = new NotificationHubResource(); result.setValue(valueInstance); JsonNode idValue = responseDoc.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); valueInstance.setId(idInstance); } JsonNode locationValue = responseDoc.get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); valueInstance.setLocation(locationInstance); } JsonNode nameValue = responseDoc.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); valueInstance.setName(nameInstance); } JsonNode typeValue = responseDoc.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); valueInstance.setType(typeInstance); } JsonNode tagsSequenceElement = ((JsonNode) responseDoc.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 tagsKey2 = property.getKey(); String tagsValue2 = property.getValue().getTextValue(); valueInstance.getTags().put(tagsKey2, tagsValue2); } } JsonNode propertiesValue8 = responseDoc.get("properties"); if (propertiesValue8 != null && propertiesValue8 instanceof NullNode == false) { NotificationHubProperties propertiesInstance = new NotificationHubProperties(); valueInstance.setProperties(propertiesInstance); JsonNode nameValue2 = propertiesValue8.get("name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); propertiesInstance.setName(nameInstance2); } JsonNode registrationTtlValue = propertiesValue8.get("registrationTtl"); if (registrationTtlValue != null && registrationTtlValue instanceof NullNode == false) { String registrationTtlInstance; registrationTtlInstance = registrationTtlValue.getTextValue(); propertiesInstance.setRegistrationTtl(registrationTtlInstance); } JsonNode authorizationRulesArray2 = propertiesValue8.get("authorizationRules"); if (authorizationRulesArray2 != null && authorizationRulesArray2 instanceof NullNode == false) { for (JsonNode authorizationRulesValue : ((ArrayNode) authorizationRulesArray2)) { SharedAccessAuthorizationRuleProperties sharedAccessAuthorizationRulePropertiesInstance = new SharedAccessAuthorizationRuleProperties(); propertiesInstance.getAuthorizationRules() .add(sharedAccessAuthorizationRulePropertiesInstance); JsonNode primaryKeyValue = authorizationRulesValue.get("primaryKey"); if (primaryKeyValue != null && primaryKeyValue instanceof NullNode == false) { String primaryKeyInstance; primaryKeyInstance = primaryKeyValue.getTextValue(); sharedAccessAuthorizationRulePropertiesInstance .setPrimaryKey(primaryKeyInstance); } JsonNode secondaryKeyValue = authorizationRulesValue.get("secondaryKey"); if (secondaryKeyValue != null && secondaryKeyValue instanceof NullNode == false) { String secondaryKeyInstance; secondaryKeyInstance = secondaryKeyValue.getTextValue(); sharedAccessAuthorizationRulePropertiesInstance .setSecondaryKey(secondaryKeyInstance); } JsonNode keyNameValue = authorizationRulesValue.get("keyName"); if (keyNameValue != null && keyNameValue instanceof NullNode == false) { String keyNameInstance; keyNameInstance = keyNameValue.getTextValue(); sharedAccessAuthorizationRulePropertiesInstance.setKeyName(keyNameInstance); } JsonNode claimTypeValue = authorizationRulesValue.get("claimType"); if (claimTypeValue != null && claimTypeValue instanceof NullNode == false) { String claimTypeInstance; claimTypeInstance = claimTypeValue.getTextValue(); sharedAccessAuthorizationRulePropertiesInstance.setClaimType(claimTypeInstance); } JsonNode claimValueValue = authorizationRulesValue.get("claimValue"); if (claimValueValue != null && claimValueValue instanceof NullNode == false) { String claimValueInstance; claimValueInstance = claimValueValue.getTextValue(); sharedAccessAuthorizationRulePropertiesInstance .setClaimValue(claimValueInstance); } JsonNode rightsArray2 = authorizationRulesValue.get("rights"); if (rightsArray2 != null && rightsArray2 instanceof NullNode == false) { for (JsonNode rightsValue : ((ArrayNode) rightsArray2)) { sharedAccessAuthorizationRulePropertiesInstance.getRights() .add(Enum.valueOf(AccessRights.class, rightsValue.getTextValue())); } } JsonNode createdTimeValue = authorizationRulesValue.get("createdTime"); if (createdTimeValue != null && createdTimeValue instanceof NullNode == false) { Calendar createdTimeInstance; createdTimeInstance = DatatypeConverter .parseDateTime(createdTimeValue.getTextValue()); sharedAccessAuthorizationRulePropertiesInstance .setCreatedTime(createdTimeInstance); } JsonNode modifiedTimeValue = authorizationRulesValue.get("modifiedTime"); if (modifiedTimeValue != null && modifiedTimeValue instanceof NullNode == false) { Calendar modifiedTimeInstance; modifiedTimeInstance = DatatypeConverter .parseDateTime(modifiedTimeValue.getTextValue()); sharedAccessAuthorizationRulePropertiesInstance .setModifiedTime(modifiedTimeInstance); } JsonNode revisionValue = authorizationRulesValue.get("revision"); if (revisionValue != null && revisionValue instanceof NullNode == false) { int revisionInstance; revisionInstance = revisionValue.getIntValue(); sharedAccessAuthorizationRulePropertiesInstance.setRevision(revisionInstance); } } } JsonNode apnsCredentialValue2 = propertiesValue8.get("apnsCredential"); if (apnsCredentialValue2 != null && apnsCredentialValue2 instanceof NullNode == false) { ApnsCredential apnsCredentialInstance = new ApnsCredential(); propertiesInstance.setApnsCredential(apnsCredentialInstance); JsonNode propertiesValue9 = apnsCredentialValue2.get("properties"); if (propertiesValue9 != null && propertiesValue9 instanceof NullNode == false) { ApnsCredentialProperties propertiesInstance2 = new ApnsCredentialProperties(); apnsCredentialInstance.setProperties(propertiesInstance2); JsonNode apnsCertificateValue = propertiesValue9.get("apnsCertificate"); if (apnsCertificateValue != null && apnsCertificateValue instanceof NullNode == false) { String apnsCertificateInstance; apnsCertificateInstance = apnsCertificateValue.getTextValue(); propertiesInstance2.setApnsCertificate(apnsCertificateInstance); } JsonNode certificateKeyValue = propertiesValue9.get("certificateKey"); if (certificateKeyValue != null && certificateKeyValue instanceof NullNode == false) { String certificateKeyInstance; certificateKeyInstance = certificateKeyValue.getTextValue(); propertiesInstance2.setCertificateKey(certificateKeyInstance); } JsonNode endpointValue = propertiesValue9.get("endpoint"); if (endpointValue != null && endpointValue instanceof NullNode == false) { String endpointInstance; endpointInstance = endpointValue.getTextValue(); propertiesInstance2.setEndpoint(endpointInstance); } JsonNode thumbprintValue = propertiesValue9.get("thumbprint"); if (thumbprintValue != null && thumbprintValue instanceof NullNode == false) { String thumbprintInstance; thumbprintInstance = thumbprintValue.getTextValue(); propertiesInstance2.setThumbprint(thumbprintInstance); } } } JsonNode wnsCredentialValue2 = propertiesValue8.get("wnsCredential"); if (wnsCredentialValue2 != null && wnsCredentialValue2 instanceof NullNode == false) { WnsCredential wnsCredentialInstance = new WnsCredential(); propertiesInstance.setWnsCredential(wnsCredentialInstance); JsonNode propertiesValue10 = wnsCredentialValue2.get("properties"); if (propertiesValue10 != null && propertiesValue10 instanceof NullNode == false) { WnsCredentialProperties propertiesInstance3 = new WnsCredentialProperties(); wnsCredentialInstance.setProperties(propertiesInstance3); JsonNode packageSidValue = propertiesValue10.get("packageSid"); if (packageSidValue != null && packageSidValue instanceof NullNode == false) { String packageSidInstance; packageSidInstance = packageSidValue.getTextValue(); propertiesInstance3.setPackageSid(packageSidInstance); } JsonNode secretKeyValue = propertiesValue10.get("secretKey"); if (secretKeyValue != null && secretKeyValue instanceof NullNode == false) { String secretKeyInstance; secretKeyInstance = secretKeyValue.getTextValue(); propertiesInstance3.setSecretKey(secretKeyInstance); } JsonNode windowsLiveEndpointValue = propertiesValue10.get("windowsLiveEndpoint"); if (windowsLiveEndpointValue != null && windowsLiveEndpointValue instanceof NullNode == false) { String windowsLiveEndpointInstance; windowsLiveEndpointInstance = windowsLiveEndpointValue.getTextValue(); propertiesInstance3.setWindowsLiveEndpoint(windowsLiveEndpointInstance); } } } JsonNode gcmCredentialValue2 = propertiesValue8.get("gcmCredential"); if (gcmCredentialValue2 != null && gcmCredentialValue2 instanceof NullNode == false) { GcmCredential gcmCredentialInstance = new GcmCredential(); propertiesInstance.setGcmCredential(gcmCredentialInstance); JsonNode propertiesValue11 = gcmCredentialValue2.get("properties"); if (propertiesValue11 != null && propertiesValue11 instanceof NullNode == false) { GcmCredentialProperties propertiesInstance4 = new GcmCredentialProperties(); gcmCredentialInstance.setProperties(propertiesInstance4); JsonNode gcmEndpointValue = propertiesValue11.get("gcmEndpoint"); if (gcmEndpointValue != null && gcmEndpointValue instanceof NullNode == false) { String gcmEndpointInstance; gcmEndpointInstance = gcmEndpointValue.getTextValue(); propertiesInstance4.setGcmEndpoint(gcmEndpointInstance); } JsonNode googleApiKeyValue = propertiesValue11.get("googleApiKey"); if (googleApiKeyValue != null && googleApiKeyValue instanceof NullNode == false) { String googleApiKeyInstance; googleApiKeyInstance = googleApiKeyValue.getTextValue(); propertiesInstance4.setGoogleApiKey(googleApiKeyInstance); } } } JsonNode mpnsCredentialValue2 = propertiesValue8.get("mpnsCredential"); if (mpnsCredentialValue2 != null && mpnsCredentialValue2 instanceof NullNode == false) { MpnsCredential mpnsCredentialInstance = new MpnsCredential(); propertiesInstance.setMpnsCredential(mpnsCredentialInstance); JsonNode propertiesValue12 = mpnsCredentialValue2.get("properties"); if (propertiesValue12 != null && propertiesValue12 instanceof NullNode == false) { MpnsCredentialProperties propertiesInstance5 = new MpnsCredentialProperties(); mpnsCredentialInstance.setProperties(propertiesInstance5); JsonNode mpnsCertificateValue = propertiesValue12.get("mpnsCertificate"); if (mpnsCertificateValue != null && mpnsCertificateValue instanceof NullNode == false) { String mpnsCertificateInstance; mpnsCertificateInstance = mpnsCertificateValue.getTextValue(); propertiesInstance5.setMpnsCertificate(mpnsCertificateInstance); } JsonNode certificateKeyValue2 = propertiesValue12.get("certificateKey"); if (certificateKeyValue2 != null && certificateKeyValue2 instanceof NullNode == false) { String certificateKeyInstance2; certificateKeyInstance2 = certificateKeyValue2.getTextValue(); propertiesInstance5.setCertificateKey(certificateKeyInstance2); } JsonNode thumbprintValue2 = propertiesValue12.get("thumbprint"); if (thumbprintValue2 != null && thumbprintValue2 instanceof NullNode == false) { String thumbprintInstance2; thumbprintInstance2 = thumbprintValue2.getTextValue(); propertiesInstance5.setThumbprint(thumbprintInstance2); } } } JsonNode admCredentialValue2 = propertiesValue8.get("admCredential"); if (admCredentialValue2 != null && admCredentialValue2 instanceof NullNode == false) { AdmCredential admCredentialInstance = new AdmCredential(); propertiesInstance.setAdmCredential(admCredentialInstance); JsonNode propertiesValue13 = admCredentialValue2.get("properties"); if (propertiesValue13 != null && propertiesValue13 instanceof NullNode == false) { AdmCredentialProperties propertiesInstance6 = new AdmCredentialProperties(); admCredentialInstance.setProperties(propertiesInstance6); JsonNode clientIdValue = propertiesValue13.get("clientId"); if (clientIdValue != null && clientIdValue instanceof NullNode == false) { String clientIdInstance; clientIdInstance = clientIdValue.getTextValue(); propertiesInstance6.setClientId(clientIdInstance); } JsonNode clientSecretValue = propertiesValue13.get("clientSecret"); if (clientSecretValue != null && clientSecretValue instanceof NullNode == false) { String clientSecretInstance; clientSecretInstance = clientSecretValue.getTextValue(); propertiesInstance6.setClientSecret(clientSecretInstance); } JsonNode authTokenUrlValue = propertiesValue13.get("authTokenUrl"); if (authTokenUrlValue != null && authTokenUrlValue instanceof NullNode == false) { String authTokenUrlInstance; authTokenUrlInstance = authTokenUrlValue.getTextValue(); propertiesInstance6.setAuthTokenUrl(authTokenUrlInstance); } } } JsonNode baiduCredentialValue2 = propertiesValue8.get("baiduCredential"); if (baiduCredentialValue2 != null && baiduCredentialValue2 instanceof NullNode == false) { BaiduCredential baiduCredentialInstance = new BaiduCredential(); propertiesInstance.setBaiduCredential(baiduCredentialInstance); JsonNode propertiesValue14 = baiduCredentialValue2.get("properties"); if (propertiesValue14 != null && propertiesValue14 instanceof NullNode == false) { BaiduCredentialProperties propertiesInstance7 = new BaiduCredentialProperties(); baiduCredentialInstance.setProperties(propertiesInstance7); JsonNode baiduApiKeyValue = propertiesValue14.get("baiduApiKey"); if (baiduApiKeyValue != null && baiduApiKeyValue instanceof NullNode == false) { String baiduApiKeyInstance; baiduApiKeyInstance = baiduApiKeyValue.getTextValue(); propertiesInstance7.setBaiduApiKey(baiduApiKeyInstance); } JsonNode baiduEndPointValue = propertiesValue14.get("baiduEndPoint"); if (baiduEndPointValue != null && baiduEndPointValue instanceof NullNode == false) { String baiduEndPointInstance; baiduEndPointInstance = baiduEndPointValue.getTextValue(); propertiesInstance7.setBaiduEndPoint(baiduEndPointInstance); } JsonNode baiduSecretKeyValue = propertiesValue14.get("baiduSecretKey"); if (baiduSecretKeyValue != null && baiduSecretKeyValue instanceof NullNode == false) { String baiduSecretKeyInstance; baiduSecretKeyInstance = baiduSecretKeyValue.getTextValue(); propertiesInstance7.setBaiduSecretKey(baiduSecretKeyInstance); } } } } } } 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
/** * The operation to get a virtual machine. * * @param resourceGroupName Required. The name of the resource group. * @param vmName Required. The name of the virtual machine. * @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./*from w w w . ja v a 2 s. co m*/ * @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 GetVM operation response. */ @Override public VirtualMachineGetResponse get(String resourceGroupName, String vmName) throws IOException, ServiceException, URISyntaxException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (vmName == null) { throw new NullPointerException("vmName"); } // 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("vmName", vmName); CloudTracing.enter(invocationId, this, "getAsync", 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.Compute"; url = url + "/"; url = url + "virtualMachines"; url = url + "/"; url = url + URLEncoder.encode(vmName, "UTF-8"); 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 VirtualMachineGetResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new VirtualMachineGetResponse(); 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) { VirtualMachine virtualMachineInstance = new VirtualMachine(); result.setVirtualMachine(virtualMachineInstance); JsonNode planValue = responseDoc.get("plan"); if (planValue != null && planValue instanceof NullNode == false) { Plan planInstance = new Plan(); virtualMachineInstance.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 = responseDoc.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(); virtualMachineInstance.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(); virtualMachineInstance.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(); virtualMachineInstance.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(); virtualMachineInstance.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(); virtualMachineInstance.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(); virtualMachineInstance.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(); virtualMachineInstance.setProvisioningState(provisioningStateInstance); } JsonNode instanceViewValue = propertiesValue.get("instanceView"); if (instanceViewValue != null && instanceViewValue instanceof NullNode == false) { VirtualMachineInstanceView instanceViewInstance = new VirtualMachineInstanceView(); virtualMachineInstance.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 = responseDoc.get("resources"); if (resourcesArray != null && resourcesArray instanceof NullNode == false) { virtualMachineInstance.setExtensions(new ArrayList<VirtualMachineExtension>()); for (JsonNode resourcesValue : ((ArrayNode) resourcesArray)) { VirtualMachineExtension virtualMachineExtensionJsonInstance = new VirtualMachineExtension(); virtualMachineInstance.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 = responseDoc.get("id"); if (idValue5 != null && idValue5 instanceof NullNode == false) { String idInstance5; idInstance5 = idValue5.getTextValue(); virtualMachineInstance.setId(idInstance5); } JsonNode nameValue8 = responseDoc.get("name"); if (nameValue8 != null && nameValue8 instanceof NullNode == false) { String nameInstance8; nameInstance8 = nameValue8.getTextValue(); virtualMachineInstance.setName(nameInstance8); } JsonNode typeValue6 = responseDoc.get("type"); if (typeValue6 != null && typeValue6 instanceof NullNode == false) { String typeInstance6; typeInstance6 = typeValue6.getTextValue(); virtualMachineInstance.setType(typeInstance6); } JsonNode locationValue2 = responseDoc.get("location"); if (locationValue2 != null && locationValue2 instanceof NullNode == false) { String locationInstance2; locationInstance2 = locationValue2.getTextValue(); virtualMachineInstance.setLocation(locationInstance2); } JsonNode tagsSequenceElement2 = ((JsonNode) responseDoc.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(); virtualMachineInstance.getTags().put(tagsKey2, tagsValue2); } } } } 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
/** * Creates a new Job with a user-provided job id, or updates an existing * job, replacing its definition with that specified. * * @param jobId Required. Id of the job to create or update. * @param parameters Required. Parameters specifying the job definition for * a CreateOrUpdate Job operation./* ww w . j ava 2s . 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 CreateOrUpdate Job operation response. */ @Override public JobCreateOrUpdateResponse createOrUpdate(String jobId, JobCreateOrUpdateParameters parameters) throws IOException, ServiceException, URISyntaxException { // Validate if (jobId == null) { throw new NullPointerException("jobId"); } if (parameters == null) { throw new NullPointerException("parameters"); } if (parameters.getAction() == null) { throw new NullPointerException("parameters.Action"); } if (parameters.getAction().getErrorAction() != null) { if (parameters.getAction().getErrorAction().getQueueMessage() != null) { if (parameters.getAction().getErrorAction().getQueueMessage().getMessage() == null) { throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.Message"); } if (parameters.getAction().getErrorAction().getQueueMessage().getQueueName() == null) { throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.QueueName"); } if (parameters.getAction().getErrorAction().getQueueMessage().getSasToken() == null) { throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.SasToken"); } if (parameters.getAction().getErrorAction().getQueueMessage().getStorageAccountName() == null) { throw new NullPointerException("parameters.Action.ErrorAction.QueueMessage.StorageAccountName"); } } if (parameters.getAction().getErrorAction().getRequest() != null) { if (parameters.getAction().getErrorAction().getRequest().getMethod() == null) { throw new NullPointerException("parameters.Action.ErrorAction.Request.Method"); } if (parameters.getAction().getErrorAction().getRequest().getUri() == null) { throw new NullPointerException("parameters.Action.ErrorAction.Request.Uri"); } } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() != null) { if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getAuthentication() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.Authentication"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage().getAuthentication() .getSasKey() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.Authentication.SasKey"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage().getAuthentication() .getSasKeyName() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.Authentication.SasKeyName"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage().getAuthentication() .getType() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.Authentication.Type"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage().getMessage() == null) { throw new NullPointerException("parameters.Action.ErrorAction.ServiceBusQueueMessage.Message"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage().getNamespace() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.Namespace"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage().getQueueName() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.QueueName"); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getTransportType() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusQueueMessage.TransportType"); } } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() != null) { if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getAuthentication() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.Authentication"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage().getAuthentication() .getSasKey() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.Authentication.SasKey"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage().getAuthentication() .getSasKeyName() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.Authentication.SasKeyName"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage().getAuthentication() .getType() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.Authentication.Type"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage().getMessage() == null) { throw new NullPointerException("parameters.Action.ErrorAction.ServiceBusTopicMessage.Message"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage().getNamespace() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.Namespace"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage().getTopicPath() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.TopicPath"); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getTransportType() == null) { throw new NullPointerException( "parameters.Action.ErrorAction.ServiceBusTopicMessage.TransportType"); } } if (parameters.getAction().getErrorAction().getType() == null) { throw new NullPointerException("parameters.Action.ErrorAction.Type"); } } if (parameters.getAction().getQueueMessage() != null) { if (parameters.getAction().getQueueMessage().getMessage() == null) { throw new NullPointerException("parameters.Action.QueueMessage.Message"); } if (parameters.getAction().getQueueMessage().getQueueName() == null) { throw new NullPointerException("parameters.Action.QueueMessage.QueueName"); } if (parameters.getAction().getQueueMessage().getSasToken() == null) { throw new NullPointerException("parameters.Action.QueueMessage.SasToken"); } if (parameters.getAction().getQueueMessage().getStorageAccountName() == null) { throw new NullPointerException("parameters.Action.QueueMessage.StorageAccountName"); } } if (parameters.getAction().getRequest() != null) { if (parameters.getAction().getRequest().getMethod() == null) { throw new NullPointerException("parameters.Action.Request.Method"); } if (parameters.getAction().getRequest().getUri() == null) { throw new NullPointerException("parameters.Action.Request.Uri"); } } if (parameters.getAction().getRetryPolicy() != null) { if (parameters.getAction().getRetryPolicy().getRetryType() == null) { throw new NullPointerException("parameters.Action.RetryPolicy.RetryType"); } } if (parameters.getAction().getServiceBusQueueMessage() != null) { if (parameters.getAction().getServiceBusQueueMessage().getAuthentication() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.Authentication"); } if (parameters.getAction().getServiceBusQueueMessage().getAuthentication().getSasKey() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.Authentication.SasKey"); } if (parameters.getAction().getServiceBusQueueMessage().getAuthentication().getSasKeyName() == null) { throw new NullPointerException( "parameters.Action.ServiceBusQueueMessage.Authentication.SasKeyName"); } if (parameters.getAction().getServiceBusQueueMessage().getAuthentication().getType() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.Authentication.Type"); } if (parameters.getAction().getServiceBusQueueMessage().getMessage() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.Message"); } if (parameters.getAction().getServiceBusQueueMessage().getNamespace() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.Namespace"); } if (parameters.getAction().getServiceBusQueueMessage().getQueueName() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.QueueName"); } if (parameters.getAction().getServiceBusQueueMessage().getTransportType() == null) { throw new NullPointerException("parameters.Action.ServiceBusQueueMessage.TransportType"); } } if (parameters.getAction().getServiceBusTopicMessage() != null) { if (parameters.getAction().getServiceBusTopicMessage().getAuthentication() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.Authentication"); } if (parameters.getAction().getServiceBusTopicMessage().getAuthentication().getSasKey() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.Authentication.SasKey"); } if (parameters.getAction().getServiceBusTopicMessage().getAuthentication().getSasKeyName() == null) { throw new NullPointerException( "parameters.Action.ServiceBusTopicMessage.Authentication.SasKeyName"); } if (parameters.getAction().getServiceBusTopicMessage().getAuthentication().getType() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.Authentication.Type"); } if (parameters.getAction().getServiceBusTopicMessage().getMessage() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.Message"); } if (parameters.getAction().getServiceBusTopicMessage().getNamespace() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.Namespace"); } if (parameters.getAction().getServiceBusTopicMessage().getTopicPath() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.TopicPath"); } if (parameters.getAction().getServiceBusTopicMessage().getTransportType() == null) { throw new NullPointerException("parameters.Action.ServiceBusTopicMessage.TransportType"); } } if (parameters.getAction().getType() == null) { throw new NullPointerException("parameters.Action.Type"); } if (parameters.getRecurrence() != null) { if (parameters.getRecurrence().getFrequency() == null) { throw new NullPointerException("parameters.Recurrence.Frequency"); } if (parameters.getRecurrence().getSchedule() != null) { if (parameters.getRecurrence().getSchedule().getMonthlyOccurrences() != null) { for (JobScheduleMonthlyOccurrence monthlyOccurrencesParameterItem : parameters.getRecurrence() .getSchedule().getMonthlyOccurrences()) { if (monthlyOccurrencesParameterItem.getDay() == null) { throw new NullPointerException("parameters.Recurrence.Schedule.MonthlyOccurrences.Day"); } } } } } // 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, "createOrUpdateAsync", 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"); 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 HttpPut httpRequest = new HttpPut(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 jobCreateOrUpdateParametersValue = objectMapper.createObjectNode(); requestDoc = jobCreateOrUpdateParametersValue; if (parameters.getStartTime() != null) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) jobCreateOrUpdateParametersValue).put("startTime", simpleDateFormat.format(parameters.getStartTime().getTime())); } ObjectNode actionValue = objectMapper.createObjectNode(); ((ObjectNode) jobCreateOrUpdateParametersValue).put("action", actionValue); ((ObjectNode) actionValue).put("type", SchedulerClientImpl.jobActionTypeToString(parameters.getAction().getType())); if (parameters.getAction().getRetryPolicy() != null) { ObjectNode retryPolicyValue = objectMapper.createObjectNode(); ((ObjectNode) actionValue).put("retryPolicy", retryPolicyValue); ((ObjectNode) retryPolicyValue).put("retryType", SchedulerClientImpl.retryTypeToString(parameters.getAction().getRetryPolicy().getRetryType())); if (parameters.getAction().getRetryPolicy().getRetryInterval() != null) { ((ObjectNode) retryPolicyValue).put("retryInterval", TimeSpan8601Converter.format(parameters.getAction().getRetryPolicy().getRetryInterval())); } if (parameters.getAction().getRetryPolicy().getRetryCount() != null) { ((ObjectNode) retryPolicyValue).put("retryCount", parameters.getAction().getRetryPolicy().getRetryCount()); } } if (parameters.getAction().getErrorAction() != null) { ObjectNode errorActionValue = objectMapper.createObjectNode(); ((ObjectNode) actionValue).put("errorAction", errorActionValue); ((ObjectNode) errorActionValue).put("type", SchedulerClientImpl.jobActionTypeToString(parameters.getAction().getErrorAction().getType())); if (parameters.getAction().getErrorAction().getRequest() != null) { ObjectNode requestValue = objectMapper.createObjectNode(); ((ObjectNode) errorActionValue).put("request", requestValue); ((ObjectNode) requestValue).put("uri", parameters.getAction().getErrorAction().getRequest().getUri().toString()); ((ObjectNode) requestValue).put("method", parameters.getAction().getErrorAction().getRequest().getMethod()); if (parameters.getAction().getErrorAction().getRequest().getHeaders() != null) { if (parameters.getAction().getErrorAction().getRequest() .getHeaders() instanceof LazyCollection == false || ((LazyCollection) parameters.getAction().getErrorAction().getRequest().getHeaders()) .isInitialized()) { ObjectNode headersDictionary = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry : parameters.getAction().getErrorAction().getRequest() .getHeaders().entrySet()) { String headersKey = entry.getKey(); String headersValue = entry.getValue(); ((ObjectNode) headersDictionary).put(headersKey, headersValue); } ((ObjectNode) requestValue).put("headers", headersDictionary); } } if (parameters.getAction().getErrorAction().getRequest().getBody() != null) { ((ObjectNode) requestValue).put("body", parameters.getAction().getErrorAction().getRequest().getBody()); } if (parameters.getAction().getErrorAction().getRequest().getAuthentication() != null) { ObjectNode authenticationValue = objectMapper.createObjectNode(); ((ObjectNode) requestValue).put("authentication", authenticationValue); if (parameters.getAction().getErrorAction().getRequest() .getAuthentication() instanceof ClientCertAuthentication) { ((ObjectNode) authenticationValue).put("type", "ClientCertificate"); ClientCertAuthentication derived = ((ClientCertAuthentication) parameters.getAction() .getErrorAction().getRequest().getAuthentication()); if (derived.getPassword() != null) { ((ObjectNode) authenticationValue).put("password", derived.getPassword()); } if (derived.getPfx() != null) { ((ObjectNode) authenticationValue).put("pfx", derived.getPfx()); } if (derived.getCertificateThumbprint() != null) { ((ObjectNode) authenticationValue).put("certificateThumbprint", derived.getCertificateThumbprint()); } if (derived.getCertificateExpiration() != null) { SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) authenticationValue).put("certificateExpiration", simpleDateFormat2.format(derived.getCertificateExpiration().getTime())); } if (derived.getCertificateSubjectName() != null) { ((ObjectNode) authenticationValue).put("certificateSubjectName", derived.getCertificateSubjectName()); } if (derived.getType() != null) { ((ObjectNode) authenticationValue).put("type", SchedulerClientImpl.httpAuthenticationTypeToString(derived.getType())); } } if (parameters.getAction().getErrorAction().getRequest() .getAuthentication() instanceof AADOAuthAuthentication) { ((ObjectNode) authenticationValue).put("type", "ActiveDirectoryOAuth"); AADOAuthAuthentication derived2 = ((AADOAuthAuthentication) parameters.getAction() .getErrorAction().getRequest().getAuthentication()); if (derived2.getSecret() != null) { ((ObjectNode) authenticationValue).put("secret", derived2.getSecret()); } if (derived2.getTenant() != null) { ((ObjectNode) authenticationValue).put("tenant", derived2.getTenant()); } if (derived2.getAudience() != null) { ((ObjectNode) authenticationValue).put("audience", derived2.getAudience()); } if (derived2.getClientId() != null) { ((ObjectNode) authenticationValue).put("clientId", derived2.getClientId()); } if (derived2.getType() != null) { ((ObjectNode) authenticationValue).put("type", SchedulerClientImpl.httpAuthenticationTypeToString(derived2.getType())); } } if (parameters.getAction().getErrorAction().getRequest() .getAuthentication() instanceof BasicAuthentication) { ((ObjectNode) authenticationValue).put("type", "Basic"); BasicAuthentication derived3 = ((BasicAuthentication) parameters.getAction() .getErrorAction().getRequest().getAuthentication()); ((ObjectNode) authenticationValue).put("username", derived3.getUsername()); if (derived3.getPassword() != null) { ((ObjectNode) authenticationValue).put("password", derived3.getPassword()); } if (derived3.getType() != null) { ((ObjectNode) authenticationValue).put("type", SchedulerClientImpl.httpAuthenticationTypeToString(derived3.getType())); } } } } if (parameters.getAction().getErrorAction().getQueueMessage() != null) { ObjectNode queueMessageValue = objectMapper.createObjectNode(); ((ObjectNode) errorActionValue).put("queueMessage", queueMessageValue); ((ObjectNode) queueMessageValue).put("storageAccount", parameters.getAction().getErrorAction().getQueueMessage().getStorageAccountName()); ((ObjectNode) queueMessageValue).put("queueName", parameters.getAction().getErrorAction().getQueueMessage().getQueueName()); ((ObjectNode) queueMessageValue).put("sasToken", parameters.getAction().getErrorAction().getQueueMessage().getSasToken()); ((ObjectNode) queueMessageValue).put("message", parameters.getAction().getErrorAction().getQueueMessage().getMessage()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() != null) { ObjectNode serviceBusTopicMessageValue = objectMapper.createObjectNode(); ((ObjectNode) errorActionValue).put("serviceBusTopicMessage", serviceBusTopicMessageValue); ((ObjectNode) serviceBusTopicMessageValue).put("topicPath", parameters.getAction().getErrorAction().getServiceBusTopicMessage().getTopicPath()); ((ObjectNode) serviceBusTopicMessageValue).put("namespace", parameters.getAction().getErrorAction().getServiceBusTopicMessage().getNamespace()); ((ObjectNode) serviceBusTopicMessageValue).put("transportType", SchedulerClientImpl.jobServiceBusTransportTypeToString(parameters.getAction() .getErrorAction().getServiceBusTopicMessage().getTransportType())); ObjectNode authenticationValue2 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusTopicMessageValue).put("authentication", authenticationValue2); ((ObjectNode) authenticationValue2).put("sasKeyName", parameters.getAction().getErrorAction() .getServiceBusTopicMessage().getAuthentication().getSasKeyName()); ((ObjectNode) authenticationValue2).put("sasKey", parameters.getAction().getErrorAction() .getServiceBusTopicMessage().getAuthentication().getSasKey()); ((ObjectNode) authenticationValue2).put("type", SchedulerClientImpl.jobServiceBusAuthenticationTypeToString(parameters.getAction() .getErrorAction().getServiceBusTopicMessage().getAuthentication().getType())); ((ObjectNode) serviceBusTopicMessageValue).put("message", parameters.getAction().getErrorAction().getServiceBusTopicMessage().getMessage()); if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties() != null) { ObjectNode brokeredMessagePropertiesValue = objectMapper.createObjectNode(); ((ObjectNode) serviceBusTopicMessageValue).put("brokeredMessageProperties", brokeredMessagePropertiesValue); if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getContentType() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("contentType", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getContentType()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getCorrelationId() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("correlationId", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getCorrelationId()); } ((ObjectNode) brokeredMessagePropertiesValue).put("forcePersistence", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().isForcePersistence()); if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getLabel() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("label", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getLabel()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getMessageId() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("messageId", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getMessageId()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("partitionKey", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getPartitionKey()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getReplyTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("replyTo", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getReplyTo()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getReplyToSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("replyToSessionId", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getReplyToSessionId()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getScheduledEnqueueTimeUtc() != null) { SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat3.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue).put("scheduledEnqueueTimeUtc", simpleDateFormat3.format(parameters.getAction().getErrorAction() .getServiceBusTopicMessage().getBrokeredMessageProperties() .getScheduledEnqueueTimeUtc().getTime())); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("sessionId", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getSessionId()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getTimeToLive() != null) { SimpleDateFormat simpleDateFormat4 = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat4.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue).put("timeToLive", simpleDateFormat4 .format(parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getTimeToLive().getTime())); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("to", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getTo()); } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getViaPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue).put("viaPartitionKey", parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getViaPartitionKey()); } } if (parameters.getAction().getErrorAction().getServiceBusTopicMessage() .getCustomMessageProperties() != null) { ObjectNode customMessagePropertiesDictionary = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry2 : parameters.getAction().getErrorAction() .getServiceBusTopicMessage().getCustomMessageProperties().entrySet()) { String customMessagePropertiesKey = entry2.getKey(); String customMessagePropertiesValue = entry2.getValue(); ((ObjectNode) customMessagePropertiesDictionary).put(customMessagePropertiesKey, customMessagePropertiesValue); } ((ObjectNode) serviceBusTopicMessageValue).put("customMessageProperties", customMessagePropertiesDictionary); } } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() != null) { ObjectNode serviceBusQueueMessageValue = objectMapper.createObjectNode(); ((ObjectNode) errorActionValue).put("serviceBusQueueMessage", serviceBusQueueMessageValue); ((ObjectNode) serviceBusQueueMessageValue).put("queueName", parameters.getAction().getErrorAction().getServiceBusQueueMessage().getQueueName()); ((ObjectNode) serviceBusQueueMessageValue).put("namespace", parameters.getAction().getErrorAction().getServiceBusQueueMessage().getNamespace()); ((ObjectNode) serviceBusQueueMessageValue).put("transportType", SchedulerClientImpl.jobServiceBusTransportTypeToString(parameters.getAction() .getErrorAction().getServiceBusQueueMessage().getTransportType())); ObjectNode authenticationValue3 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusQueueMessageValue).put("authentication", authenticationValue3); ((ObjectNode) authenticationValue3).put("sasKeyName", parameters.getAction().getErrorAction() .getServiceBusQueueMessage().getAuthentication().getSasKeyName()); ((ObjectNode) authenticationValue3).put("sasKey", parameters.getAction().getErrorAction() .getServiceBusQueueMessage().getAuthentication().getSasKey()); ((ObjectNode) authenticationValue3).put("type", SchedulerClientImpl.jobServiceBusAuthenticationTypeToString(parameters.getAction() .getErrorAction().getServiceBusQueueMessage().getAuthentication().getType())); ((ObjectNode) serviceBusQueueMessageValue).put("message", parameters.getAction().getErrorAction().getServiceBusQueueMessage().getMessage()); if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties() != null) { ObjectNode brokeredMessagePropertiesValue2 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusQueueMessageValue).put("brokeredMessageProperties", brokeredMessagePropertiesValue2); if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getContentType() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("contentType", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getContentType()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getCorrelationId() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("correlationId", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getCorrelationId()); } ((ObjectNode) brokeredMessagePropertiesValue2).put("forcePersistence", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().isForcePersistence()); if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getLabel() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("label", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getLabel()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getMessageId() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("messageId", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getMessageId()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("partitionKey", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getPartitionKey()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getReplyTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("replyTo", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getReplyTo()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getReplyToSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("replyToSessionId", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getReplyToSessionId()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getScheduledEnqueueTimeUtc() != null) { SimpleDateFormat simpleDateFormat5 = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat5.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue2).put("scheduledEnqueueTimeUtc", simpleDateFormat5.format(parameters.getAction().getErrorAction() .getServiceBusQueueMessage().getBrokeredMessageProperties() .getScheduledEnqueueTimeUtc().getTime())); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("sessionId", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getSessionId()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getTimeToLive() != null) { SimpleDateFormat simpleDateFormat6 = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat6.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue2).put("timeToLive", simpleDateFormat6 .format(parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getTimeToLive().getTime())); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("to", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getTo()); } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getViaPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue2).put("viaPartitionKey", parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getViaPartitionKey()); } } if (parameters.getAction().getErrorAction().getServiceBusQueueMessage() .getCustomMessageProperties() != null) { ObjectNode customMessagePropertiesDictionary2 = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry3 : parameters.getAction().getErrorAction() .getServiceBusQueueMessage().getCustomMessageProperties().entrySet()) { String customMessagePropertiesKey2 = entry3.getKey(); String customMessagePropertiesValue2 = entry3.getValue(); ((ObjectNode) customMessagePropertiesDictionary2).put(customMessagePropertiesKey2, customMessagePropertiesValue2); } ((ObjectNode) serviceBusQueueMessageValue).put("customMessageProperties", customMessagePropertiesDictionary2); } } } if (parameters.getAction().getRequest() != null) { ObjectNode requestValue2 = objectMapper.createObjectNode(); ((ObjectNode) actionValue).put("request", requestValue2); ((ObjectNode) requestValue2).put("uri", parameters.getAction().getRequest().getUri().toString()); ((ObjectNode) requestValue2).put("method", parameters.getAction().getRequest().getMethod()); if (parameters.getAction().getRequest().getHeaders() != null) { if (parameters.getAction().getRequest().getHeaders() instanceof LazyCollection == false || ((LazyCollection) parameters.getAction().getRequest().getHeaders()).isInitialized()) { ObjectNode headersDictionary2 = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry4 : parameters.getAction().getRequest().getHeaders() .entrySet()) { String headersKey2 = entry4.getKey(); String headersValue2 = entry4.getValue(); ((ObjectNode) headersDictionary2).put(headersKey2, headersValue2); } ((ObjectNode) requestValue2).put("headers", headersDictionary2); } } if (parameters.getAction().getRequest().getBody() != null) { ((ObjectNode) requestValue2).put("body", parameters.getAction().getRequest().getBody()); } if (parameters.getAction().getRequest().getAuthentication() != null) { ObjectNode authenticationValue4 = objectMapper.createObjectNode(); ((ObjectNode) requestValue2).put("authentication", authenticationValue4); if (parameters.getAction().getRequest().getAuthentication() instanceof ClientCertAuthentication) { ((ObjectNode) authenticationValue4).put("type", "ClientCertificate"); ClientCertAuthentication derived4 = ((ClientCertAuthentication) parameters.getAction() .getRequest().getAuthentication()); if (derived4.getPassword() != null) { ((ObjectNode) authenticationValue4).put("password", derived4.getPassword()); } if (derived4.getPfx() != null) { ((ObjectNode) authenticationValue4).put("pfx", derived4.getPfx()); } if (derived4.getCertificateThumbprint() != null) { ((ObjectNode) authenticationValue4).put("certificateThumbprint", derived4.getCertificateThumbprint()); } if (derived4.getCertificateExpiration() != null) { SimpleDateFormat simpleDateFormat7 = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat7.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) authenticationValue4).put("certificateExpiration", simpleDateFormat7.format(derived4.getCertificateExpiration().getTime())); } if (derived4.getCertificateSubjectName() != null) { ((ObjectNode) authenticationValue4).put("certificateSubjectName", derived4.getCertificateSubjectName()); } if (derived4.getType() != null) { ((ObjectNode) authenticationValue4).put("type", SchedulerClientImpl.httpAuthenticationTypeToString(derived4.getType())); } } if (parameters.getAction().getRequest().getAuthentication() instanceof AADOAuthAuthentication) { ((ObjectNode) authenticationValue4).put("type", "ActiveDirectoryOAuth"); AADOAuthAuthentication derived5 = ((AADOAuthAuthentication) parameters.getAction().getRequest() .getAuthentication()); if (derived5.getSecret() != null) { ((ObjectNode) authenticationValue4).put("secret", derived5.getSecret()); } if (derived5.getTenant() != null) { ((ObjectNode) authenticationValue4).put("tenant", derived5.getTenant()); } if (derived5.getAudience() != null) { ((ObjectNode) authenticationValue4).put("audience", derived5.getAudience()); } if (derived5.getClientId() != null) { ((ObjectNode) authenticationValue4).put("clientId", derived5.getClientId()); } if (derived5.getType() != null) { ((ObjectNode) authenticationValue4).put("type", SchedulerClientImpl.httpAuthenticationTypeToString(derived5.getType())); } } if (parameters.getAction().getRequest().getAuthentication() instanceof BasicAuthentication) { ((ObjectNode) authenticationValue4).put("type", "Basic"); BasicAuthentication derived6 = ((BasicAuthentication) parameters.getAction().getRequest() .getAuthentication()); ((ObjectNode) authenticationValue4).put("username", derived6.getUsername()); if (derived6.getPassword() != null) { ((ObjectNode) authenticationValue4).put("password", derived6.getPassword()); } if (derived6.getType() != null) { ((ObjectNode) authenticationValue4).put("type", SchedulerClientImpl.httpAuthenticationTypeToString(derived6.getType())); } } } } if (parameters.getAction().getQueueMessage() != null) { ObjectNode queueMessageValue2 = objectMapper.createObjectNode(); ((ObjectNode) actionValue).put("queueMessage", queueMessageValue2); ((ObjectNode) queueMessageValue2).put("storageAccount", parameters.getAction().getQueueMessage().getStorageAccountName()); ((ObjectNode) queueMessageValue2).put("queueName", parameters.getAction().getQueueMessage().getQueueName()); ((ObjectNode) queueMessageValue2).put("sasToken", parameters.getAction().getQueueMessage().getSasToken()); ((ObjectNode) queueMessageValue2).put("message", parameters.getAction().getQueueMessage().getMessage()); } if (parameters.getAction().getServiceBusTopicMessage() != null) { ObjectNode serviceBusTopicMessageValue2 = objectMapper.createObjectNode(); ((ObjectNode) actionValue).put("serviceBusTopicMessage", serviceBusTopicMessageValue2); ((ObjectNode) serviceBusTopicMessageValue2).put("topicPath", parameters.getAction().getServiceBusTopicMessage().getTopicPath()); ((ObjectNode) serviceBusTopicMessageValue2).put("namespace", parameters.getAction().getServiceBusTopicMessage().getNamespace()); ((ObjectNode) serviceBusTopicMessageValue2).put("transportType", SchedulerClientImpl.jobServiceBusTransportTypeToString( parameters.getAction().getServiceBusTopicMessage().getTransportType())); ObjectNode authenticationValue5 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusTopicMessageValue2).put("authentication", authenticationValue5); ((ObjectNode) authenticationValue5).put("sasKeyName", parameters.getAction().getServiceBusTopicMessage().getAuthentication().getSasKeyName()); ((ObjectNode) authenticationValue5).put("sasKey", parameters.getAction().getServiceBusTopicMessage().getAuthentication().getSasKey()); ((ObjectNode) authenticationValue5).put("type", SchedulerClientImpl.jobServiceBusAuthenticationTypeToString( parameters.getAction().getServiceBusTopicMessage().getAuthentication().getType())); ((ObjectNode) serviceBusTopicMessageValue2).put("message", parameters.getAction().getServiceBusTopicMessage().getMessage()); if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() != null) { ObjectNode brokeredMessagePropertiesValue3 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusTopicMessageValue2).put("brokeredMessageProperties", brokeredMessagePropertiesValue3); if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getContentType() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("contentType", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getContentType()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getCorrelationId() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("correlationId", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getCorrelationId()); } ((ObjectNode) brokeredMessagePropertiesValue3).put("forcePersistence", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().isForcePersistence()); if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getLabel() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("label", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getLabel()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getMessageId() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("messageId", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getMessageId()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("partitionKey", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getPartitionKey()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getReplyTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("replyTo", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getReplyTo()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getReplyToSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("replyToSessionId", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getReplyToSessionId()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getScheduledEnqueueTimeUtc() != null) { SimpleDateFormat simpleDateFormat8 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat8.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue3).put("scheduledEnqueueTimeUtc", simpleDateFormat8.format(parameters.getAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getScheduledEnqueueTimeUtc().getTime())); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("sessionId", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getSessionId()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getTimeToLive() != null) { SimpleDateFormat simpleDateFormat9 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat9.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue3).put("timeToLive", simpleDateFormat9.format(parameters.getAction().getServiceBusTopicMessage() .getBrokeredMessageProperties().getTimeToLive().getTime())); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("to", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getTo()); } if (parameters.getAction().getServiceBusTopicMessage().getBrokeredMessageProperties() .getViaPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue3).put("viaPartitionKey", parameters.getAction() .getServiceBusTopicMessage().getBrokeredMessageProperties().getViaPartitionKey()); } } if (parameters.getAction().getServiceBusTopicMessage().getCustomMessageProperties() != null) { ObjectNode customMessagePropertiesDictionary3 = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry5 : parameters.getAction().getServiceBusTopicMessage() .getCustomMessageProperties().entrySet()) { String customMessagePropertiesKey3 = entry5.getKey(); String customMessagePropertiesValue3 = entry5.getValue(); ((ObjectNode) customMessagePropertiesDictionary3).put(customMessagePropertiesKey3, customMessagePropertiesValue3); } ((ObjectNode) serviceBusTopicMessageValue2).put("customMessageProperties", customMessagePropertiesDictionary3); } } if (parameters.getAction().getServiceBusQueueMessage() != null) { ObjectNode serviceBusQueueMessageValue2 = objectMapper.createObjectNode(); ((ObjectNode) actionValue).put("serviceBusQueueMessage", serviceBusQueueMessageValue2); ((ObjectNode) serviceBusQueueMessageValue2).put("queueName", parameters.getAction().getServiceBusQueueMessage().getQueueName()); ((ObjectNode) serviceBusQueueMessageValue2).put("namespace", parameters.getAction().getServiceBusQueueMessage().getNamespace()); ((ObjectNode) serviceBusQueueMessageValue2).put("transportType", SchedulerClientImpl.jobServiceBusTransportTypeToString( parameters.getAction().getServiceBusQueueMessage().getTransportType())); ObjectNode authenticationValue6 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusQueueMessageValue2).put("authentication", authenticationValue6); ((ObjectNode) authenticationValue6).put("sasKeyName", parameters.getAction().getServiceBusQueueMessage().getAuthentication().getSasKeyName()); ((ObjectNode) authenticationValue6).put("sasKey", parameters.getAction().getServiceBusQueueMessage().getAuthentication().getSasKey()); ((ObjectNode) authenticationValue6).put("type", SchedulerClientImpl.jobServiceBusAuthenticationTypeToString( parameters.getAction().getServiceBusQueueMessage().getAuthentication().getType())); ((ObjectNode) serviceBusQueueMessageValue2).put("message", parameters.getAction().getServiceBusQueueMessage().getMessage()); if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() != null) { ObjectNode brokeredMessagePropertiesValue4 = objectMapper.createObjectNode(); ((ObjectNode) serviceBusQueueMessageValue2).put("brokeredMessageProperties", brokeredMessagePropertiesValue4); if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getContentType() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("contentType", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getContentType()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getCorrelationId() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("correlationId", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getCorrelationId()); } ((ObjectNode) brokeredMessagePropertiesValue4).put("forcePersistence", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().isForcePersistence()); if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getLabel() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("label", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getLabel()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getMessageId() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("messageId", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getMessageId()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("partitionKey", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getPartitionKey()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getReplyTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("replyTo", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getReplyTo()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getReplyToSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("replyToSessionId", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getReplyToSessionId()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getScheduledEnqueueTimeUtc() != null) { SimpleDateFormat simpleDateFormat10 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat10.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue4).put("scheduledEnqueueTimeUtc", simpleDateFormat10.format(parameters.getAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getScheduledEnqueueTimeUtc().getTime())); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getSessionId() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("sessionId", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getSessionId()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getTimeToLive() != null) { SimpleDateFormat simpleDateFormat11 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat11.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) brokeredMessagePropertiesValue4).put("timeToLive", simpleDateFormat11.format(parameters.getAction().getServiceBusQueueMessage() .getBrokeredMessageProperties().getTimeToLive().getTime())); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getTo() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("to", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getTo()); } if (parameters.getAction().getServiceBusQueueMessage().getBrokeredMessageProperties() .getViaPartitionKey() != null) { ((ObjectNode) brokeredMessagePropertiesValue4).put("viaPartitionKey", parameters.getAction() .getServiceBusQueueMessage().getBrokeredMessageProperties().getViaPartitionKey()); } } if (parameters.getAction().getServiceBusQueueMessage().getCustomMessageProperties() != null) { ObjectNode customMessagePropertiesDictionary4 = objectMapper.createObjectNode(); for (Map.Entry<String, String> entry6 : parameters.getAction().getServiceBusQueueMessage() .getCustomMessageProperties().entrySet()) { String customMessagePropertiesKey4 = entry6.getKey(); String customMessagePropertiesValue4 = entry6.getValue(); ((ObjectNode) customMessagePropertiesDictionary4).put(customMessagePropertiesKey4, customMessagePropertiesValue4); } ((ObjectNode) serviceBusQueueMessageValue2).put("customMessageProperties", customMessagePropertiesDictionary4); } } if (parameters.getRecurrence() != null) { ObjectNode recurrenceValue = objectMapper.createObjectNode(); ((ObjectNode) jobCreateOrUpdateParametersValue).put("recurrence", recurrenceValue); ((ObjectNode) recurrenceValue).put("frequency", SchedulerClientImpl.jobRecurrenceFrequencyToString(parameters.getRecurrence().getFrequency())); if (parameters.getRecurrence().getInterval() != null) { ((ObjectNode) recurrenceValue).put("interval", parameters.getRecurrence().getInterval()); } if (parameters.getRecurrence().getCount() != null) { ((ObjectNode) recurrenceValue).put("count", parameters.getRecurrence().getCount()); } if (parameters.getRecurrence().getEndTime() != null) { SimpleDateFormat simpleDateFormat12 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat12.setTimeZone(TimeZone.getTimeZone("UTC")); ((ObjectNode) recurrenceValue).put("endTime", simpleDateFormat12.format(parameters.getRecurrence().getEndTime().getTime())); } if (parameters.getRecurrence().getSchedule() != null) { ObjectNode scheduleValue = objectMapper.createObjectNode(); ((ObjectNode) recurrenceValue).put("schedule", scheduleValue); if (parameters.getRecurrence().getSchedule().getMinutes() != null) { ArrayNode minutesArray = objectMapper.createArrayNode(); for (int minutesItem : parameters.getRecurrence().getSchedule().getMinutes()) { minutesArray.add(minutesItem); } ((ObjectNode) scheduleValue).put("minutes", minutesArray); } if (parameters.getRecurrence().getSchedule().getHours() != null) { ArrayNode hoursArray = objectMapper.createArrayNode(); for (int hoursItem : parameters.getRecurrence().getSchedule().getHours()) { hoursArray.add(hoursItem); } ((ObjectNode) scheduleValue).put("hours", hoursArray); } if (parameters.getRecurrence().getSchedule().getDays() != null) { ArrayNode weekDaysArray = objectMapper.createArrayNode(); for (JobScheduleDay weekDaysItem : parameters.getRecurrence().getSchedule().getDays()) { weekDaysArray.add(SchedulerClientImpl.jobScheduleDayToString(weekDaysItem)); } ((ObjectNode) scheduleValue).put("weekDays", weekDaysArray); } if (parameters.getRecurrence().getSchedule().getMonths() != null) { ArrayNode monthsArray = objectMapper.createArrayNode(); for (int monthsItem : parameters.getRecurrence().getSchedule().getMonths()) { monthsArray.add(monthsItem); } ((ObjectNode) scheduleValue).put("months", monthsArray); } if (parameters.getRecurrence().getSchedule().getMonthDays() != null) { ArrayNode monthDaysArray = objectMapper.createArrayNode(); for (int monthDaysItem : parameters.getRecurrence().getSchedule().getMonthDays()) { monthDaysArray.add(monthDaysItem); } ((ObjectNode) scheduleValue).put("monthDays", monthDaysArray); } if (parameters.getRecurrence().getSchedule().getMonthlyOccurrences() != null) { ArrayNode monthlyOccurrencesArray = objectMapper.createArrayNode(); for (JobScheduleMonthlyOccurrence monthlyOccurrencesItem : parameters.getRecurrence() .getSchedule().getMonthlyOccurrences()) { ObjectNode jobScheduleMonthlyOccurrenceValue = objectMapper.createObjectNode(); monthlyOccurrencesArray.add(jobScheduleMonthlyOccurrenceValue); ((ObjectNode) jobScheduleMonthlyOccurrenceValue).put("day", SchedulerClientImpl.jobScheduleDayToString(monthlyOccurrencesItem.getDay())); if (monthlyOccurrencesItem.getOccurrence() != null) { ((ObjectNode) jobScheduleMonthlyOccurrenceValue).put("occurrence", monthlyOccurrencesItem.getOccurrence()); } } ((ObjectNode) scheduleValue).put("monthlyOccurrences", monthlyOccurrencesArray); } } } 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 && statusCode != HttpStatus.SC_CREATED) { ServiceException ex = ServiceException.createFromJson(httpRequest, requestContent, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result JobCreateOrUpdateResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_CREATED) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new JobCreateOrUpdateResponse(); 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) { Job jobInstance = new Job(); result.setJob(jobInstance); JsonNode idValue = responseDoc.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); jobInstance.setId(idInstance); } JsonNode startTimeValue = responseDoc.get("startTime"); if (startTimeValue != null && startTimeValue instanceof NullNode == false) { Calendar startTimeInstance; startTimeInstance = DatatypeConverter.parseDateTime(startTimeValue.getTextValue()); jobInstance.setStartTime(startTimeInstance); } JsonNode actionValue2 = responseDoc.get("action"); if (actionValue2 != null && actionValue2 instanceof NullNode == false) { JobAction actionInstance = new JobAction(); jobInstance.setAction(actionInstance); JsonNode typeValue = actionValue2.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { JobActionType typeInstance; typeInstance = SchedulerClientImpl.parseJobActionType(typeValue.getTextValue()); actionInstance.setType(typeInstance); } JsonNode retryPolicyValue2 = actionValue2.get("retryPolicy"); if (retryPolicyValue2 != null && retryPolicyValue2 instanceof NullNode == false) { RetryPolicy retryPolicyInstance = new RetryPolicy(); actionInstance.setRetryPolicy(retryPolicyInstance); JsonNode retryTypeValue = retryPolicyValue2.get("retryType"); if (retryTypeValue != null && retryTypeValue instanceof NullNode == false) { RetryType retryTypeInstance; retryTypeInstance = SchedulerClientImpl .parseRetryType(retryTypeValue.getTextValue()); retryPolicyInstance.setRetryType(retryTypeInstance); } JsonNode retryIntervalValue = retryPolicyValue2.get("retryInterval"); if (retryIntervalValue != null && retryIntervalValue instanceof NullNode == false) { Duration retryIntervalInstance; retryIntervalInstance = TimeSpan8601Converter .parse(retryIntervalValue.getTextValue()); retryPolicyInstance.setRetryInterval(retryIntervalInstance); } JsonNode retryCountValue = retryPolicyValue2.get("retryCount"); if (retryCountValue != null && retryCountValue instanceof NullNode == false) { int retryCountInstance; retryCountInstance = retryCountValue.getIntValue(); retryPolicyInstance.setRetryCount(retryCountInstance); } } JsonNode errorActionValue2 = actionValue2.get("errorAction"); if (errorActionValue2 != null && errorActionValue2 instanceof NullNode == false) { JobErrorAction errorActionInstance = new JobErrorAction(); actionInstance.setErrorAction(errorActionInstance); JsonNode typeValue2 = errorActionValue2.get("type"); if (typeValue2 != null && typeValue2 instanceof NullNode == false) { JobActionType typeInstance2; typeInstance2 = SchedulerClientImpl.parseJobActionType(typeValue2.getTextValue()); errorActionInstance.setType(typeInstance2); } JsonNode requestValue3 = errorActionValue2.get("request"); if (requestValue3 != null && requestValue3 instanceof NullNode == false) { JobHttpRequest requestInstance = new JobHttpRequest(); errorActionInstance.setRequest(requestInstance); JsonNode uriValue = requestValue3.get("uri"); if (uriValue != null && uriValue instanceof NullNode == false) { URI uriInstance; uriInstance = new URI(uriValue.getTextValue()); requestInstance.setUri(uriInstance); } JsonNode methodValue = requestValue3.get("method"); if (methodValue != null && methodValue instanceof NullNode == false) { String methodInstance; methodInstance = methodValue.getTextValue(); requestInstance.setMethod(methodInstance); } JsonNode headersSequenceElement = ((JsonNode) requestValue3.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 headersKey3 = property.getKey(); String headersValue3 = property.getValue().getTextValue(); requestInstance.getHeaders().put(headersKey3, headersValue3); } } JsonNode bodyValue = requestValue3.get("body"); if (bodyValue != null && bodyValue instanceof NullNode == false) { String bodyInstance; bodyInstance = bodyValue.getTextValue(); requestInstance.setBody(bodyInstance); } JsonNode authenticationValue7 = requestValue3.get("authentication"); if (authenticationValue7 != null && authenticationValue7 instanceof NullNode == false) { String typeName = authenticationValue7.get("type").getTextValue(); if ("ClientCertificate".equals(typeName)) { ClientCertAuthentication clientCertAuthenticationInstance = new ClientCertAuthentication(); JsonNode passwordValue = authenticationValue7.get("password"); if (passwordValue != null && passwordValue instanceof NullNode == false) { String passwordInstance; passwordInstance = passwordValue.getTextValue(); clientCertAuthenticationInstance.setPassword(passwordInstance); } JsonNode pfxValue = authenticationValue7.get("pfx"); if (pfxValue != null && pfxValue instanceof NullNode == false) { String pfxInstance; pfxInstance = pfxValue.getTextValue(); clientCertAuthenticationInstance.setPfx(pfxInstance); } JsonNode certificateThumbprintValue = authenticationValue7 .get("certificateThumbprint"); if (certificateThumbprintValue != null && certificateThumbprintValue instanceof NullNode == false) { String certificateThumbprintInstance; certificateThumbprintInstance = certificateThumbprintValue .getTextValue(); clientCertAuthenticationInstance .setCertificateThumbprint(certificateThumbprintInstance); } JsonNode certificateExpirationValue = authenticationValue7 .get("certificateExpiration"); if (certificateExpirationValue != null && certificateExpirationValue instanceof NullNode == false) { Calendar certificateExpirationInstance; certificateExpirationInstance = DatatypeConverter .parseDateTime(certificateExpirationValue.getTextValue()); clientCertAuthenticationInstance .setCertificateExpiration(certificateExpirationInstance); } JsonNode certificateSubjectNameValue = authenticationValue7 .get("certificateSubjectName"); if (certificateSubjectNameValue != null && certificateSubjectNameValue instanceof NullNode == false) { String certificateSubjectNameInstance; certificateSubjectNameInstance = certificateSubjectNameValue .getTextValue(); clientCertAuthenticationInstance .setCertificateSubjectName(certificateSubjectNameInstance); } JsonNode typeValue3 = authenticationValue7.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 = authenticationValue7.get("secret"); if (secretValue != null && secretValue instanceof NullNode == false) { String secretInstance; secretInstance = secretValue.getTextValue(); aADOAuthAuthenticationInstance.setSecret(secretInstance); } JsonNode tenantValue = authenticationValue7.get("tenant"); if (tenantValue != null && tenantValue instanceof NullNode == false) { String tenantInstance; tenantInstance = tenantValue.getTextValue(); aADOAuthAuthenticationInstance.setTenant(tenantInstance); } JsonNode audienceValue = authenticationValue7.get("audience"); if (audienceValue != null && audienceValue instanceof NullNode == false) { String audienceInstance; audienceInstance = audienceValue.getTextValue(); aADOAuthAuthenticationInstance.setAudience(audienceInstance); } JsonNode clientIdValue = authenticationValue7.get("clientId"); if (clientIdValue != null && clientIdValue instanceof NullNode == false) { String clientIdInstance; clientIdInstance = clientIdValue.getTextValue(); aADOAuthAuthenticationInstance.setClientId(clientIdInstance); } JsonNode typeValue4 = authenticationValue7.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 = authenticationValue7.get("username"); if (usernameValue != null && usernameValue instanceof NullNode == false) { String usernameInstance; usernameInstance = usernameValue.getTextValue(); basicAuthenticationInstance.setUsername(usernameInstance); } JsonNode passwordValue2 = authenticationValue7.get("password"); if (passwordValue2 != null && passwordValue2 instanceof NullNode == false) { String passwordInstance2; passwordInstance2 = passwordValue2.getTextValue(); basicAuthenticationInstance.setPassword(passwordInstance2); } JsonNode typeValue5 = authenticationValue7.get("type"); if (typeValue5 != null && typeValue5 instanceof NullNode == false) { HttpAuthenticationType typeInstance5; typeInstance5 = SchedulerClientImpl .parseHttpAuthenticationType(typeValue5.getTextValue()); basicAuthenticationInstance.setType(typeInstance5); } requestInstance.setAuthentication(basicAuthenticationInstance); } } } JsonNode queueMessageValue3 = errorActionValue2.get("queueMessage"); if (queueMessageValue3 != null && queueMessageValue3 instanceof NullNode == false) { JobQueueMessage queueMessageInstance = new JobQueueMessage(); errorActionInstance.setQueueMessage(queueMessageInstance); JsonNode storageAccountValue = queueMessageValue3.get("storageAccount"); if (storageAccountValue != null && storageAccountValue instanceof NullNode == false) { String storageAccountInstance; storageAccountInstance = storageAccountValue.getTextValue(); queueMessageInstance.setStorageAccountName(storageAccountInstance); } JsonNode queueNameValue = queueMessageValue3.get("queueName"); if (queueNameValue != null && queueNameValue instanceof NullNode == false) { String queueNameInstance; queueNameInstance = queueNameValue.getTextValue(); queueMessageInstance.setQueueName(queueNameInstance); } JsonNode sasTokenValue = queueMessageValue3.get("sasToken"); if (sasTokenValue != null && sasTokenValue instanceof NullNode == false) { String sasTokenInstance; sasTokenInstance = sasTokenValue.getTextValue(); queueMessageInstance.setSasToken(sasTokenInstance); } JsonNode messageValue = queueMessageValue3.get("message"); if (messageValue != null && messageValue instanceof NullNode == false) { String messageInstance; messageInstance = messageValue.getTextValue(); queueMessageInstance.setMessage(messageInstance); } } JsonNode serviceBusTopicMessageValue3 = errorActionValue2.get("serviceBusTopicMessage"); if (serviceBusTopicMessageValue3 != null && serviceBusTopicMessageValue3 instanceof NullNode == false) { JobServiceBusTopicMessage serviceBusTopicMessageInstance = new JobServiceBusTopicMessage(); errorActionInstance.setServiceBusTopicMessage(serviceBusTopicMessageInstance); JsonNode topicPathValue = serviceBusTopicMessageValue3.get("topicPath"); if (topicPathValue != null && topicPathValue instanceof NullNode == false) { String topicPathInstance; topicPathInstance = topicPathValue.getTextValue(); serviceBusTopicMessageInstance.setTopicPath(topicPathInstance); } JsonNode namespaceValue = serviceBusTopicMessageValue3.get("namespace"); if (namespaceValue != null && namespaceValue instanceof NullNode == false) { String namespaceInstance; namespaceInstance = namespaceValue.getTextValue(); serviceBusTopicMessageInstance.setNamespace(namespaceInstance); } JsonNode transportTypeValue = serviceBusTopicMessageValue3.get("transportType"); if (transportTypeValue != null && transportTypeValue instanceof NullNode == false) { JobServiceBusTransportType transportTypeInstance; transportTypeInstance = SchedulerClientImpl .parseJobServiceBusTransportType(transportTypeValue.getTextValue()); serviceBusTopicMessageInstance.setTransportType(transportTypeInstance); } JsonNode authenticationValue8 = serviceBusTopicMessageValue3.get("authentication"); if (authenticationValue8 != null && authenticationValue8 instanceof NullNode == false) { JobServiceBusAuthentication authenticationInstance = new JobServiceBusAuthentication(); serviceBusTopicMessageInstance.setAuthentication(authenticationInstance); JsonNode sasKeyNameValue = authenticationValue8.get("sasKeyName"); if (sasKeyNameValue != null && sasKeyNameValue instanceof NullNode == false) { String sasKeyNameInstance; sasKeyNameInstance = sasKeyNameValue.getTextValue(); authenticationInstance.setSasKeyName(sasKeyNameInstance); } JsonNode sasKeyValue = authenticationValue8.get("sasKey"); if (sasKeyValue != null && sasKeyValue instanceof NullNode == false) { String sasKeyInstance; sasKeyInstance = sasKeyValue.getTextValue(); authenticationInstance.setSasKey(sasKeyInstance); } JsonNode typeValue6 = authenticationValue8.get("type"); if (typeValue6 != null && typeValue6 instanceof NullNode == false) { JobServiceBusAuthenticationType typeInstance6; typeInstance6 = SchedulerClientImpl .parseJobServiceBusAuthenticationType(typeValue6.getTextValue()); authenticationInstance.setType(typeInstance6); } } JsonNode messageValue2 = serviceBusTopicMessageValue3.get("message"); if (messageValue2 != null && messageValue2 instanceof NullNode == false) { String messageInstance2; messageInstance2 = messageValue2.getTextValue(); serviceBusTopicMessageInstance.setMessage(messageInstance2); } JsonNode brokeredMessagePropertiesValue5 = serviceBusTopicMessageValue3 .get("brokeredMessageProperties"); if (brokeredMessagePropertiesValue5 != null && brokeredMessagePropertiesValue5 instanceof NullNode == false) { JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance = new JobServiceBusBrokeredMessageProperties(); serviceBusTopicMessageInstance .setBrokeredMessageProperties(brokeredMessagePropertiesInstance); JsonNode contentTypeValue = brokeredMessagePropertiesValue5.get("contentType"); if (contentTypeValue != null && contentTypeValue instanceof NullNode == false) { String contentTypeInstance; contentTypeInstance = contentTypeValue.getTextValue(); brokeredMessagePropertiesInstance.setContentType(contentTypeInstance); } JsonNode correlationIdValue = brokeredMessagePropertiesValue5 .get("correlationId"); if (correlationIdValue != null && correlationIdValue instanceof NullNode == false) { String correlationIdInstance; correlationIdInstance = correlationIdValue.getTextValue(); brokeredMessagePropertiesInstance.setCorrelationId(correlationIdInstance); } JsonNode forcePersistenceValue = brokeredMessagePropertiesValue5 .get("forcePersistence"); if (forcePersistenceValue != null && forcePersistenceValue instanceof NullNode == false) { boolean forcePersistenceInstance; forcePersistenceInstance = forcePersistenceValue.getBooleanValue(); brokeredMessagePropertiesInstance .setForcePersistence(forcePersistenceInstance); } JsonNode labelValue = brokeredMessagePropertiesValue5.get("label"); if (labelValue != null && labelValue instanceof NullNode == false) { String labelInstance; labelInstance = labelValue.getTextValue(); brokeredMessagePropertiesInstance.setLabel(labelInstance); } JsonNode messageIdValue = brokeredMessagePropertiesValue5.get("messageId"); if (messageIdValue != null && messageIdValue instanceof NullNode == false) { String messageIdInstance; messageIdInstance = messageIdValue.getTextValue(); brokeredMessagePropertiesInstance.setMessageId(messageIdInstance); } JsonNode partitionKeyValue = brokeredMessagePropertiesValue5 .get("partitionKey"); if (partitionKeyValue != null && partitionKeyValue instanceof NullNode == false) { String partitionKeyInstance; partitionKeyInstance = partitionKeyValue.getTextValue(); brokeredMessagePropertiesInstance.setPartitionKey(partitionKeyInstance); } JsonNode replyToValue = brokeredMessagePropertiesValue5.get("replyTo"); if (replyToValue != null && replyToValue instanceof NullNode == false) { String replyToInstance; replyToInstance = replyToValue.getTextValue(); brokeredMessagePropertiesInstance.setReplyTo(replyToInstance); } JsonNode replyToSessionIdValue = brokeredMessagePropertiesValue5 .get("replyToSessionId"); if (replyToSessionIdValue != null && replyToSessionIdValue instanceof NullNode == false) { String replyToSessionIdInstance; replyToSessionIdInstance = replyToSessionIdValue.getTextValue(); brokeredMessagePropertiesInstance .setReplyToSessionId(replyToSessionIdInstance); } JsonNode scheduledEnqueueTimeUtcValue = brokeredMessagePropertiesValue5 .get("scheduledEnqueueTimeUtc"); if (scheduledEnqueueTimeUtcValue != null && scheduledEnqueueTimeUtcValue instanceof NullNode == false) { Calendar scheduledEnqueueTimeUtcInstance; scheduledEnqueueTimeUtcInstance = DatatypeConverter .parseDateTime(scheduledEnqueueTimeUtcValue.getTextValue()); brokeredMessagePropertiesInstance .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance); } JsonNode sessionIdValue = brokeredMessagePropertiesValue5.get("sessionId"); if (sessionIdValue != null && sessionIdValue instanceof NullNode == false) { String sessionIdInstance; sessionIdInstance = sessionIdValue.getTextValue(); brokeredMessagePropertiesInstance.setSessionId(sessionIdInstance); } JsonNode timeToLiveValue = brokeredMessagePropertiesValue5.get("timeToLive"); if (timeToLiveValue != null && timeToLiveValue instanceof NullNode == false) { Calendar timeToLiveInstance; timeToLiveInstance = DatatypeConverter .parseDateTime(timeToLiveValue.getTextValue()); brokeredMessagePropertiesInstance.setTimeToLive(timeToLiveInstance); } JsonNode toValue = brokeredMessagePropertiesValue5.get("to"); if (toValue != null && toValue instanceof NullNode == false) { String toInstance; toInstance = toValue.getTextValue(); brokeredMessagePropertiesInstance.setTo(toInstance); } JsonNode viaPartitionKeyValue = brokeredMessagePropertiesValue5 .get("viaPartitionKey"); if (viaPartitionKeyValue != null && viaPartitionKeyValue instanceof NullNode == false) { String viaPartitionKeyInstance; viaPartitionKeyInstance = viaPartitionKeyValue.getTextValue(); brokeredMessagePropertiesInstance .setViaPartitionKey(viaPartitionKeyInstance); } } JsonNode customMessagePropertiesSequenceElement = ((JsonNode) serviceBusTopicMessageValue3 .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 customMessagePropertiesKey5 = property2.getKey(); String customMessagePropertiesValue5 = property2.getValue().getTextValue(); serviceBusTopicMessageInstance.getCustomMessageProperties() .put(customMessagePropertiesKey5, customMessagePropertiesValue5); } } } JsonNode serviceBusQueueMessageValue3 = errorActionValue2.get("serviceBusQueueMessage"); if (serviceBusQueueMessageValue3 != null && serviceBusQueueMessageValue3 instanceof NullNode == false) { JobServiceBusQueueMessage serviceBusQueueMessageInstance = new JobServiceBusQueueMessage(); errorActionInstance.setServiceBusQueueMessage(serviceBusQueueMessageInstance); JsonNode queueNameValue2 = serviceBusQueueMessageValue3.get("queueName"); if (queueNameValue2 != null && queueNameValue2 instanceof NullNode == false) { String queueNameInstance2; queueNameInstance2 = queueNameValue2.getTextValue(); serviceBusQueueMessageInstance.setQueueName(queueNameInstance2); } JsonNode namespaceValue2 = serviceBusQueueMessageValue3.get("namespace"); if (namespaceValue2 != null && namespaceValue2 instanceof NullNode == false) { String namespaceInstance2; namespaceInstance2 = namespaceValue2.getTextValue(); serviceBusQueueMessageInstance.setNamespace(namespaceInstance2); } JsonNode transportTypeValue2 = serviceBusQueueMessageValue3.get("transportType"); if (transportTypeValue2 != null && transportTypeValue2 instanceof NullNode == false) { JobServiceBusTransportType transportTypeInstance2; transportTypeInstance2 = SchedulerClientImpl .parseJobServiceBusTransportType(transportTypeValue2.getTextValue()); serviceBusQueueMessageInstance.setTransportType(transportTypeInstance2); } JsonNode authenticationValue9 = serviceBusQueueMessageValue3.get("authentication"); if (authenticationValue9 != null && authenticationValue9 instanceof NullNode == false) { JobServiceBusAuthentication authenticationInstance2 = new JobServiceBusAuthentication(); serviceBusQueueMessageInstance.setAuthentication(authenticationInstance2); JsonNode sasKeyNameValue2 = authenticationValue9.get("sasKeyName"); if (sasKeyNameValue2 != null && sasKeyNameValue2 instanceof NullNode == false) { String sasKeyNameInstance2; sasKeyNameInstance2 = sasKeyNameValue2.getTextValue(); authenticationInstance2.setSasKeyName(sasKeyNameInstance2); } JsonNode sasKeyValue2 = authenticationValue9.get("sasKey"); if (sasKeyValue2 != null && sasKeyValue2 instanceof NullNode == false) { String sasKeyInstance2; sasKeyInstance2 = sasKeyValue2.getTextValue(); authenticationInstance2.setSasKey(sasKeyInstance2); } JsonNode typeValue7 = authenticationValue9.get("type"); if (typeValue7 != null && typeValue7 instanceof NullNode == false) { JobServiceBusAuthenticationType typeInstance7; typeInstance7 = SchedulerClientImpl .parseJobServiceBusAuthenticationType(typeValue7.getTextValue()); authenticationInstance2.setType(typeInstance7); } } JsonNode messageValue3 = serviceBusQueueMessageValue3.get("message"); if (messageValue3 != null && messageValue3 instanceof NullNode == false) { String messageInstance3; messageInstance3 = messageValue3.getTextValue(); serviceBusQueueMessageInstance.setMessage(messageInstance3); } JsonNode brokeredMessagePropertiesValue6 = serviceBusQueueMessageValue3 .get("brokeredMessageProperties"); if (brokeredMessagePropertiesValue6 != null && brokeredMessagePropertiesValue6 instanceof NullNode == false) { JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance2 = new JobServiceBusBrokeredMessageProperties(); serviceBusQueueMessageInstance .setBrokeredMessageProperties(brokeredMessagePropertiesInstance2); JsonNode contentTypeValue2 = brokeredMessagePropertiesValue6.get("contentType"); if (contentTypeValue2 != null && contentTypeValue2 instanceof NullNode == false) { String contentTypeInstance2; contentTypeInstance2 = contentTypeValue2.getTextValue(); brokeredMessagePropertiesInstance2.setContentType(contentTypeInstance2); } JsonNode correlationIdValue2 = brokeredMessagePropertiesValue6 .get("correlationId"); if (correlationIdValue2 != null && correlationIdValue2 instanceof NullNode == false) { String correlationIdInstance2; correlationIdInstance2 = correlationIdValue2.getTextValue(); brokeredMessagePropertiesInstance2.setCorrelationId(correlationIdInstance2); } JsonNode forcePersistenceValue2 = brokeredMessagePropertiesValue6 .get("forcePersistence"); if (forcePersistenceValue2 != null && forcePersistenceValue2 instanceof NullNode == false) { boolean forcePersistenceInstance2; forcePersistenceInstance2 = forcePersistenceValue2.getBooleanValue(); brokeredMessagePropertiesInstance2 .setForcePersistence(forcePersistenceInstance2); } JsonNode labelValue2 = brokeredMessagePropertiesValue6.get("label"); if (labelValue2 != null && labelValue2 instanceof NullNode == false) { String labelInstance2; labelInstance2 = labelValue2.getTextValue(); brokeredMessagePropertiesInstance2.setLabel(labelInstance2); } JsonNode messageIdValue2 = brokeredMessagePropertiesValue6.get("messageId"); if (messageIdValue2 != null && messageIdValue2 instanceof NullNode == false) { String messageIdInstance2; messageIdInstance2 = messageIdValue2.getTextValue(); brokeredMessagePropertiesInstance2.setMessageId(messageIdInstance2); } JsonNode partitionKeyValue2 = brokeredMessagePropertiesValue6 .get("partitionKey"); if (partitionKeyValue2 != null && partitionKeyValue2 instanceof NullNode == false) { String partitionKeyInstance2; partitionKeyInstance2 = partitionKeyValue2.getTextValue(); brokeredMessagePropertiesInstance2.setPartitionKey(partitionKeyInstance2); } JsonNode replyToValue2 = brokeredMessagePropertiesValue6.get("replyTo"); if (replyToValue2 != null && replyToValue2 instanceof NullNode == false) { String replyToInstance2; replyToInstance2 = replyToValue2.getTextValue(); brokeredMessagePropertiesInstance2.setReplyTo(replyToInstance2); } JsonNode replyToSessionIdValue2 = brokeredMessagePropertiesValue6 .get("replyToSessionId"); if (replyToSessionIdValue2 != null && replyToSessionIdValue2 instanceof NullNode == false) { String replyToSessionIdInstance2; replyToSessionIdInstance2 = replyToSessionIdValue2.getTextValue(); brokeredMessagePropertiesInstance2 .setReplyToSessionId(replyToSessionIdInstance2); } JsonNode scheduledEnqueueTimeUtcValue2 = brokeredMessagePropertiesValue6 .get("scheduledEnqueueTimeUtc"); if (scheduledEnqueueTimeUtcValue2 != null && scheduledEnqueueTimeUtcValue2 instanceof NullNode == false) { Calendar scheduledEnqueueTimeUtcInstance2; scheduledEnqueueTimeUtcInstance2 = DatatypeConverter .parseDateTime(scheduledEnqueueTimeUtcValue2.getTextValue()); brokeredMessagePropertiesInstance2 .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance2); } JsonNode sessionIdValue2 = brokeredMessagePropertiesValue6.get("sessionId"); if (sessionIdValue2 != null && sessionIdValue2 instanceof NullNode == false) { String sessionIdInstance2; sessionIdInstance2 = sessionIdValue2.getTextValue(); brokeredMessagePropertiesInstance2.setSessionId(sessionIdInstance2); } JsonNode timeToLiveValue2 = brokeredMessagePropertiesValue6.get("timeToLive"); if (timeToLiveValue2 != null && timeToLiveValue2 instanceof NullNode == false) { Calendar timeToLiveInstance2; timeToLiveInstance2 = DatatypeConverter .parseDateTime(timeToLiveValue2.getTextValue()); brokeredMessagePropertiesInstance2.setTimeToLive(timeToLiveInstance2); } JsonNode toValue2 = brokeredMessagePropertiesValue6.get("to"); if (toValue2 != null && toValue2 instanceof NullNode == false) { String toInstance2; toInstance2 = toValue2.getTextValue(); brokeredMessagePropertiesInstance2.setTo(toInstance2); } JsonNode viaPartitionKeyValue2 = brokeredMessagePropertiesValue6 .get("viaPartitionKey"); if (viaPartitionKeyValue2 != null && viaPartitionKeyValue2 instanceof NullNode == false) { String viaPartitionKeyInstance2; viaPartitionKeyInstance2 = viaPartitionKeyValue2.getTextValue(); brokeredMessagePropertiesInstance2 .setViaPartitionKey(viaPartitionKeyInstance2); } } JsonNode customMessagePropertiesSequenceElement2 = ((JsonNode) serviceBusQueueMessageValue3 .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 customMessagePropertiesKey6 = property3.getKey(); String customMessagePropertiesValue6 = property3.getValue().getTextValue(); serviceBusQueueMessageInstance.getCustomMessageProperties() .put(customMessagePropertiesKey6, customMessagePropertiesValue6); } } } } JsonNode requestValue4 = actionValue2.get("request"); if (requestValue4 != null && requestValue4 instanceof NullNode == false) { JobHttpRequest requestInstance2 = new JobHttpRequest(); actionInstance.setRequest(requestInstance2); JsonNode uriValue2 = requestValue4.get("uri"); if (uriValue2 != null && uriValue2 instanceof NullNode == false) { URI uriInstance2; uriInstance2 = new URI(uriValue2.getTextValue()); requestInstance2.setUri(uriInstance2); } JsonNode methodValue2 = requestValue4.get("method"); if (methodValue2 != null && methodValue2 instanceof NullNode == false) { String methodInstance2; methodInstance2 = methodValue2.getTextValue(); requestInstance2.setMethod(methodInstance2); } JsonNode headersSequenceElement2 = ((JsonNode) requestValue4.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 headersKey4 = property4.getKey(); String headersValue4 = property4.getValue().getTextValue(); requestInstance2.getHeaders().put(headersKey4, headersValue4); } } JsonNode bodyValue2 = requestValue4.get("body"); if (bodyValue2 != null && bodyValue2 instanceof NullNode == false) { String bodyInstance2; bodyInstance2 = bodyValue2.getTextValue(); requestInstance2.setBody(bodyInstance2); } JsonNode authenticationValue10 = requestValue4.get("authentication"); if (authenticationValue10 != null && authenticationValue10 instanceof NullNode == false) { String typeName2 = authenticationValue10.get("type").getTextValue(); if ("ClientCertificate".equals(typeName2)) { ClientCertAuthentication clientCertAuthenticationInstance2 = new ClientCertAuthentication(); JsonNode passwordValue3 = authenticationValue10.get("password"); if (passwordValue3 != null && passwordValue3 instanceof NullNode == false) { String passwordInstance3; passwordInstance3 = passwordValue3.getTextValue(); clientCertAuthenticationInstance2.setPassword(passwordInstance3); } JsonNode pfxValue2 = authenticationValue10.get("pfx"); if (pfxValue2 != null && pfxValue2 instanceof NullNode == false) { String pfxInstance2; pfxInstance2 = pfxValue2.getTextValue(); clientCertAuthenticationInstance2.setPfx(pfxInstance2); } JsonNode certificateThumbprintValue2 = authenticationValue10 .get("certificateThumbprint"); if (certificateThumbprintValue2 != null && certificateThumbprintValue2 instanceof NullNode == false) { String certificateThumbprintInstance2; certificateThumbprintInstance2 = certificateThumbprintValue2.getTextValue(); clientCertAuthenticationInstance2 .setCertificateThumbprint(certificateThumbprintInstance2); } JsonNode certificateExpirationValue2 = authenticationValue10 .get("certificateExpiration"); if (certificateExpirationValue2 != null && certificateExpirationValue2 instanceof NullNode == false) { Calendar certificateExpirationInstance2; certificateExpirationInstance2 = DatatypeConverter .parseDateTime(certificateExpirationValue2.getTextValue()); clientCertAuthenticationInstance2 .setCertificateExpiration(certificateExpirationInstance2); } JsonNode certificateSubjectNameValue2 = authenticationValue10 .get("certificateSubjectName"); if (certificateSubjectNameValue2 != null && certificateSubjectNameValue2 instanceof NullNode == false) { String certificateSubjectNameInstance2; certificateSubjectNameInstance2 = certificateSubjectNameValue2 .getTextValue(); clientCertAuthenticationInstance2 .setCertificateSubjectName(certificateSubjectNameInstance2); } JsonNode typeValue8 = authenticationValue10.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 = authenticationValue10.get("secret"); if (secretValue2 != null && secretValue2 instanceof NullNode == false) { String secretInstance2; secretInstance2 = secretValue2.getTextValue(); aADOAuthAuthenticationInstance2.setSecret(secretInstance2); } JsonNode tenantValue2 = authenticationValue10.get("tenant"); if (tenantValue2 != null && tenantValue2 instanceof NullNode == false) { String tenantInstance2; tenantInstance2 = tenantValue2.getTextValue(); aADOAuthAuthenticationInstance2.setTenant(tenantInstance2); } JsonNode audienceValue2 = authenticationValue10.get("audience"); if (audienceValue2 != null && audienceValue2 instanceof NullNode == false) { String audienceInstance2; audienceInstance2 = audienceValue2.getTextValue(); aADOAuthAuthenticationInstance2.setAudience(audienceInstance2); } JsonNode clientIdValue2 = authenticationValue10.get("clientId"); if (clientIdValue2 != null && clientIdValue2 instanceof NullNode == false) { String clientIdInstance2; clientIdInstance2 = clientIdValue2.getTextValue(); aADOAuthAuthenticationInstance2.setClientId(clientIdInstance2); } JsonNode typeValue9 = authenticationValue10.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 = authenticationValue10.get("username"); if (usernameValue2 != null && usernameValue2 instanceof NullNode == false) { String usernameInstance2; usernameInstance2 = usernameValue2.getTextValue(); basicAuthenticationInstance2.setUsername(usernameInstance2); } JsonNode passwordValue4 = authenticationValue10.get("password"); if (passwordValue4 != null && passwordValue4 instanceof NullNode == false) { String passwordInstance4; passwordInstance4 = passwordValue4.getTextValue(); basicAuthenticationInstance2.setPassword(passwordInstance4); } JsonNode typeValue10 = authenticationValue10.get("type"); if (typeValue10 != null && typeValue10 instanceof NullNode == false) { HttpAuthenticationType typeInstance10; typeInstance10 = SchedulerClientImpl .parseHttpAuthenticationType(typeValue10.getTextValue()); basicAuthenticationInstance2.setType(typeInstance10); } requestInstance2.setAuthentication(basicAuthenticationInstance2); } } } JsonNode queueMessageValue4 = actionValue2.get("queueMessage"); if (queueMessageValue4 != null && queueMessageValue4 instanceof NullNode == false) { JobQueueMessage queueMessageInstance2 = new JobQueueMessage(); actionInstance.setQueueMessage(queueMessageInstance2); JsonNode storageAccountValue2 = queueMessageValue4.get("storageAccount"); if (storageAccountValue2 != null && storageAccountValue2 instanceof NullNode == false) { String storageAccountInstance2; storageAccountInstance2 = storageAccountValue2.getTextValue(); queueMessageInstance2.setStorageAccountName(storageAccountInstance2); } JsonNode queueNameValue3 = queueMessageValue4.get("queueName"); if (queueNameValue3 != null && queueNameValue3 instanceof NullNode == false) { String queueNameInstance3; queueNameInstance3 = queueNameValue3.getTextValue(); queueMessageInstance2.setQueueName(queueNameInstance3); } JsonNode sasTokenValue2 = queueMessageValue4.get("sasToken"); if (sasTokenValue2 != null && sasTokenValue2 instanceof NullNode == false) { String sasTokenInstance2; sasTokenInstance2 = sasTokenValue2.getTextValue(); queueMessageInstance2.setSasToken(sasTokenInstance2); } JsonNode messageValue4 = queueMessageValue4.get("message"); if (messageValue4 != null && messageValue4 instanceof NullNode == false) { String messageInstance4; messageInstance4 = messageValue4.getTextValue(); queueMessageInstance2.setMessage(messageInstance4); } } JsonNode serviceBusTopicMessageValue4 = actionValue2.get("serviceBusTopicMessage"); if (serviceBusTopicMessageValue4 != null && serviceBusTopicMessageValue4 instanceof NullNode == false) { JobServiceBusTopicMessage serviceBusTopicMessageInstance2 = new JobServiceBusTopicMessage(); actionInstance.setServiceBusTopicMessage(serviceBusTopicMessageInstance2); JsonNode topicPathValue2 = serviceBusTopicMessageValue4.get("topicPath"); if (topicPathValue2 != null && topicPathValue2 instanceof NullNode == false) { String topicPathInstance2; topicPathInstance2 = topicPathValue2.getTextValue(); serviceBusTopicMessageInstance2.setTopicPath(topicPathInstance2); } JsonNode namespaceValue3 = serviceBusTopicMessageValue4.get("namespace"); if (namespaceValue3 != null && namespaceValue3 instanceof NullNode == false) { String namespaceInstance3; namespaceInstance3 = namespaceValue3.getTextValue(); serviceBusTopicMessageInstance2.setNamespace(namespaceInstance3); } JsonNode transportTypeValue3 = serviceBusTopicMessageValue4.get("transportType"); if (transportTypeValue3 != null && transportTypeValue3 instanceof NullNode == false) { JobServiceBusTransportType transportTypeInstance3; transportTypeInstance3 = SchedulerClientImpl .parseJobServiceBusTransportType(transportTypeValue3.getTextValue()); serviceBusTopicMessageInstance2.setTransportType(transportTypeInstance3); } JsonNode authenticationValue11 = serviceBusTopicMessageValue4.get("authentication"); if (authenticationValue11 != null && authenticationValue11 instanceof NullNode == false) { JobServiceBusAuthentication authenticationInstance3 = new JobServiceBusAuthentication(); serviceBusTopicMessageInstance2.setAuthentication(authenticationInstance3); JsonNode sasKeyNameValue3 = authenticationValue11.get("sasKeyName"); if (sasKeyNameValue3 != null && sasKeyNameValue3 instanceof NullNode == false) { String sasKeyNameInstance3; sasKeyNameInstance3 = sasKeyNameValue3.getTextValue(); authenticationInstance3.setSasKeyName(sasKeyNameInstance3); } JsonNode sasKeyValue3 = authenticationValue11.get("sasKey"); if (sasKeyValue3 != null && sasKeyValue3 instanceof NullNode == false) { String sasKeyInstance3; sasKeyInstance3 = sasKeyValue3.getTextValue(); authenticationInstance3.setSasKey(sasKeyInstance3); } JsonNode typeValue11 = authenticationValue11.get("type"); if (typeValue11 != null && typeValue11 instanceof NullNode == false) { JobServiceBusAuthenticationType typeInstance11; typeInstance11 = SchedulerClientImpl .parseJobServiceBusAuthenticationType(typeValue11.getTextValue()); authenticationInstance3.setType(typeInstance11); } } JsonNode messageValue5 = serviceBusTopicMessageValue4.get("message"); if (messageValue5 != null && messageValue5 instanceof NullNode == false) { String messageInstance5; messageInstance5 = messageValue5.getTextValue(); serviceBusTopicMessageInstance2.setMessage(messageInstance5); } JsonNode brokeredMessagePropertiesValue7 = serviceBusTopicMessageValue4 .get("brokeredMessageProperties"); if (brokeredMessagePropertiesValue7 != null && brokeredMessagePropertiesValue7 instanceof NullNode == false) { JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance3 = new JobServiceBusBrokeredMessageProperties(); serviceBusTopicMessageInstance2 .setBrokeredMessageProperties(brokeredMessagePropertiesInstance3); JsonNode contentTypeValue3 = brokeredMessagePropertiesValue7.get("contentType"); if (contentTypeValue3 != null && contentTypeValue3 instanceof NullNode == false) { String contentTypeInstance3; contentTypeInstance3 = contentTypeValue3.getTextValue(); brokeredMessagePropertiesInstance3.setContentType(contentTypeInstance3); } JsonNode correlationIdValue3 = brokeredMessagePropertiesValue7.get("correlationId"); if (correlationIdValue3 != null && correlationIdValue3 instanceof NullNode == false) { String correlationIdInstance3; correlationIdInstance3 = correlationIdValue3.getTextValue(); brokeredMessagePropertiesInstance3.setCorrelationId(correlationIdInstance3); } JsonNode forcePersistenceValue3 = brokeredMessagePropertiesValue7 .get("forcePersistence"); if (forcePersistenceValue3 != null && forcePersistenceValue3 instanceof NullNode == false) { boolean forcePersistenceInstance3; forcePersistenceInstance3 = forcePersistenceValue3.getBooleanValue(); brokeredMessagePropertiesInstance3 .setForcePersistence(forcePersistenceInstance3); } JsonNode labelValue3 = brokeredMessagePropertiesValue7.get("label"); if (labelValue3 != null && labelValue3 instanceof NullNode == false) { String labelInstance3; labelInstance3 = labelValue3.getTextValue(); brokeredMessagePropertiesInstance3.setLabel(labelInstance3); } JsonNode messageIdValue3 = brokeredMessagePropertiesValue7.get("messageId"); if (messageIdValue3 != null && messageIdValue3 instanceof NullNode == false) { String messageIdInstance3; messageIdInstance3 = messageIdValue3.getTextValue(); brokeredMessagePropertiesInstance3.setMessageId(messageIdInstance3); } JsonNode partitionKeyValue3 = brokeredMessagePropertiesValue7.get("partitionKey"); if (partitionKeyValue3 != null && partitionKeyValue3 instanceof NullNode == false) { String partitionKeyInstance3; partitionKeyInstance3 = partitionKeyValue3.getTextValue(); brokeredMessagePropertiesInstance3.setPartitionKey(partitionKeyInstance3); } JsonNode replyToValue3 = brokeredMessagePropertiesValue7.get("replyTo"); if (replyToValue3 != null && replyToValue3 instanceof NullNode == false) { String replyToInstance3; replyToInstance3 = replyToValue3.getTextValue(); brokeredMessagePropertiesInstance3.setReplyTo(replyToInstance3); } JsonNode replyToSessionIdValue3 = brokeredMessagePropertiesValue7 .get("replyToSessionId"); if (replyToSessionIdValue3 != null && replyToSessionIdValue3 instanceof NullNode == false) { String replyToSessionIdInstance3; replyToSessionIdInstance3 = replyToSessionIdValue3.getTextValue(); brokeredMessagePropertiesInstance3 .setReplyToSessionId(replyToSessionIdInstance3); } JsonNode scheduledEnqueueTimeUtcValue3 = brokeredMessagePropertiesValue7 .get("scheduledEnqueueTimeUtc"); if (scheduledEnqueueTimeUtcValue3 != null && scheduledEnqueueTimeUtcValue3 instanceof NullNode == false) { Calendar scheduledEnqueueTimeUtcInstance3; scheduledEnqueueTimeUtcInstance3 = DatatypeConverter .parseDateTime(scheduledEnqueueTimeUtcValue3.getTextValue()); brokeredMessagePropertiesInstance3 .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance3); } JsonNode sessionIdValue3 = brokeredMessagePropertiesValue7.get("sessionId"); if (sessionIdValue3 != null && sessionIdValue3 instanceof NullNode == false) { String sessionIdInstance3; sessionIdInstance3 = sessionIdValue3.getTextValue(); brokeredMessagePropertiesInstance3.setSessionId(sessionIdInstance3); } JsonNode timeToLiveValue3 = brokeredMessagePropertiesValue7.get("timeToLive"); if (timeToLiveValue3 != null && timeToLiveValue3 instanceof NullNode == false) { Calendar timeToLiveInstance3; timeToLiveInstance3 = DatatypeConverter .parseDateTime(timeToLiveValue3.getTextValue()); brokeredMessagePropertiesInstance3.setTimeToLive(timeToLiveInstance3); } JsonNode toValue3 = brokeredMessagePropertiesValue7.get("to"); if (toValue3 != null && toValue3 instanceof NullNode == false) { String toInstance3; toInstance3 = toValue3.getTextValue(); brokeredMessagePropertiesInstance3.setTo(toInstance3); } JsonNode viaPartitionKeyValue3 = brokeredMessagePropertiesValue7 .get("viaPartitionKey"); if (viaPartitionKeyValue3 != null && viaPartitionKeyValue3 instanceof NullNode == false) { String viaPartitionKeyInstance3; viaPartitionKeyInstance3 = viaPartitionKeyValue3.getTextValue(); brokeredMessagePropertiesInstance3.setViaPartitionKey(viaPartitionKeyInstance3); } } JsonNode customMessagePropertiesSequenceElement3 = ((JsonNode) serviceBusTopicMessageValue4 .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 customMessagePropertiesKey7 = property5.getKey(); String customMessagePropertiesValue7 = property5.getValue().getTextValue(); serviceBusTopicMessageInstance2.getCustomMessageProperties() .put(customMessagePropertiesKey7, customMessagePropertiesValue7); } } } JsonNode serviceBusQueueMessageValue4 = actionValue2.get("serviceBusQueueMessage"); if (serviceBusQueueMessageValue4 != null && serviceBusQueueMessageValue4 instanceof NullNode == false) { JobServiceBusQueueMessage serviceBusQueueMessageInstance2 = new JobServiceBusQueueMessage(); actionInstance.setServiceBusQueueMessage(serviceBusQueueMessageInstance2); JsonNode queueNameValue4 = serviceBusQueueMessageValue4.get("queueName"); if (queueNameValue4 != null && queueNameValue4 instanceof NullNode == false) { String queueNameInstance4; queueNameInstance4 = queueNameValue4.getTextValue(); serviceBusQueueMessageInstance2.setQueueName(queueNameInstance4); } JsonNode namespaceValue4 = serviceBusQueueMessageValue4.get("namespace"); if (namespaceValue4 != null && namespaceValue4 instanceof NullNode == false) { String namespaceInstance4; namespaceInstance4 = namespaceValue4.getTextValue(); serviceBusQueueMessageInstance2.setNamespace(namespaceInstance4); } JsonNode transportTypeValue4 = serviceBusQueueMessageValue4.get("transportType"); if (transportTypeValue4 != null && transportTypeValue4 instanceof NullNode == false) { JobServiceBusTransportType transportTypeInstance4; transportTypeInstance4 = SchedulerClientImpl .parseJobServiceBusTransportType(transportTypeValue4.getTextValue()); serviceBusQueueMessageInstance2.setTransportType(transportTypeInstance4); } JsonNode authenticationValue12 = serviceBusQueueMessageValue4.get("authentication"); if (authenticationValue12 != null && authenticationValue12 instanceof NullNode == false) { JobServiceBusAuthentication authenticationInstance4 = new JobServiceBusAuthentication(); serviceBusQueueMessageInstance2.setAuthentication(authenticationInstance4); JsonNode sasKeyNameValue4 = authenticationValue12.get("sasKeyName"); if (sasKeyNameValue4 != null && sasKeyNameValue4 instanceof NullNode == false) { String sasKeyNameInstance4; sasKeyNameInstance4 = sasKeyNameValue4.getTextValue(); authenticationInstance4.setSasKeyName(sasKeyNameInstance4); } JsonNode sasKeyValue4 = authenticationValue12.get("sasKey"); if (sasKeyValue4 != null && sasKeyValue4 instanceof NullNode == false) { String sasKeyInstance4; sasKeyInstance4 = sasKeyValue4.getTextValue(); authenticationInstance4.setSasKey(sasKeyInstance4); } JsonNode typeValue12 = authenticationValue12.get("type"); if (typeValue12 != null && typeValue12 instanceof NullNode == false) { JobServiceBusAuthenticationType typeInstance12; typeInstance12 = SchedulerClientImpl .parseJobServiceBusAuthenticationType(typeValue12.getTextValue()); authenticationInstance4.setType(typeInstance12); } } JsonNode messageValue6 = serviceBusQueueMessageValue4.get("message"); if (messageValue6 != null && messageValue6 instanceof NullNode == false) { String messageInstance6; messageInstance6 = messageValue6.getTextValue(); serviceBusQueueMessageInstance2.setMessage(messageInstance6); } JsonNode brokeredMessagePropertiesValue8 = serviceBusQueueMessageValue4 .get("brokeredMessageProperties"); if (brokeredMessagePropertiesValue8 != null && brokeredMessagePropertiesValue8 instanceof NullNode == false) { JobServiceBusBrokeredMessageProperties brokeredMessagePropertiesInstance4 = new JobServiceBusBrokeredMessageProperties(); serviceBusQueueMessageInstance2 .setBrokeredMessageProperties(brokeredMessagePropertiesInstance4); JsonNode contentTypeValue4 = brokeredMessagePropertiesValue8.get("contentType"); if (contentTypeValue4 != null && contentTypeValue4 instanceof NullNode == false) { String contentTypeInstance4; contentTypeInstance4 = contentTypeValue4.getTextValue(); brokeredMessagePropertiesInstance4.setContentType(contentTypeInstance4); } JsonNode correlationIdValue4 = brokeredMessagePropertiesValue8.get("correlationId"); if (correlationIdValue4 != null && correlationIdValue4 instanceof NullNode == false) { String correlationIdInstance4; correlationIdInstance4 = correlationIdValue4.getTextValue(); brokeredMessagePropertiesInstance4.setCorrelationId(correlationIdInstance4); } JsonNode forcePersistenceValue4 = brokeredMessagePropertiesValue8 .get("forcePersistence"); if (forcePersistenceValue4 != null && forcePersistenceValue4 instanceof NullNode == false) { boolean forcePersistenceInstance4; forcePersistenceInstance4 = forcePersistenceValue4.getBooleanValue(); brokeredMessagePropertiesInstance4 .setForcePersistence(forcePersistenceInstance4); } JsonNode labelValue4 = brokeredMessagePropertiesValue8.get("label"); if (labelValue4 != null && labelValue4 instanceof NullNode == false) { String labelInstance4; labelInstance4 = labelValue4.getTextValue(); brokeredMessagePropertiesInstance4.setLabel(labelInstance4); } JsonNode messageIdValue4 = brokeredMessagePropertiesValue8.get("messageId"); if (messageIdValue4 != null && messageIdValue4 instanceof NullNode == false) { String messageIdInstance4; messageIdInstance4 = messageIdValue4.getTextValue(); brokeredMessagePropertiesInstance4.setMessageId(messageIdInstance4); } JsonNode partitionKeyValue4 = brokeredMessagePropertiesValue8.get("partitionKey"); if (partitionKeyValue4 != null && partitionKeyValue4 instanceof NullNode == false) { String partitionKeyInstance4; partitionKeyInstance4 = partitionKeyValue4.getTextValue(); brokeredMessagePropertiesInstance4.setPartitionKey(partitionKeyInstance4); } JsonNode replyToValue4 = brokeredMessagePropertiesValue8.get("replyTo"); if (replyToValue4 != null && replyToValue4 instanceof NullNode == false) { String replyToInstance4; replyToInstance4 = replyToValue4.getTextValue(); brokeredMessagePropertiesInstance4.setReplyTo(replyToInstance4); } JsonNode replyToSessionIdValue4 = brokeredMessagePropertiesValue8 .get("replyToSessionId"); if (replyToSessionIdValue4 != null && replyToSessionIdValue4 instanceof NullNode == false) { String replyToSessionIdInstance4; replyToSessionIdInstance4 = replyToSessionIdValue4.getTextValue(); brokeredMessagePropertiesInstance4 .setReplyToSessionId(replyToSessionIdInstance4); } JsonNode scheduledEnqueueTimeUtcValue4 = brokeredMessagePropertiesValue8 .get("scheduledEnqueueTimeUtc"); if (scheduledEnqueueTimeUtcValue4 != null && scheduledEnqueueTimeUtcValue4 instanceof NullNode == false) { Calendar scheduledEnqueueTimeUtcInstance4; scheduledEnqueueTimeUtcInstance4 = DatatypeConverter .parseDateTime(scheduledEnqueueTimeUtcValue4.getTextValue()); brokeredMessagePropertiesInstance4 .setScheduledEnqueueTimeUtc(scheduledEnqueueTimeUtcInstance4); } JsonNode sessionIdValue4 = brokeredMessagePropertiesValue8.get("sessionId"); if (sessionIdValue4 != null && sessionIdValue4 instanceof NullNode == false) { String sessionIdInstance4; sessionIdInstance4 = sessionIdValue4.getTextValue(); brokeredMessagePropertiesInstance4.setSessionId(sessionIdInstance4); } JsonNode timeToLiveValue4 = brokeredMessagePropertiesValue8.get("timeToLive"); if (timeToLiveValue4 != null && timeToLiveValue4 instanceof NullNode == false) { Calendar timeToLiveInstance4; timeToLiveInstance4 = DatatypeConverter .parseDateTime(timeToLiveValue4.getTextValue()); brokeredMessagePropertiesInstance4.setTimeToLive(timeToLiveInstance4); } JsonNode toValue4 = brokeredMessagePropertiesValue8.get("to"); if (toValue4 != null && toValue4 instanceof NullNode == false) { String toInstance4; toInstance4 = toValue4.getTextValue(); brokeredMessagePropertiesInstance4.setTo(toInstance4); } JsonNode viaPartitionKeyValue4 = brokeredMessagePropertiesValue8 .get("viaPartitionKey"); if (viaPartitionKeyValue4 != null && viaPartitionKeyValue4 instanceof NullNode == false) { String viaPartitionKeyInstance4; viaPartitionKeyInstance4 = viaPartitionKeyValue4.getTextValue(); brokeredMessagePropertiesInstance4.setViaPartitionKey(viaPartitionKeyInstance4); } } JsonNode customMessagePropertiesSequenceElement4 = ((JsonNode) serviceBusQueueMessageValue4 .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 customMessagePropertiesKey8 = property6.getKey(); String customMessagePropertiesValue8 = property6.getValue().getTextValue(); serviceBusQueueMessageInstance2.getCustomMessageProperties() .put(customMessagePropertiesKey8, customMessagePropertiesValue8); } } } } JsonNode recurrenceValue2 = responseDoc.get("recurrence"); if (recurrenceValue2 != null && recurrenceValue2 instanceof NullNode == false) { JobRecurrence recurrenceInstance = new JobRecurrence(); jobInstance.setRecurrence(recurrenceInstance); JsonNode frequencyValue = recurrenceValue2.get("frequency"); if (frequencyValue != null && frequencyValue instanceof NullNode == false) { JobRecurrenceFrequency frequencyInstance; frequencyInstance = SchedulerClientImpl .parseJobRecurrenceFrequency(frequencyValue.getTextValue()); recurrenceInstance.setFrequency(frequencyInstance); } JsonNode intervalValue = recurrenceValue2.get("interval"); if (intervalValue != null && intervalValue instanceof NullNode == false) { int intervalInstance; intervalInstance = intervalValue.getIntValue(); recurrenceInstance.setInterval(intervalInstance); } JsonNode countValue = recurrenceValue2.get("count"); if (countValue != null && countValue instanceof NullNode == false) { int countInstance; countInstance = countValue.getIntValue(); recurrenceInstance.setCount(countInstance); } JsonNode endTimeValue = recurrenceValue2.get("endTime"); if (endTimeValue != null && endTimeValue instanceof NullNode == false) { Calendar endTimeInstance; endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue()); recurrenceInstance.setEndTime(endTimeInstance); } JsonNode scheduleValue2 = recurrenceValue2.get("schedule"); if (scheduleValue2 != null && scheduleValue2 instanceof NullNode == false) { JobRecurrenceSchedule scheduleInstance = new JobRecurrenceSchedule(); recurrenceInstance.setSchedule(scheduleInstance); JsonNode minutesArray2 = scheduleValue2.get("minutes"); if (minutesArray2 != null && minutesArray2 instanceof NullNode == false) { scheduleInstance.setMinutes(new ArrayList<Integer>()); for (JsonNode minutesValue : ((ArrayNode) minutesArray2)) { scheduleInstance.getMinutes().add(minutesValue.getIntValue()); } } JsonNode hoursArray2 = scheduleValue2.get("hours"); if (hoursArray2 != null && hoursArray2 instanceof NullNode == false) { scheduleInstance.setHours(new ArrayList<Integer>()); for (JsonNode hoursValue : ((ArrayNode) hoursArray2)) { scheduleInstance.getHours().add(hoursValue.getIntValue()); } } JsonNode weekDaysArray2 = scheduleValue2.get("weekDays"); if (weekDaysArray2 != null && weekDaysArray2 instanceof NullNode == false) { scheduleInstance.setDays(new ArrayList<JobScheduleDay>()); for (JsonNode weekDaysValue : ((ArrayNode) weekDaysArray2)) { scheduleInstance.getDays().add( SchedulerClientImpl.parseJobScheduleDay(weekDaysValue.getTextValue())); } } JsonNode monthsArray2 = scheduleValue2.get("months"); if (monthsArray2 != null && monthsArray2 instanceof NullNode == false) { scheduleInstance.setMonths(new ArrayList<Integer>()); for (JsonNode monthsValue : ((ArrayNode) monthsArray2)) { scheduleInstance.getMonths().add(monthsValue.getIntValue()); } } JsonNode monthDaysArray2 = scheduleValue2.get("monthDays"); if (monthDaysArray2 != null && monthDaysArray2 instanceof NullNode == false) { scheduleInstance.setMonthDays(new ArrayList<Integer>()); for (JsonNode monthDaysValue : ((ArrayNode) monthDaysArray2)) { scheduleInstance.getMonthDays().add(monthDaysValue.getIntValue()); } } JsonNode monthlyOccurrencesArray2 = scheduleValue2.get("monthlyOccurrences"); if (monthlyOccurrencesArray2 != null && monthlyOccurrencesArray2 instanceof NullNode == false) { scheduleInstance .setMonthlyOccurrences(new ArrayList<JobScheduleMonthlyOccurrence>()); for (JsonNode monthlyOccurrencesValue : ((ArrayNode) monthlyOccurrencesArray2)) { 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 = responseDoc.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 = responseDoc.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.websites.WebSiteOperationsImpl.java
/** * You can retrieve historical usage metrics for a site by issuing an HTTP * GET request. (see/* w w w. j av a2 s . c o m*/ * http://msdn.microsoft.com/en-us/library/windowsazure/dn166964.aspx for * more information) * * @param resourceGroupName Required. The name of the resource group. * @param webSiteName Required. The name of the web site. * @param slotName Optional. The name of the slot. * @param parameters Required. The Get Web Site Historical Usage Metrics * parameters. * @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 Web Site Historical Usage Metrics operation response. */ @Override public WebSiteGetHistoricalUsageMetricsResponse getHistoricalUsageMetrics(String resourceGroupName, String webSiteName, String slotName, WebSiteGetHistoricalUsageMetricsParameters parameters) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (webSiteName == null) { throw new NullPointerException("webSiteName"); } 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("resourceGroupName", resourceGroupName); tracingParameters.put("webSiteName", webSiteName); tracingParameters.put("slotName", slotName); tracingParameters.put("parameters", parameters); CloudTracing.enter(invocationId, this, "getHistoricalUsageMetricsAsync", 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.Web"; url = url + "/"; url = url + "sites"; url = url + "/"; url = url + URLEncoder.encode(webSiteName, "UTF-8"); if (slotName != null) { url = url + "/slots/" + URLEncoder.encode(slotName, "UTF-8"); } url = url + "/metrics"; ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-06-01"); if (parameters.getMetricNames() != null && parameters.getMetricNames().size() > 0) { queryParameters.add("names=" + URLEncoder.encode(CollectionStringBuilder.join(parameters.getMetricNames(), ","), "UTF-8")); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); if (parameters.getStartTime() != null) { queryParameters.add("StartTime=" + URLEncoder.encode(simpleDateFormat.format(parameters.getStartTime().getTime()), "UTF-8")); } SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); if (parameters.getEndTime() != null) { queryParameters.add("EndTime=" + URLEncoder.encode(simpleDateFormat2.format(parameters.getEndTime().getTime()), "UTF-8")); } if (parameters.getTimeGrain() != null) { queryParameters.add("timeGrain=" + URLEncoder.encode(parameters.getTimeGrain(), "UTF-8")); } queryParameters.add("details=" + URLEncoder .encode(Boolean.toString(parameters.isIncludeInstanceBreakdown()).toLowerCase(), "UTF-8")); queryParameters.add( "slotView=" + URLEncoder.encode(Boolean.toString(parameters.isSlotView()).toLowerCase(), "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 WebSiteGetHistoricalUsageMetricsResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetHistoricalUsageMetricsResponse(); 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 propertiesArray = responseDoc.get("properties"); if (propertiesArray != null && propertiesArray instanceof NullNode == false) { for (JsonNode propertiesValue : ((ArrayNode) propertiesArray)) { HistoricalUsageMetric historicalUsageMetricInstance = new HistoricalUsageMetric(); result.getUsageMetrics().add(historicalUsageMetricInstance); JsonNode codeValue = propertiesValue.get("code"); if (codeValue != null && codeValue instanceof NullNode == false) { String codeInstance; codeInstance = codeValue.getTextValue(); historicalUsageMetricInstance.setCode(codeInstance); } JsonNode dataValue = propertiesValue.get("data"); if (dataValue != null && dataValue instanceof NullNode == false) { HistoricalUsageMetricData dataInstance = new HistoricalUsageMetricData(); historicalUsageMetricInstance.setData(dataInstance); JsonNode displayNameValue = dataValue.get("displayName"); if (displayNameValue != null && displayNameValue instanceof NullNode == false) { String displayNameInstance; displayNameInstance = displayNameValue.getTextValue(); dataInstance.setDisplayName(displayNameInstance); } JsonNode endTimeValue = dataValue.get("EndTime"); if (endTimeValue != null && endTimeValue instanceof NullNode == false) { Calendar endTimeInstance; endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue()); dataInstance.setEndTime(endTimeInstance); } JsonNode nameValue = dataValue.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); dataInstance.setName(nameInstance); } JsonNode primaryAggregationTypeValue = dataValue.get("primaryAggregationType"); if (primaryAggregationTypeValue != null && primaryAggregationTypeValue instanceof NullNode == false) { String primaryAggregationTypeInstance; primaryAggregationTypeInstance = primaryAggregationTypeValue.getTextValue(); dataInstance.setPrimaryAggregationType(primaryAggregationTypeInstance); } JsonNode startTimeValue = dataValue.get("startTime"); if (startTimeValue != null && startTimeValue instanceof NullNode == false) { Calendar startTimeInstance; startTimeInstance = DatatypeConverter .parseDateTime(startTimeValue.getTextValue()); dataInstance.setStartTime(startTimeInstance); } JsonNode timeGrainValue = dataValue.get("timeGrain"); if (timeGrainValue != null && timeGrainValue instanceof NullNode == false) { String timeGrainInstance; timeGrainInstance = timeGrainValue.getTextValue(); dataInstance.setTimeGrain(timeGrainInstance); } JsonNode unitValue = dataValue.get("unit"); if (unitValue != null && unitValue instanceof NullNode == false) { String unitInstance; unitInstance = unitValue.getTextValue(); dataInstance.setUnit(unitInstance); } JsonNode valuesArray = dataValue.get("values"); if (valuesArray != null && valuesArray instanceof NullNode == false) { for (JsonNode valuesValue : ((ArrayNode) valuesArray)) { HistoricalUsageMetricSample metricSampleInstance = new HistoricalUsageMetricSample(); dataInstance.getValues().add(metricSampleInstance); JsonNode countValue = valuesValue.get("count"); if (countValue != null && countValue instanceof NullNode == false) { int countInstance; countInstance = countValue.getIntValue(); metricSampleInstance.setCount(countInstance); } JsonNode maximumValue = valuesValue.get("maximum"); if (maximumValue != null && maximumValue instanceof NullNode == false) { String maximumInstance; maximumInstance = maximumValue.getTextValue(); metricSampleInstance.setMaximum(maximumInstance); } JsonNode minimumValue = valuesValue.get("minimum"); if (minimumValue != null && minimumValue instanceof NullNode == false) { String minimumInstance; minimumInstance = minimumValue.getTextValue(); metricSampleInstance.setMinimum(minimumInstance); } JsonNode timeCreatedValue = valuesValue.get("timeCreated"); if (timeCreatedValue != null && timeCreatedValue instanceof NullNode == false) { Calendar timeCreatedInstance; timeCreatedInstance = DatatypeConverter .parseDateTime(timeCreatedValue.getTextValue()); metricSampleInstance.setTimeCreated(timeCreatedInstance); } JsonNode totalValue = valuesValue.get("total"); if (totalValue != null && totalValue instanceof NullNode == false) { String totalInstance; totalInstance = totalValue.getTextValue(); metricSampleInstance.setTotal(totalInstance); } JsonNode instanceNameValue = valuesValue.get("instanceName"); if (instanceNameValue != null && instanceNameValue instanceof NullNode == false) { String instanceNameInstance; instanceNameInstance = instanceNameValue.getTextValue(); metricSampleInstance.setInstanceName(instanceNameInstance); } } } } JsonNode messageValue = propertiesValue.get("message"); if (messageValue != null && messageValue instanceof NullNode == false) { String messageInstance; messageInstance = messageValue.getTextValue(); historicalUsageMetricInstance.setMessage(messageInstance); } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
From source file:com.microsoft.azure.management.sql.DatabaseOperationsImpl.java
/** * Gets the status of an Azure Sql Database create or update operation. * * @param operationStatusLink Required. Location value returned by the Begin * operation/*w w w . j a v a 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. * @return Response for long running Azure Sql Database operations. */ @Override public DatabaseCreateOrUpdateResponse getDatabaseOperationStatus(String operationStatusLink) throws IOException, ServiceException { // Validate if (operationStatusLink == null) { throw new NullPointerException("operationStatusLink"); } // 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("operationStatusLink", operationStatusLink); CloudTracing.enter(invocationId, this, "getDatabaseOperationStatusAsync", tracingParameters); } // Construct URL String url = ""; url = url + operationStatusLink; 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 && statusCode != HttpStatus.SC_CREATED && statusCode != HttpStatus.SC_ACCEPTED) { ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result DatabaseCreateOrUpdateResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_CREATED || statusCode == HttpStatus.SC_ACCEPTED) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new DatabaseCreateOrUpdateResponse(); 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) { ErrorResponse errorInstance = new ErrorResponse(); result.setError(errorInstance); JsonNode codeValue = responseDoc.get("code"); if (codeValue != null && codeValue instanceof NullNode == false) { String codeInstance; codeInstance = codeValue.getTextValue(); errorInstance.setCode(codeInstance); } JsonNode messageValue = responseDoc.get("message"); if (messageValue != null && messageValue instanceof NullNode == false) { String messageInstance; messageInstance = messageValue.getTextValue(); errorInstance.setMessage(messageInstance); } JsonNode targetValue = responseDoc.get("target"); if (targetValue != null && targetValue instanceof NullNode == false) { String targetInstance; targetInstance = targetValue.getTextValue(); errorInstance.setTarget(targetInstance); } Database databaseInstance = new Database(); result.setDatabase(databaseInstance); JsonNode propertiesValue = responseDoc.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 = responseDoc.get("id"); if (idValue8 != null && idValue8 instanceof NullNode == false) { String idInstance8; idInstance8 = idValue8.getTextValue(); databaseInstance.setId(idInstance8); } JsonNode nameValue10 = responseDoc.get("name"); if (nameValue10 != null && nameValue10 instanceof NullNode == false) { String nameInstance10; nameInstance10 = nameValue10.getTextValue(); databaseInstance.setName(nameInstance10); } JsonNode typeValue8 = responseDoc.get("type"); if (typeValue8 != null && typeValue8 instanceof NullNode == false) { String typeInstance8; typeInstance8 = typeValue8.getTextValue(); databaseInstance.setType(typeInstance8); } JsonNode locationValue8 = responseDoc.get("location"); if (locationValue8 != null && locationValue8 instanceof NullNode == false) { String locationInstance8; locationInstance8 = locationValue8.getTextValue(); databaseInstance.setLocation(locationInstance8); } JsonNode tagsSequenceElement8 = ((JsonNode) responseDoc.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 (statusCode == HttpStatus.SC_CREATED) { result.setStatus(OperationStatus.Succeeded); } if (statusCode == HttpStatus.SC_OK) { result.setStatus(OperationStatus.Succeeded); } 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.network.GatewayOperationsImpl.java
/** * The Get Virtual Network Gateway operation gets information about the * network gateway for the specified virtual network in Azure. (see * http://msdn.microsoft.com/en-us/library/windowsazure/jj154109.aspx for * more information)/*from ww w .j a va2 s . c o m*/ * * @param networkName Required. The name of the virtual network for this * gateway. * @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. * @return A standard service response including an HTTP status code and * request ID. */ @Override public GatewayGetResponse get(String networkName) throws IOException, ServiceException, ParserConfigurationException, SAXException { // Validate if (networkName == null) { throw new NullPointerException("networkName"); } // 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("networkName", networkName); CloudTracing.enter(invocationId, this, "getAsync", 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/networking/"; url = url + URLEncoder.encode(networkName, "UTF-8"); url = url + "/gateway"; 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 GatewayGetResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new GatewayGetResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent)); Element gatewayElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Gateway"); if (gatewayElement != null) { Element stateElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "State"); if (stateElement != null) { String stateInstance; stateInstance = stateElement.getTextContent(); result.setState(stateInstance); } Element vIPAddressElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "VIPAddress"); if (vIPAddressElement != null) { InetAddress vIPAddressInstance; vIPAddressInstance = InetAddress.getByName(vIPAddressElement.getTextContent()); result.setVipAddress(vIPAddressInstance); } Element lastEventElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "LastEvent"); if (lastEventElement != null) { GatewayEvent lastEventInstance = new GatewayEvent(); result.setLastEvent(lastEventInstance); Element timestampElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Timestamp"); if (timestampElement != null) { Calendar timestampInstance; timestampInstance = DatatypeConverter.parseDateTime(timestampElement.getTextContent()); lastEventInstance.setTimestamp(timestampInstance); } Element idElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Id"); if (idElement != null) { String idInstance; idInstance = idElement.getTextContent(); lastEventInstance.setId(idInstance); } Element messageElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Message"); if (messageElement != null) { String messageInstance; messageInstance = messageElement.getTextContent(); lastEventInstance.setMessage(messageInstance); } Element dataElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Data"); if (dataElement != null) { String dataInstance; dataInstance = dataElement.getTextContent(); lastEventInstance.setData(dataInstance); } } Element gatewayTypeElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "GatewayType"); if (gatewayTypeElement != null) { String gatewayTypeInstance; gatewayTypeInstance = gatewayTypeElement.getTextContent(); result.setGatewayType(gatewayTypeInstance); } Element gatewaySizeElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "GatewaySize"); if (gatewaySizeElement != null) { String gatewaySizeInstance; gatewaySizeInstance = gatewaySizeElement.getTextContent(); result.setGatewaySKU(gatewaySizeInstance); } Element defaultSitesElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "DefaultSites"); if (defaultSitesElement != null) { GatewayDefaultSite defaultSitesInstance = new GatewayDefaultSite(); result.setDefaultSite(defaultSitesInstance); Element stringElement = XmlUtility.getElementByTagNameNS(defaultSitesElement, "http://schemas.microsoft.com/windowsazure", "string"); if (stringElement != null) { String stringInstance; stringInstance = stringElement.getTextContent(); defaultSitesInstance.setName(stringInstance); } } } } 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.websites.WebSiteOperationsImpl.java
/** * You can retrieve current usage metrics for a site by issuing an HTTP GET * request. The metrics returned include CPU Time, Data In, Data Out, Local * Bytes Read, Local Bytes Written, Network Bytes Read, Network Bytes * Written, WP Stop Requests, Memory Usage, CPU Time - Minute Limit, and * File System Storage. (see//from ww w . j a v a 2 s . c o m * http://msdn.microsoft.com/en-us/library/windowsazure/dn166991.aspx for * more information) * * @param webSpaceName Required. The name of the web space. * @param webSiteName Required. The name of the web site. * @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. * @return The Get Usage Metrics Web Site operation response. */ @Override public WebSiteGetUsageMetricsResponse getUsageMetrics(String webSpaceName, String webSiteName) throws IOException, ServiceException, ParserConfigurationException, SAXException { // Validate if (webSpaceName == null) { throw new NullPointerException("webSpaceName"); } if (webSiteName == null) { throw new NullPointerException("webSiteName"); } // 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("webSpaceName", webSpaceName); tracingParameters.put("webSiteName", webSiteName); CloudTracing.enter(invocationId, this, "getUsageMetricsAsync", 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/WebSpaces/"; url = url + URLEncoder.encode(webSpaceName, "UTF-8"); url = url + "/sites/"; url = url + URLEncoder.encode(webSiteName, "UTF-8"); url = url + "/usages"; 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", "2014-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 WebSiteGetUsageMetricsResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetUsageMetricsResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent)); Element usagesElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Usages"); if (usagesElement != null) { if (usagesElement != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(usagesElement, "http://schemas.microsoft.com/windowsazure", "Usage") .size(); i1 = i1 + 1) { org.w3c.dom.Element usageMetricsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(usagesElement, "http://schemas.microsoft.com/windowsazure", "Usage") .get(i1)); WebSiteGetUsageMetricsResponse.UsageMetric usageInstance = new WebSiteGetUsageMetricsResponse.UsageMetric(); result.getUsageMetrics().add(usageInstance); Element computeModeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "ComputeMode"); if (computeModeElement != null && computeModeElement.getTextContent() != null && !computeModeElement.getTextContent().isEmpty()) { WebSiteComputeMode computeModeInstance; computeModeInstance = WebSiteComputeMode .valueOf(computeModeElement.getTextContent()); usageInstance.setComputeMode(computeModeInstance); } Element currentValueElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "CurrentValue"); if (currentValueElement != null) { String currentValueInstance; currentValueInstance = currentValueElement.getTextContent(); usageInstance.setCurrentValue(currentValueInstance); } Element displayNameElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "DisplayName"); if (displayNameElement != null) { String displayNameInstance; displayNameInstance = displayNameElement.getTextContent(); usageInstance.setDisplayName(displayNameInstance); } Element limitElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Limit"); if (limitElement != null) { String limitInstance; limitInstance = limitElement.getTextContent(); usageInstance.setLimit(limitInstance); } Element nameElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Name"); if (nameElement != null) { String nameInstance; nameInstance = nameElement.getTextContent(); usageInstance.setName(nameInstance); } Element nextResetTimeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "NextResetTime"); if (nextResetTimeElement != null) { Calendar nextResetTimeInstance; nextResetTimeInstance = DatatypeConverter .parseDateTime(nextResetTimeElement.getTextContent()); usageInstance.setNextResetTime(nextResetTimeInstance); } Element resourceNameElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "ResourceName"); if (resourceNameElement != null) { String resourceNameInstance; resourceNameInstance = resourceNameElement.getTextContent(); usageInstance.setResourceName(resourceNameInstance); } Element siteModeElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "SiteMode"); if (siteModeElement != null && siteModeElement.getTextContent() != null && !siteModeElement.getTextContent().isEmpty()) { WebSiteMode siteModeInstance; siteModeInstance = WebSiteMode.valueOf(siteModeElement.getTextContent()); usageInstance.setSiteMode(siteModeInstance); } Element unitElement = XmlUtility.getElementByTagNameNS(usageMetricsElement, "http://schemas.microsoft.com/windowsazure", "Unit"); if (unitElement != null) { String unitInstance; unitInstance = unitElement.getTextContent(); usageInstance.setUnit(unitInstance); } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }