/*
 * An XML document type.
 * Localname: RegisterPublisher
 * Namespace: http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd
 * Java type: org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument
 *
 * Automatically generated - do not modify.
 */
package org.activemq.ws.xmlbeans.notification.brokered.impl;
/**
 * A document containing one RegisterPublisher(@http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd) element.
 *
 * This is a complex type.
 */
public class RegisterPublisherDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument
{
    
    public RegisterPublisherDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName REGISTERPUBLISHER$0 = 
        new javax.xml.namespace.QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd", "RegisterPublisher");
    
    
    /**
     * Gets the "RegisterPublisher" element
     */
    public org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher getRegisterPublisher()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher target = null;
            target = (org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher)get_store().find_element_user(REGISTERPUBLISHER$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "RegisterPublisher" element
     */
    public void setRegisterPublisher(org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher registerPublisher)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher target = null;
            target = (org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher)get_store().find_element_user(REGISTERPUBLISHER$0, 0);
            if (target == null)
            {
                target = (org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher)get_store().add_element_user(REGISTERPUBLISHER$0);
            }
            target.set(registerPublisher);
        }
    }
    
    /**
     * Appends and returns a new empty "RegisterPublisher" element
     */
    public org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher addNewRegisterPublisher()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher target = null;
            target = (org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher)get_store().add_element_user(REGISTERPUBLISHER$0);
            return target;
        }
    }
    /**
     * An XML RegisterPublisher(@http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd).
     *
     * This is a complex type.
     */
    public static class RegisterPublisherImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.activemq.ws.xmlbeans.notification.brokered.RegisterPublisherDocument.RegisterPublisher
    {
        
        public RegisterPublisherImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType);
        }
        
        private static final javax.xml.namespace.QName PUBLISHERREFERENCE$0 = 
            new javax.xml.namespace.QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd", "PublisherReference");
        private static final javax.xml.namespace.QName TOPIC$2 = 
            new javax.xml.namespace.QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd", "Topic");
        private static final javax.xml.namespace.QName DEMAND$4 = 
            new javax.xml.namespace.QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd", "Demand");
        private static final javax.xml.namespace.QName INITIALTERMINATIONTIME$6 = 
            new javax.xml.namespace.QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd", "InitialTerminationTime");
        
        
        /**
         * Gets the "PublisherReference" element
         */
        public org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType getPublisherReference()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType target = null;
                target = (org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType)get_store().find_element_user(PUBLISHERREFERENCE$0, 0);
                if (target == null)
                {
                    return null;
                }
                return target;
            }
        }
        
        /**
         * True if has "PublisherReference" element
         */
        public boolean isSetPublisherReference()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(PUBLISHERREFERENCE$0) != 0;
            }
        }
        
        /**
         * Sets the "PublisherReference" element
         */
        public void setPublisherReference(org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType publisherReference)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType target = null;
                target = (org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType)get_store().find_element_user(PUBLISHERREFERENCE$0, 0);
                if (target == null)
                {
                    target = (org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType)get_store().add_element_user(PUBLISHERREFERENCE$0);
                }
                target.set(publisherReference);
            }
        }
        
        /**
         * Appends and returns a new empty "PublisherReference" element
         */
        public org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType addNewPublisherReference()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType target = null;
                target = (org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType)get_store().add_element_user(PUBLISHERREFERENCE$0);
                return target;
            }
        }
        
        /**
         * Unsets the "PublisherReference" element
         */
        public void unsetPublisherReference()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(PUBLISHERREFERENCE$0, 0);
            }
        }
        
        /**
         * Gets array of all "Topic" elements
         */
        public org.activemq.ws.xmlbeans.notification.base.TopicExpressionType[] getTopicArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List targetList = new java.util.ArrayList();
                get_store().find_all_element_users(TOPIC$2, targetList);
                org.activemq.ws.xmlbeans.notification.base.TopicExpressionType[] result = new org.activemq.ws.xmlbeans.notification.base.TopicExpressionType[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "Topic" element
         */
        public org.activemq.ws.xmlbeans.notification.base.TopicExpressionType getTopicArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.notification.base.TopicExpressionType target = null;
                target = (org.activemq.ws.xmlbeans.notification.base.TopicExpressionType)get_store().find_element_user(TOPIC$2, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "Topic" element
         */
        public int sizeOfTopicArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(TOPIC$2);
            }
        }
        
        /**
         * Sets array of all "Topic" element
         */
        public void setTopicArray(org.activemq.ws.xmlbeans.notification.base.TopicExpressionType[] topicArray)
        {
            synchronized (monitor())
            {
                check_orphaned();
                arraySetterHelper(topicArray, TOPIC$2);
            }
        }
        
        /**
         * Sets ith "Topic" element
         */
        public void setTopicArray(int i, org.activemq.ws.xmlbeans.notification.base.TopicExpressionType topic)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.notification.base.TopicExpressionType target = null;
                target = (org.activemq.ws.xmlbeans.notification.base.TopicExpressionType)get_store().find_element_user(TOPIC$2, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                target.set(topic);
            }
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "Topic" element
         */
        public org.activemq.ws.xmlbeans.notification.base.TopicExpressionType insertNewTopic(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.notification.base.TopicExpressionType target = null;
                target = (org.activemq.ws.xmlbeans.notification.base.TopicExpressionType)get_store().insert_element_user(TOPIC$2, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "Topic" element
         */
        public org.activemq.ws.xmlbeans.notification.base.TopicExpressionType addNewTopic()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.activemq.ws.xmlbeans.notification.base.TopicExpressionType target = null;
                target = (org.activemq.ws.xmlbeans.notification.base.TopicExpressionType)get_store().add_element_user(TOPIC$2);
                return target;
            }
        }
        
        /**
         * Removes the ith "Topic" element
         */
        public void removeTopic(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(TOPIC$2, i);
            }
        }
        
        /**
         * Gets the "Demand" element
         */
        public boolean getDemand()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DEMAND$4, 0);
                if (target == null)
                {
                    return false;
                }
                return target.getBooleanValue();
            }
        }
        
        /**
         * Gets (as xml) the "Demand" element
         */
        public org.apache.xmlbeans.XmlBoolean xgetDemand()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlBoolean target = null;
                target = (org.apache.xmlbeans.XmlBoolean)get_store().find_element_user(DEMAND$4, 0);
                return target;
            }
        }
        
        /**
         * True if has "Demand" element
         */
        public boolean isSetDemand()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(DEMAND$4) != 0;
            }
        }
        
        /**
         * Sets the "Demand" element
         */
        public void setDemand(boolean demand)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DEMAND$4, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(DEMAND$4);
                }
                target.setBooleanValue(demand);
            }
        }
        
        /**
         * Sets (as xml) the "Demand" element
         */
        public void xsetDemand(org.apache.xmlbeans.XmlBoolean demand)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlBoolean target = null;
                target = (org.apache.xmlbeans.XmlBoolean)get_store().find_element_user(DEMAND$4, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.XmlBoolean)get_store().add_element_user(DEMAND$4);
                }
                target.set(demand);
            }
        }
        
        /**
         * Unsets the "Demand" element
         */
        public void unsetDemand()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(DEMAND$4, 0);
            }
        }
        
        /**
         * Gets the "InitialTerminationTime" element
         */
        public java.util.Calendar getInitialTerminationTime()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(INITIALTERMINATIONTIME$6, 0);
                if (target == null)
                {
                    return null;
                }
                return target.getCalendarValue();
            }
        }
        
        /**
         * Gets (as xml) the "InitialTerminationTime" element
         */
        public org.apache.xmlbeans.XmlDateTime xgetInitialTerminationTime()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlDateTime target = null;
                target = (org.apache.xmlbeans.XmlDateTime)get_store().find_element_user(INITIALTERMINATIONTIME$6, 0);
                return target;
            }
        }
        
        /**
         * True if has "InitialTerminationTime" element
         */
        public boolean isSetInitialTerminationTime()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(INITIALTERMINATIONTIME$6) != 0;
            }
        }
        
        /**
         * Sets the "InitialTerminationTime" element
         */
        public void setInitialTerminationTime(java.util.Calendar initialTerminationTime)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(INITIALTERMINATIONTIME$6, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(INITIALTERMINATIONTIME$6);
                }
                target.setCalendarValue(initialTerminationTime);
            }
        }
        
        /**
         * Sets (as xml) the "InitialTerminationTime" element
         */
        public void xsetInitialTerminationTime(org.apache.xmlbeans.XmlDateTime initialTerminationTime)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlDateTime target = null;
                target = (org.apache.xmlbeans.XmlDateTime)get_store().find_element_user(INITIALTERMINATIONTIME$6, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.XmlDateTime)get_store().add_element_user(INITIALTERMINATIONTIME$6);
                }
                target.set(initialTerminationTime);
            }
        }
        
        /**
         * Unsets the "InitialTerminationTime" element
         */
        public void unsetInitialTerminationTime()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(INITIALTERMINATIONTIME$6, 0);
            }
        }
    }
}
