Package com.microsoft.windowsazure.management.websites.models

Examples of com.microsoft.windowsazure.management.websites.models.WebSiteOperationStatusResponse


                }
                throw ex;
            }
           
            // Create Result
            WebSiteOperationStatusResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new WebSiteOperationStatusResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element operationElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Operation");
            if (operationElement != null) {
                Element createdTimeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "CreatedTime");
                if (createdTimeElement != null) {
                    Calendar createdTimeInstance;
                    createdTimeInstance = DatatypeConverter.parseDateTime(createdTimeElement.getTextContent());
                    result.setCreatedTime(createdTimeInstance);
                }
               
                Element errorsSequenceElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Errors");
                if (errorsSequenceElement != null) {
                    boolean isNil = false;
                    Attr nilAttribute = errorsSequenceElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute != null) {
                        isNil = "true".equals(nilAttribute.getValue());
                    }
                    if (isNil == false) {
                        for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(errorsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Error").size(); i1 = i1 + 1) {
                            org.w3c.dom.Element errorsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(errorsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Error").get(i1));
                            WebSiteOperationStatusResponse.Error errorInstance = new WebSiteOperationStatusResponse.Error();
                            result.getErrors().add(errorInstance);
                           
                            Element codeElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "Code");
                            if (codeElement != null) {
                                boolean isNil2 = false;
                                Attr nilAttribute2 = codeElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute2 != null) {
                                    isNil2 = "true".equals(nilAttribute2.getValue());
                                }
                                if (isNil2 == false) {
                                    String codeInstance;
                                    codeInstance = codeElement.getTextContent();
                                    errorInstance.setCode(codeInstance);
                                }
                            }
                           
                            Element messageElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "Message");
                            if (messageElement != null) {
                                boolean isNil3 = false;
                                Attr nilAttribute3 = messageElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute3 != null) {
                                    isNil3 = "true".equals(nilAttribute3.getValue());
                                }
                                if (isNil3 == false) {
                                    String messageInstance;
                                    messageInstance = messageElement.getTextContent();
                                    errorInstance.setMessage(messageInstance);
                                }
                            }
                           
                            Element extendedCodeElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "ExtendedCode");
                            if (extendedCodeElement != null) {
                                boolean isNil4 = false;
                                Attr nilAttribute4 = extendedCodeElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute4 != null) {
                                    isNil4 = "true".equals(nilAttribute4.getValue());
                                }
                                if (isNil4 == false) {
                                    String extendedCodeInstance;
                                    extendedCodeInstance = extendedCodeElement.getTextContent();
                                    errorInstance.setExtendedCode(extendedCodeInstance);
                                }
                            }
                           
                            Element messageTemplateElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "MessageTemplate");
                            if (messageTemplateElement != null) {
                                boolean isNil5 = false;
                                Attr nilAttribute5 = messageTemplateElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute5 != null) {
                                    isNil5 = "true".equals(nilAttribute5.getValue());
                                }
                                if (isNil5 == false) {
                                    String messageTemplateInstance;
                                    messageTemplateInstance = messageTemplateElement.getTextContent();
                                    errorInstance.setMessageTemplate(messageTemplateInstance);
                                }
                            }
                           
                            Element parametersSequenceElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "Parameters");
                            if (parametersSequenceElement != null) {
                                boolean isNil6 = false;
                                Attr nilAttribute6 = parametersSequenceElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute6 != null) {
                                    isNil6 = "true".equals(nilAttribute6.getValue());
                                }
                                if (isNil6 == false) {
                                    for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(parametersSequenceElement, "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string").size(); i2 = i2 + 1) {
                                        org.w3c.dom.Element parametersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(parametersSequenceElement, "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string").get(i2));
                                        errorInstance.getParameters().add(parametersElement.getTextContent());
                                    }
                                } else {
                                    errorInstance.setParameters(null);
                                }
                            }
                           
                            Element innerErrorsElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "InnerErrors");
                            if (innerErrorsElement != null) {
                                boolean isNil7 = false;
                                Attr nilAttribute7 = innerErrorsElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute7 != null) {
                                    isNil7 = "true".equals(nilAttribute7.getValue());
                                }
                                if (isNil7 == false) {
                                    String innerErrorsInstance;
                                    innerErrorsInstance = innerErrorsElement.getTextContent();
                                    errorInstance.setInnerErrors(innerErrorsInstance);
                                }
                            }
                        }
                    } else {
                        result.setErrors(null);
                    }
                }
               
                Element expirationTimeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "ExpirationTime");
                if (expirationTimeElement != null) {
                    Calendar expirationTimeInstance;
                    expirationTimeInstance = DatatypeConverter.parseDateTime(expirationTimeElement.getTextContent());
                    result.setExpirationTime(expirationTimeInstance);
                }
               
                Element geoMasterOperationIdElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "GeoMasterOperationId");
                if (geoMasterOperationIdElement != null) {
                    boolean isNil8 = false;
                    Attr nilAttribute8 = geoMasterOperationIdElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute8 != null) {
                        isNil8 = "true".equals(nilAttribute8.getValue());
                    }
                    if (isNil8 == false) {
                        String geoMasterOperationIdInstance;
                        geoMasterOperationIdInstance = geoMasterOperationIdElement.getTextContent();
                        result.setGeoMasterOperationId(geoMasterOperationIdInstance);
                    }
                }
               
                Element idElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Id");
                if (idElement != null) {
                    boolean isNil9 = false;
                    Attr nilAttribute9 = idElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute9 != null) {
                        isNil9 = "true".equals(nilAttribute9.getValue());
                    }
                    if (isNil9 == false) {
                        String idInstance;
                        idInstance = idElement.getTextContent();
                        result.setOperationId(idInstance);
                    }
                }
               
                Element modifiedTimeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "ModifiedTime");
                if (modifiedTimeElement != null) {
                    Calendar modifiedTimeInstance;
                    modifiedTimeInstance = DatatypeConverter.parseDateTime(modifiedTimeElement.getTextContent());
                    result.setModifiedTime(modifiedTimeInstance);
                }
               
                Element nameElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    boolean isNil10 = false;
                    Attr nilAttribute10 = nameElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute10 != null) {
                        isNil10 = "true".equals(nilAttribute10.getValue());
                    }
                    if (isNil10 == false) {
                        String nameInstance;
                        nameInstance = nameElement.getTextContent();
                        result.setName(nameInstance);
                    }
                }
               
                Element statusElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null) {
                    WebSiteOperationStatus statusInstance;
                    statusInstance = WebSiteOperationStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }
            }
           
            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);
            }
View Full Code Here


        try {
            if (shouldTrace) {
                client2 = this.getClient().withRequestFilterLast(new ClientRequestTrackingHandler(invocationId)).withResponseFilterLast(new ClientRequestTrackingHandler(invocationId));
            }
           
            WebSiteOperationStatusResponse response = client2.getWebSitesOperations().beginSwapingSlotsAsync(webSpaceName, webSiteName, sourceSlotName, targetSlotName).get();
            if (response.getStatus() == WebSiteOperationStatus.Succeeded) {
                return response;
            }
            WebSiteOperationStatusResponse result = client2.getOperationStatusAsync(webSpaceName, webSiteName, response.getOperationId()).get();
            int delayInSeconds = 30;
            if (client2.getLongRunningOperationInitialTimeout() >= 0) {
                delayInSeconds = client2.getLongRunningOperationInitialTimeout();
            }
            while ((result.getStatus() != WebSiteOperationStatus.InProgress) == false) {
                Thread.sleep(delayInSeconds * 1000);
                result = client2.getOperationStatusAsync(webSpaceName, webSiteName, response.getOperationId()).get();
                delayInSeconds = 30;
                if (client2.getLongRunningOperationRetryTimeout() >= 0) {
                    delayInSeconds = client2.getLongRunningOperationRetryTimeout();
                }
            }
           
            if (shouldTrace) {
                CloudTracing.exit(invocationId, result);
            }
           
            if (result.getStatus() != WebSiteOperationStatus.Succeeded) {
                if (result.getErrors() != null && result.getErrors().size() > 0) {
                    ServiceException ex = new ServiceException(result.getErrors().get(0).getCode() + " : " + result.getErrors().get(0).getMessage());
                    ex.setErrorCode(result.getErrors().get(0).getCode());
                    ex.setErrorMessage(result.getErrors().get(0).getMessage());
                    if (shouldTrace) {
                        CloudTracing.error(invocationId, ex);
                    }
                    throw ex;
                } else {
View Full Code Here

                }
                throw ex;
            }
           
            // Create Result
            WebSiteOperationStatusResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new WebSiteOperationStatusResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element operationElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Operation");
            if (operationElement != null) {
                Element createdTimeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "CreatedTime");
                if (createdTimeElement != null) {
                    Calendar createdTimeInstance;
                    createdTimeInstance = DatatypeConverter.parseDateTime(createdTimeElement.getTextContent());
                    result.setCreatedTime(createdTimeInstance);
                }
               
                Element errorsSequenceElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Errors");
                if (errorsSequenceElement != null) {
                    boolean isNil = false;
                    Attr nilAttribute = errorsSequenceElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute != null) {
                        isNil = "true".equals(nilAttribute.getValue());
                    }
                    if (isNil == false) {
                        for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(errorsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Error").size(); i1 = i1 + 1) {
                            org.w3c.dom.Element errorsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(errorsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Error").get(i1));
                            WebSiteOperationStatusResponse.Error errorInstance = new WebSiteOperationStatusResponse.Error();
                            result.getErrors().add(errorInstance);
                           
                            Element codeElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "Code");
                            if (codeElement != null) {
                                boolean isNil2 = false;
                                Attr nilAttribute2 = codeElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute2 != null) {
                                    isNil2 = "true".equals(nilAttribute2.getValue());
                                }
                                if (isNil2 == false) {
                                    String codeInstance;
                                    codeInstance = codeElement.getTextContent();
                                    errorInstance.setCode(codeInstance);
                                }
                            }
                           
                            Element messageElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "Message");
                            if (messageElement != null) {
                                boolean isNil3 = false;
                                Attr nilAttribute3 = messageElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute3 != null) {
                                    isNil3 = "true".equals(nilAttribute3.getValue());
                                }
                                if (isNil3 == false) {
                                    String messageInstance;
                                    messageInstance = messageElement.getTextContent();
                                    errorInstance.setMessage(messageInstance);
                                }
                            }
                           
                            Element extendedCodeElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "ExtendedCode");
                            if (extendedCodeElement != null) {
                                boolean isNil4 = false;
                                Attr nilAttribute4 = extendedCodeElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute4 != null) {
                                    isNil4 = "true".equals(nilAttribute4.getValue());
                                }
                                if (isNil4 == false) {
                                    String extendedCodeInstance;
                                    extendedCodeInstance = extendedCodeElement.getTextContent();
                                    errorInstance.setExtendedCode(extendedCodeInstance);
                                }
                            }
                           
                            Element messageTemplateElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "MessageTemplate");
                            if (messageTemplateElement != null) {
                                boolean isNil5 = false;
                                Attr nilAttribute5 = messageTemplateElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute5 != null) {
                                    isNil5 = "true".equals(nilAttribute5.getValue());
                                }
                                if (isNil5 == false) {
                                    String messageTemplateInstance;
                                    messageTemplateInstance = messageTemplateElement.getTextContent();
                                    errorInstance.setMessageTemplate(messageTemplateInstance);
                                }
                            }
                           
                            Element parametersSequenceElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "Parameters");
                            if (parametersSequenceElement != null) {
                                boolean isNil6 = false;
                                Attr nilAttribute6 = parametersSequenceElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute6 != null) {
                                    isNil6 = "true".equals(nilAttribute6.getValue());
                                }
                                if (isNil6 == false) {
                                    for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(parametersSequenceElement, "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string").size(); i2 = i2 + 1) {
                                        org.w3c.dom.Element parametersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(parametersSequenceElement, "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string").get(i2));
                                        errorInstance.getParameters().add(parametersElement.getTextContent());
                                    }
                                } else {
                                    errorInstance.setParameters(null);
                                }
                            }
                           
                            Element innerErrorsElement = XmlUtility.getElementByTagNameNS(errorsElement, "http://schemas.microsoft.com/windowsazure", "InnerErrors");
                            if (innerErrorsElement != null) {
                                boolean isNil7 = false;
                                Attr nilAttribute7 = innerErrorsElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                                if (nilAttribute7 != null) {
                                    isNil7 = "true".equals(nilAttribute7.getValue());
                                }
                                if (isNil7 == false) {
                                    String innerErrorsInstance;
                                    innerErrorsInstance = innerErrorsElement.getTextContent();
                                    errorInstance.setInnerErrors(innerErrorsInstance);
                                }
                            }
                        }
                    } else {
                        result.setErrors(null);
                    }
                }
               
                Element expirationTimeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "ExpirationTime");
                if (expirationTimeElement != null) {
                    Calendar expirationTimeInstance;
                    expirationTimeInstance = DatatypeConverter.parseDateTime(expirationTimeElement.getTextContent());
                    result.setExpirationTime(expirationTimeInstance);
                }
               
                Element geoMasterOperationIdElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "GeoMasterOperationId");
                if (geoMasterOperationIdElement != null) {
                    boolean isNil8 = false;
                    Attr nilAttribute8 = geoMasterOperationIdElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute8 != null) {
                        isNil8 = "true".equals(nilAttribute8.getValue());
                    }
                    if (isNil8 == false) {
                        String geoMasterOperationIdInstance;
                        geoMasterOperationIdInstance = geoMasterOperationIdElement.getTextContent();
                        result.setGeoMasterOperationId(geoMasterOperationIdInstance);
                    }
                }
               
                Element idElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Id");
                if (idElement != null) {
                    boolean isNil9 = false;
                    Attr nilAttribute9 = idElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute9 != null) {
                        isNil9 = "true".equals(nilAttribute9.getValue());
                    }
                    if (isNil9 == false) {
                        String idInstance;
                        idInstance = idElement.getTextContent();
                        result.setOperationId(idInstance);
                    }
                }
               
                Element modifiedTimeElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "ModifiedTime");
                if (modifiedTimeElement != null) {
                    Calendar modifiedTimeInstance;
                    modifiedTimeInstance = DatatypeConverter.parseDateTime(modifiedTimeElement.getTextContent());
                    result.setModifiedTime(modifiedTimeInstance);
                }
               
                Element nameElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    boolean isNil10 = false;
                    Attr nilAttribute10 = nameElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    if (nilAttribute10 != null) {
                        isNil10 = "true".equals(nilAttribute10.getValue());
                    }
                    if (isNil10 == false) {
                        String nameInstance;
                        nameInstance = nameElement.getTextContent();
                        result.setName(nameInstance);
                    }
                }
               
                Element statusElement = XmlUtility.getElementByTagNameNS(operationElement, "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null) {
                    WebSiteOperationStatus statusInstance;
                    statusInstance = WebSiteOperationStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }
            }
           
            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);
            }
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.management.websites.models.WebSiteOperationStatusResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.