/*
 * An XML document type.
 * Localname: SubscriptionEnd
 * Namespace: http://schemas.xmlsoap.org/ws/2004/08/eventing
 * Java type: org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument
 *
 * Automatically generated - do not modify.
 */
package org.activemq.ws.xmlbeans.eventing.impl;
/**
 * A document containing one SubscriptionEnd(@http://schemas.xmlsoap.org/ws/2004/08/eventing) element.
 *
 * This is a complex type.
 */
public class SubscriptionEndDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument
{
    
    public SubscriptionEndDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName SUBSCRIPTIONEND$0 = 
        new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "SubscriptionEnd");
    
    
    /**
     * Gets the "SubscriptionEnd" element
     */
    public org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd getSubscriptionEnd()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd target = null;
            target = (org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd)get_store().find_element_user(SUBSCRIPTIONEND$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "SubscriptionEnd" element
     */
    public void setSubscriptionEnd(org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd subscriptionEnd)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd target = null;
            target = (org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd)get_store().find_element_user(SUBSCRIPTIONEND$0, 0);
            if (target == null)
            {
                target = (org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd)get_store().add_element_user(SUBSCRIPTIONEND$0);
            }
            target.set(subscriptionEnd);
        }
    }
    
    /**
     * Appends and returns a new empty "SubscriptionEnd" element
     */
    public org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd addNewSubscriptionEnd()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd target = null;
            target = (org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd)get_store().add_element_user(SUBSCRIPTIONEND$0);
            return target;
        }
    }
    /**
     * An XML SubscriptionEnd(@http://schemas.xmlsoap.org/ws/2004/08/eventing).
     *
     * This is a complex type.
     */
    public static class SubscriptionEndImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.activemq.ws.xmlbeans.eventing.SubscriptionEndDocument.SubscriptionEnd
    {
        
        public SubscriptionEndImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType);
        }
        
        private static final javax.xml.namespace.QName SUBSCRIPTIONMANAGER$0 = 
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "SubscriptionManager");
        private static final javax.xml.namespace.QName STATUS$2 = 
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Status");
        private static final javax.xml.namespace.QName REASON$4 = 
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Reason");
        
        
        /**
         * Gets the "SubscriptionManager" element
         */
        public org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType getSubscriptionManager()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType target = null;
                target = (org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType)get_store().find_element_user(SUBSCRIPTIONMANAGER$0, 0);
                if (target == null)
                {
                    return null;
                }
                return target;
            }
        }
        
        /**
         * Sets the "SubscriptionManager" element
         */
        public void setSubscriptionManager(org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType subscriptionManager)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType target = null;
                target = (org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType)get_store().find_element_user(SUBSCRIPTIONMANAGER$0, 0);
                if (target == null)
                {
                    target = (org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType)get_store().add_element_user(SUBSCRIPTIONMANAGER$0);
                }
                target.set(subscriptionManager);
            }
        }
        
        /**
         * Appends and returns a new empty "SubscriptionManager" element
         */
        public org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType addNewSubscriptionManager()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType target = null;
                target = (org.activemq.ws.xmlbeans.addressing.v2004_08.EndpointReferenceType)get_store().add_element_user(SUBSCRIPTIONMANAGER$0);
                return target;
            }
        }
        
        /**
         * Gets the "Status" element
         */
        public java.lang.String getStatus()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STATUS$2, 0);
                if (target == null)
                {
                    return null;
                }
                return target.getStringValue();
            }
        }
        
        /**
         * Gets (as xml) the "Status" element
         */
        public org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType xgetStatus()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType target = null;
                target = (org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType)get_store().find_element_user(STATUS$2, 0);
                return target;
            }
        }
        
        /**
         * Sets the "Status" element
         */
        public void setStatus(java.lang.String status)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STATUS$2, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(STATUS$2);
                }
                target.setStringValue(status);
            }
        }
        
        /**
         * Sets (as xml) the "Status" element
         */
        public void xsetStatus(org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType status)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType target = null;
                target = (org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType)get_store().find_element_user(STATUS$2, 0);
                if (target == null)
                {
                    target = (org.activemq.ws.xmlbeans.eventing.OpenSubscriptionEndCodeType)get_store().add_element_user(STATUS$2);
                }
                target.set(status);
            }
        }
        
        /**
         * Gets array of all "Reason" elements
         */
        public org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType[] getReasonArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List targetList = new java.util.ArrayList();
                get_store().find_all_element_users(REASON$4, targetList);
                org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType[] result = new org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "Reason" element
         */
        public org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType getReasonArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType target = null;
                target = (org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType)get_store().find_element_user(REASON$4, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "Reason" element
         */
        public int sizeOfReasonArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(REASON$4);
            }
        }
        
        /**
         * Sets array of all "Reason" element
         */
        public void setReasonArray(org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType[] reasonArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(reasonArray, REASON$4);
            }
        }
        
        /**
         * Sets ith "Reason" element
         */
        public void setReasonArray(int i, org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType reason)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType target = null;
                target = (org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType)get_store().find_element_user(REASON$4, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(reason);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "Reason" element
         */
        public org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType insertNewReason(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType target = null;
                target = (org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType)get_store().insert_element_user(REASON$4, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "Reason" element
         */
        public org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType addNewReason()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType target = null;
                target = (org.activemq.ws.xmlbeans.eventing.LanguageSpecificStringType)get_store().add_element_user(REASON$4);
                return target;
            }
        }
        
        /**
         * Removes the ith "Reason" element
         */
        public void removeReason(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(REASON$4, i);
            }
        }
    }
}
