/*
 * An XML document type.
 * Localname: MessageData
 * Namespace: http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd
 * Java type: org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument
 *
 * Automatically generated - do not modify.
 */
package org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.impl;
/**
 * A document containing one MessageData(@http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd) element.
 *
 * This is a complex type.
 */
public class MessageDataDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument
{
    
    public MessageDataDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName MESSAGEDATA$0 = 
        new javax.xml.namespace.QName("http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd", "MessageData");
    
    
    /**
     * Gets the "MessageData" element
     */
    public org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData getMessageData()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData target = null;
            target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData)get_store().find_element_user(MESSAGEDATA$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "MessageData" element
     */
    public void setMessageData(org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData messageData)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData target = null;
            target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData)get_store().find_element_user(MESSAGEDATA$0, 0);
            if (target == null)
            {
                target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData)get_store().add_element_user(MESSAGEDATA$0);
            }
            target.set(messageData);
        }
    }
    
    /**
     * Appends and returns a new empty "MessageData" element
     */
    public org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData addNewMessageData()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData target = null;
            target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData)get_store().add_element_user(MESSAGEDATA$0);
            return target;
        }
    }
    /**
     * An XML MessageData(@http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd).
     *
     * This is a complex type.
     */
    public static class MessageDataImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.MessageDataDocument.MessageData
    {
        
        public MessageDataImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType);
        }
        
        private static final javax.xml.namespace.QName MESSAGEID$0 = 
            new javax.xml.namespace.QName("http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd", "MessageId");
        private static final javax.xml.namespace.QName TIMESTAMP$2 = 
            new javax.xml.namespace.QName("http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd", "Timestamp");
        private static final javax.xml.namespace.QName REFTOMESSAGEID$4 = 
            new javax.xml.namespace.QName("http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd", "RefToMessageId");
        private static final javax.xml.namespace.QName TIMETOLIVE$6 = 
            new javax.xml.namespace.QName("http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd", "TimeToLive");
        
        
        /**
         * Gets the "MessageId" element
         */
        public java.lang.String getMessageId()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(MESSAGEID$0, 0);
                if (target == null)
                {
                    return null;
                }
                return target.getStringValue();
            }
        }
        
        /**
         * Gets (as xml) the "MessageId" element
         */
        public org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString xgetMessageId()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString target = null;
                target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString)get_store().find_element_user(MESSAGEID$0, 0);
                return target;
            }
        }
        
        /**
         * Sets the "MessageId" element
         */
        public void setMessageId(java.lang.String messageId)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(MESSAGEID$0, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(MESSAGEID$0);
                }
                target.setStringValue(messageId);
            }
        }
        
        /**
         * Sets (as xml) the "MessageId" element
         */
        public void xsetMessageId(org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString messageId)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString target = null;
                target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString)get_store().find_element_user(MESSAGEID$0, 0);
                if (target == null)
                {
                    target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString)get_store().add_element_user(MESSAGEID$0);
                }
                target.set(messageId);
            }
        }
        
        /**
         * Gets the "Timestamp" element
         */
        public java.util.Calendar getTimestamp()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TIMESTAMP$2, 0);
                if (target == null)
                {
                    return null;
                }
                return target.getCalendarValue();
            }
        }
        
        /**
         * Gets (as xml) the "Timestamp" element
         */
        public org.apache.xmlbeans.XmlDateTime xgetTimestamp()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlDateTime target = null;
                target = (org.apache.xmlbeans.XmlDateTime)get_store().find_element_user(TIMESTAMP$2, 0);
                return target;
            }
        }
        
        /**
         * Sets the "Timestamp" element
         */
        public void setTimestamp(java.util.Calendar timestamp)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TIMESTAMP$2, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(TIMESTAMP$2);
                }
                target.setCalendarValue(timestamp);
            }
        }
        
        /**
         * Sets (as xml) the "Timestamp" element
         */
        public void xsetTimestamp(org.apache.xmlbeans.XmlDateTime timestamp)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlDateTime target = null;
                target = (org.apache.xmlbeans.XmlDateTime)get_store().find_element_user(TIMESTAMP$2, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.XmlDateTime)get_store().add_element_user(TIMESTAMP$2);
                }
                target.set(timestamp);
            }
        }
        
        /**
         * Gets the "RefToMessageId" element
         */
        public java.lang.String getRefToMessageId()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(REFTOMESSAGEID$4, 0);
                if (target == null)
                {
                    return null;
                }
                return target.getStringValue();
            }
        }
        
        /**
         * Gets (as xml) the "RefToMessageId" element
         */
        public org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString xgetRefToMessageId()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString target = null;
                target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString)get_store().find_element_user(REFTOMESSAGEID$4, 0);
                return target;
            }
        }
        
        /**
         * True if has "RefToMessageId" element
         */
        public boolean isSetRefToMessageId()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(REFTOMESSAGEID$4) != 0;
            }
        }
        
        /**
         * Sets the "RefToMessageId" element
         */
        public void setRefToMessageId(java.lang.String refToMessageId)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(REFTOMESSAGEID$4, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(REFTOMESSAGEID$4);
                }
                target.setStringValue(refToMessageId);
            }
        }
        
        /**
         * Sets (as xml) the "RefToMessageId" element
         */
        public void xsetRefToMessageId(org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString refToMessageId)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString target = null;
                target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString)get_store().find_element_user(REFTOMESSAGEID$4, 0);
                if (target == null)
                {
                    target = (org.oasisOpen.committees.ebxmlMsg.schema.msgHeader20.NonEmptyString)get_store().add_element_user(REFTOMESSAGEID$4);
                }
                target.set(refToMessageId);
            }
        }
        
        /**
         * Unsets the "RefToMessageId" element
         */
        public void unsetRefToMessageId()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(REFTOMESSAGEID$4, 0);
            }
        }
        
        /**
         * Gets the "TimeToLive" element
         */
        public java.util.Calendar getTimeToLive()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TIMETOLIVE$6, 0);
                if (target == null)
                {
                    return null;
                }
                return target.getCalendarValue();
            }
        }
        
        /**
         * Gets (as xml) the "TimeToLive" element
         */
        public org.apache.xmlbeans.XmlDateTime xgetTimeToLive()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlDateTime target = null;
                target = (org.apache.xmlbeans.XmlDateTime)get_store().find_element_user(TIMETOLIVE$6, 0);
                return target;
            }
        }
        
        /**
         * True if has "TimeToLive" element
         */
        public boolean isSetTimeToLive()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(TIMETOLIVE$6) != 0;
            }
        }
        
        /**
         * Sets the "TimeToLive" element
         */
        public void setTimeToLive(java.util.Calendar timeToLive)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TIMETOLIVE$6, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(TIMETOLIVE$6);
                }
                target.setCalendarValue(timeToLive);
            }
        }
        
        /**
         * Sets (as xml) the "TimeToLive" element
         */
        public void xsetTimeToLive(org.apache.xmlbeans.XmlDateTime timeToLive)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlDateTime target = null;
                target = (org.apache.xmlbeans.XmlDateTime)get_store().find_element_user(TIMETOLIVE$6, 0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.XmlDateTime)get_store().add_element_user(TIMETOLIVE$6);
                }
                target.set(timeToLive);
            }
        }
        
        /**
         * Unsets the "TimeToLive" element
         */
        public void unsetTimeToLive()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(TIMETOLIVE$6, 0);
            }
        }
    }
}
