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.notificationhubs.NotificationHubOperationsImpl.java
/** * Lists the notification hubs associated with a namespace. * * @param resourceGroupName Required. The name of the resource group. * @param namespaceName Required. The namespace name. * @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 ww w .ja va 2 s . c o 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 response of the List NotificationHub operation. */ @Override public NotificationHubListResponse list(String resourceGroupName, String namespaceName) throws IOException, ServiceException, URISyntaxException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (namespaceName == null) { throw new NullPointerException("namespaceName"); } // 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); CloudTracing.enter(invocationId, this, "listAsync", 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"; 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 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 NotificationHubListResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new NotificationHubListResponse(); ObjectMapper objectMapper = new ObjectMapper(); JsonNode responseDoc = null; String responseDocContent = IOUtils.toString(responseContent); if (responseDocContent == null == false && responseDocContent.length() > 0) { responseDoc = objectMapper.readTree(responseDocContent); } if (responseDoc != null && responseDoc instanceof NullNode == false) { JsonNode valueArray = responseDoc.get("value"); if (valueArray != null && valueArray instanceof NullNode == false) { for (JsonNode valueValue : ((ArrayNode) valueArray)) { NotificationHubResource notificationHubResourceInstance = new NotificationHubResource(); result.getValue().add(notificationHubResourceInstance); JsonNode idValue = valueValue.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); notificationHubResourceInstance.setId(idInstance); } JsonNode locationValue = valueValue.get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); notificationHubResourceInstance.setLocation(locationInstance); } JsonNode nameValue = valueValue.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); notificationHubResourceInstance.setName(nameInstance); } JsonNode typeValue = valueValue.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); notificationHubResourceInstance.setType(typeInstance); } JsonNode tagsSequenceElement = ((JsonNode) valueValue.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(); notificationHubResourceInstance.getTags().put(tagsKey, tagsValue); } } JsonNode propertiesValue = valueValue.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { NotificationHubProperties propertiesInstance = new NotificationHubProperties(); notificationHubResourceInstance.setProperties(propertiesInstance); JsonNode nameValue2 = propertiesValue.get("name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); propertiesInstance.setName(nameInstance2); } JsonNode registrationTtlValue = propertiesValue.get("registrationTtl"); if (registrationTtlValue != null && registrationTtlValue instanceof NullNode == false) { String registrationTtlInstance; registrationTtlInstance = registrationTtlValue.getTextValue(); propertiesInstance.setRegistrationTtl(registrationTtlInstance); } JsonNode authorizationRulesArray = propertiesValue.get("authorizationRules"); if (authorizationRulesArray != null && authorizationRulesArray instanceof NullNode == false) { for (JsonNode authorizationRulesValue : ((ArrayNode) authorizationRulesArray)) { 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 rightsArray = authorizationRulesValue.get("rights"); if (rightsArray != null && rightsArray instanceof NullNode == false) { for (JsonNode rightsValue : ((ArrayNode) rightsArray)) { 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 apnsCredentialValue = propertiesValue.get("apnsCredential"); if (apnsCredentialValue != null && apnsCredentialValue instanceof NullNode == false) { ApnsCredential apnsCredentialInstance = new ApnsCredential(); propertiesInstance.setApnsCredential(apnsCredentialInstance); JsonNode propertiesValue2 = apnsCredentialValue.get("properties"); if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) { ApnsCredentialProperties propertiesInstance2 = new ApnsCredentialProperties(); apnsCredentialInstance.setProperties(propertiesInstance2); JsonNode apnsCertificateValue = propertiesValue2.get("apnsCertificate"); if (apnsCertificateValue != null && apnsCertificateValue instanceof NullNode == false) { String apnsCertificateInstance; apnsCertificateInstance = apnsCertificateValue.getTextValue(); propertiesInstance2.setApnsCertificate(apnsCertificateInstance); } JsonNode certificateKeyValue = propertiesValue2.get("certificateKey"); if (certificateKeyValue != null && certificateKeyValue instanceof NullNode == false) { String certificateKeyInstance; certificateKeyInstance = certificateKeyValue.getTextValue(); propertiesInstance2.setCertificateKey(certificateKeyInstance); } JsonNode endpointValue = propertiesValue2.get("endpoint"); if (endpointValue != null && endpointValue instanceof NullNode == false) { String endpointInstance; endpointInstance = endpointValue.getTextValue(); propertiesInstance2.setEndpoint(endpointInstance); } JsonNode thumbprintValue = propertiesValue2.get("thumbprint"); if (thumbprintValue != null && thumbprintValue instanceof NullNode == false) { String thumbprintInstance; thumbprintInstance = thumbprintValue.getTextValue(); propertiesInstance2.setThumbprint(thumbprintInstance); } } } JsonNode wnsCredentialValue = propertiesValue.get("wnsCredential"); if (wnsCredentialValue != null && wnsCredentialValue instanceof NullNode == false) { WnsCredential wnsCredentialInstance = new WnsCredential(); propertiesInstance.setWnsCredential(wnsCredentialInstance); JsonNode propertiesValue3 = wnsCredentialValue.get("properties"); if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) { WnsCredentialProperties propertiesInstance3 = new WnsCredentialProperties(); wnsCredentialInstance.setProperties(propertiesInstance3); JsonNode packageSidValue = propertiesValue3.get("packageSid"); if (packageSidValue != null && packageSidValue instanceof NullNode == false) { String packageSidInstance; packageSidInstance = packageSidValue.getTextValue(); propertiesInstance3.setPackageSid(packageSidInstance); } JsonNode secretKeyValue = propertiesValue3.get("secretKey"); if (secretKeyValue != null && secretKeyValue instanceof NullNode == false) { String secretKeyInstance; secretKeyInstance = secretKeyValue.getTextValue(); propertiesInstance3.setSecretKey(secretKeyInstance); } JsonNode windowsLiveEndpointValue = propertiesValue3 .get("windowsLiveEndpoint"); if (windowsLiveEndpointValue != null && windowsLiveEndpointValue instanceof NullNode == false) { String windowsLiveEndpointInstance; windowsLiveEndpointInstance = windowsLiveEndpointValue.getTextValue(); propertiesInstance3.setWindowsLiveEndpoint(windowsLiveEndpointInstance); } } } JsonNode gcmCredentialValue = propertiesValue.get("gcmCredential"); if (gcmCredentialValue != null && gcmCredentialValue instanceof NullNode == false) { GcmCredential gcmCredentialInstance = new GcmCredential(); propertiesInstance.setGcmCredential(gcmCredentialInstance); JsonNode propertiesValue4 = gcmCredentialValue.get("properties"); if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) { GcmCredentialProperties propertiesInstance4 = new GcmCredentialProperties(); gcmCredentialInstance.setProperties(propertiesInstance4); JsonNode gcmEndpointValue = propertiesValue4.get("gcmEndpoint"); if (gcmEndpointValue != null && gcmEndpointValue instanceof NullNode == false) { String gcmEndpointInstance; gcmEndpointInstance = gcmEndpointValue.getTextValue(); propertiesInstance4.setGcmEndpoint(gcmEndpointInstance); } JsonNode googleApiKeyValue = propertiesValue4.get("googleApiKey"); if (googleApiKeyValue != null && googleApiKeyValue instanceof NullNode == false) { String googleApiKeyInstance; googleApiKeyInstance = googleApiKeyValue.getTextValue(); propertiesInstance4.setGoogleApiKey(googleApiKeyInstance); } } } JsonNode mpnsCredentialValue = propertiesValue.get("mpnsCredential"); if (mpnsCredentialValue != null && mpnsCredentialValue instanceof NullNode == false) { MpnsCredential mpnsCredentialInstance = new MpnsCredential(); propertiesInstance.setMpnsCredential(mpnsCredentialInstance); JsonNode propertiesValue5 = mpnsCredentialValue.get("properties"); if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) { MpnsCredentialProperties propertiesInstance5 = new MpnsCredentialProperties(); mpnsCredentialInstance.setProperties(propertiesInstance5); JsonNode mpnsCertificateValue = propertiesValue5.get("mpnsCertificate"); if (mpnsCertificateValue != null && mpnsCertificateValue instanceof NullNode == false) { String mpnsCertificateInstance; mpnsCertificateInstance = mpnsCertificateValue.getTextValue(); propertiesInstance5.setMpnsCertificate(mpnsCertificateInstance); } JsonNode certificateKeyValue2 = propertiesValue5.get("certificateKey"); if (certificateKeyValue2 != null && certificateKeyValue2 instanceof NullNode == false) { String certificateKeyInstance2; certificateKeyInstance2 = certificateKeyValue2.getTextValue(); propertiesInstance5.setCertificateKey(certificateKeyInstance2); } JsonNode thumbprintValue2 = propertiesValue5.get("thumbprint"); if (thumbprintValue2 != null && thumbprintValue2 instanceof NullNode == false) { String thumbprintInstance2; thumbprintInstance2 = thumbprintValue2.getTextValue(); propertiesInstance5.setThumbprint(thumbprintInstance2); } } } JsonNode admCredentialValue = propertiesValue.get("admCredential"); if (admCredentialValue != null && admCredentialValue instanceof NullNode == false) { AdmCredential admCredentialInstance = new AdmCredential(); propertiesInstance.setAdmCredential(admCredentialInstance); JsonNode propertiesValue6 = admCredentialValue.get("properties"); if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) { AdmCredentialProperties propertiesInstance6 = new AdmCredentialProperties(); admCredentialInstance.setProperties(propertiesInstance6); JsonNode clientIdValue = propertiesValue6.get("clientId"); if (clientIdValue != null && clientIdValue instanceof NullNode == false) { String clientIdInstance; clientIdInstance = clientIdValue.getTextValue(); propertiesInstance6.setClientId(clientIdInstance); } JsonNode clientSecretValue = propertiesValue6.get("clientSecret"); if (clientSecretValue != null && clientSecretValue instanceof NullNode == false) { String clientSecretInstance; clientSecretInstance = clientSecretValue.getTextValue(); propertiesInstance6.setClientSecret(clientSecretInstance); } JsonNode authTokenUrlValue = propertiesValue6.get("authTokenUrl"); if (authTokenUrlValue != null && authTokenUrlValue instanceof NullNode == false) { String authTokenUrlInstance; authTokenUrlInstance = authTokenUrlValue.getTextValue(); propertiesInstance6.setAuthTokenUrl(authTokenUrlInstance); } } } JsonNode baiduCredentialValue = propertiesValue.get("baiduCredential"); if (baiduCredentialValue != null && baiduCredentialValue instanceof NullNode == false) { BaiduCredential baiduCredentialInstance = new BaiduCredential(); propertiesInstance.setBaiduCredential(baiduCredentialInstance); JsonNode propertiesValue7 = baiduCredentialValue.get("properties"); if (propertiesValue7 != null && propertiesValue7 instanceof NullNode == false) { BaiduCredentialProperties propertiesInstance7 = new BaiduCredentialProperties(); baiduCredentialInstance.setProperties(propertiesInstance7); JsonNode baiduApiKeyValue = propertiesValue7.get("baiduApiKey"); if (baiduApiKeyValue != null && baiduApiKeyValue instanceof NullNode == false) { String baiduApiKeyInstance; baiduApiKeyInstance = baiduApiKeyValue.getTextValue(); propertiesInstance7.setBaiduApiKey(baiduApiKeyInstance); } JsonNode baiduEndPointValue = propertiesValue7.get("baiduEndPoint"); if (baiduEndPointValue != null && baiduEndPointValue instanceof NullNode == false) { String baiduEndPointInstance; baiduEndPointInstance = baiduEndPointValue.getTextValue(); propertiesInstance7.setBaiduEndPoint(baiduEndPointInstance); } JsonNode baiduSecretKeyValue = propertiesValue7.get("baiduSecretKey"); if (baiduSecretKeyValue != null && baiduSecretKeyValue instanceof NullNode == false) { String baiduSecretKeyInstance; baiduSecretKeyInstance = baiduSecretKeyValue.getTextValue(); propertiesInstance7.setBaiduSecretKey(baiduSecretKeyInstance); } } } } } } JsonNode nextLinkValue = responseDoc.get("nextLink"); if (nextLinkValue != null && nextLinkValue instanceof NullNode == false) { String nextLinkInstance; nextLinkInstance = nextLinkValue.getTextValue(); result.setNextLink(nextLinkInstance); } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
From source file:com.microsoft.azure.management.sql.DatabaseActivationOperationsImpl.java
/** * Gets the status of an Azure SQL Data Warehouse Database pause or resume * operation.//from w w w . j ava 2s. c o m * * @param operationStatusLink Required. Location value returned by the Begin * 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. * @return Response for long running Azure Sql Database operations. */ @Override public DatabaseCreateOrUpdateResponse getDatabaseActivationOperationStatus(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, "getDatabaseActivationOperationStatusAsync", 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_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_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_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.azure.management.sql.ElasticPoolOperationsImpl.java
/** * Returns information about activity on Azure SQL Databases inside of an * Azure Sql Database Elastic Pool./*from ww w .j av a 2 s. com*/ * * @param resourceGroupName Required. The name of the Resource Group to * which the server belongs. * @param serverName Required. The name of the Azure SQL Database Server on * which the Elastic Pool is hosted. * @param elasticPoolName Required. The name of the Azure SQL Database * Elastic Pool. * @throws IOException Signals that an I/O exception of some sort has * occurred. This class is the general class of exceptions produced by * failed or interrupted I/O operations. * @throws ServiceException Thrown if an unexpected response is found. * @return Represents the response to a List Azure Sql Elastic Pool Database * Activity request. */ @Override public ElasticPoolDatabaseActivityListResponse listDatabaseActivity(String resourceGroupName, String serverName, String elasticPoolName) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (serverName == null) { throw new NullPointerException("serverName"); } if (elasticPoolName == null) { throw new NullPointerException("elasticPoolName"); } // Tracing boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put("resourceGroupName", resourceGroupName); tracingParameters.put("serverName", serverName); tracingParameters.put("elasticPoolName", elasticPoolName); CloudTracing.enter(invocationId, this, "listDatabaseActivityAsync", tracingParameters); } // Construct URL String url = ""; url = url + "/subscriptions/"; if (this.getClient().getCredentials().getSubscriptionId() != null) { url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8"); } url = url + "/resourceGroups/"; url = url + URLEncoder.encode(resourceGroupName, "UTF-8"); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + URLEncoder.encode(serverName, "UTF-8"); url = url + "/elasticPools/"; url = url + URLEncoder.encode(elasticPoolName, "UTF-8"); url = url + "/elasticPoolDatabaseActivity"; ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-04-01"); if (queryParameters.size() > 0) { url = url + "?" + CollectionStringBuilder.join(queryParameters, "&"); } String baseUrl = this.getClient().getBaseUri().toString(); // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl.charAt(baseUrl.length() - 1) == '/') { baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0); } if (url.charAt(0) == '/') { url = url.substring(1); } url = baseUrl + "/" + url; url = url.replace(" ", "%20"); // Create HTTP transport objects HttpGet httpRequest = new HttpGet(url); // Set Headers // Send Request HttpResponse httpResponse = null; try { if (shouldTrace) { CloudTracing.sendRequest(invocationId, httpRequest); } httpResponse = this.getClient().getHttpClient().execute(httpRequest); if (shouldTrace) { CloudTracing.receiveResponse(invocationId, httpResponse); } int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result ElasticPoolDatabaseActivityListResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new ElasticPoolDatabaseActivityListResponse(); ObjectMapper objectMapper = new ObjectMapper(); JsonNode responseDoc = null; String responseDocContent = IOUtils.toString(responseContent); if (responseDocContent == null == false && responseDocContent.length() > 0) { responseDoc = objectMapper.readTree(responseDocContent); } if (responseDoc != null && responseDoc instanceof NullNode == false) { JsonNode valueArray = responseDoc.get("value"); if (valueArray != null && valueArray instanceof NullNode == false) { for (JsonNode valueValue : ((ArrayNode) valueArray)) { ElasticPoolDatabaseActivity elasticPoolDatabaseActivityInstance = new ElasticPoolDatabaseActivity(); result.getElasticPoolDatabaseActivities().add(elasticPoolDatabaseActivityInstance); JsonNode propertiesValue = valueValue.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { ElasticPoolDatabaseActivityProperties propertiesInstance = new ElasticPoolDatabaseActivityProperties(); elasticPoolDatabaseActivityInstance.setProperties(propertiesInstance); JsonNode databaseNameValue = propertiesValue.get("databaseName"); if (databaseNameValue != null && databaseNameValue instanceof NullNode == false) { String databaseNameInstance; databaseNameInstance = databaseNameValue.getTextValue(); propertiesInstance.setDatabaseName(databaseNameInstance); } JsonNode endTimeValue = propertiesValue.get("endTime"); if (endTimeValue != null && endTimeValue instanceof NullNode == false) { Calendar endTimeInstance; endTimeInstance = DatatypeConverter.parseDateTime(endTimeValue.getTextValue()); propertiesInstance.setEndTime(endTimeInstance); } JsonNode errorCodeValue = propertiesValue.get("errorCode"); if (errorCodeValue != null && errorCodeValue instanceof NullNode == false) { int errorCodeInstance; errorCodeInstance = errorCodeValue.getIntValue(); propertiesInstance.setErrorCode(errorCodeInstance); } JsonNode errorMessageValue = propertiesValue.get("errorMessage"); if (errorMessageValue != null && errorMessageValue instanceof NullNode == false) { String errorMessageInstance; errorMessageInstance = errorMessageValue.getTextValue(); propertiesInstance.setErrorMessage(errorMessageInstance); } JsonNode errorSeverityValue = propertiesValue.get("errorSeverity"); if (errorSeverityValue != null && errorSeverityValue instanceof NullNode == false) { int errorSeverityInstance; errorSeverityInstance = errorSeverityValue.getIntValue(); propertiesInstance.setErrorSeverity(errorSeverityInstance); } JsonNode operationValue = propertiesValue.get("operation"); if (operationValue != null && operationValue instanceof NullNode == false) { String operationInstance; operationInstance = operationValue.getTextValue(); propertiesInstance.setOperation(operationInstance); } JsonNode operationIdValue = propertiesValue.get("operationId"); if (operationIdValue != null && operationIdValue instanceof NullNode == false) { String operationIdInstance; operationIdInstance = operationIdValue.getTextValue(); propertiesInstance.setOperationId(operationIdInstance); } JsonNode percentCompleteValue = propertiesValue.get("percentComplete"); if (percentCompleteValue != null && percentCompleteValue instanceof NullNode == false) { int percentCompleteInstance; percentCompleteInstance = percentCompleteValue.getIntValue(); propertiesInstance.setPercentComplete(percentCompleteInstance); } JsonNode requestedElasticPoolNameValue = propertiesValue .get("requestedElasticPoolName"); if (requestedElasticPoolNameValue != null && requestedElasticPoolNameValue instanceof NullNode == false) { String requestedElasticPoolNameInstance; requestedElasticPoolNameInstance = requestedElasticPoolNameValue.getTextValue(); propertiesInstance .setRequestedElasticPoolName(requestedElasticPoolNameInstance); } JsonNode currentElasticPoolNameValue = propertiesValue .get("currentElasticPoolName"); if (currentElasticPoolNameValue != null && currentElasticPoolNameValue instanceof NullNode == false) { String currentElasticPoolNameInstance; currentElasticPoolNameInstance = currentElasticPoolNameValue.getTextValue(); propertiesInstance.setCurrentElasticPoolName(currentElasticPoolNameInstance); } JsonNode currentServiceObjectiveValue = propertiesValue .get("currentServiceObjective"); if (currentServiceObjectiveValue != null && currentServiceObjectiveValue instanceof NullNode == false) { String currentServiceObjectiveInstance; currentServiceObjectiveInstance = currentServiceObjectiveValue.getTextValue(); propertiesInstance .setCurrentServiceObjectiveName(currentServiceObjectiveInstance); } JsonNode requestedServiceObjectiveValue = propertiesValue .get("requestedServiceObjective"); if (requestedServiceObjectiveValue != null && requestedServiceObjectiveValue instanceof NullNode == false) { String requestedServiceObjectiveInstance; requestedServiceObjectiveInstance = requestedServiceObjectiveValue .getTextValue(); propertiesInstance .setRequestedServiceObjectiveName(requestedServiceObjectiveInstance); } JsonNode serverNameValue = propertiesValue.get("serverName"); if (serverNameValue != null && serverNameValue instanceof NullNode == false) { String serverNameInstance; serverNameInstance = serverNameValue.getTextValue(); propertiesInstance.setServerName(serverNameInstance); } JsonNode startTimeValue = propertiesValue.get("startTime"); if (startTimeValue != null && startTimeValue instanceof NullNode == false) { Calendar startTimeInstance; startTimeInstance = DatatypeConverter .parseDateTime(startTimeValue.getTextValue()); propertiesInstance.setStartTime(startTimeInstance); } JsonNode stateValue = propertiesValue.get("state"); if (stateValue != null && stateValue instanceof NullNode == false) { String stateInstance; stateInstance = stateValue.getTextValue(); propertiesInstance.setState(stateInstance); } } JsonNode idValue = valueValue.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); elasticPoolDatabaseActivityInstance.setId(idInstance); } JsonNode nameValue = valueValue.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); elasticPoolDatabaseActivityInstance.setName(nameInstance); } JsonNode typeValue = valueValue.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); elasticPoolDatabaseActivityInstance.setType(typeInstance); } JsonNode locationValue = valueValue.get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); elasticPoolDatabaseActivityInstance.setLocation(locationInstance); } JsonNode tagsSequenceElement = ((JsonNode) valueValue.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(); elasticPoolDatabaseActivityInstance.getTags().put(tagsKey, tagsValue); } } } } } } 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.servicebus.QueueOperationsImpl.java
/** * Updates the queue description and makes a call to update corresponding DB * entries. (see//from w w w .ja v a 2 s. c om * http://msdn.microsoft.com/en-us/library/windowsazure/jj856305.aspx for * more information) * * @param namespaceName Required. The namespace name. * @param queue Required. The service bus queue. * @throws ParserConfigurationException Thrown if there was an error * configuring the parser for the response body. * @throws SAXException Thrown if there was an error parsing the response * body. * @throws TransformerException Thrown if there was an error creating the * DOM transformer. * @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 A response to a request for a particular queue. */ @Override public ServiceBusQueueResponse update(String namespaceName, ServiceBusQueue queue) throws ParserConfigurationException, SAXException, TransformerException, IOException, ServiceException { // Validate if (namespaceName == null) { throw new NullPointerException("namespaceName"); } if (queue == null) { throw new NullPointerException("queue"); } // 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("namespaceName", namespaceName); tracingParameters.put("queue", queue); CloudTracing.enter(invocationId, this, "updateAsync", 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/servicebus/namespaces/"; url = url + URLEncoder.encode(namespaceName, "UTF-8"); url = url + "/queues/"; if (queue.getName() != null) { url = url + URLEncoder.encode(queue.getName(), "UTF-8"); } url = url + "/"; 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/atom+xml"); httpRequest.setHeader("if-match", "*"); httpRequest.setHeader("type", "entry"); httpRequest.setHeader("x-ms-version", "2013-08-01"); httpRequest.setHeader("x-process-at", "ServiceBus"); // Serialize Request String requestContent = null; DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document requestDoc = documentBuilder.newDocument(); Element entryElement = requestDoc.createElementNS("http://www.w3.org/2005/Atom", "entry"); requestDoc.appendChild(entryElement); Element contentElement = requestDoc.createElementNS("http://www.w3.org/2005/Atom", "content"); entryElement.appendChild(contentElement); Attr typeAttribute = requestDoc.createAttribute("type"); typeAttribute.setValue("application/atom+xml;type=entry;charset=utf-8"); contentElement.setAttributeNode(typeAttribute); Element queueDescriptionElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "QueueDescription"); contentElement.appendChild(queueDescriptionElement); if (queue.getLockDuration() != null) { Element lockDurationElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "LockDuration"); lockDurationElement.appendChild(requestDoc.createTextNode(queue.getLockDuration())); queueDescriptionElement.appendChild(lockDurationElement); } Element maxSizeInMegabytesElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "MaxSizeInMegabytes"); maxSizeInMegabytesElement .appendChild(requestDoc.createTextNode(Integer.toString(queue.getMaxSizeInMegabytes()))); queueDescriptionElement.appendChild(maxSizeInMegabytesElement); Element requiresDuplicateDetectionElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "RequiresDuplicateDetection"); requiresDuplicateDetectionElement.appendChild( requestDoc.createTextNode(Boolean.toString(queue.isRequiresDuplicateDetection()).toLowerCase())); queueDescriptionElement.appendChild(requiresDuplicateDetectionElement); Element requiresSessionElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "RequiresSession"); requiresSessionElement .appendChild(requestDoc.createTextNode(Boolean.toString(queue.isRequiresSession()).toLowerCase())); queueDescriptionElement.appendChild(requiresSessionElement); if (queue.getDefaultMessageTimeToLive() != null) { Element defaultMessageTimeToLiveElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "DefaultMessageTimeToLive"); defaultMessageTimeToLiveElement .appendChild(requestDoc.createTextNode(queue.getDefaultMessageTimeToLive())); queueDescriptionElement.appendChild(defaultMessageTimeToLiveElement); } Element deadLetteringOnMessageExpirationElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "DeadLetteringOnMessageExpiration"); deadLetteringOnMessageExpirationElement.appendChild(requestDoc .createTextNode(Boolean.toString(queue.isDeadLetteringOnMessageExpiration()).toLowerCase())); queueDescriptionElement.appendChild(deadLetteringOnMessageExpirationElement); if (queue.getDuplicateDetectionHistoryTimeWindow() != null) { Element duplicateDetectionHistoryTimeWindowElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "DuplicateDetectionHistoryTimeWindow"); duplicateDetectionHistoryTimeWindowElement .appendChild(requestDoc.createTextNode(queue.getDuplicateDetectionHistoryTimeWindow())); queueDescriptionElement.appendChild(duplicateDetectionHistoryTimeWindowElement); } Element enableBatchedOperationsElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "EnableBatchedOperations"); enableBatchedOperationsElement.appendChild( requestDoc.createTextNode(Boolean.toString(queue.isEnableBatchedOperations()).toLowerCase())); queueDescriptionElement.appendChild(enableBatchedOperationsElement); Element sizeInBytesElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SizeInBytes"); sizeInBytesElement.appendChild(requestDoc.createTextNode(Integer.toString(queue.getSizeInBytes()))); queueDescriptionElement.appendChild(sizeInBytesElement); Element messageCountElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "MessageCount"); messageCountElement.appendChild(requestDoc.createTextNode(Integer.toString(queue.getMessageCount()))); queueDescriptionElement.appendChild(messageCountElement); Element isAnonymousAccessibleElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "IsAnonymousAccessible"); isAnonymousAccessibleElement.appendChild( requestDoc.createTextNode(Boolean.toString(queue.isAnonymousAccessible()).toLowerCase())); queueDescriptionElement.appendChild(isAnonymousAccessibleElement); if (queue.getAuthorizationRules() != null) { if (queue.getAuthorizationRules() instanceof LazyCollection == false || ((LazyCollection) queue.getAuthorizationRules()).isInitialized()) { Element authorizationRulesSequenceElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AuthorizationRules"); for (ServiceBusSharedAccessAuthorizationRule authorizationRulesItem : queue .getAuthorizationRules()) { Element authorizationRuleElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AuthorizationRule"); authorizationRulesSequenceElement.appendChild(authorizationRuleElement); Attr typeAttribute2 = requestDoc.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "type"); typeAttribute2.setValue("SharedAccessAuthorizationRule"); authorizationRuleElement.setAttributeNode(typeAttribute2); if (authorizationRulesItem.getClaimType() != null) { Element claimTypeElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ClaimType"); claimTypeElement .appendChild(requestDoc.createTextNode(authorizationRulesItem.getClaimType())); authorizationRuleElement.appendChild(claimTypeElement); } if (authorizationRulesItem.getClaimValue() != null) { Element claimValueElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ClaimValue"); claimValueElement .appendChild(requestDoc.createTextNode(authorizationRulesItem.getClaimValue())); authorizationRuleElement.appendChild(claimValueElement); } if (authorizationRulesItem.getRights() != null) { if (authorizationRulesItem.getRights() instanceof LazyCollection == false || ((LazyCollection) authorizationRulesItem.getRights()).isInitialized()) { Element rightsSequenceElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Rights"); for (AccessRight rightsItem : authorizationRulesItem.getRights()) { Element rightsItemElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessRights"); rightsItemElement.appendChild(requestDoc.createTextNode(rightsItem.toString())); rightsSequenceElement.appendChild(rightsItemElement); } authorizationRuleElement.appendChild(rightsSequenceElement); } } Element createdTimeElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedTime"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); createdTimeElement.appendChild(requestDoc.createTextNode( simpleDateFormat.format(authorizationRulesItem.getCreatedTime().getTime()))); authorizationRuleElement.appendChild(createdTimeElement); if (authorizationRulesItem.getKeyName() != null) { Element keyNameElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "KeyName"); keyNameElement.appendChild(requestDoc.createTextNode(authorizationRulesItem.getKeyName())); authorizationRuleElement.appendChild(keyNameElement); } Element modifiedTimeElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ModifiedTime"); SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"); simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC")); modifiedTimeElement.appendChild(requestDoc.createTextNode( simpleDateFormat2.format(authorizationRulesItem.getModifiedTime().getTime()))); authorizationRuleElement.appendChild(modifiedTimeElement); if (authorizationRulesItem.getPrimaryKey() != null) { Element primaryKeyElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "PrimaryKey"); primaryKeyElement .appendChild(requestDoc.createTextNode(authorizationRulesItem.getPrimaryKey())); authorizationRuleElement.appendChild(primaryKeyElement); } if (authorizationRulesItem.getSecondaryKey() != null) { Element secondaryKeyElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SecondaryKey"); secondaryKeyElement .appendChild(requestDoc.createTextNode(authorizationRulesItem.getSecondaryKey())); authorizationRuleElement.appendChild(secondaryKeyElement); } } queueDescriptionElement.appendChild(authorizationRulesSequenceElement); } } if (queue.getStatus() != null) { Element statusElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Status"); statusElement.appendChild(requestDoc.createTextNode(queue.getStatus())); queueDescriptionElement.appendChild(statusElement); } Element supportOrderingElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SupportOrdering"); supportOrderingElement .appendChild(requestDoc.createTextNode(Boolean.toString(queue.isSupportOrdering()).toLowerCase())); queueDescriptionElement.appendChild(supportOrderingElement); if (queue.getCountDetails() != null) { Element countDetailsElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CountDetails"); queueDescriptionElement.appendChild(countDetailsElement); Element activeMessageCountElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2011/06/servicebus", "ActiveMessageCount"); activeMessageCountElement.appendChild( requestDoc.createTextNode(Integer.toString(queue.getCountDetails().getActiveMessageCount()))); countDetailsElement.appendChild(activeMessageCountElement); Element deadLetterMessageCountElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2011/06/servicebus", "DeadLetterMessageCount"); deadLetterMessageCountElement.appendChild(requestDoc .createTextNode(Integer.toString(queue.getCountDetails().getDeadLetterMessageCount()))); countDetailsElement.appendChild(deadLetterMessageCountElement); Element scheduledMessageCountElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2011/06/servicebus", "ScheduledMessageCount"); scheduledMessageCountElement.appendChild(requestDoc .createTextNode(Integer.toString(queue.getCountDetails().getScheduledMessageCount()))); countDetailsElement.appendChild(scheduledMessageCountElement); Element transferDeadLetterMessageCountElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2011/06/servicebus", "TransferDeadLetterMessageCount"); transferDeadLetterMessageCountElement.appendChild(requestDoc .createTextNode(Integer.toString(queue.getCountDetails().getTransferDeadLetterMessageCount()))); countDetailsElement.appendChild(transferDeadLetterMessageCountElement); Element transferMessageCountElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2011/06/servicebus", "TransferMessageCount"); transferMessageCountElement.appendChild( requestDoc.createTextNode(Integer.toString(queue.getCountDetails().getTransferMessageCount()))); countDetailsElement.appendChild(transferMessageCountElement); } if (queue.getAutoDeleteOnIdle() != null) { Element autoDeleteOnIdleElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AutoDeleteOnIdle"); autoDeleteOnIdleElement.appendChild(requestDoc.createTextNode(queue.getAutoDeleteOnIdle())); queueDescriptionElement.appendChild(autoDeleteOnIdleElement); } if (queue.getEntityAvailabilityStatus() != null) { Element entityAvailabilityStatusElement = requestDoc.createElementNS( "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "EntityAvailabilityStatus"); entityAvailabilityStatusElement .appendChild(requestDoc.createTextNode(queue.getEntityAvailabilityStatus())); queueDescriptionElement.appendChild(entityAvailabilityStatusElement); } DOMSource domSource = new DOMSource(requestDoc); StringWriter stringWriter = new StringWriter(); StreamResult streamResult = new StreamResult(stringWriter); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(domSource, streamResult); requestContent = stringWriter.toString(); StringEntity entity = new StringEntity(requestContent); httpRequest.setEntity(entity); httpRequest.setHeader("Content-Type", "application/atom+xml"); // 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, requestContent, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result ServiceBusQueueResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new ServiceBusQueueResponse(); DocumentBuilderFactory documentBuilderFactory2 = DocumentBuilderFactory.newInstance(); documentBuilderFactory2.setNamespaceAware(true); DocumentBuilder documentBuilder2 = documentBuilderFactory2.newDocumentBuilder(); Document responseDoc = documentBuilder2.parse(new BOMInputStream(responseContent)); Element entryElement2 = XmlUtility.getElementByTagNameNS(responseDoc, "http://www.w3.org/2005/Atom", "entry"); if (entryElement2 != null) { Element titleElement = XmlUtility.getElementByTagNameNS(entryElement2, "http://www.w3.org/2005/Atom", "title"); if (titleElement != null) { } Element contentElement2 = XmlUtility.getElementByTagNameNS(entryElement2, "http://www.w3.org/2005/Atom", "content"); if (contentElement2 != null) { Element queueDescriptionElement2 = XmlUtility.getElementByTagNameNS(contentElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "QueueDescription"); if (queueDescriptionElement2 != null) { ServiceBusQueue queueDescriptionInstance = new ServiceBusQueue(); result.setQueue(queueDescriptionInstance); Element lockDurationElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "LockDuration"); if (lockDurationElement2 != null) { String lockDurationInstance; lockDurationInstance = lockDurationElement2.getTextContent(); queueDescriptionInstance.setLockDuration(lockDurationInstance); } Element maxSizeInMegabytesElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "MaxSizeInMegabytes"); if (maxSizeInMegabytesElement2 != null) { int maxSizeInMegabytesInstance; maxSizeInMegabytesInstance = DatatypeConverter .parseInt(maxSizeInMegabytesElement2.getTextContent()); queueDescriptionInstance.setMaxSizeInMegabytes(maxSizeInMegabytesInstance); } Element requiresDuplicateDetectionElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "RequiresDuplicateDetection"); if (requiresDuplicateDetectionElement2 != null) { boolean requiresDuplicateDetectionInstance; requiresDuplicateDetectionInstance = DatatypeConverter.parseBoolean( requiresDuplicateDetectionElement2.getTextContent().toLowerCase()); queueDescriptionInstance .setRequiresDuplicateDetection(requiresDuplicateDetectionInstance); } Element requiresSessionElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "RequiresSession"); if (requiresSessionElement2 != null) { boolean requiresSessionInstance; requiresSessionInstance = DatatypeConverter .parseBoolean(requiresSessionElement2.getTextContent().toLowerCase()); queueDescriptionInstance.setRequiresSession(requiresSessionInstance); } Element defaultMessageTimeToLiveElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "DefaultMessageTimeToLive"); if (defaultMessageTimeToLiveElement2 != null) { String defaultMessageTimeToLiveInstance; defaultMessageTimeToLiveInstance = defaultMessageTimeToLiveElement2 .getTextContent(); queueDescriptionInstance .setDefaultMessageTimeToLive(defaultMessageTimeToLiveInstance); } Element deadLetteringOnMessageExpirationElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "DeadLetteringOnMessageExpiration"); if (deadLetteringOnMessageExpirationElement2 != null) { boolean deadLetteringOnMessageExpirationInstance; deadLetteringOnMessageExpirationInstance = DatatypeConverter.parseBoolean( deadLetteringOnMessageExpirationElement2.getTextContent().toLowerCase()); queueDescriptionInstance.setDeadLetteringOnMessageExpiration( deadLetteringOnMessageExpirationInstance); } Element duplicateDetectionHistoryTimeWindowElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "DuplicateDetectionHistoryTimeWindow"); if (duplicateDetectionHistoryTimeWindowElement2 != null) { String duplicateDetectionHistoryTimeWindowInstance; duplicateDetectionHistoryTimeWindowInstance = duplicateDetectionHistoryTimeWindowElement2 .getTextContent(); queueDescriptionInstance.setDuplicateDetectionHistoryTimeWindow( duplicateDetectionHistoryTimeWindowInstance); } Element maxDeliveryCountElement = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "MaxDeliveryCount"); if (maxDeliveryCountElement != null) { int maxDeliveryCountInstance; maxDeliveryCountInstance = DatatypeConverter .parseInt(maxDeliveryCountElement.getTextContent()); queueDescriptionInstance.setMaxDeliveryCount(maxDeliveryCountInstance); } Element enableBatchedOperationsElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "EnableBatchedOperations"); if (enableBatchedOperationsElement2 != null) { boolean enableBatchedOperationsInstance; enableBatchedOperationsInstance = DatatypeConverter.parseBoolean( enableBatchedOperationsElement2.getTextContent().toLowerCase()); queueDescriptionInstance .setEnableBatchedOperations(enableBatchedOperationsInstance); } Element sizeInBytesElement2 = XmlUtility.getElementByTagNameNS(queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SizeInBytes"); if (sizeInBytesElement2 != null) { int sizeInBytesInstance; sizeInBytesInstance = DatatypeConverter .parseInt(sizeInBytesElement2.getTextContent()); queueDescriptionInstance.setSizeInBytes(sizeInBytesInstance); } Element messageCountElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "MessageCount"); if (messageCountElement2 != null) { int messageCountInstance; messageCountInstance = DatatypeConverter .parseInt(messageCountElement2.getTextContent()); queueDescriptionInstance.setMessageCount(messageCountInstance); } Element isAnonymousAccessibleElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "IsAnonymousAccessible"); if (isAnonymousAccessibleElement2 != null) { boolean isAnonymousAccessibleInstance; isAnonymousAccessibleInstance = DatatypeConverter .parseBoolean(isAnonymousAccessibleElement2.getTextContent().toLowerCase()); queueDescriptionInstance.setIsAnonymousAccessible(isAnonymousAccessibleInstance); } Element authorizationRulesSequenceElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AuthorizationRules"); if (authorizationRulesSequenceElement2 != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(authorizationRulesSequenceElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AuthorizationRule") .size(); i1 = i1 + 1) { org.w3c.dom.Element authorizationRulesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(authorizationRulesSequenceElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AuthorizationRule") .get(i1)); ServiceBusSharedAccessAuthorizationRule authorizationRuleInstance = new ServiceBusSharedAccessAuthorizationRule(); queueDescriptionInstance.getAuthorizationRules().add(authorizationRuleInstance); Element claimTypeElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ClaimType"); if (claimTypeElement2 != null) { String claimTypeInstance; claimTypeInstance = claimTypeElement2.getTextContent(); authorizationRuleInstance.setClaimType(claimTypeInstance); } Element claimValueElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ClaimValue"); if (claimValueElement2 != null) { String claimValueInstance; claimValueInstance = claimValueElement2.getTextContent(); authorizationRuleInstance.setClaimValue(claimValueInstance); } Element rightsSequenceElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Rights"); if (rightsSequenceElement2 != null) { for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(rightsSequenceElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessRights") .size(); i2 = i2 + 1) { org.w3c.dom.Element rightsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(rightsSequenceElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessRights") .get(i2)); authorizationRuleInstance.getRights() .add(AccessRight.valueOf(rightsElement.getTextContent())); } } Element createdTimeElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedTime"); if (createdTimeElement2 != null) { Calendar createdTimeInstance; createdTimeInstance = DatatypeConverter .parseDateTime(createdTimeElement2.getTextContent()); authorizationRuleInstance.setCreatedTime(createdTimeInstance); } Element keyNameElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "KeyName"); if (keyNameElement2 != null) { String keyNameInstance; keyNameInstance = keyNameElement2.getTextContent(); authorizationRuleInstance.setKeyName(keyNameInstance); } Element modifiedTimeElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ModifiedTime"); if (modifiedTimeElement2 != null) { Calendar modifiedTimeInstance; modifiedTimeInstance = DatatypeConverter .parseDateTime(modifiedTimeElement2.getTextContent()); authorizationRuleInstance.setModifiedTime(modifiedTimeInstance); } Element primaryKeyElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "PrimaryKey"); if (primaryKeyElement2 != null) { String primaryKeyInstance; primaryKeyInstance = primaryKeyElement2.getTextContent(); authorizationRuleInstance.setPrimaryKey(primaryKeyInstance); } Element secondaryKeyElement2 = XmlUtility.getElementByTagNameNS( authorizationRulesElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SecondaryKey"); if (secondaryKeyElement2 != null) { String secondaryKeyInstance; secondaryKeyInstance = secondaryKeyElement2.getTextContent(); authorizationRuleInstance.setSecondaryKey(secondaryKeyInstance); } } } Element statusElement2 = XmlUtility.getElementByTagNameNS(queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Status"); if (statusElement2 != null) { String statusInstance; statusInstance = statusElement2.getTextContent(); queueDescriptionInstance.setStatus(statusInstance); } Element createdAtElement = XmlUtility.getElementByTagNameNS(queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CreatedAt"); if (createdAtElement != null) { Calendar createdAtInstance; createdAtInstance = DatatypeConverter .parseDateTime(createdAtElement.getTextContent()); queueDescriptionInstance.setCreatedAt(createdAtInstance); } Element updatedAtElement = XmlUtility.getElementByTagNameNS(queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "UpdatedAt"); if (updatedAtElement != null) { Calendar updatedAtInstance; updatedAtInstance = DatatypeConverter .parseDateTime(updatedAtElement.getTextContent()); queueDescriptionInstance.setUpdatedAt(updatedAtInstance); } Element accessedAtElement = XmlUtility.getElementByTagNameNS(queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessedAt"); if (accessedAtElement != null) { Calendar accessedAtInstance; accessedAtInstance = DatatypeConverter .parseDateTime(accessedAtElement.getTextContent()); queueDescriptionInstance.setAccessedAt(accessedAtInstance); } Element supportOrderingElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "SupportOrdering"); if (supportOrderingElement2 != null) { boolean supportOrderingInstance; supportOrderingInstance = DatatypeConverter .parseBoolean(supportOrderingElement2.getTextContent().toLowerCase()); queueDescriptionInstance.setSupportOrdering(supportOrderingInstance); } Element countDetailsElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "CountDetails"); if (countDetailsElement2 != null) { CountDetails countDetailsInstance = new CountDetails(); queueDescriptionInstance.setCountDetails(countDetailsInstance); Element activeMessageCountElement2 = XmlUtility.getElementByTagNameNS( countDetailsElement2, "http://schemas.microsoft.com/netservices/2011/06/servicebus", "ActiveMessageCount"); if (activeMessageCountElement2 != null) { int activeMessageCountInstance; activeMessageCountInstance = DatatypeConverter .parseInt(activeMessageCountElement2.getTextContent()); countDetailsInstance.setActiveMessageCount(activeMessageCountInstance); } Element deadLetterMessageCountElement2 = XmlUtility.getElementByTagNameNS( countDetailsElement2, "http://schemas.microsoft.com/netservices/2011/06/servicebus", "DeadLetterMessageCount"); if (deadLetterMessageCountElement2 != null) { int deadLetterMessageCountInstance; deadLetterMessageCountInstance = DatatypeConverter .parseInt(deadLetterMessageCountElement2.getTextContent()); countDetailsInstance.setDeadLetterMessageCount(deadLetterMessageCountInstance); } Element scheduledMessageCountElement2 = XmlUtility.getElementByTagNameNS( countDetailsElement2, "http://schemas.microsoft.com/netservices/2011/06/servicebus", "ScheduledMessageCount"); if (scheduledMessageCountElement2 != null) { int scheduledMessageCountInstance; scheduledMessageCountInstance = DatatypeConverter .parseInt(scheduledMessageCountElement2.getTextContent()); countDetailsInstance.setScheduledMessageCount(scheduledMessageCountInstance); } Element transferDeadLetterMessageCountElement2 = XmlUtility.getElementByTagNameNS( countDetailsElement2, "http://schemas.microsoft.com/netservices/2011/06/servicebus", "TransferDeadLetterMessageCount"); if (transferDeadLetterMessageCountElement2 != null) { int transferDeadLetterMessageCountInstance; transferDeadLetterMessageCountInstance = DatatypeConverter .parseInt(transferDeadLetterMessageCountElement2.getTextContent()); countDetailsInstance.setTransferDeadLetterMessageCount( transferDeadLetterMessageCountInstance); } Element transferMessageCountElement2 = XmlUtility.getElementByTagNameNS( countDetailsElement2, "http://schemas.microsoft.com/netservices/2011/06/servicebus", "TransferMessageCount"); if (transferMessageCountElement2 != null) { int transferMessageCountInstance; transferMessageCountInstance = DatatypeConverter .parseInt(transferMessageCountElement2.getTextContent()); countDetailsInstance.setTransferMessageCount(transferMessageCountInstance); } } Element autoDeleteOnIdleElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AutoDeleteOnIdle"); if (autoDeleteOnIdleElement2 != null) { String autoDeleteOnIdleInstance; autoDeleteOnIdleInstance = autoDeleteOnIdleElement2.getTextContent(); queueDescriptionInstance.setAutoDeleteOnIdle(autoDeleteOnIdleInstance); } Element entityAvailabilityStatusElement2 = XmlUtility.getElementByTagNameNS( queueDescriptionElement2, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "EntityAvailabilityStatus"); if (entityAvailabilityStatusElement2 != null) { String entityAvailabilityStatusInstance; entityAvailabilityStatusInstance = entityAvailabilityStatusElement2 .getTextContent(); queueDescriptionInstance .setEntityAvailabilityStatus(entityAvailabilityStatusInstance); } } } } } 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
/** * Gets a schedule configuration for site backups. * * @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.//from w ww . j a v a 2 s . c o m * @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 Scheduled backup definition. */ @Override public WebSiteGetBackupConfigurationResponse getBackupConfiguration(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, "getBackupConfigurationAsync", 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 + "/backup/config"; 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 WebSiteGetBackupConfigurationResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetBackupConfigurationResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent)); Element backupRequestElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "BackupRequest"); if (backupRequestElement != null) { Element enabledElement = XmlUtility.getElementByTagNameNS(backupRequestElement, "http://schemas.microsoft.com/windowsazure", "Enabled"); if (enabledElement != null && enabledElement.getTextContent() != null && !enabledElement.getTextContent().isEmpty()) { boolean enabledInstance; enabledInstance = DatatypeConverter .parseBoolean(enabledElement.getTextContent().toLowerCase()); result.setEnabled(enabledInstance); } Element nameElement = XmlUtility.getElementByTagNameNS(backupRequestElement, "http://schemas.microsoft.com/windowsazure", "Name"); if (nameElement != null) { String nameInstance; nameInstance = nameElement.getTextContent(); result.setName(nameInstance); } Element backupScheduleElement = XmlUtility.getElementByTagNameNS(backupRequestElement, "http://schemas.microsoft.com/windowsazure", "BackupSchedule"); if (backupScheduleElement != null) { BackupSchedule backupScheduleInstance = new BackupSchedule(); result.setBackupSchedule(backupScheduleInstance); Element frequencyIntervalElement = XmlUtility.getElementByTagNameNS(backupScheduleElement, "http://schemas.microsoft.com/windowsazure", "FrequencyInterval"); if (frequencyIntervalElement != null) { int frequencyIntervalInstance; frequencyIntervalInstance = DatatypeConverter .parseInt(frequencyIntervalElement.getTextContent()); backupScheduleInstance.setFrequencyInterval(frequencyIntervalInstance); } Element frequencyUnitElement = XmlUtility.getElementByTagNameNS(backupScheduleElement, "http://schemas.microsoft.com/windowsazure", "FrequencyUnit"); if (frequencyUnitElement != null && frequencyUnitElement.getTextContent() != null && !frequencyUnitElement.getTextContent().isEmpty()) { FrequencyUnit frequencyUnitInstance; frequencyUnitInstance = FrequencyUnit.valueOf(frequencyUnitElement.getTextContent()); backupScheduleInstance.setFrequencyUnit(frequencyUnitInstance); } Element keepAtLeastOneBackupElement = XmlUtility.getElementByTagNameNS( backupScheduleElement, "http://schemas.microsoft.com/windowsazure", "KeepAtLeastOneBackup"); if (keepAtLeastOneBackupElement != null) { boolean keepAtLeastOneBackupInstance; keepAtLeastOneBackupInstance = DatatypeConverter .parseBoolean(keepAtLeastOneBackupElement.getTextContent().toLowerCase()); backupScheduleInstance.setKeepAtLeastOneBackup(keepAtLeastOneBackupInstance); } Element lastExecutionTimeElement = XmlUtility.getElementByTagNameNS(backupScheduleElement, "http://schemas.microsoft.com/windowsazure", "LastExecutionTime"); if (lastExecutionTimeElement != null && lastExecutionTimeElement.getTextContent() != null && !lastExecutionTimeElement.getTextContent().isEmpty()) { Calendar lastExecutionTimeInstance; lastExecutionTimeInstance = DatatypeConverter .parseDateTime(lastExecutionTimeElement.getTextContent()); backupScheduleInstance.setLastExecutionTime(lastExecutionTimeInstance); } Element retentionPeriodInDaysElement = XmlUtility.getElementByTagNameNS( backupScheduleElement, "http://schemas.microsoft.com/windowsazure", "RetentionPeriodInDays"); if (retentionPeriodInDaysElement != null) { int retentionPeriodInDaysInstance; retentionPeriodInDaysInstance = DatatypeConverter .parseInt(retentionPeriodInDaysElement.getTextContent()); backupScheduleInstance.setRetentionPeriodInDays(retentionPeriodInDaysInstance); } Element startTimeElement = XmlUtility.getElementByTagNameNS(backupScheduleElement, "http://schemas.microsoft.com/windowsazure", "StartTime"); if (startTimeElement != null && startTimeElement.getTextContent() != null && !startTimeElement.getTextContent().isEmpty()) { Calendar startTimeInstance; startTimeInstance = DatatypeConverter.parseDateTime(startTimeElement.getTextContent()); backupScheduleInstance.setStartTime(startTimeInstance); } } Element databasesSequenceElement = XmlUtility.getElementByTagNameNS(backupRequestElement, "http://schemas.microsoft.com/windowsazure", "Databases"); if (databasesSequenceElement != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(databasesSequenceElement, "http://schemas.microsoft.com/windowsazure", "DatabaseBackupSetting") .size(); i1 = i1 + 1) { org.w3c.dom.Element databasesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility .getElementsByTagNameNS(databasesSequenceElement, "http://schemas.microsoft.com/windowsazure", "DatabaseBackupSetting") .get(i1)); DatabaseBackupSetting databaseBackupSettingInstance = new DatabaseBackupSetting(); result.getDatabases().add(databaseBackupSettingInstance); Element connectionStringElement = XmlUtility.getElementByTagNameNS(databasesElement, "http://schemas.microsoft.com/windowsazure", "ConnectionString"); if (connectionStringElement != null) { String connectionStringInstance; connectionStringInstance = connectionStringElement.getTextContent(); databaseBackupSettingInstance.setConnectionString(connectionStringInstance); } Element connectionStringNameElement = XmlUtility.getElementByTagNameNS(databasesElement, "http://schemas.microsoft.com/windowsazure", "ConnectionStringName"); if (connectionStringNameElement != null) { String connectionStringNameInstance; connectionStringNameInstance = connectionStringNameElement.getTextContent(); databaseBackupSettingInstance.setConnectionStringName(connectionStringNameInstance); } Element databaseTypeElement = XmlUtility.getElementByTagNameNS(databasesElement, "http://schemas.microsoft.com/windowsazure", "DatabaseType"); if (databaseTypeElement != null) { String databaseTypeInstance; databaseTypeInstance = databaseTypeElement.getTextContent(); databaseBackupSettingInstance.setDatabaseType(databaseTypeInstance); } Element nameElement2 = XmlUtility.getElementByTagNameNS(databasesElement, "http://schemas.microsoft.com/windowsazure", "Name"); if (nameElement2 != null) { String nameInstance2; nameInstance2 = nameElement2.getTextContent(); databaseBackupSettingInstance.setName(nameInstance2); } } } Element storageAccountUrlElement = XmlUtility.getElementByTagNameNS(backupRequestElement, "http://schemas.microsoft.com/windowsazure", "StorageAccountUrl"); if (storageAccountUrlElement != null) { String storageAccountUrlInstance; storageAccountUrlInstance = storageAccountUrlElement.getTextContent(); result.setStorageAccountUrl(storageAccountUrlInstance); } } } 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.ElasticPoolOperationsImpl.java
/** * Returns information about an Azure SQL Database inside of an Azure Sql * Database Elastic Pool./*w w w .j a va 2 s . c om*/ * * @param resourceGroupName Required. The name of the Resource Group to * which the server belongs. * @param serverName Required. The name of the Azure SQL Database Server on * which the database is hosted. * @param elasticPoolName Required. The name of the Azure SQL Database * Elastic Pool to be retrieved. * @throws IOException Signals that an I/O exception of some sort has * occurred. This class is the general class of exceptions produced by * failed or interrupted I/O operations. * @throws ServiceException Thrown if an unexpected response is found. * @return Represents the response to a List Azure Sql Database request. */ @Override public DatabaseListResponse listDatabases(String resourceGroupName, String serverName, String elasticPoolName) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (serverName == null) { throw new NullPointerException("serverName"); } if (elasticPoolName == null) { throw new NullPointerException("elasticPoolName"); } // Tracing boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put("resourceGroupName", resourceGroupName); tracingParameters.put("serverName", serverName); tracingParameters.put("elasticPoolName", elasticPoolName); CloudTracing.enter(invocationId, this, "listDatabasesAsync", tracingParameters); } // Construct URL String url = ""; url = url + "/subscriptions/"; if (this.getClient().getCredentials().getSubscriptionId() != null) { url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8"); } url = url + "/resourceGroups/"; url = url + URLEncoder.encode(resourceGroupName, "UTF-8"); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + URLEncoder.encode(serverName, "UTF-8"); url = url + "/elasticPools/"; url = url + URLEncoder.encode(elasticPoolName, "UTF-8"); url = url + "/databases"; ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-04-01"); if (queryParameters.size() > 0) { url = url + "?" + CollectionStringBuilder.join(queryParameters, "&"); } String baseUrl = this.getClient().getBaseUri().toString(); // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl.charAt(baseUrl.length() - 1) == '/') { baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0); } if (url.charAt(0) == '/') { url = url.substring(1); } url = baseUrl + "/" + url; url = url.replace(" ", "%20"); // Create HTTP transport objects HttpGet httpRequest = new HttpGet(url); // Set Headers // Send Request HttpResponse httpResponse = null; try { if (shouldTrace) { CloudTracing.sendRequest(invocationId, httpRequest); } httpResponse = this.getClient().getHttpClient().execute(httpRequest); if (shouldTrace) { CloudTracing.receiveResponse(invocationId, httpResponse); } int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result DatabaseListResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new DatabaseListResponse(); ObjectMapper objectMapper = new ObjectMapper(); JsonNode responseDoc = null; String responseDocContent = IOUtils.toString(responseContent); if (responseDocContent == null == false && responseDocContent.length() > 0) { responseDoc = objectMapper.readTree(responseDocContent); } if (responseDoc != null && responseDoc instanceof NullNode == false) { JsonNode valueArray = responseDoc.get("value"); if (valueArray != null && valueArray instanceof NullNode == false) { for (JsonNode valueValue : ((ArrayNode) valueArray)) { Database databaseInstance = new Database(); result.getDatabases().add(databaseInstance); JsonNode propertiesValue = valueValue.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { DatabaseProperties propertiesInstance = new DatabaseProperties(); databaseInstance.setProperties(propertiesInstance); JsonNode collationValue = propertiesValue.get("collation"); if (collationValue != null && collationValue instanceof NullNode == false) { String collationInstance; collationInstance = collationValue.getTextValue(); propertiesInstance.setCollation(collationInstance); } JsonNode creationDateValue = propertiesValue.get("creationDate"); if (creationDateValue != null && creationDateValue instanceof NullNode == false) { Calendar creationDateInstance; creationDateInstance = DatatypeConverter .parseDateTime(creationDateValue.getTextValue()); propertiesInstance.setCreationDate(creationDateInstance); } JsonNode currentServiceObjectiveIdValue = propertiesValue .get("currentServiceObjectiveId"); if (currentServiceObjectiveIdValue != null && currentServiceObjectiveIdValue instanceof NullNode == false) { String currentServiceObjectiveIdInstance; currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue .getTextValue(); propertiesInstance .setCurrentServiceObjectiveId(currentServiceObjectiveIdInstance); } JsonNode databaseIdValue = propertiesValue.get("databaseId"); if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) { String databaseIdInstance; databaseIdInstance = databaseIdValue.getTextValue(); propertiesInstance.setDatabaseId(databaseIdInstance); } JsonNode earliestRestoreDateValue = propertiesValue.get("earliestRestoreDate"); if (earliestRestoreDateValue != null && earliestRestoreDateValue instanceof NullNode == false) { Calendar earliestRestoreDateInstance; earliestRestoreDateInstance = DatatypeConverter .parseDateTime(earliestRestoreDateValue.getTextValue()); propertiesInstance.setEarliestRestoreDate(earliestRestoreDateInstance); } JsonNode editionValue = propertiesValue.get("edition"); if (editionValue != null && editionValue instanceof NullNode == false) { String editionInstance; editionInstance = editionValue.getTextValue(); propertiesInstance.setEdition(editionInstance); } JsonNode maxSizeBytesValue = propertiesValue.get("maxSizeBytes"); if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) { long maxSizeBytesInstance; maxSizeBytesInstance = maxSizeBytesValue.getLongValue(); propertiesInstance.setMaxSizeBytes(maxSizeBytesInstance); } JsonNode requestedServiceObjectiveIdValue = propertiesValue .get("requestedServiceObjectiveId"); if (requestedServiceObjectiveIdValue != null && requestedServiceObjectiveIdValue instanceof NullNode == false) { String requestedServiceObjectiveIdInstance; requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue .getTextValue(); propertiesInstance .setRequestedServiceObjectiveId(requestedServiceObjectiveIdInstance); } JsonNode requestedServiceObjectiveNameValue = propertiesValue .get("requestedServiceObjectiveName"); if (requestedServiceObjectiveNameValue != null && requestedServiceObjectiveNameValue instanceof NullNode == false) { String requestedServiceObjectiveNameInstance; requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue .getTextValue(); propertiesInstance.setRequestedServiceObjectiveName( requestedServiceObjectiveNameInstance); } JsonNode serviceLevelObjectiveValue = propertiesValue.get("serviceLevelObjective"); if (serviceLevelObjectiveValue != null && serviceLevelObjectiveValue instanceof NullNode == false) { String serviceLevelObjectiveInstance; serviceLevelObjectiveInstance = serviceLevelObjectiveValue.getTextValue(); propertiesInstance.setServiceObjective(serviceLevelObjectiveInstance); } JsonNode statusValue = propertiesValue.get("status"); if (statusValue != null && statusValue instanceof NullNode == false) { String statusInstance; statusInstance = statusValue.getTextValue(); propertiesInstance.setStatus(statusInstance); } JsonNode elasticPoolNameValue = propertiesValue.get("elasticPoolName"); if (elasticPoolNameValue != null && elasticPoolNameValue instanceof NullNode == false) { String elasticPoolNameInstance; elasticPoolNameInstance = elasticPoolNameValue.getTextValue(); propertiesInstance.setElasticPoolName(elasticPoolNameInstance); } JsonNode serviceTierAdvisorsArray = propertiesValue.get("serviceTierAdvisors"); if (serviceTierAdvisorsArray != null && serviceTierAdvisorsArray instanceof NullNode == false) { for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) { ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor(); propertiesInstance.getServiceTierAdvisors().add(serviceTierAdvisorInstance); JsonNode propertiesValue2 = serviceTierAdvisorsValue.get("properties"); if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) { ServiceTierAdvisorProperties propertiesInstance2 = new ServiceTierAdvisorProperties(); serviceTierAdvisorInstance.setProperties(propertiesInstance2); JsonNode observationPeriodStartValue = propertiesValue2 .get("observationPeriodStart"); if (observationPeriodStartValue != null && observationPeriodStartValue instanceof NullNode == false) { Calendar observationPeriodStartInstance; observationPeriodStartInstance = DatatypeConverter .parseDateTime(observationPeriodStartValue.getTextValue()); propertiesInstance2 .setObservationPeriodStart(observationPeriodStartInstance); } JsonNode observationPeriodEndValue = propertiesValue2 .get("observationPeriodEnd"); if (observationPeriodEndValue != null && observationPeriodEndValue instanceof NullNode == false) { Calendar observationPeriodEndInstance; observationPeriodEndInstance = DatatypeConverter .parseDateTime(observationPeriodEndValue.getTextValue()); propertiesInstance2 .setObservationPeriodEnd(observationPeriodEndInstance); } JsonNode activeTimeRatioValue = propertiesValue2.get("activeTimeRatio"); if (activeTimeRatioValue != null && activeTimeRatioValue instanceof NullNode == false) { double activeTimeRatioInstance; activeTimeRatioInstance = activeTimeRatioValue.getDoubleValue(); propertiesInstance2.setActiveTimeRatio(activeTimeRatioInstance); } JsonNode minDtuValue = propertiesValue2.get("minDtu"); if (minDtuValue != null && minDtuValue instanceof NullNode == false) { double minDtuInstance; minDtuInstance = minDtuValue.getDoubleValue(); propertiesInstance2.setMinDtu(minDtuInstance); } JsonNode avgDtuValue = propertiesValue2.get("avgDtu"); if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) { double avgDtuInstance; avgDtuInstance = avgDtuValue.getDoubleValue(); propertiesInstance2.setAvgDtu(avgDtuInstance); } JsonNode maxDtuValue = propertiesValue2.get("maxDtu"); if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) { double maxDtuInstance; maxDtuInstance = maxDtuValue.getDoubleValue(); propertiesInstance2.setMaxDtu(maxDtuInstance); } JsonNode maxSizeInGBValue = propertiesValue2.get("maxSizeInGB"); if (maxSizeInGBValue != null && maxSizeInGBValue instanceof NullNode == false) { double maxSizeInGBInstance; maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue(); propertiesInstance2.setMaxSizeInGB(maxSizeInGBInstance); } JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue2 .get("serviceLevelObjectiveUsageMetrics"); if (serviceLevelObjectiveUsageMetricsArray != null && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) { for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) { SloUsageMetric sloUsageMetricInstance = new SloUsageMetric(); propertiesInstance2.getServiceLevelObjectiveUsageMetrics() .add(sloUsageMetricInstance); JsonNode serviceLevelObjectiveValue2 = serviceLevelObjectiveUsageMetricsValue .get("serviceLevelObjective"); if (serviceLevelObjectiveValue2 != null && serviceLevelObjectiveValue2 instanceof NullNode == false) { String serviceLevelObjectiveInstance2; serviceLevelObjectiveInstance2 = serviceLevelObjectiveValue2 .getTextValue(); sloUsageMetricInstance.setServiceLevelObjective( serviceLevelObjectiveInstance2); } JsonNode serviceLevelObjectiveIdValue = serviceLevelObjectiveUsageMetricsValue .get("serviceLevelObjectiveId"); if (serviceLevelObjectiveIdValue != null && serviceLevelObjectiveIdValue instanceof NullNode == false) { String serviceLevelObjectiveIdInstance; serviceLevelObjectiveIdInstance = serviceLevelObjectiveIdValue .getTextValue(); sloUsageMetricInstance.setServiceLevelObjectiveId( serviceLevelObjectiveIdInstance); } JsonNode inRangeTimeRatioValue = serviceLevelObjectiveUsageMetricsValue .get("inRangeTimeRatio"); if (inRangeTimeRatioValue != null && inRangeTimeRatioValue instanceof NullNode == false) { double inRangeTimeRatioInstance; inRangeTimeRatioInstance = inRangeTimeRatioValue .getDoubleValue(); sloUsageMetricInstance .setInRangeTimeRatio(inRangeTimeRatioInstance); } JsonNode idValue = serviceLevelObjectiveUsageMetricsValue .get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); sloUsageMetricInstance.setId(idInstance); } JsonNode nameValue = serviceLevelObjectiveUsageMetricsValue .get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); sloUsageMetricInstance.setName(nameInstance); } JsonNode typeValue = serviceLevelObjectiveUsageMetricsValue .get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); sloUsageMetricInstance.setType(typeInstance); } JsonNode locationValue = serviceLevelObjectiveUsageMetricsValue .get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); sloUsageMetricInstance.setLocation(locationInstance); } JsonNode tagsSequenceElement = ((JsonNode) serviceLevelObjectiveUsageMetricsValue .get("tags")); if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement .getFields(); while (itr.hasNext()) { Map.Entry<String, JsonNode> property = itr.next(); String tagsKey = property.getKey(); String tagsValue = property.getValue().getTextValue(); sloUsageMetricInstance.getTags().put(tagsKey, tagsValue); } } } } JsonNode currentServiceLevelObjectiveValue = propertiesValue2 .get("currentServiceLevelObjective"); if (currentServiceLevelObjectiveValue != null && currentServiceLevelObjectiveValue instanceof NullNode == false) { String currentServiceLevelObjectiveInstance; currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue .getTextValue(); propertiesInstance2.setCurrentServiceLevelObjective( currentServiceLevelObjectiveInstance); } JsonNode currentServiceLevelObjectiveIdValue = propertiesValue2 .get("currentServiceLevelObjectiveId"); if (currentServiceLevelObjectiveIdValue != null && currentServiceLevelObjectiveIdValue instanceof NullNode == false) { String currentServiceLevelObjectiveIdInstance; currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2.setCurrentServiceLevelObjectiveId( currentServiceLevelObjectiveIdInstance); } JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("usageBasedRecommendationServiceLevelObjective"); if (usageBasedRecommendationServiceLevelObjectiveValue != null && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String usageBasedRecommendationServiceLevelObjectiveInstance; usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setUsageBasedRecommendationServiceLevelObjective( usageBasedRecommendationServiceLevelObjectiveInstance); } JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("usageBasedRecommendationServiceLevelObjectiveId"); if (usageBasedRecommendationServiceLevelObjectiveIdValue != null && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String usageBasedRecommendationServiceLevelObjectiveIdInstance; usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2 .setUsageBasedRecommendationServiceLevelObjectiveId( usageBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("databaseSizeBasedRecommendationServiceLevelObjective"); if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String databaseSizeBasedRecommendationServiceLevelObjectiveInstance; databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setDatabaseSizeBasedRecommendationServiceLevelObjective( databaseSizeBasedRecommendationServiceLevelObjectiveInstance); } JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("databaseSizeBasedRecommendationServiceLevelObjectiveId"); if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance; databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2 .setDatabaseSizeBasedRecommendationServiceLevelObjectiveId( databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("disasterPlanBasedRecommendationServiceLevelObjective"); if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String disasterPlanBasedRecommendationServiceLevelObjectiveInstance; disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setDisasterPlanBasedRecommendationServiceLevelObjective( disasterPlanBasedRecommendationServiceLevelObjectiveInstance); } JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("disasterPlanBasedRecommendationServiceLevelObjectiveId"); if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance; disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2 .setDisasterPlanBasedRecommendationServiceLevelObjectiveId( disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("overallRecommendationServiceLevelObjective"); if (overallRecommendationServiceLevelObjectiveValue != null && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String overallRecommendationServiceLevelObjectiveInstance; overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2.setOverallRecommendationServiceLevelObjective( overallRecommendationServiceLevelObjectiveInstance); } JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("overallRecommendationServiceLevelObjectiveId"); if (overallRecommendationServiceLevelObjectiveIdValue != null && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String overallRecommendationServiceLevelObjectiveIdInstance; overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2.setOverallRecommendationServiceLevelObjectiveId( overallRecommendationServiceLevelObjectiveIdInstance); } JsonNode confidenceValue = propertiesValue2.get("confidence"); if (confidenceValue != null && confidenceValue instanceof NullNode == false) { double confidenceInstance; confidenceInstance = confidenceValue.getDoubleValue(); propertiesInstance2.setConfidence(confidenceInstance); } } JsonNode idValue2 = serviceTierAdvisorsValue.get("id"); if (idValue2 != null && idValue2 instanceof NullNode == false) { String idInstance2; idInstance2 = idValue2.getTextValue(); serviceTierAdvisorInstance.setId(idInstance2); } JsonNode nameValue2 = serviceTierAdvisorsValue.get("name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); serviceTierAdvisorInstance.setName(nameInstance2); } JsonNode typeValue2 = serviceTierAdvisorsValue.get("type"); if (typeValue2 != null && typeValue2 instanceof NullNode == false) { String typeInstance2; typeInstance2 = typeValue2.getTextValue(); serviceTierAdvisorInstance.setType(typeInstance2); } JsonNode locationValue2 = serviceTierAdvisorsValue.get("location"); if (locationValue2 != null && locationValue2 instanceof NullNode == false) { String locationInstance2; locationInstance2 = locationValue2.getTextValue(); serviceTierAdvisorInstance.setLocation(locationInstance2); } JsonNode tagsSequenceElement2 = ((JsonNode) serviceTierAdvisorsValue .get("tags")); if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr2 = tagsSequenceElement2 .getFields(); while (itr2.hasNext()) { Map.Entry<String, JsonNode> property2 = itr2.next(); String tagsKey2 = property2.getKey(); String tagsValue2 = property2.getValue().getTextValue(); serviceTierAdvisorInstance.getTags().put(tagsKey2, tagsValue2); } } } } JsonNode upgradeHintValue = propertiesValue.get("upgradeHint"); if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) { UpgradeHint upgradeHintInstance = new UpgradeHint(); propertiesInstance.setUpgradeHint(upgradeHintInstance); JsonNode targetServiceLevelObjectiveValue = upgradeHintValue .get("targetServiceLevelObjective"); if (targetServiceLevelObjectiveValue != null && targetServiceLevelObjectiveValue instanceof NullNode == false) { String targetServiceLevelObjectiveInstance; targetServiceLevelObjectiveInstance = targetServiceLevelObjectiveValue .getTextValue(); upgradeHintInstance.setTargetServiceLevelObjective( targetServiceLevelObjectiveInstance); } JsonNode targetServiceLevelObjectiveIdValue = upgradeHintValue .get("targetServiceLevelObjectiveId"); if (targetServiceLevelObjectiveIdValue != null && targetServiceLevelObjectiveIdValue instanceof NullNode == false) { String targetServiceLevelObjectiveIdInstance; targetServiceLevelObjectiveIdInstance = targetServiceLevelObjectiveIdValue .getTextValue(); upgradeHintInstance.setTargetServiceLevelObjectiveId( targetServiceLevelObjectiveIdInstance); } JsonNode idValue3 = upgradeHintValue.get("id"); if (idValue3 != null && idValue3 instanceof NullNode == false) { String idInstance3; idInstance3 = idValue3.getTextValue(); upgradeHintInstance.setId(idInstance3); } JsonNode nameValue3 = upgradeHintValue.get("name"); if (nameValue3 != null && nameValue3 instanceof NullNode == false) { String nameInstance3; nameInstance3 = nameValue3.getTextValue(); upgradeHintInstance.setName(nameInstance3); } JsonNode typeValue3 = upgradeHintValue.get("type"); if (typeValue3 != null && typeValue3 instanceof NullNode == false) { String typeInstance3; typeInstance3 = typeValue3.getTextValue(); upgradeHintInstance.setType(typeInstance3); } JsonNode locationValue3 = upgradeHintValue.get("location"); if (locationValue3 != null && locationValue3 instanceof NullNode == false) { String locationInstance3; locationInstance3 = locationValue3.getTextValue(); upgradeHintInstance.setLocation(locationInstance3); } JsonNode tagsSequenceElement3 = ((JsonNode) upgradeHintValue.get("tags")); if (tagsSequenceElement3 != null && tagsSequenceElement3 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr3 = tagsSequenceElement3 .getFields(); while (itr3.hasNext()) { Map.Entry<String, JsonNode> property3 = itr3.next(); String tagsKey3 = property3.getKey(); String tagsValue3 = property3.getValue().getTextValue(); upgradeHintInstance.getTags().put(tagsKey3, tagsValue3); } } } JsonNode schemasArray = propertiesValue.get("schemas"); if (schemasArray != null && schemasArray instanceof NullNode == false) { for (JsonNode schemasValue : ((ArrayNode) schemasArray)) { Schema schemaInstance = new Schema(); propertiesInstance.getSchemas().add(schemaInstance); JsonNode propertiesValue3 = schemasValue.get("properties"); if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) { SchemaProperties propertiesInstance3 = new SchemaProperties(); schemaInstance.setProperties(propertiesInstance3); JsonNode tablesArray = propertiesValue3.get("tables"); if (tablesArray != null && tablesArray instanceof NullNode == false) { for (JsonNode tablesValue : ((ArrayNode) tablesArray)) { Table tableInstance = new Table(); propertiesInstance3.getTables().add(tableInstance); JsonNode propertiesValue4 = tablesValue.get("properties"); if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) { TableProperties propertiesInstance4 = new TableProperties(); tableInstance.setProperties(propertiesInstance4); JsonNode tableTypeValue = propertiesValue4.get("tableType"); if (tableTypeValue != null && tableTypeValue instanceof NullNode == false) { String tableTypeInstance; tableTypeInstance = tableTypeValue.getTextValue(); propertiesInstance4.setTableType(tableTypeInstance); } JsonNode columnsArray = propertiesValue4.get("columns"); if (columnsArray != null && columnsArray instanceof NullNode == false) { for (JsonNode columnsValue : ((ArrayNode) columnsArray)) { Column columnInstance = new Column(); propertiesInstance4.getColumns() .add(columnInstance); JsonNode propertiesValue5 = columnsValue .get("properties"); if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) { ColumnProperties propertiesInstance5 = new ColumnProperties(); columnInstance .setProperties(propertiesInstance5); JsonNode columnTypeValue = propertiesValue5 .get("columnType"); if (columnTypeValue != null && columnTypeValue instanceof NullNode == false) { String columnTypeInstance; columnTypeInstance = columnTypeValue .getTextValue(); propertiesInstance5 .setColumnType(columnTypeInstance); } } JsonNode idValue4 = columnsValue.get("id"); if (idValue4 != null && idValue4 instanceof NullNode == false) { String idInstance4; idInstance4 = idValue4.getTextValue(); columnInstance.setId(idInstance4); } JsonNode nameValue4 = columnsValue.get("name"); if (nameValue4 != null && nameValue4 instanceof NullNode == false) { String nameInstance4; nameInstance4 = nameValue4.getTextValue(); columnInstance.setName(nameInstance4); } JsonNode typeValue4 = columnsValue.get("type"); if (typeValue4 != null && typeValue4 instanceof NullNode == false) { String typeInstance4; typeInstance4 = typeValue4.getTextValue(); columnInstance.setType(typeInstance4); } JsonNode locationValue4 = columnsValue .get("location"); if (locationValue4 != null && locationValue4 instanceof NullNode == false) { String locationInstance4; locationInstance4 = locationValue4 .getTextValue(); columnInstance.setLocation(locationInstance4); } JsonNode tagsSequenceElement4 = ((JsonNode) columnsValue .get("tags")); if (tagsSequenceElement4 != null && tagsSequenceElement4 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr4 = tagsSequenceElement4 .getFields(); while (itr4.hasNext()) { Map.Entry<String, JsonNode> property4 = itr4 .next(); String tagsKey4 = property4.getKey(); String tagsValue4 = property4.getValue() .getTextValue(); columnInstance.getTags().put(tagsKey4, tagsValue4); } } } } JsonNode recommendedIndexesArray = propertiesValue4 .get("recommendedIndexes"); if (recommendedIndexesArray != null && recommendedIndexesArray instanceof NullNode == false) { for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) { RecommendedIndex recommendedIndexInstance = new RecommendedIndex(); propertiesInstance4.getRecommendedIndexes() .add(recommendedIndexInstance); JsonNode propertiesValue6 = recommendedIndexesValue .get("properties"); if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) { RecommendedIndexProperties propertiesInstance6 = new RecommendedIndexProperties(); recommendedIndexInstance .setProperties(propertiesInstance6); JsonNode actionValue = propertiesValue6 .get("action"); if (actionValue != null && actionValue instanceof NullNode == false) { String actionInstance; actionInstance = actionValue.getTextValue(); propertiesInstance6 .setAction(actionInstance); } JsonNode stateValue = propertiesValue6 .get("state"); if (stateValue != null && stateValue instanceof NullNode == false) { String stateInstance; stateInstance = stateValue.getTextValue(); propertiesInstance6.setState(stateInstance); } JsonNode createdValue = propertiesValue6 .get("created"); if (createdValue != null && createdValue instanceof NullNode == false) { Calendar createdInstance; createdInstance = DatatypeConverter .parseDateTime(createdValue .getTextValue()); propertiesInstance6 .setCreated(createdInstance); } JsonNode lastModifiedValue = propertiesValue6 .get("lastModified"); if (lastModifiedValue != null && lastModifiedValue instanceof NullNode == false) { Calendar lastModifiedInstance; lastModifiedInstance = DatatypeConverter .parseDateTime(lastModifiedValue .getTextValue()); propertiesInstance6.setLastModified( lastModifiedInstance); } JsonNode indexTypeValue = propertiesValue6 .get("indexType"); if (indexTypeValue != null && indexTypeValue instanceof NullNode == false) { String indexTypeInstance; indexTypeInstance = indexTypeValue .getTextValue(); propertiesInstance6 .setIndexType(indexTypeInstance); } JsonNode schemaValue = propertiesValue6 .get("schema"); if (schemaValue != null && schemaValue instanceof NullNode == false) { String schemaInstance2; schemaInstance2 = schemaValue .getTextValue(); propertiesInstance6 .setSchema(schemaInstance2); } JsonNode tableValue = propertiesValue6 .get("table"); if (tableValue != null && tableValue instanceof NullNode == false) { String tableInstance2; tableInstance2 = tableValue.getTextValue(); propertiesInstance6 .setTable(tableInstance2); } JsonNode columnsArray2 = propertiesValue6 .get("columns"); if (columnsArray2 != null && columnsArray2 instanceof NullNode == false) { for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) { propertiesInstance6.getColumns().add( columnsValue2.getTextValue()); } } JsonNode includedColumnsArray = propertiesValue6 .get("includedColumns"); if (includedColumnsArray != null && includedColumnsArray instanceof NullNode == false) { for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) { propertiesInstance6.getIncludedColumns() .add(includedColumnsValue .getTextValue()); } } JsonNode indexScriptValue = propertiesValue6 .get("indexScript"); if (indexScriptValue != null && indexScriptValue instanceof NullNode == false) { String indexScriptInstance; indexScriptInstance = indexScriptValue .getTextValue(); propertiesInstance6.setIndexScript( indexScriptInstance); } JsonNode estimatedImpactArray = propertiesValue6 .get("estimatedImpact"); if (estimatedImpactArray != null && estimatedImpactArray instanceof NullNode == false) { for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) { OperationImpact operationImpactInstance = new OperationImpact(); propertiesInstance6.getEstimatedImpact() .add(operationImpactInstance); JsonNode nameValue5 = estimatedImpactValue .get("name"); if (nameValue5 != null && nameValue5 instanceof NullNode == false) { String nameInstance5; nameInstance5 = nameValue5 .getTextValue(); operationImpactInstance .setName(nameInstance5); } JsonNode unitValue = estimatedImpactValue .get("unit"); if (unitValue != null && unitValue instanceof NullNode == false) { String unitInstance; unitInstance = unitValue .getTextValue(); operationImpactInstance .setUnit(unitInstance); } JsonNode changeValueAbsoluteValue = estimatedImpactValue .get("changeValueAbsolute"); if (changeValueAbsoluteValue != null && changeValueAbsoluteValue instanceof NullNode == false) { double changeValueAbsoluteInstance; changeValueAbsoluteInstance = changeValueAbsoluteValue .getDoubleValue(); operationImpactInstance .setChangeValueAbsolute( changeValueAbsoluteInstance); } JsonNode changeValueRelativeValue = estimatedImpactValue .get("changeValueRelative"); if (changeValueRelativeValue != null && changeValueRelativeValue instanceof NullNode == false) { double changeValueRelativeInstance; changeValueRelativeInstance = changeValueRelativeValue .getDoubleValue(); operationImpactInstance .setChangeValueRelative( changeValueRelativeInstance); } } } JsonNode reportedImpactArray = propertiesValue6 .get("reportedImpact"); if (reportedImpactArray != null && reportedImpactArray instanceof NullNode == false) { for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) { OperationImpact operationImpactInstance2 = new OperationImpact(); propertiesInstance6.getReportedImpact() .add(operationImpactInstance2); JsonNode nameValue6 = reportedImpactValue .get("name"); if (nameValue6 != null && nameValue6 instanceof NullNode == false) { String nameInstance6; nameInstance6 = nameValue6 .getTextValue(); operationImpactInstance2 .setName(nameInstance6); } JsonNode unitValue2 = reportedImpactValue .get("unit"); if (unitValue2 != null && unitValue2 instanceof NullNode == false) { String unitInstance2; unitInstance2 = unitValue2 .getTextValue(); operationImpactInstance2 .setUnit(unitInstance2); } JsonNode changeValueAbsoluteValue2 = reportedImpactValue .get("changeValueAbsolute"); if (changeValueAbsoluteValue2 != null && changeValueAbsoluteValue2 instanceof NullNode == false) { double changeValueAbsoluteInstance2; changeValueAbsoluteInstance2 = changeValueAbsoluteValue2 .getDoubleValue(); operationImpactInstance2 .setChangeValueAbsolute( changeValueAbsoluteInstance2); } JsonNode changeValueRelativeValue2 = reportedImpactValue .get("changeValueRelative"); if (changeValueRelativeValue2 != null && changeValueRelativeValue2 instanceof NullNode == false) { double changeValueRelativeInstance2; changeValueRelativeInstance2 = changeValueRelativeValue2 .getDoubleValue(); operationImpactInstance2 .setChangeValueRelative( changeValueRelativeInstance2); } } } } JsonNode idValue5 = recommendedIndexesValue .get("id"); if (idValue5 != null && idValue5 instanceof NullNode == false) { String idInstance5; idInstance5 = idValue5.getTextValue(); recommendedIndexInstance.setId(idInstance5); } JsonNode nameValue7 = recommendedIndexesValue .get("name"); if (nameValue7 != null && nameValue7 instanceof NullNode == false) { String nameInstance7; nameInstance7 = nameValue7.getTextValue(); recommendedIndexInstance.setName(nameInstance7); } JsonNode typeValue5 = recommendedIndexesValue .get("type"); if (typeValue5 != null && typeValue5 instanceof NullNode == false) { String typeInstance5; typeInstance5 = typeValue5.getTextValue(); recommendedIndexInstance.setType(typeInstance5); } JsonNode locationValue5 = recommendedIndexesValue .get("location"); if (locationValue5 != null && locationValue5 instanceof NullNode == false) { String locationInstance5; locationInstance5 = locationValue5 .getTextValue(); recommendedIndexInstance .setLocation(locationInstance5); } JsonNode tagsSequenceElement5 = ((JsonNode) recommendedIndexesValue .get("tags")); if (tagsSequenceElement5 != null && tagsSequenceElement5 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr5 = tagsSequenceElement5 .getFields(); while (itr5.hasNext()) { Map.Entry<String, JsonNode> property5 = itr5 .next(); String tagsKey5 = property5.getKey(); String tagsValue5 = property5.getValue() .getTextValue(); recommendedIndexInstance.getTags() .put(tagsKey5, tagsValue5); } } } } } JsonNode idValue6 = tablesValue.get("id"); if (idValue6 != null && idValue6 instanceof NullNode == false) { String idInstance6; idInstance6 = idValue6.getTextValue(); tableInstance.setId(idInstance6); } JsonNode nameValue8 = tablesValue.get("name"); if (nameValue8 != null && nameValue8 instanceof NullNode == false) { String nameInstance8; nameInstance8 = nameValue8.getTextValue(); tableInstance.setName(nameInstance8); } JsonNode typeValue6 = tablesValue.get("type"); if (typeValue6 != null && typeValue6 instanceof NullNode == false) { String typeInstance6; typeInstance6 = typeValue6.getTextValue(); tableInstance.setType(typeInstance6); } JsonNode locationValue6 = tablesValue.get("location"); if (locationValue6 != null && locationValue6 instanceof NullNode == false) { String locationInstance6; locationInstance6 = locationValue6.getTextValue(); tableInstance.setLocation(locationInstance6); } JsonNode tagsSequenceElement6 = ((JsonNode) tablesValue .get("tags")); if (tagsSequenceElement6 != null && tagsSequenceElement6 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr6 = tagsSequenceElement6 .getFields(); while (itr6.hasNext()) { Map.Entry<String, JsonNode> property6 = itr6.next(); String tagsKey6 = property6.getKey(); String tagsValue6 = property6.getValue().getTextValue(); tableInstance.getTags().put(tagsKey6, tagsValue6); } } } } } JsonNode idValue7 = schemasValue.get("id"); if (idValue7 != null && idValue7 instanceof NullNode == false) { String idInstance7; idInstance7 = idValue7.getTextValue(); schemaInstance.setId(idInstance7); } JsonNode nameValue9 = schemasValue.get("name"); if (nameValue9 != null && nameValue9 instanceof NullNode == false) { String nameInstance9; nameInstance9 = nameValue9.getTextValue(); schemaInstance.setName(nameInstance9); } JsonNode typeValue7 = schemasValue.get("type"); if (typeValue7 != null && typeValue7 instanceof NullNode == false) { String typeInstance7; typeInstance7 = typeValue7.getTextValue(); schemaInstance.setType(typeInstance7); } JsonNode locationValue7 = schemasValue.get("location"); if (locationValue7 != null && locationValue7 instanceof NullNode == false) { String locationInstance7; locationInstance7 = locationValue7.getTextValue(); schemaInstance.setLocation(locationInstance7); } JsonNode tagsSequenceElement7 = ((JsonNode) schemasValue.get("tags")); if (tagsSequenceElement7 != null && tagsSequenceElement7 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr7 = tagsSequenceElement7 .getFields(); while (itr7.hasNext()) { Map.Entry<String, JsonNode> property7 = itr7.next(); String tagsKey7 = property7.getKey(); String tagsValue7 = property7.getValue().getTextValue(); schemaInstance.getTags().put(tagsKey7, tagsValue7); } } } } JsonNode defaultSecondaryLocationValue = propertiesValue .get("defaultSecondaryLocation"); if (defaultSecondaryLocationValue != null && defaultSecondaryLocationValue instanceof NullNode == false) { String defaultSecondaryLocationInstance; defaultSecondaryLocationInstance = defaultSecondaryLocationValue.getTextValue(); propertiesInstance .setDefaultSecondaryLocation(defaultSecondaryLocationInstance); } } JsonNode idValue8 = valueValue.get("id"); if (idValue8 != null && idValue8 instanceof NullNode == false) { String idInstance8; idInstance8 = idValue8.getTextValue(); databaseInstance.setId(idInstance8); } JsonNode nameValue10 = valueValue.get("name"); if (nameValue10 != null && nameValue10 instanceof NullNode == false) { String nameInstance10; nameInstance10 = nameValue10.getTextValue(); databaseInstance.setName(nameInstance10); } JsonNode typeValue8 = valueValue.get("type"); if (typeValue8 != null && typeValue8 instanceof NullNode == false) { String typeInstance8; typeInstance8 = typeValue8.getTextValue(); databaseInstance.setType(typeInstance8); } JsonNode locationValue8 = valueValue.get("location"); if (locationValue8 != null && locationValue8 instanceof NullNode == false) { String locationInstance8; locationInstance8 = locationValue8.getTextValue(); databaseInstance.setLocation(locationInstance8); } JsonNode tagsSequenceElement8 = ((JsonNode) valueValue.get("tags")); if (tagsSequenceElement8 != null && tagsSequenceElement8 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr8 = tagsSequenceElement8.getFields(); while (itr8.hasNext()) { Map.Entry<String, JsonNode> property8 = itr8.next(); String tagsKey8 = property8.getKey(); String tagsValue8 = property8.getValue().getTextValue(); databaseInstance.getTags().put(tagsKey8, tagsValue8); } } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
From source file:com.microsoft.azure.management.sql.DatabaseOperationsImpl.java
/** * Returns information about an Azure SQL Database. * * @param resourceGroupName Required. The name of the Resource Group to * which the server belongs.//from w w w.jav a2s .c o m * @param serverName Required. The name of the Azure SQL Database Server on * which the database is hosted. * @param databaseId Required. The Id of the Azure SQL Database to be * retrieved. * @throws IOException Signals that an I/O exception of some sort has * occurred. This class is the general class of exceptions produced by * failed or interrupted I/O operations. * @throws ServiceException Thrown if an unexpected response is found. * @return Represents the response to a List Azure Sql Database request. */ @Override public DatabaseListResponse getById(String resourceGroupName, String serverName, String databaseId) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (serverName == null) { throw new NullPointerException("serverName"); } if (databaseId == null) { throw new NullPointerException("databaseId"); } // Tracing boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put("resourceGroupName", resourceGroupName); tracingParameters.put("serverName", serverName); tracingParameters.put("databaseId", databaseId); CloudTracing.enter(invocationId, this, "getByIdAsync", tracingParameters); } // Construct URL String url = ""; url = url + "/subscriptions/"; if (this.getClient().getCredentials().getSubscriptionId() != null) { url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8"); } url = url + "/resourceGroups/"; url = url + URLEncoder.encode(resourceGroupName, "UTF-8"); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + URLEncoder.encode(serverName, "UTF-8"); url = url + "/databases"; ArrayList<String> queryParameters = new ArrayList<String>(); ArrayList<String> odataFilter = new ArrayList<String>(); odataFilter.add("properties/databaseId eq guid'" + URLEncoder.encode(databaseId, "UTF-8") + "'"); if (odataFilter.size() > 0) { queryParameters.add("$filter=" + CollectionStringBuilder.join(odataFilter, null)); } queryParameters.add("api-version=" + "2014-04-01"); if (queryParameters.size() > 0) { url = url + "?" + CollectionStringBuilder.join(queryParameters, "&"); } String baseUrl = this.getClient().getBaseUri().toString(); // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl.charAt(baseUrl.length() - 1) == '/') { baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0); } if (url.charAt(0) == '/') { url = url.substring(1); } url = baseUrl + "/" + url; url = url.replace(" ", "%20"); // Create HTTP transport objects HttpGet httpRequest = new HttpGet(url); // Set Headers // Send Request HttpResponse httpResponse = null; try { if (shouldTrace) { CloudTracing.sendRequest(invocationId, httpRequest); } httpResponse = this.getClient().getHttpClient().execute(httpRequest); if (shouldTrace) { CloudTracing.receiveResponse(invocationId, httpResponse); } int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result DatabaseListResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new DatabaseListResponse(); ObjectMapper objectMapper = new ObjectMapper(); JsonNode responseDoc = null; String responseDocContent = IOUtils.toString(responseContent); if (responseDocContent == null == false && responseDocContent.length() > 0) { responseDoc = objectMapper.readTree(responseDocContent); } if (responseDoc != null && responseDoc instanceof NullNode == false) { JsonNode valueArray = responseDoc.get("value"); if (valueArray != null && valueArray instanceof NullNode == false) { for (JsonNode valueValue : ((ArrayNode) valueArray)) { Database databaseInstance = new Database(); result.getDatabases().add(databaseInstance); JsonNode propertiesValue = valueValue.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { DatabaseProperties propertiesInstance = new DatabaseProperties(); databaseInstance.setProperties(propertiesInstance); JsonNode collationValue = propertiesValue.get("collation"); if (collationValue != null && collationValue instanceof NullNode == false) { String collationInstance; collationInstance = collationValue.getTextValue(); propertiesInstance.setCollation(collationInstance); } JsonNode creationDateValue = propertiesValue.get("creationDate"); if (creationDateValue != null && creationDateValue instanceof NullNode == false) { Calendar creationDateInstance; creationDateInstance = DatatypeConverter .parseDateTime(creationDateValue.getTextValue()); propertiesInstance.setCreationDate(creationDateInstance); } JsonNode currentServiceObjectiveIdValue = propertiesValue .get("currentServiceObjectiveId"); if (currentServiceObjectiveIdValue != null && currentServiceObjectiveIdValue instanceof NullNode == false) { String currentServiceObjectiveIdInstance; currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue .getTextValue(); propertiesInstance .setCurrentServiceObjectiveId(currentServiceObjectiveIdInstance); } JsonNode databaseIdValue = propertiesValue.get("databaseId"); if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) { String databaseIdInstance; databaseIdInstance = databaseIdValue.getTextValue(); propertiesInstance.setDatabaseId(databaseIdInstance); } JsonNode earliestRestoreDateValue = propertiesValue.get("earliestRestoreDate"); if (earliestRestoreDateValue != null && earliestRestoreDateValue instanceof NullNode == false) { Calendar earliestRestoreDateInstance; earliestRestoreDateInstance = DatatypeConverter .parseDateTime(earliestRestoreDateValue.getTextValue()); propertiesInstance.setEarliestRestoreDate(earliestRestoreDateInstance); } JsonNode editionValue = propertiesValue.get("edition"); if (editionValue != null && editionValue instanceof NullNode == false) { String editionInstance; editionInstance = editionValue.getTextValue(); propertiesInstance.setEdition(editionInstance); } JsonNode maxSizeBytesValue = propertiesValue.get("maxSizeBytes"); if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) { long maxSizeBytesInstance; maxSizeBytesInstance = maxSizeBytesValue.getLongValue(); propertiesInstance.setMaxSizeBytes(maxSizeBytesInstance); } JsonNode requestedServiceObjectiveIdValue = propertiesValue .get("requestedServiceObjectiveId"); if (requestedServiceObjectiveIdValue != null && requestedServiceObjectiveIdValue instanceof NullNode == false) { String requestedServiceObjectiveIdInstance; requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue .getTextValue(); propertiesInstance .setRequestedServiceObjectiveId(requestedServiceObjectiveIdInstance); } JsonNode requestedServiceObjectiveNameValue = propertiesValue .get("requestedServiceObjectiveName"); if (requestedServiceObjectiveNameValue != null && requestedServiceObjectiveNameValue instanceof NullNode == false) { String requestedServiceObjectiveNameInstance; requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue .getTextValue(); propertiesInstance.setRequestedServiceObjectiveName( requestedServiceObjectiveNameInstance); } JsonNode serviceLevelObjectiveValue = propertiesValue.get("serviceLevelObjective"); if (serviceLevelObjectiveValue != null && serviceLevelObjectiveValue instanceof NullNode == false) { String serviceLevelObjectiveInstance; serviceLevelObjectiveInstance = serviceLevelObjectiveValue.getTextValue(); propertiesInstance.setServiceObjective(serviceLevelObjectiveInstance); } JsonNode statusValue = propertiesValue.get("status"); if (statusValue != null && statusValue instanceof NullNode == false) { String statusInstance; statusInstance = statusValue.getTextValue(); propertiesInstance.setStatus(statusInstance); } JsonNode elasticPoolNameValue = propertiesValue.get("elasticPoolName"); if (elasticPoolNameValue != null && elasticPoolNameValue instanceof NullNode == false) { String elasticPoolNameInstance; elasticPoolNameInstance = elasticPoolNameValue.getTextValue(); propertiesInstance.setElasticPoolName(elasticPoolNameInstance); } JsonNode serviceTierAdvisorsArray = propertiesValue.get("serviceTierAdvisors"); if (serviceTierAdvisorsArray != null && serviceTierAdvisorsArray instanceof NullNode == false) { for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) { ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor(); propertiesInstance.getServiceTierAdvisors().add(serviceTierAdvisorInstance); JsonNode propertiesValue2 = serviceTierAdvisorsValue.get("properties"); if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) { ServiceTierAdvisorProperties propertiesInstance2 = new ServiceTierAdvisorProperties(); serviceTierAdvisorInstance.setProperties(propertiesInstance2); JsonNode observationPeriodStartValue = propertiesValue2 .get("observationPeriodStart"); if (observationPeriodStartValue != null && observationPeriodStartValue instanceof NullNode == false) { Calendar observationPeriodStartInstance; observationPeriodStartInstance = DatatypeConverter .parseDateTime(observationPeriodStartValue.getTextValue()); propertiesInstance2 .setObservationPeriodStart(observationPeriodStartInstance); } JsonNode observationPeriodEndValue = propertiesValue2 .get("observationPeriodEnd"); if (observationPeriodEndValue != null && observationPeriodEndValue instanceof NullNode == false) { Calendar observationPeriodEndInstance; observationPeriodEndInstance = DatatypeConverter .parseDateTime(observationPeriodEndValue.getTextValue()); propertiesInstance2 .setObservationPeriodEnd(observationPeriodEndInstance); } JsonNode activeTimeRatioValue = propertiesValue2.get("activeTimeRatio"); if (activeTimeRatioValue != null && activeTimeRatioValue instanceof NullNode == false) { double activeTimeRatioInstance; activeTimeRatioInstance = activeTimeRatioValue.getDoubleValue(); propertiesInstance2.setActiveTimeRatio(activeTimeRatioInstance); } JsonNode minDtuValue = propertiesValue2.get("minDtu"); if (minDtuValue != null && minDtuValue instanceof NullNode == false) { double minDtuInstance; minDtuInstance = minDtuValue.getDoubleValue(); propertiesInstance2.setMinDtu(minDtuInstance); } JsonNode avgDtuValue = propertiesValue2.get("avgDtu"); if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) { double avgDtuInstance; avgDtuInstance = avgDtuValue.getDoubleValue(); propertiesInstance2.setAvgDtu(avgDtuInstance); } JsonNode maxDtuValue = propertiesValue2.get("maxDtu"); if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) { double maxDtuInstance; maxDtuInstance = maxDtuValue.getDoubleValue(); propertiesInstance2.setMaxDtu(maxDtuInstance); } JsonNode maxSizeInGBValue = propertiesValue2.get("maxSizeInGB"); if (maxSizeInGBValue != null && maxSizeInGBValue instanceof NullNode == false) { double maxSizeInGBInstance; maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue(); propertiesInstance2.setMaxSizeInGB(maxSizeInGBInstance); } JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue2 .get("serviceLevelObjectiveUsageMetrics"); if (serviceLevelObjectiveUsageMetricsArray != null && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) { for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) { SloUsageMetric sloUsageMetricInstance = new SloUsageMetric(); propertiesInstance2.getServiceLevelObjectiveUsageMetrics() .add(sloUsageMetricInstance); JsonNode serviceLevelObjectiveValue2 = serviceLevelObjectiveUsageMetricsValue .get("serviceLevelObjective"); if (serviceLevelObjectiveValue2 != null && serviceLevelObjectiveValue2 instanceof NullNode == false) { String serviceLevelObjectiveInstance2; serviceLevelObjectiveInstance2 = serviceLevelObjectiveValue2 .getTextValue(); sloUsageMetricInstance.setServiceLevelObjective( serviceLevelObjectiveInstance2); } JsonNode serviceLevelObjectiveIdValue = serviceLevelObjectiveUsageMetricsValue .get("serviceLevelObjectiveId"); if (serviceLevelObjectiveIdValue != null && serviceLevelObjectiveIdValue instanceof NullNode == false) { String serviceLevelObjectiveIdInstance; serviceLevelObjectiveIdInstance = serviceLevelObjectiveIdValue .getTextValue(); sloUsageMetricInstance.setServiceLevelObjectiveId( serviceLevelObjectiveIdInstance); } JsonNode inRangeTimeRatioValue = serviceLevelObjectiveUsageMetricsValue .get("inRangeTimeRatio"); if (inRangeTimeRatioValue != null && inRangeTimeRatioValue instanceof NullNode == false) { double inRangeTimeRatioInstance; inRangeTimeRatioInstance = inRangeTimeRatioValue .getDoubleValue(); sloUsageMetricInstance .setInRangeTimeRatio(inRangeTimeRatioInstance); } JsonNode idValue = serviceLevelObjectiveUsageMetricsValue .get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); sloUsageMetricInstance.setId(idInstance); } JsonNode nameValue = serviceLevelObjectiveUsageMetricsValue .get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); sloUsageMetricInstance.setName(nameInstance); } JsonNode typeValue = serviceLevelObjectiveUsageMetricsValue .get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); sloUsageMetricInstance.setType(typeInstance); } JsonNode locationValue = serviceLevelObjectiveUsageMetricsValue .get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); sloUsageMetricInstance.setLocation(locationInstance); } JsonNode tagsSequenceElement = ((JsonNode) serviceLevelObjectiveUsageMetricsValue .get("tags")); if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement .getFields(); while (itr.hasNext()) { Map.Entry<String, JsonNode> property = itr.next(); String tagsKey = property.getKey(); String tagsValue = property.getValue().getTextValue(); sloUsageMetricInstance.getTags().put(tagsKey, tagsValue); } } } } JsonNode currentServiceLevelObjectiveValue = propertiesValue2 .get("currentServiceLevelObjective"); if (currentServiceLevelObjectiveValue != null && currentServiceLevelObjectiveValue instanceof NullNode == false) { String currentServiceLevelObjectiveInstance; currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue .getTextValue(); propertiesInstance2.setCurrentServiceLevelObjective( currentServiceLevelObjectiveInstance); } JsonNode currentServiceLevelObjectiveIdValue = propertiesValue2 .get("currentServiceLevelObjectiveId"); if (currentServiceLevelObjectiveIdValue != null && currentServiceLevelObjectiveIdValue instanceof NullNode == false) { String currentServiceLevelObjectiveIdInstance; currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2.setCurrentServiceLevelObjectiveId( currentServiceLevelObjectiveIdInstance); } JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("usageBasedRecommendationServiceLevelObjective"); if (usageBasedRecommendationServiceLevelObjectiveValue != null && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String usageBasedRecommendationServiceLevelObjectiveInstance; usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setUsageBasedRecommendationServiceLevelObjective( usageBasedRecommendationServiceLevelObjectiveInstance); } JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("usageBasedRecommendationServiceLevelObjectiveId"); if (usageBasedRecommendationServiceLevelObjectiveIdValue != null && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String usageBasedRecommendationServiceLevelObjectiveIdInstance; usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2 .setUsageBasedRecommendationServiceLevelObjectiveId( usageBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("databaseSizeBasedRecommendationServiceLevelObjective"); if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String databaseSizeBasedRecommendationServiceLevelObjectiveInstance; databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setDatabaseSizeBasedRecommendationServiceLevelObjective( databaseSizeBasedRecommendationServiceLevelObjectiveInstance); } JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("databaseSizeBasedRecommendationServiceLevelObjectiveId"); if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance; databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2 .setDatabaseSizeBasedRecommendationServiceLevelObjectiveId( databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("disasterPlanBasedRecommendationServiceLevelObjective"); if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String disasterPlanBasedRecommendationServiceLevelObjectiveInstance; disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setDisasterPlanBasedRecommendationServiceLevelObjective( disasterPlanBasedRecommendationServiceLevelObjectiveInstance); } JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("disasterPlanBasedRecommendationServiceLevelObjectiveId"); if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance; disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2 .setDisasterPlanBasedRecommendationServiceLevelObjectiveId( disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue2 .get("overallRecommendationServiceLevelObjective"); if (overallRecommendationServiceLevelObjectiveValue != null && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String overallRecommendationServiceLevelObjectiveInstance; overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance2.setOverallRecommendationServiceLevelObjective( overallRecommendationServiceLevelObjectiveInstance); } JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue2 .get("overallRecommendationServiceLevelObjectiveId"); if (overallRecommendationServiceLevelObjectiveIdValue != null && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String overallRecommendationServiceLevelObjectiveIdInstance; overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance2.setOverallRecommendationServiceLevelObjectiveId( overallRecommendationServiceLevelObjectiveIdInstance); } JsonNode confidenceValue = propertiesValue2.get("confidence"); if (confidenceValue != null && confidenceValue instanceof NullNode == false) { double confidenceInstance; confidenceInstance = confidenceValue.getDoubleValue(); propertiesInstance2.setConfidence(confidenceInstance); } } JsonNode idValue2 = serviceTierAdvisorsValue.get("id"); if (idValue2 != null && idValue2 instanceof NullNode == false) { String idInstance2; idInstance2 = idValue2.getTextValue(); serviceTierAdvisorInstance.setId(idInstance2); } JsonNode nameValue2 = serviceTierAdvisorsValue.get("name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); serviceTierAdvisorInstance.setName(nameInstance2); } JsonNode typeValue2 = serviceTierAdvisorsValue.get("type"); if (typeValue2 != null && typeValue2 instanceof NullNode == false) { String typeInstance2; typeInstance2 = typeValue2.getTextValue(); serviceTierAdvisorInstance.setType(typeInstance2); } JsonNode locationValue2 = serviceTierAdvisorsValue.get("location"); if (locationValue2 != null && locationValue2 instanceof NullNode == false) { String locationInstance2; locationInstance2 = locationValue2.getTextValue(); serviceTierAdvisorInstance.setLocation(locationInstance2); } JsonNode tagsSequenceElement2 = ((JsonNode) serviceTierAdvisorsValue .get("tags")); if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr2 = tagsSequenceElement2 .getFields(); while (itr2.hasNext()) { Map.Entry<String, JsonNode> property2 = itr2.next(); String tagsKey2 = property2.getKey(); String tagsValue2 = property2.getValue().getTextValue(); serviceTierAdvisorInstance.getTags().put(tagsKey2, tagsValue2); } } } } JsonNode upgradeHintValue = propertiesValue.get("upgradeHint"); if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) { UpgradeHint upgradeHintInstance = new UpgradeHint(); propertiesInstance.setUpgradeHint(upgradeHintInstance); JsonNode targetServiceLevelObjectiveValue = upgradeHintValue .get("targetServiceLevelObjective"); if (targetServiceLevelObjectiveValue != null && targetServiceLevelObjectiveValue instanceof NullNode == false) { String targetServiceLevelObjectiveInstance; targetServiceLevelObjectiveInstance = targetServiceLevelObjectiveValue .getTextValue(); upgradeHintInstance.setTargetServiceLevelObjective( targetServiceLevelObjectiveInstance); } JsonNode targetServiceLevelObjectiveIdValue = upgradeHintValue .get("targetServiceLevelObjectiveId"); if (targetServiceLevelObjectiveIdValue != null && targetServiceLevelObjectiveIdValue instanceof NullNode == false) { String targetServiceLevelObjectiveIdInstance; targetServiceLevelObjectiveIdInstance = targetServiceLevelObjectiveIdValue .getTextValue(); upgradeHintInstance.setTargetServiceLevelObjectiveId( targetServiceLevelObjectiveIdInstance); } JsonNode idValue3 = upgradeHintValue.get("id"); if (idValue3 != null && idValue3 instanceof NullNode == false) { String idInstance3; idInstance3 = idValue3.getTextValue(); upgradeHintInstance.setId(idInstance3); } JsonNode nameValue3 = upgradeHintValue.get("name"); if (nameValue3 != null && nameValue3 instanceof NullNode == false) { String nameInstance3; nameInstance3 = nameValue3.getTextValue(); upgradeHintInstance.setName(nameInstance3); } JsonNode typeValue3 = upgradeHintValue.get("type"); if (typeValue3 != null && typeValue3 instanceof NullNode == false) { String typeInstance3; typeInstance3 = typeValue3.getTextValue(); upgradeHintInstance.setType(typeInstance3); } JsonNode locationValue3 = upgradeHintValue.get("location"); if (locationValue3 != null && locationValue3 instanceof NullNode == false) { String locationInstance3; locationInstance3 = locationValue3.getTextValue(); upgradeHintInstance.setLocation(locationInstance3); } JsonNode tagsSequenceElement3 = ((JsonNode) upgradeHintValue.get("tags")); if (tagsSequenceElement3 != null && tagsSequenceElement3 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr3 = tagsSequenceElement3 .getFields(); while (itr3.hasNext()) { Map.Entry<String, JsonNode> property3 = itr3.next(); String tagsKey3 = property3.getKey(); String tagsValue3 = property3.getValue().getTextValue(); upgradeHintInstance.getTags().put(tagsKey3, tagsValue3); } } } JsonNode schemasArray = propertiesValue.get("schemas"); if (schemasArray != null && schemasArray instanceof NullNode == false) { for (JsonNode schemasValue : ((ArrayNode) schemasArray)) { Schema schemaInstance = new Schema(); propertiesInstance.getSchemas().add(schemaInstance); JsonNode propertiesValue3 = schemasValue.get("properties"); if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) { SchemaProperties propertiesInstance3 = new SchemaProperties(); schemaInstance.setProperties(propertiesInstance3); JsonNode tablesArray = propertiesValue3.get("tables"); if (tablesArray != null && tablesArray instanceof NullNode == false) { for (JsonNode tablesValue : ((ArrayNode) tablesArray)) { Table tableInstance = new Table(); propertiesInstance3.getTables().add(tableInstance); JsonNode propertiesValue4 = tablesValue.get("properties"); if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) { TableProperties propertiesInstance4 = new TableProperties(); tableInstance.setProperties(propertiesInstance4); JsonNode tableTypeValue = propertiesValue4.get("tableType"); if (tableTypeValue != null && tableTypeValue instanceof NullNode == false) { String tableTypeInstance; tableTypeInstance = tableTypeValue.getTextValue(); propertiesInstance4.setTableType(tableTypeInstance); } JsonNode columnsArray = propertiesValue4.get("columns"); if (columnsArray != null && columnsArray instanceof NullNode == false) { for (JsonNode columnsValue : ((ArrayNode) columnsArray)) { Column columnInstance = new Column(); propertiesInstance4.getColumns() .add(columnInstance); JsonNode propertiesValue5 = columnsValue .get("properties"); if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) { ColumnProperties propertiesInstance5 = new ColumnProperties(); columnInstance .setProperties(propertiesInstance5); JsonNode columnTypeValue = propertiesValue5 .get("columnType"); if (columnTypeValue != null && columnTypeValue instanceof NullNode == false) { String columnTypeInstance; columnTypeInstance = columnTypeValue .getTextValue(); propertiesInstance5 .setColumnType(columnTypeInstance); } } JsonNode idValue4 = columnsValue.get("id"); if (idValue4 != null && idValue4 instanceof NullNode == false) { String idInstance4; idInstance4 = idValue4.getTextValue(); columnInstance.setId(idInstance4); } JsonNode nameValue4 = columnsValue.get("name"); if (nameValue4 != null && nameValue4 instanceof NullNode == false) { String nameInstance4; nameInstance4 = nameValue4.getTextValue(); columnInstance.setName(nameInstance4); } JsonNode typeValue4 = columnsValue.get("type"); if (typeValue4 != null && typeValue4 instanceof NullNode == false) { String typeInstance4; typeInstance4 = typeValue4.getTextValue(); columnInstance.setType(typeInstance4); } JsonNode locationValue4 = columnsValue .get("location"); if (locationValue4 != null && locationValue4 instanceof NullNode == false) { String locationInstance4; locationInstance4 = locationValue4 .getTextValue(); columnInstance.setLocation(locationInstance4); } JsonNode tagsSequenceElement4 = ((JsonNode) columnsValue .get("tags")); if (tagsSequenceElement4 != null && tagsSequenceElement4 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr4 = tagsSequenceElement4 .getFields(); while (itr4.hasNext()) { Map.Entry<String, JsonNode> property4 = itr4 .next(); String tagsKey4 = property4.getKey(); String tagsValue4 = property4.getValue() .getTextValue(); columnInstance.getTags().put(tagsKey4, tagsValue4); } } } } JsonNode recommendedIndexesArray = propertiesValue4 .get("recommendedIndexes"); if (recommendedIndexesArray != null && recommendedIndexesArray instanceof NullNode == false) { for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) { RecommendedIndex recommendedIndexInstance = new RecommendedIndex(); propertiesInstance4.getRecommendedIndexes() .add(recommendedIndexInstance); JsonNode propertiesValue6 = recommendedIndexesValue .get("properties"); if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) { RecommendedIndexProperties propertiesInstance6 = new RecommendedIndexProperties(); recommendedIndexInstance .setProperties(propertiesInstance6); JsonNode actionValue = propertiesValue6 .get("action"); if (actionValue != null && actionValue instanceof NullNode == false) { String actionInstance; actionInstance = actionValue.getTextValue(); propertiesInstance6 .setAction(actionInstance); } JsonNode stateValue = propertiesValue6 .get("state"); if (stateValue != null && stateValue instanceof NullNode == false) { String stateInstance; stateInstance = stateValue.getTextValue(); propertiesInstance6.setState(stateInstance); } JsonNode createdValue = propertiesValue6 .get("created"); if (createdValue != null && createdValue instanceof NullNode == false) { Calendar createdInstance; createdInstance = DatatypeConverter .parseDateTime(createdValue .getTextValue()); propertiesInstance6 .setCreated(createdInstance); } JsonNode lastModifiedValue = propertiesValue6 .get("lastModified"); if (lastModifiedValue != null && lastModifiedValue instanceof NullNode == false) { Calendar lastModifiedInstance; lastModifiedInstance = DatatypeConverter .parseDateTime(lastModifiedValue .getTextValue()); propertiesInstance6.setLastModified( lastModifiedInstance); } JsonNode indexTypeValue = propertiesValue6 .get("indexType"); if (indexTypeValue != null && indexTypeValue instanceof NullNode == false) { String indexTypeInstance; indexTypeInstance = indexTypeValue .getTextValue(); propertiesInstance6 .setIndexType(indexTypeInstance); } JsonNode schemaValue = propertiesValue6 .get("schema"); if (schemaValue != null && schemaValue instanceof NullNode == false) { String schemaInstance2; schemaInstance2 = schemaValue .getTextValue(); propertiesInstance6 .setSchema(schemaInstance2); } JsonNode tableValue = propertiesValue6 .get("table"); if (tableValue != null && tableValue instanceof NullNode == false) { String tableInstance2; tableInstance2 = tableValue.getTextValue(); propertiesInstance6 .setTable(tableInstance2); } JsonNode columnsArray2 = propertiesValue6 .get("columns"); if (columnsArray2 != null && columnsArray2 instanceof NullNode == false) { for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) { propertiesInstance6.getColumns().add( columnsValue2.getTextValue()); } } JsonNode includedColumnsArray = propertiesValue6 .get("includedColumns"); if (includedColumnsArray != null && includedColumnsArray instanceof NullNode == false) { for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) { propertiesInstance6.getIncludedColumns() .add(includedColumnsValue .getTextValue()); } } JsonNode indexScriptValue = propertiesValue6 .get("indexScript"); if (indexScriptValue != null && indexScriptValue instanceof NullNode == false) { String indexScriptInstance; indexScriptInstance = indexScriptValue .getTextValue(); propertiesInstance6.setIndexScript( indexScriptInstance); } JsonNode estimatedImpactArray = propertiesValue6 .get("estimatedImpact"); if (estimatedImpactArray != null && estimatedImpactArray instanceof NullNode == false) { for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) { OperationImpact operationImpactInstance = new OperationImpact(); propertiesInstance6.getEstimatedImpact() .add(operationImpactInstance); JsonNode nameValue5 = estimatedImpactValue .get("name"); if (nameValue5 != null && nameValue5 instanceof NullNode == false) { String nameInstance5; nameInstance5 = nameValue5 .getTextValue(); operationImpactInstance .setName(nameInstance5); } JsonNode unitValue = estimatedImpactValue .get("unit"); if (unitValue != null && unitValue instanceof NullNode == false) { String unitInstance; unitInstance = unitValue .getTextValue(); operationImpactInstance .setUnit(unitInstance); } JsonNode changeValueAbsoluteValue = estimatedImpactValue .get("changeValueAbsolute"); if (changeValueAbsoluteValue != null && changeValueAbsoluteValue instanceof NullNode == false) { double changeValueAbsoluteInstance; changeValueAbsoluteInstance = changeValueAbsoluteValue .getDoubleValue(); operationImpactInstance .setChangeValueAbsolute( changeValueAbsoluteInstance); } JsonNode changeValueRelativeValue = estimatedImpactValue .get("changeValueRelative"); if (changeValueRelativeValue != null && changeValueRelativeValue instanceof NullNode == false) { double changeValueRelativeInstance; changeValueRelativeInstance = changeValueRelativeValue .getDoubleValue(); operationImpactInstance .setChangeValueRelative( changeValueRelativeInstance); } } } JsonNode reportedImpactArray = propertiesValue6 .get("reportedImpact"); if (reportedImpactArray != null && reportedImpactArray instanceof NullNode == false) { for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) { OperationImpact operationImpactInstance2 = new OperationImpact(); propertiesInstance6.getReportedImpact() .add(operationImpactInstance2); JsonNode nameValue6 = reportedImpactValue .get("name"); if (nameValue6 != null && nameValue6 instanceof NullNode == false) { String nameInstance6; nameInstance6 = nameValue6 .getTextValue(); operationImpactInstance2 .setName(nameInstance6); } JsonNode unitValue2 = reportedImpactValue .get("unit"); if (unitValue2 != null && unitValue2 instanceof NullNode == false) { String unitInstance2; unitInstance2 = unitValue2 .getTextValue(); operationImpactInstance2 .setUnit(unitInstance2); } JsonNode changeValueAbsoluteValue2 = reportedImpactValue .get("changeValueAbsolute"); if (changeValueAbsoluteValue2 != null && changeValueAbsoluteValue2 instanceof NullNode == false) { double changeValueAbsoluteInstance2; changeValueAbsoluteInstance2 = changeValueAbsoluteValue2 .getDoubleValue(); operationImpactInstance2 .setChangeValueAbsolute( changeValueAbsoluteInstance2); } JsonNode changeValueRelativeValue2 = reportedImpactValue .get("changeValueRelative"); if (changeValueRelativeValue2 != null && changeValueRelativeValue2 instanceof NullNode == false) { double changeValueRelativeInstance2; changeValueRelativeInstance2 = changeValueRelativeValue2 .getDoubleValue(); operationImpactInstance2 .setChangeValueRelative( changeValueRelativeInstance2); } } } } JsonNode idValue5 = recommendedIndexesValue .get("id"); if (idValue5 != null && idValue5 instanceof NullNode == false) { String idInstance5; idInstance5 = idValue5.getTextValue(); recommendedIndexInstance.setId(idInstance5); } JsonNode nameValue7 = recommendedIndexesValue .get("name"); if (nameValue7 != null && nameValue7 instanceof NullNode == false) { String nameInstance7; nameInstance7 = nameValue7.getTextValue(); recommendedIndexInstance.setName(nameInstance7); } JsonNode typeValue5 = recommendedIndexesValue .get("type"); if (typeValue5 != null && typeValue5 instanceof NullNode == false) { String typeInstance5; typeInstance5 = typeValue5.getTextValue(); recommendedIndexInstance.setType(typeInstance5); } JsonNode locationValue5 = recommendedIndexesValue .get("location"); if (locationValue5 != null && locationValue5 instanceof NullNode == false) { String locationInstance5; locationInstance5 = locationValue5 .getTextValue(); recommendedIndexInstance .setLocation(locationInstance5); } JsonNode tagsSequenceElement5 = ((JsonNode) recommendedIndexesValue .get("tags")); if (tagsSequenceElement5 != null && tagsSequenceElement5 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr5 = tagsSequenceElement5 .getFields(); while (itr5.hasNext()) { Map.Entry<String, JsonNode> property5 = itr5 .next(); String tagsKey5 = property5.getKey(); String tagsValue5 = property5.getValue() .getTextValue(); recommendedIndexInstance.getTags() .put(tagsKey5, tagsValue5); } } } } } JsonNode idValue6 = tablesValue.get("id"); if (idValue6 != null && idValue6 instanceof NullNode == false) { String idInstance6; idInstance6 = idValue6.getTextValue(); tableInstance.setId(idInstance6); } JsonNode nameValue8 = tablesValue.get("name"); if (nameValue8 != null && nameValue8 instanceof NullNode == false) { String nameInstance8; nameInstance8 = nameValue8.getTextValue(); tableInstance.setName(nameInstance8); } JsonNode typeValue6 = tablesValue.get("type"); if (typeValue6 != null && typeValue6 instanceof NullNode == false) { String typeInstance6; typeInstance6 = typeValue6.getTextValue(); tableInstance.setType(typeInstance6); } JsonNode locationValue6 = tablesValue.get("location"); if (locationValue6 != null && locationValue6 instanceof NullNode == false) { String locationInstance6; locationInstance6 = locationValue6.getTextValue(); tableInstance.setLocation(locationInstance6); } JsonNode tagsSequenceElement6 = ((JsonNode) tablesValue .get("tags")); if (tagsSequenceElement6 != null && tagsSequenceElement6 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr6 = tagsSequenceElement6 .getFields(); while (itr6.hasNext()) { Map.Entry<String, JsonNode> property6 = itr6.next(); String tagsKey6 = property6.getKey(); String tagsValue6 = property6.getValue().getTextValue(); tableInstance.getTags().put(tagsKey6, tagsValue6); } } } } } JsonNode idValue7 = schemasValue.get("id"); if (idValue7 != null && idValue7 instanceof NullNode == false) { String idInstance7; idInstance7 = idValue7.getTextValue(); schemaInstance.setId(idInstance7); } JsonNode nameValue9 = schemasValue.get("name"); if (nameValue9 != null && nameValue9 instanceof NullNode == false) { String nameInstance9; nameInstance9 = nameValue9.getTextValue(); schemaInstance.setName(nameInstance9); } JsonNode typeValue7 = schemasValue.get("type"); if (typeValue7 != null && typeValue7 instanceof NullNode == false) { String typeInstance7; typeInstance7 = typeValue7.getTextValue(); schemaInstance.setType(typeInstance7); } JsonNode locationValue7 = schemasValue.get("location"); if (locationValue7 != null && locationValue7 instanceof NullNode == false) { String locationInstance7; locationInstance7 = locationValue7.getTextValue(); schemaInstance.setLocation(locationInstance7); } JsonNode tagsSequenceElement7 = ((JsonNode) schemasValue.get("tags")); if (tagsSequenceElement7 != null && tagsSequenceElement7 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr7 = tagsSequenceElement7 .getFields(); while (itr7.hasNext()) { Map.Entry<String, JsonNode> property7 = itr7.next(); String tagsKey7 = property7.getKey(); String tagsValue7 = property7.getValue().getTextValue(); schemaInstance.getTags().put(tagsKey7, tagsValue7); } } } } JsonNode defaultSecondaryLocationValue = propertiesValue .get("defaultSecondaryLocation"); if (defaultSecondaryLocationValue != null && defaultSecondaryLocationValue instanceof NullNode == false) { String defaultSecondaryLocationInstance; defaultSecondaryLocationInstance = defaultSecondaryLocationValue.getTextValue(); propertiesInstance .setDefaultSecondaryLocation(defaultSecondaryLocationInstance); } } JsonNode idValue8 = valueValue.get("id"); if (idValue8 != null && idValue8 instanceof NullNode == false) { String idInstance8; idInstance8 = idValue8.getTextValue(); databaseInstance.setId(idInstance8); } JsonNode nameValue10 = valueValue.get("name"); if (nameValue10 != null && nameValue10 instanceof NullNode == false) { String nameInstance10; nameInstance10 = nameValue10.getTextValue(); databaseInstance.setName(nameInstance10); } JsonNode typeValue8 = valueValue.get("type"); if (typeValue8 != null && typeValue8 instanceof NullNode == false) { String typeInstance8; typeInstance8 = typeValue8.getTextValue(); databaseInstance.setType(typeInstance8); } JsonNode locationValue8 = valueValue.get("location"); if (locationValue8 != null && locationValue8 instanceof NullNode == false) { String locationInstance8; locationInstance8 = locationValue8.getTextValue(); databaseInstance.setLocation(locationInstance8); } JsonNode tagsSequenceElement8 = ((JsonNode) valueValue.get("tags")); if (tagsSequenceElement8 != null && tagsSequenceElement8 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr8 = tagsSequenceElement8.getFields(); while (itr8.hasNext()) { Map.Entry<String, JsonNode> property8 = itr8.next(); String tagsKey8 = property8.getKey(); String tagsValue8 = property8.getValue().getTextValue(); databaseInstance.getTags().put(tagsKey8, tagsValue8); } } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
From source file:com.microsoft.azure.management.notificationhubs.NotificationHubOperationsImpl.java
/** * The get authorization rules operation gets the authorization rules for a * NotificationHub./* w ww .j av a2s . c o m*/ * * @param resourceGroupName Required. The name of the resource group. * @param namespaceName Required. The NotificationHub to get the * authorization rule for. * @param notificationHubName Required. The notification hub name. * @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 response of the List Namespace operation. */ @Override public SharedAccessAuthorizationRuleListResponse listAuthorizationRules(String resourceGroupName, String namespaceName, String notificationHubName) 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"); } // 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); CloudTracing.enter(invocationId, this, "listAuthorizationRulesAsync", 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"); url = url + "/AuthorizationRules"; 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 HttpPost httpRequest = new HttpPost(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 SharedAccessAuthorizationRuleListResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new SharedAccessAuthorizationRuleListResponse(); ObjectMapper objectMapper = new ObjectMapper(); JsonNode responseDoc = null; String responseDocContent = IOUtils.toString(responseContent); if (responseDocContent == null == false && responseDocContent.length() > 0) { responseDoc = objectMapper.readTree(responseDocContent); } if (responseDoc != null && responseDoc instanceof NullNode == false) { JsonNode valueArray = responseDoc.get("value"); if (valueArray != null && valueArray instanceof NullNode == false) { for (JsonNode valueValue : ((ArrayNode) valueArray)) { SharedAccessAuthorizationRuleResource sharedAccessAuthorizationRuleResourceInstance = new SharedAccessAuthorizationRuleResource(); result.getValue().add(sharedAccessAuthorizationRuleResourceInstance); JsonNode idValue = valueValue.get("id"); if (idValue != null && idValue instanceof NullNode == false) { String idInstance; idInstance = idValue.getTextValue(); sharedAccessAuthorizationRuleResourceInstance.setId(idInstance); } JsonNode locationValue = valueValue.get("location"); if (locationValue != null && locationValue instanceof NullNode == false) { String locationInstance; locationInstance = locationValue.getTextValue(); sharedAccessAuthorizationRuleResourceInstance.setLocation(locationInstance); } JsonNode nameValue = valueValue.get("name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); sharedAccessAuthorizationRuleResourceInstance.setName(nameInstance); } JsonNode typeValue = valueValue.get("type"); if (typeValue != null && typeValue instanceof NullNode == false) { String typeInstance; typeInstance = typeValue.getTextValue(); sharedAccessAuthorizationRuleResourceInstance.setType(typeInstance); } JsonNode tagsSequenceElement = ((JsonNode) valueValue.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(); sharedAccessAuthorizationRuleResourceInstance.getTags().put(tagsKey, tagsValue); } } JsonNode propertiesValue = valueValue.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { SharedAccessAuthorizationRuleProperties propertiesInstance = new SharedAccessAuthorizationRuleProperties(); sharedAccessAuthorizationRuleResourceInstance.setProperties(propertiesInstance); JsonNode primaryKeyValue = propertiesValue.get("primaryKey"); if (primaryKeyValue != null && primaryKeyValue instanceof NullNode == false) { String primaryKeyInstance; primaryKeyInstance = primaryKeyValue.getTextValue(); propertiesInstance.setPrimaryKey(primaryKeyInstance); } JsonNode secondaryKeyValue = propertiesValue.get("secondaryKey"); if (secondaryKeyValue != null && secondaryKeyValue instanceof NullNode == false) { String secondaryKeyInstance; secondaryKeyInstance = secondaryKeyValue.getTextValue(); propertiesInstance.setSecondaryKey(secondaryKeyInstance); } JsonNode keyNameValue = propertiesValue.get("keyName"); if (keyNameValue != null && keyNameValue instanceof NullNode == false) { String keyNameInstance; keyNameInstance = keyNameValue.getTextValue(); propertiesInstance.setKeyName(keyNameInstance); } JsonNode claimTypeValue = propertiesValue.get("claimType"); if (claimTypeValue != null && claimTypeValue instanceof NullNode == false) { String claimTypeInstance; claimTypeInstance = claimTypeValue.getTextValue(); propertiesInstance.setClaimType(claimTypeInstance); } JsonNode claimValueValue = propertiesValue.get("claimValue"); if (claimValueValue != null && claimValueValue instanceof NullNode == false) { String claimValueInstance; claimValueInstance = claimValueValue.getTextValue(); propertiesInstance.setClaimValue(claimValueInstance); } JsonNode rightsArray = propertiesValue.get("rights"); if (rightsArray != null && rightsArray instanceof NullNode == false) { for (JsonNode rightsValue : ((ArrayNode) rightsArray)) { propertiesInstance.getRights() .add(Enum.valueOf(AccessRights.class, rightsValue.getTextValue())); } } JsonNode createdTimeValue = propertiesValue.get("createdTime"); if (createdTimeValue != null && createdTimeValue instanceof NullNode == false) { Calendar createdTimeInstance; createdTimeInstance = DatatypeConverter .parseDateTime(createdTimeValue.getTextValue()); propertiesInstance.setCreatedTime(createdTimeInstance); } JsonNode modifiedTimeValue = propertiesValue.get("modifiedTime"); if (modifiedTimeValue != null && modifiedTimeValue instanceof NullNode == false) { Calendar modifiedTimeInstance; modifiedTimeInstance = DatatypeConverter .parseDateTime(modifiedTimeValue.getTextValue()); propertiesInstance.setModifiedTime(modifiedTimeInstance); } JsonNode revisionValue = propertiesValue.get("revision"); if (revisionValue != null && revisionValue instanceof NullNode == false) { int revisionInstance; revisionInstance = revisionValue.getIntValue(); propertiesInstance.setRevision(revisionInstance); } } } } JsonNode nextLinkValue = responseDoc.get("nextLink"); if (nextLinkValue != null && nextLinkValue instanceof NullNode == false) { String nextLinkInstance; nextLinkInstance = nextLinkValue.getTextValue(); result.setNextLink(nextLinkInstance); } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
From source file:com.microsoft.azure.management.sql.RecommendedElasticPoolOperationsImpl.java
/** * Returns information about Azure SQL Recommended Elastic Pools. * * @param resourceGroupName Required. The name of the Resource Group to * which the Azure SQL Recommended Serve belongs. * @param serverName Required. The name of the Azure SQL Database Server in * which Azure SQL Recommended Elastic Pools are hosted. * @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 ww . j a v a 2 s . com * @throws ServiceException Thrown if an unexpected response is found. * @return Represents the response to a List Azure Sql Recommended Elastic * Pool request. */ @Override public RecommendedElasticPoolListResponse list(String resourceGroupName, String serverName) throws IOException, ServiceException { // Validate if (resourceGroupName == null) { throw new NullPointerException("resourceGroupName"); } if (serverName == null) { throw new NullPointerException("serverName"); } // Tracing boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put("resourceGroupName", resourceGroupName); tracingParameters.put("serverName", serverName); CloudTracing.enter(invocationId, this, "listAsync", tracingParameters); } // Construct URL String url = ""; url = url + "/subscriptions/"; if (this.getClient().getCredentials().getSubscriptionId() != null) { url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8"); } url = url + "/resourceGroups/"; url = url + URLEncoder.encode(resourceGroupName, "UTF-8"); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + URLEncoder.encode(serverName, "UTF-8"); url = url + "/recommendedElasticPools"; ArrayList<String> queryParameters = new ArrayList<String>(); queryParameters.add("api-version=" + "2014-04-01"); if (queryParameters.size() > 0) { url = url + "?" + CollectionStringBuilder.join(queryParameters, "&"); } String baseUrl = this.getClient().getBaseUri().toString(); // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl.charAt(baseUrl.length() - 1) == '/') { baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0); } if (url.charAt(0) == '/') { url = url.substring(1); } url = baseUrl + "/" + url; url = url.replace(" ", "%20"); // Create HTTP transport objects HttpGet httpRequest = new HttpGet(url); // Set Headers // Send Request HttpResponse httpResponse = null; try { if (shouldTrace) { CloudTracing.sendRequest(invocationId, httpRequest); } httpResponse = this.getClient().getHttpClient().execute(httpRequest); if (shouldTrace) { CloudTracing.receiveResponse(invocationId, httpResponse); } int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result RecommendedElasticPoolListResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new RecommendedElasticPoolListResponse(); ObjectMapper objectMapper = new ObjectMapper(); JsonNode responseDoc = null; String responseDocContent = IOUtils.toString(responseContent); if (responseDocContent == null == false && responseDocContent.length() > 0) { responseDoc = objectMapper.readTree(responseDocContent); } if (responseDoc != null && responseDoc instanceof NullNode == false) { JsonNode valueArray = responseDoc.get("value"); if (valueArray != null && valueArray instanceof NullNode == false) { for (JsonNode valueValue : ((ArrayNode) valueArray)) { RecommendedElasticPool recommendedElasticPoolInstance = new RecommendedElasticPool(); result.getRecommendedElasticPools().add(recommendedElasticPoolInstance); JsonNode propertiesValue = valueValue.get("properties"); if (propertiesValue != null && propertiesValue instanceof NullNode == false) { RecommendedElasticPoolProperties propertiesInstance = new RecommendedElasticPoolProperties(); recommendedElasticPoolInstance.setProperties(propertiesInstance); JsonNode databaseEditionValue = propertiesValue.get("databaseEdition"); if (databaseEditionValue != null && databaseEditionValue instanceof NullNode == false) { String databaseEditionInstance; databaseEditionInstance = databaseEditionValue.getTextValue(); propertiesInstance.setDatabaseEdition(databaseEditionInstance); } JsonNode dtuValue = propertiesValue.get("dtu"); if (dtuValue != null && dtuValue instanceof NullNode == false) { double dtuInstance; dtuInstance = dtuValue.getDoubleValue(); propertiesInstance.setDtu(dtuInstance); } JsonNode databaseDtuMinValue = propertiesValue.get("databaseDtuMin"); if (databaseDtuMinValue != null && databaseDtuMinValue instanceof NullNode == false) { double databaseDtuMinInstance; databaseDtuMinInstance = databaseDtuMinValue.getDoubleValue(); propertiesInstance.setDatabaseDtuMin(databaseDtuMinInstance); } JsonNode databaseDtuMaxValue = propertiesValue.get("databaseDtuMax"); if (databaseDtuMaxValue != null && databaseDtuMaxValue instanceof NullNode == false) { double databaseDtuMaxInstance; databaseDtuMaxInstance = databaseDtuMaxValue.getDoubleValue(); propertiesInstance.setDatabaseDtuMax(databaseDtuMaxInstance); } JsonNode storageMBValue = propertiesValue.get("storageMB"); if (storageMBValue != null && storageMBValue instanceof NullNode == false) { double storageMBInstance; storageMBInstance = storageMBValue.getDoubleValue(); propertiesInstance.setStorageMB(storageMBInstance); } JsonNode observationPeriodStartValue = propertiesValue .get("observationPeriodStart"); if (observationPeriodStartValue != null && observationPeriodStartValue instanceof NullNode == false) { Calendar observationPeriodStartInstance; observationPeriodStartInstance = DatatypeConverter .parseDateTime(observationPeriodStartValue.getTextValue()); propertiesInstance.setObservationPeriodStart(observationPeriodStartInstance); } JsonNode observationPeriodEndValue = propertiesValue.get("observationPeriodEnd"); if (observationPeriodEndValue != null && observationPeriodEndValue instanceof NullNode == false) { Calendar observationPeriodEndInstance; observationPeriodEndInstance = DatatypeConverter .parseDateTime(observationPeriodEndValue.getTextValue()); propertiesInstance.setObservationPeriodEnd(observationPeriodEndInstance); } JsonNode maxObservedDtuValue = propertiesValue.get("maxObservedDtu"); if (maxObservedDtuValue != null && maxObservedDtuValue instanceof NullNode == false) { double maxObservedDtuInstance; maxObservedDtuInstance = maxObservedDtuValue.getDoubleValue(); propertiesInstance.setMaxObservedDtu(maxObservedDtuInstance); } JsonNode maxObservedStorageMBValue = propertiesValue.get("maxObservedStorageMB"); if (maxObservedStorageMBValue != null && maxObservedStorageMBValue instanceof NullNode == false) { double maxObservedStorageMBInstance; maxObservedStorageMBInstance = maxObservedStorageMBValue.getDoubleValue(); propertiesInstance.setMaxObservedStorageMB(maxObservedStorageMBInstance); } JsonNode databasesArray = propertiesValue.get("databases"); if (databasesArray != null && databasesArray instanceof NullNode == false) { for (JsonNode databasesValue : ((ArrayNode) databasesArray)) { Database databaseInstance = new Database(); propertiesInstance.getDatabases().add(databaseInstance); JsonNode propertiesValue2 = databasesValue.get("properties"); if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) { DatabaseProperties propertiesInstance2 = new DatabaseProperties(); databaseInstance.setProperties(propertiesInstance2); JsonNode collationValue = propertiesValue2.get("collation"); if (collationValue != null && collationValue instanceof NullNode == false) { String collationInstance; collationInstance = collationValue.getTextValue(); propertiesInstance2.setCollation(collationInstance); } JsonNode creationDateValue = propertiesValue2.get("creationDate"); if (creationDateValue != null && creationDateValue instanceof NullNode == false) { Calendar creationDateInstance; creationDateInstance = DatatypeConverter .parseDateTime(creationDateValue.getTextValue()); propertiesInstance2.setCreationDate(creationDateInstance); } JsonNode currentServiceObjectiveIdValue = propertiesValue2 .get("currentServiceObjectiveId"); if (currentServiceObjectiveIdValue != null && currentServiceObjectiveIdValue instanceof NullNode == false) { String currentServiceObjectiveIdInstance; currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue .getTextValue(); propertiesInstance2.setCurrentServiceObjectiveId( currentServiceObjectiveIdInstance); } JsonNode databaseIdValue = propertiesValue2.get("databaseId"); if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) { String databaseIdInstance; databaseIdInstance = databaseIdValue.getTextValue(); propertiesInstance2.setDatabaseId(databaseIdInstance); } JsonNode earliestRestoreDateValue = propertiesValue2 .get("earliestRestoreDate"); if (earliestRestoreDateValue != null && earliestRestoreDateValue instanceof NullNode == false) { Calendar earliestRestoreDateInstance; earliestRestoreDateInstance = DatatypeConverter .parseDateTime(earliestRestoreDateValue.getTextValue()); propertiesInstance2 .setEarliestRestoreDate(earliestRestoreDateInstance); } JsonNode editionValue = propertiesValue2.get("edition"); if (editionValue != null && editionValue instanceof NullNode == false) { String editionInstance; editionInstance = editionValue.getTextValue(); propertiesInstance2.setEdition(editionInstance); } JsonNode maxSizeBytesValue = propertiesValue2.get("maxSizeBytes"); if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) { long maxSizeBytesInstance; maxSizeBytesInstance = maxSizeBytesValue.getLongValue(); propertiesInstance2.setMaxSizeBytes(maxSizeBytesInstance); } JsonNode requestedServiceObjectiveIdValue = propertiesValue2 .get("requestedServiceObjectiveId"); if (requestedServiceObjectiveIdValue != null && requestedServiceObjectiveIdValue instanceof NullNode == false) { String requestedServiceObjectiveIdInstance; requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue .getTextValue(); propertiesInstance2.setRequestedServiceObjectiveId( requestedServiceObjectiveIdInstance); } JsonNode requestedServiceObjectiveNameValue = propertiesValue2 .get("requestedServiceObjectiveName"); if (requestedServiceObjectiveNameValue != null && requestedServiceObjectiveNameValue instanceof NullNode == false) { String requestedServiceObjectiveNameInstance; requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue .getTextValue(); propertiesInstance2.setRequestedServiceObjectiveName( requestedServiceObjectiveNameInstance); } JsonNode serviceLevelObjectiveValue = propertiesValue2 .get("serviceLevelObjective"); if (serviceLevelObjectiveValue != null && serviceLevelObjectiveValue instanceof NullNode == false) { String serviceLevelObjectiveInstance; serviceLevelObjectiveInstance = serviceLevelObjectiveValue .getTextValue(); propertiesInstance2 .setServiceObjective(serviceLevelObjectiveInstance); } JsonNode statusValue = propertiesValue2.get("status"); if (statusValue != null && statusValue instanceof NullNode == false) { String statusInstance; statusInstance = statusValue.getTextValue(); propertiesInstance2.setStatus(statusInstance); } JsonNode elasticPoolNameValue = propertiesValue2.get("elasticPoolName"); if (elasticPoolNameValue != null && elasticPoolNameValue instanceof NullNode == false) { String elasticPoolNameInstance; elasticPoolNameInstance = elasticPoolNameValue.getTextValue(); propertiesInstance2.setElasticPoolName(elasticPoolNameInstance); } JsonNode serviceTierAdvisorsArray = propertiesValue2 .get("serviceTierAdvisors"); if (serviceTierAdvisorsArray != null && serviceTierAdvisorsArray instanceof NullNode == false) { for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) { ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor(); propertiesInstance2.getServiceTierAdvisors() .add(serviceTierAdvisorInstance); JsonNode propertiesValue3 = serviceTierAdvisorsValue .get("properties"); if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) { ServiceTierAdvisorProperties propertiesInstance3 = new ServiceTierAdvisorProperties(); serviceTierAdvisorInstance .setProperties(propertiesInstance3); JsonNode observationPeriodStartValue2 = propertiesValue3 .get("observationPeriodStart"); if (observationPeriodStartValue2 != null && observationPeriodStartValue2 instanceof NullNode == false) { Calendar observationPeriodStartInstance2; observationPeriodStartInstance2 = DatatypeConverter .parseDateTime(observationPeriodStartValue2 .getTextValue()); propertiesInstance3.setObservationPeriodStart( observationPeriodStartInstance2); } JsonNode observationPeriodEndValue2 = propertiesValue3 .get("observationPeriodEnd"); if (observationPeriodEndValue2 != null && observationPeriodEndValue2 instanceof NullNode == false) { Calendar observationPeriodEndInstance2; observationPeriodEndInstance2 = DatatypeConverter .parseDateTime(observationPeriodEndValue2 .getTextValue()); propertiesInstance3.setObservationPeriodEnd( observationPeriodEndInstance2); } JsonNode activeTimeRatioValue = propertiesValue3 .get("activeTimeRatio"); if (activeTimeRatioValue != null && activeTimeRatioValue instanceof NullNode == false) { double activeTimeRatioInstance; activeTimeRatioInstance = activeTimeRatioValue .getDoubleValue(); propertiesInstance3 .setActiveTimeRatio(activeTimeRatioInstance); } JsonNode minDtuValue = propertiesValue3.get("minDtu"); if (minDtuValue != null && minDtuValue instanceof NullNode == false) { double minDtuInstance; minDtuInstance = minDtuValue.getDoubleValue(); propertiesInstance3.setMinDtu(minDtuInstance); } JsonNode avgDtuValue = propertiesValue3.get("avgDtu"); if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) { double avgDtuInstance; avgDtuInstance = avgDtuValue.getDoubleValue(); propertiesInstance3.setAvgDtu(avgDtuInstance); } JsonNode maxDtuValue = propertiesValue3.get("maxDtu"); if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) { double maxDtuInstance; maxDtuInstance = maxDtuValue.getDoubleValue(); propertiesInstance3.setMaxDtu(maxDtuInstance); } JsonNode maxSizeInGBValue = propertiesValue3 .get("maxSizeInGB"); if (maxSizeInGBValue != null && maxSizeInGBValue instanceof NullNode == false) { double maxSizeInGBInstance; maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue(); propertiesInstance3.setMaxSizeInGB(maxSizeInGBInstance); } JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue3 .get("serviceLevelObjectiveUsageMetrics"); if (serviceLevelObjectiveUsageMetricsArray != null && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) { for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) { SloUsageMetric sloUsageMetricInstance = new SloUsageMetric(); propertiesInstance3 .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 = propertiesValue3 .get("currentServiceLevelObjective"); if (currentServiceLevelObjectiveValue != null && currentServiceLevelObjectiveValue instanceof NullNode == false) { String currentServiceLevelObjectiveInstance; currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue .getTextValue(); propertiesInstance3.setCurrentServiceLevelObjective( currentServiceLevelObjectiveInstance); } JsonNode currentServiceLevelObjectiveIdValue = propertiesValue3 .get("currentServiceLevelObjectiveId"); if (currentServiceLevelObjectiveIdValue != null && currentServiceLevelObjectiveIdValue instanceof NullNode == false) { String currentServiceLevelObjectiveIdInstance; currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance3.setCurrentServiceLevelObjectiveId( currentServiceLevelObjectiveIdInstance); } JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue3 .get("usageBasedRecommendationServiceLevelObjective"); if (usageBasedRecommendationServiceLevelObjectiveValue != null && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String usageBasedRecommendationServiceLevelObjectiveInstance; usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance3 .setUsageBasedRecommendationServiceLevelObjective( usageBasedRecommendationServiceLevelObjectiveInstance); } JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue3 .get("usageBasedRecommendationServiceLevelObjectiveId"); if (usageBasedRecommendationServiceLevelObjectiveIdValue != null && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String usageBasedRecommendationServiceLevelObjectiveIdInstance; usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance3 .setUsageBasedRecommendationServiceLevelObjectiveId( usageBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue3 .get("databaseSizeBasedRecommendationServiceLevelObjective"); if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String databaseSizeBasedRecommendationServiceLevelObjectiveInstance; databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance3 .setDatabaseSizeBasedRecommendationServiceLevelObjective( databaseSizeBasedRecommendationServiceLevelObjectiveInstance); } JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue3 .get("databaseSizeBasedRecommendationServiceLevelObjectiveId"); if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance; databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance3 .setDatabaseSizeBasedRecommendationServiceLevelObjectiveId( databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue3 .get("disasterPlanBasedRecommendationServiceLevelObjective"); if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String disasterPlanBasedRecommendationServiceLevelObjectiveInstance; disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance3 .setDisasterPlanBasedRecommendationServiceLevelObjective( disasterPlanBasedRecommendationServiceLevelObjectiveInstance); } JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue3 .get("disasterPlanBasedRecommendationServiceLevelObjectiveId"); if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance; disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance3 .setDisasterPlanBasedRecommendationServiceLevelObjectiveId( disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance); } JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue3 .get("overallRecommendationServiceLevelObjective"); if (overallRecommendationServiceLevelObjectiveValue != null && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) { String overallRecommendationServiceLevelObjectiveInstance; overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue .getTextValue(); propertiesInstance3 .setOverallRecommendationServiceLevelObjective( overallRecommendationServiceLevelObjectiveInstance); } JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue3 .get("overallRecommendationServiceLevelObjectiveId"); if (overallRecommendationServiceLevelObjectiveIdValue != null && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) { String overallRecommendationServiceLevelObjectiveIdInstance; overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue .getTextValue(); propertiesInstance3 .setOverallRecommendationServiceLevelObjectiveId( overallRecommendationServiceLevelObjectiveIdInstance); } JsonNode confidenceValue = propertiesValue3 .get("confidence"); if (confidenceValue != null && confidenceValue instanceof NullNode == false) { double confidenceInstance; confidenceInstance = confidenceValue.getDoubleValue(); propertiesInstance3.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 = propertiesValue2.get("upgradeHint"); if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) { UpgradeHint upgradeHintInstance = new UpgradeHint(); propertiesInstance2.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 = propertiesValue2.get("schemas"); if (schemasArray != null && schemasArray instanceof NullNode == false) { for (JsonNode schemasValue : ((ArrayNode) schemasArray)) { Schema schemaInstance = new Schema(); propertiesInstance2.getSchemas().add(schemaInstance); JsonNode propertiesValue4 = schemasValue.get("properties"); if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) { SchemaProperties propertiesInstance4 = new SchemaProperties(); schemaInstance.setProperties(propertiesInstance4); JsonNode tablesArray = propertiesValue4.get("tables"); if (tablesArray != null && tablesArray instanceof NullNode == false) { for (JsonNode tablesValue : ((ArrayNode) tablesArray)) { Table tableInstance = new Table(); propertiesInstance4.getTables().add(tableInstance); JsonNode propertiesValue5 = tablesValue .get("properties"); if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) { TableProperties propertiesInstance5 = new TableProperties(); tableInstance .setProperties(propertiesInstance5); JsonNode tableTypeValue = propertiesValue5 .get("tableType"); if (tableTypeValue != null && tableTypeValue instanceof NullNode == false) { String tableTypeInstance; tableTypeInstance = tableTypeValue .getTextValue(); propertiesInstance5 .setTableType(tableTypeInstance); } JsonNode columnsArray = propertiesValue5 .get("columns"); if (columnsArray != null && columnsArray instanceof NullNode == false) { for (JsonNode columnsValue : ((ArrayNode) columnsArray)) { Column columnInstance = new Column(); propertiesInstance5.getColumns() .add(columnInstance); JsonNode propertiesValue6 = columnsValue .get("properties"); if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) { ColumnProperties propertiesInstance6 = new ColumnProperties(); columnInstance.setProperties( propertiesInstance6); JsonNode columnTypeValue = propertiesValue6 .get("columnType"); if (columnTypeValue != null && columnTypeValue instanceof NullNode == false) { String columnTypeInstance; columnTypeInstance = columnTypeValue .getTextValue(); propertiesInstance6 .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 = propertiesValue5 .get("recommendedIndexes"); if (recommendedIndexesArray != null && recommendedIndexesArray instanceof NullNode == false) { for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) { RecommendedIndex recommendedIndexInstance = new RecommendedIndex(); propertiesInstance5 .getRecommendedIndexes() .add(recommendedIndexInstance); JsonNode propertiesValue7 = recommendedIndexesValue .get("properties"); if (propertiesValue7 != null && propertiesValue7 instanceof NullNode == false) { RecommendedIndexProperties propertiesInstance7 = new RecommendedIndexProperties(); recommendedIndexInstance .setProperties( propertiesInstance7); JsonNode actionValue = propertiesValue7 .get("action"); if (actionValue != null && actionValue instanceof NullNode == false) { String actionInstance; actionInstance = actionValue .getTextValue(); propertiesInstance7.setAction( actionInstance); } JsonNode stateValue = propertiesValue7 .get("state"); if (stateValue != null && stateValue instanceof NullNode == false) { String stateInstance; stateInstance = stateValue .getTextValue(); propertiesInstance7.setState( stateInstance); } JsonNode createdValue = propertiesValue7 .get("created"); if (createdValue != null && createdValue instanceof NullNode == false) { Calendar createdInstance; createdInstance = DatatypeConverter .parseDateTime( createdValue .getTextValue()); propertiesInstance7.setCreated( createdInstance); } JsonNode lastModifiedValue = propertiesValue7 .get("lastModified"); if (lastModifiedValue != null && lastModifiedValue instanceof NullNode == false) { Calendar lastModifiedInstance; lastModifiedInstance = DatatypeConverter .parseDateTime( lastModifiedValue .getTextValue()); propertiesInstance7 .setLastModified( lastModifiedInstance); } JsonNode indexTypeValue = propertiesValue7 .get("indexType"); if (indexTypeValue != null && indexTypeValue instanceof NullNode == false) { String indexTypeInstance; indexTypeInstance = indexTypeValue .getTextValue(); propertiesInstance7 .setIndexType( indexTypeInstance); } JsonNode schemaValue = propertiesValue7 .get("schema"); if (schemaValue != null && schemaValue instanceof NullNode == false) { String schemaInstance2; schemaInstance2 = schemaValue .getTextValue(); propertiesInstance7.setSchema( schemaInstance2); } JsonNode tableValue = propertiesValue7 .get("table"); if (tableValue != null && tableValue instanceof NullNode == false) { String tableInstance2; tableInstance2 = tableValue .getTextValue(); propertiesInstance7.setTable( tableInstance2); } JsonNode columnsArray2 = propertiesValue7 .get("columns"); if (columnsArray2 != null && columnsArray2 instanceof NullNode == false) { for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) { propertiesInstance7 .getColumns() .add(columnsValue2 .getTextValue()); } } JsonNode includedColumnsArray = propertiesValue7 .get("includedColumns"); if (includedColumnsArray != null && includedColumnsArray instanceof NullNode == false) { for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) { propertiesInstance7 .getIncludedColumns() .add(includedColumnsValue .getTextValue()); } } JsonNode indexScriptValue = propertiesValue7 .get("indexScript"); if (indexScriptValue != null && indexScriptValue instanceof NullNode == false) { String indexScriptInstance; indexScriptInstance = indexScriptValue .getTextValue(); propertiesInstance7 .setIndexScript( indexScriptInstance); } JsonNode estimatedImpactArray = propertiesValue7 .get("estimatedImpact"); if (estimatedImpactArray != null && estimatedImpactArray instanceof NullNode == false) { for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) { OperationImpact operationImpactInstance = new OperationImpact(); propertiesInstance7 .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 = propertiesValue7 .get("reportedImpact"); if (reportedImpactArray != null && reportedImpactArray instanceof NullNode == false) { for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) { OperationImpact operationImpactInstance2 = new OperationImpact(); propertiesInstance7 .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 = propertiesValue2 .get("defaultSecondaryLocation"); if (defaultSecondaryLocationValue != null && defaultSecondaryLocationValue instanceof NullNode == false) { String defaultSecondaryLocationInstance; defaultSecondaryLocationInstance = defaultSecondaryLocationValue .getTextValue(); propertiesInstance2.setDefaultSecondaryLocation( defaultSecondaryLocationInstance); } } JsonNode idValue8 = databasesValue.get("id"); if (idValue8 != null && idValue8 instanceof NullNode == false) { String idInstance8; idInstance8 = idValue8.getTextValue(); databaseInstance.setId(idInstance8); } JsonNode nameValue10 = databasesValue.get("name"); if (nameValue10 != null && nameValue10 instanceof NullNode == false) { String nameInstance10; nameInstance10 = nameValue10.getTextValue(); databaseInstance.setName(nameInstance10); } JsonNode typeValue8 = databasesValue.get("type"); if (typeValue8 != null && typeValue8 instanceof NullNode == false) { String typeInstance8; typeInstance8 = typeValue8.getTextValue(); databaseInstance.setType(typeInstance8); } JsonNode locationValue8 = databasesValue.get("location"); if (locationValue8 != null && locationValue8 instanceof NullNode == false) { String locationInstance8; locationInstance8 = locationValue8.getTextValue(); databaseInstance.setLocation(locationInstance8); } JsonNode tagsSequenceElement8 = ((JsonNode) databasesValue.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); } } } } JsonNode metricsArray = propertiesValue.get("metrics"); if (metricsArray != null && metricsArray instanceof NullNode == false) { for (JsonNode metricsValue : ((ArrayNode) metricsArray)) { RecommendedElasticPoolMetric recommendedElasticPoolMetricInstance = new RecommendedElasticPoolMetric(); propertiesInstance.getMetrics().add(recommendedElasticPoolMetricInstance); JsonNode dateTimeValue = metricsValue.get("dateTime"); if (dateTimeValue != null && dateTimeValue instanceof NullNode == false) { Calendar dateTimeInstance; dateTimeInstance = DatatypeConverter .parseDateTime(dateTimeValue.getTextValue()); recommendedElasticPoolMetricInstance.setDateTime(dateTimeInstance); } JsonNode dtuValue2 = metricsValue.get("dtu"); if (dtuValue2 != null && dtuValue2 instanceof NullNode == false) { double dtuInstance2; dtuInstance2 = dtuValue2.getDoubleValue(); recommendedElasticPoolMetricInstance.setDtu(dtuInstance2); } JsonNode sizeGBValue = metricsValue.get("sizeGB"); if (sizeGBValue != null && sizeGBValue instanceof NullNode == false) { double sizeGBInstance; sizeGBInstance = sizeGBValue.getDoubleValue(); recommendedElasticPoolMetricInstance.setSizeGB(sizeGBInstance); } } } } JsonNode idValue9 = valueValue.get("id"); if (idValue9 != null && idValue9 instanceof NullNode == false) { String idInstance9; idInstance9 = idValue9.getTextValue(); recommendedElasticPoolInstance.setId(idInstance9); } JsonNode nameValue11 = valueValue.get("name"); if (nameValue11 != null && nameValue11 instanceof NullNode == false) { String nameInstance11; nameInstance11 = nameValue11.getTextValue(); recommendedElasticPoolInstance.setName(nameInstance11); } JsonNode typeValue9 = valueValue.get("type"); if (typeValue9 != null && typeValue9 instanceof NullNode == false) { String typeInstance9; typeInstance9 = typeValue9.getTextValue(); recommendedElasticPoolInstance.setType(typeInstance9); } JsonNode locationValue9 = valueValue.get("location"); if (locationValue9 != null && locationValue9 instanceof NullNode == false) { String locationInstance9; locationInstance9 = locationValue9.getTextValue(); recommendedElasticPoolInstance.setLocation(locationInstance9); } JsonNode tagsSequenceElement9 = ((JsonNode) valueValue.get("tags")); if (tagsSequenceElement9 != null && tagsSequenceElement9 instanceof NullNode == false) { Iterator<Map.Entry<String, JsonNode>> itr9 = tagsSequenceElement9.getFields(); while (itr9.hasNext()) { Map.Entry<String, JsonNode> property9 = itr9.next(); String tagsKey9 = property9.getKey(); String tagsValue9 = property9.getValue().getTextValue(); recommendedElasticPoolInstance.getTags().put(tagsKey9, tagsValue9); } } } } } } 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 the config settings for a web site by issuing an HTTP * GET request. (see/*from w ww .ja v a2 s . c o m*/ * http://msdn.microsoft.com/en-us/library/windowsazure/dn166985.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. * @return The Get Configuration Web Site operation response. */ @Override public WebSiteGetConfigurationResponse getConfiguration(String webSpaceName, String webSiteName) throws IOException, ServiceException { // 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, "getConfigurationAsync", 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 + "/config"; 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("accept", "application/json"); 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.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result WebSiteGetConfigurationResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new WebSiteGetConfigurationResponse(); 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 appSettingsSequenceElement = ((JsonNode) responseDoc.get("AppSettings")); if (appSettingsSequenceElement != null && appSettingsSequenceElement instanceof NullNode == false) { for (JsonNode appSettingsElement : ((ArrayNode) appSettingsSequenceElement)) { String appSettingsKey = appSettingsElement.get("Name").getTextValue(); String appSettingsValue = appSettingsElement.get("Value").getTextValue(); result.getAppSettings().put(appSettingsKey, appSettingsValue); } } JsonNode connectionStringsArray = responseDoc.get("ConnectionStrings"); if (connectionStringsArray != null && connectionStringsArray instanceof NullNode == false) { for (JsonNode connectionStringsValue : ((ArrayNode) connectionStringsArray)) { WebSiteGetConfigurationResponse.ConnectionStringInfo connectionStringInfoInstance = new WebSiteGetConfigurationResponse.ConnectionStringInfo(); result.getConnectionStrings().add(connectionStringInfoInstance); JsonNode connectionStringValue = connectionStringsValue.get("ConnectionString"); if (connectionStringValue != null && connectionStringValue instanceof NullNode == false) { String connectionStringInstance; connectionStringInstance = connectionStringValue.getTextValue(); connectionStringInfoInstance.setConnectionString(connectionStringInstance); } JsonNode nameValue = connectionStringsValue.get("Name"); if (nameValue != null && nameValue instanceof NullNode == false) { String nameInstance; nameInstance = nameValue.getTextValue(); connectionStringInfoInstance.setName(nameInstance); } JsonNode typeValue = connectionStringsValue.get("Type"); if (typeValue != null && typeValue instanceof NullNode == false) { ConnectionStringType typeInstance; typeInstance = ConnectionStringType.values()[typeValue.getIntValue()]; connectionStringInfoInstance.setType(typeInstance); } } } JsonNode defaultDocumentsArray = responseDoc.get("DefaultDocuments"); if (defaultDocumentsArray != null && defaultDocumentsArray instanceof NullNode == false) { for (JsonNode defaultDocumentsValue : ((ArrayNode) defaultDocumentsArray)) { result.getDefaultDocuments().add(defaultDocumentsValue.getTextValue()); } } JsonNode detailedErrorLoggingEnabledValue = responseDoc.get("DetailedErrorLoggingEnabled"); if (detailedErrorLoggingEnabledValue != null && detailedErrorLoggingEnabledValue instanceof NullNode == false) { boolean detailedErrorLoggingEnabledInstance; detailedErrorLoggingEnabledInstance = detailedErrorLoggingEnabledValue.getBooleanValue(); result.setDetailedErrorLoggingEnabled(detailedErrorLoggingEnabledInstance); } JsonNode documentRootValue = responseDoc.get("DocumentRoot"); if (documentRootValue != null && documentRootValue instanceof NullNode == false) { String documentRootInstance; documentRootInstance = documentRootValue.getTextValue(); result.setDocumentRoot(documentRootInstance); } JsonNode handlerMappingsArray = responseDoc.get("HandlerMappings"); if (handlerMappingsArray != null && handlerMappingsArray instanceof NullNode == false) { for (JsonNode handlerMappingsValue : ((ArrayNode) handlerMappingsArray)) { WebSiteGetConfigurationResponse.HandlerMapping handlerMappingInstance = new WebSiteGetConfigurationResponse.HandlerMapping(); result.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 = responseDoc.get("HttpLoggingEnabled"); if (httpLoggingEnabledValue != null && httpLoggingEnabledValue instanceof NullNode == false) { boolean httpLoggingEnabledInstance; httpLoggingEnabledInstance = httpLoggingEnabledValue.getBooleanValue(); result.setHttpLoggingEnabled(httpLoggingEnabledInstance); } JsonNode logsDirectorySizeLimitValue = responseDoc.get("LogsDirectorySizeLimit"); if (logsDirectorySizeLimitValue != null && logsDirectorySizeLimitValue instanceof NullNode == false) { int logsDirectorySizeLimitInstance; logsDirectorySizeLimitInstance = logsDirectorySizeLimitValue.getIntValue(); result.setLogsDirectorySizeLimit(logsDirectorySizeLimitInstance); } JsonNode managedPipelineModeValue = responseDoc.get("ManagedPipelineMode"); if (managedPipelineModeValue != null && managedPipelineModeValue instanceof NullNode == false) { ManagedPipelineMode managedPipelineModeInstance; managedPipelineModeInstance = ManagedPipelineMode.values()[managedPipelineModeValue .getIntValue()]; result.setManagedPipelineMode(managedPipelineModeInstance); } JsonNode metadataSequenceElement = ((JsonNode) responseDoc.get("Metadata")); if (metadataSequenceElement != null && metadataSequenceElement instanceof NullNode == false) { for (JsonNode metadataElement : ((ArrayNode) metadataSequenceElement)) { String metadataKey = metadataElement.get("Name").getTextValue(); String metadataValue = metadataElement.get("Value").getTextValue(); result.getMetadata().put(metadataKey, metadataValue); } } JsonNode netFrameworkVersionValue = responseDoc.get("NetFrameworkVersion"); if (netFrameworkVersionValue != null && netFrameworkVersionValue instanceof NullNode == false) { String netFrameworkVersionInstance; netFrameworkVersionInstance = netFrameworkVersionValue.getTextValue(); result.setNetFrameworkVersion(netFrameworkVersionInstance); } JsonNode numberOfWorkersValue = responseDoc.get("NumberOfWorkers"); if (numberOfWorkersValue != null && numberOfWorkersValue instanceof NullNode == false) { int numberOfWorkersInstance; numberOfWorkersInstance = numberOfWorkersValue.getIntValue(); result.setNumberOfWorkers(numberOfWorkersInstance); } JsonNode phpVersionValue = responseDoc.get("PhpVersion"); if (phpVersionValue != null && phpVersionValue instanceof NullNode == false) { String phpVersionInstance; phpVersionInstance = phpVersionValue.getTextValue(); result.setPhpVersion(phpVersionInstance); } JsonNode publishingPasswordValue = responseDoc.get("PublishingPassword"); if (publishingPasswordValue != null && publishingPasswordValue instanceof NullNode == false) { String publishingPasswordInstance; publishingPasswordInstance = publishingPasswordValue.getTextValue(); result.setPublishingPassword(publishingPasswordInstance); } JsonNode publishingUsernameValue = responseDoc.get("PublishingUsername"); if (publishingUsernameValue != null && publishingUsernameValue instanceof NullNode == false) { String publishingUsernameInstance; publishingUsernameInstance = publishingUsernameValue.getTextValue(); result.setPublishingUserName(publishingUsernameInstance); } JsonNode remoteDebuggingEnabledValue = responseDoc.get("RemoteDebuggingEnabled"); if (remoteDebuggingEnabledValue != null && remoteDebuggingEnabledValue instanceof NullNode == false) { boolean remoteDebuggingEnabledInstance; remoteDebuggingEnabledInstance = remoteDebuggingEnabledValue.getBooleanValue(); result.setRemoteDebuggingEnabled(remoteDebuggingEnabledInstance); } JsonNode remoteDebuggingVersionValue = responseDoc.get("RemoteDebuggingVersion"); if (remoteDebuggingVersionValue != null && remoteDebuggingVersionValue instanceof NullNode == false) { RemoteDebuggingVersion remoteDebuggingVersionInstance; remoteDebuggingVersionInstance = Enum.valueOf(RemoteDebuggingVersion.class, remoteDebuggingVersionValue.getTextValue()); result.setRemoteDebuggingVersion(remoteDebuggingVersionInstance); } JsonNode requestTracingEnabledValue = responseDoc.get("RequestTracingEnabled"); if (requestTracingEnabledValue != null && requestTracingEnabledValue instanceof NullNode == false) { boolean requestTracingEnabledInstance; requestTracingEnabledInstance = requestTracingEnabledValue.getBooleanValue(); result.setRequestTracingEnabled(requestTracingEnabledInstance); } JsonNode requestTracingExpirationTimeValue = responseDoc.get("RequestTracingExpirationTime"); if (requestTracingExpirationTimeValue != null && requestTracingExpirationTimeValue instanceof NullNode == false) { Calendar requestTracingExpirationTimeInstance; requestTracingExpirationTimeInstance = DatatypeConverter .parseDateTime(requestTracingExpirationTimeValue.getTextValue()); result.setRequestTracingExpirationTime(requestTracingExpirationTimeInstance); } JsonNode scmTypeValue = responseDoc.get("ScmType"); if (scmTypeValue != null && scmTypeValue instanceof NullNode == false) { String scmTypeInstance; scmTypeInstance = scmTypeValue.getTextValue(); result.setScmType(scmTypeInstance); } JsonNode use32BitWorkerProcessValue = responseDoc.get("Use32BitWorkerProcess"); if (use32BitWorkerProcessValue != null && use32BitWorkerProcessValue instanceof NullNode == false) { boolean use32BitWorkerProcessInstance; use32BitWorkerProcessInstance = use32BitWorkerProcessValue.getBooleanValue(); result.setUse32BitWorkerProcess(use32BitWorkerProcessInstance); } JsonNode webSocketsEnabledValue = responseDoc.get("WebSocketsEnabled"); if (webSocketsEnabledValue != null && webSocketsEnabledValue instanceof NullNode == false) { boolean webSocketsEnabledInstance; webSocketsEnabledInstance = webSocketsEnabledValue.getBooleanValue(); result.setWebSocketsEnabled(webSocketsEnabledInstance); } JsonNode alwaysOnValue = responseDoc.get("AlwaysOn"); if (alwaysOnValue != null && alwaysOnValue instanceof NullNode == false) { boolean alwaysOnInstance; alwaysOnInstance = alwaysOnValue.getBooleanValue(); result.setAlwaysOn(alwaysOnInstance); } JsonNode routingRulesArray = responseDoc.get("RoutingRules"); if (routingRulesArray != null && routingRulesArray instanceof NullNode == false) { for (JsonNode routingRulesValue : ((ArrayNode) routingRulesArray)) { String typeName = routingRulesValue.get("__type").getTextValue(); if ("RampUpRule:http://schemas.microsoft.com/windowsazure".equals(typeName)) { RampUpRule rampUpRuleInstance = new RampUpRule(); JsonNode actionHostNameValue = routingRulesValue.get("ActionHostName"); if (actionHostNameValue != null && actionHostNameValue instanceof NullNode == false) { String actionHostNameInstance; actionHostNameInstance = actionHostNameValue.getTextValue(); rampUpRuleInstance.setActionHostName(actionHostNameInstance); } JsonNode reroutePercentageValue = routingRulesValue.get("ReroutePercentage"); if (reroutePercentageValue != null && reroutePercentageValue instanceof NullNode == false) { double reroutePercentageInstance; reroutePercentageInstance = reroutePercentageValue.getDoubleValue(); rampUpRuleInstance.setReroutePercentage(reroutePercentageInstance); } JsonNode changeStepValue = routingRulesValue.get("ChangeStep"); if (changeStepValue != null && changeStepValue instanceof NullNode == false) { double changeStepInstance; changeStepInstance = changeStepValue.getDoubleValue(); rampUpRuleInstance.setChangeStep(changeStepInstance); } JsonNode changeIntervalInMinutesValue = routingRulesValue .get("ChangeIntervalInMinutes"); if (changeIntervalInMinutesValue != null && changeIntervalInMinutesValue instanceof NullNode == false) { int changeIntervalInMinutesInstance; changeIntervalInMinutesInstance = changeIntervalInMinutesValue.getIntValue(); rampUpRuleInstance.setChangeIntervalInMinutes(changeIntervalInMinutesInstance); } JsonNode minReroutePercentageValue = routingRulesValue.get("MinReroutePercentage"); if (minReroutePercentageValue != null && minReroutePercentageValue instanceof NullNode == false) { double minReroutePercentageInstance; minReroutePercentageInstance = minReroutePercentageValue.getDoubleValue(); rampUpRuleInstance.setMinReroutePercentage(minReroutePercentageInstance); } JsonNode maxReroutePercentageValue = routingRulesValue.get("MaxReroutePercentage"); if (maxReroutePercentageValue != null && maxReroutePercentageValue instanceof NullNode == false) { double maxReroutePercentageInstance; maxReroutePercentageInstance = maxReroutePercentageValue.getDoubleValue(); rampUpRuleInstance.setMaxReroutePercentage(maxReroutePercentageInstance); } JsonNode changeDecisionCallbackUrlValue = routingRulesValue .get("ChangeDecisionCallbackUrl"); if (changeDecisionCallbackUrlValue != null && changeDecisionCallbackUrlValue instanceof NullNode == false) { String changeDecisionCallbackUrlInstance; changeDecisionCallbackUrlInstance = changeDecisionCallbackUrlValue .getTextValue(); rampUpRuleInstance .setChangeDecisionCallbackUrl(changeDecisionCallbackUrlInstance); } JsonNode nameValue2 = routingRulesValue.get("Name"); if (nameValue2 != null && nameValue2 instanceof NullNode == false) { String nameInstance2; nameInstance2 = nameValue2.getTextValue(); rampUpRuleInstance.setName(nameInstance2); } result.getRoutingRules().add(rampUpRuleInstance); } } } JsonNode javaVersionValue = responseDoc.get("JavaVersion"); if (javaVersionValue != null && javaVersionValue instanceof NullNode == false) { String javaVersionInstance; javaVersionInstance = javaVersionValue.getTextValue(); result.setJavaVersion(javaVersionInstance); } JsonNode javaContainerValue = responseDoc.get("JavaContainer"); if (javaContainerValue != null && javaContainerValue instanceof NullNode == false) { String javaContainerInstance; javaContainerInstance = javaContainerValue.getTextValue(); result.setJavaContainer(javaContainerInstance); } JsonNode javaContainerVersionValue = responseDoc.get("JavaContainerVersion"); if (javaContainerVersionValue != null && javaContainerVersionValue instanceof NullNode == false) { String javaContainerVersionInstance; javaContainerVersionInstance = javaContainerVersionValue.getTextValue(); result.setJavaContainerVersion(javaContainerVersionInstance); } JsonNode autoSwapSlotNameValue = responseDoc.get("AutoSwapSlotName"); if (autoSwapSlotNameValue != null && autoSwapSlotNameValue instanceof NullNode == false) { String autoSwapSlotNameInstance; autoSwapSlotNameInstance = autoSwapSlotNameValue.getTextValue(); result.setAutoSwapSlotName(autoSwapSlotNameInstance); } JsonNode siteAuthEnabledValue = responseDoc.get("SiteAuthEnabled"); if (siteAuthEnabledValue != null && siteAuthEnabledValue instanceof NullNode == false) { boolean siteAuthEnabledInstance; siteAuthEnabledInstance = siteAuthEnabledValue.getBooleanValue(); result.setSiteAuthEnabled(siteAuthEnabledInstance); } JsonNode siteAuthSettingsValue = responseDoc.get("SiteAuthSettings"); if (siteAuthSettingsValue != null && siteAuthSettingsValue instanceof NullNode == false) { SiteAuthSettings siteAuthSettingsInstance = new SiteAuthSettings(); result.setSiteAuthSettings(siteAuthSettingsInstance); JsonNode aADClientIdValue = siteAuthSettingsValue.get("AADClientId"); if (aADClientIdValue != null && aADClientIdValue instanceof NullNode == false) { String aADClientIdInstance; aADClientIdInstance = aADClientIdValue.getTextValue(); siteAuthSettingsInstance.setAADClientId(aADClientIdInstance); } JsonNode openIdIssuerValue = siteAuthSettingsValue.get("OpenIdIssuer"); if (openIdIssuerValue != null && openIdIssuerValue instanceof NullNode == false) { String openIdIssuerInstance; openIdIssuerInstance = openIdIssuerValue.getTextValue(); siteAuthSettingsInstance.setOpenIdIssuer(openIdIssuerInstance); } } JsonNode limitsValue = responseDoc.get("limits"); if (limitsValue != null && limitsValue instanceof NullNode == false) { WebSiteGetConfigurationResponse.SiteLimits limitsInstance = new WebSiteGetConfigurationResponse.SiteLimits(); result.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); } } } } 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(); } } }