/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

package com.queplix.core.modules.eqlext.jxb.sr;

//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

/**
 * Class SreqType.
 *
 * @version $Revision$ $Date$
 */
public class SreqType extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

    //--------------------------/
    //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _name
     */
    private java.lang.String _name;

    /**
     * Field _formid
     */
    private java.lang.String _formid;

    /**
     * Check lock in database before records update
     */
    private java.lang.Boolean _checklock = new java.lang.Boolean("false");

    /**
     * Add information about updated record in response or not
     */
    private java.lang.Boolean _getresponse = new java.lang.Boolean("true");

    /**
     * Field _sreqRecordList
     */
    private java.util.ArrayList _sreqRecordList;

    //----------------/
    //- Constructors -/
    //----------------/

    public SreqType() {
        super();
        _sreqRecordList = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqType()

    //-----------/
    //- Methods -/
    //-----------/

    /**
     * Method addSreqRecord
     *
     * @param vSreqRecord
     */
    public void addSreqRecord(
            com.queplix.core.modules.eqlext.jxb.sr.SreqRecord vSreqRecord)
            throws java.lang.IndexOutOfBoundsException {
        _sreqRecordList.add(vSreqRecord);
    } //-- void addSreqRecord(com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) 

    /**
     * Method addSreqRecord
     *
     * @param index
     * @param vSreqRecord
     */
    public void addSreqRecord(int index,
                              com.queplix.core.modules.eqlext.jxb.sr.SreqRecord vSreqRecord)
            throws java.lang.IndexOutOfBoundsException {
        _sreqRecordList.add(index, vSreqRecord);
    } //-- void addSreqRecord(int, com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) 

    /**
     * Method clearSreqRecord
     */
    public void clearSreqRecord() {
        _sreqRecordList.clear();
    } //-- void clearSreqRecord() 

    /**
     * Method enumerateSreqRecord
     *
     * @return Enumeration
     */
    public java.util.Enumeration enumerateSreqRecord() {
        return new org.exolab.castor.util.IteratorEnumeration(
                _sreqRecordList.iterator());
    } //-- java.util.Enumeration enumerateSreqRecord() 

    /**
     * Returns the value of field 'checklock'. The field
     * 'checklock' has the following description: Check lock in
     * database before records update
     *
     * @return the value of field 'checklock'.
     */
    public java.lang.Boolean getChecklock() {
        return this._checklock;
    } //-- java.lang.Boolean getChecklock() 

    /**
     * Returns the value of field 'formid'.
     *
     * @return the value of field 'formid'.
     */
    public java.lang.String getFormid() {
        return this._formid;
    } //-- java.lang.String getFormid() 

    /**
     * Returns the value of field 'getresponse'. The field
     * 'getresponse' has the following description: Add information
     * about updated record in response or not
     *
     * @return the value of field 'getresponse'.
     */
    public java.lang.Boolean getGetresponse() {
        return this._getresponse;
    } //-- java.lang.Boolean getGetresponse() 

    /**
     * Returns the value of field 'name'.
     *
     * @return the value of field 'name'.
     */
    public java.lang.String getName() {
        return this._name;
    } //-- java.lang.String getName() 

    /**
     * Method getSreqRecord
     *
     * @param index
     * @return SreqRecord
     */
    public com.queplix.core.modules.eqlext.jxb.sr.SreqRecord getSreqRecord(
            int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _sreqRecordList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) _sreqRecordList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqRecord getSreqRecord(int) 

    /**
     * Method getSreqRecord
     *
     * @return SreqRecord
     */
    public com.queplix.core.modules.eqlext.jxb.sr.SreqRecord[] getSreqRecord() {
        int size = _sreqRecordList.size();
        com.queplix.core.modules.eqlext.jxb.sr.SreqRecord[] mArray
                = new com.queplix.core.modules.eqlext.jxb.sr.SreqRecord[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) _sreqRecordList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqRecord[] getSreqRecord() 

    /**
     * Method getSreqRecordCount
     *
     * @return int
     */
    public int getSreqRecordCount() {
        return _sreqRecordList.size();
    } //-- int getSreqRecordCount() 

    /**
     * Method isValid
     *
     * @return boolean
     */
    public boolean isValid() {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method marshal
     *
     * @param out
     */
    public void marshal(java.io.Writer out)
            throws org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {

        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * Method marshal
     *
     * @param handler
     */
    public void marshal(org.xml.sax.ContentHandler handler)
            throws java.io.IOException, org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {

        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     * Method removeSreqRecord
     *
     * @param vSreqRecord
     * @return boolean
     */
    public boolean removeSreqRecord(
            com.queplix.core.modules.eqlext.jxb.sr.SreqRecord vSreqRecord) {
        boolean removed = _sreqRecordList.remove(vSreqRecord);
        return removed;
    } //-- boolean removeSreqRecord(com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) 

    /**
     * Sets the value of field 'checklock'. The field 'checklock'
     * has the following description: Check lock in database before
     * records update
     *
     * @param checklock the value of field 'checklock'.
     */
    public void setChecklock(java.lang.Boolean checklock) {
        this._checklock = checklock;
    } //-- void setChecklock(java.lang.Boolean) 

    /**
     * Sets the value of field 'formid'.
     *
     * @param formid the value of field 'formid'.
     */
    public void setFormid(java.lang.String formid) {
        this._formid = formid;
    } //-- void setFormid(java.lang.String) 

    /**
     * Sets the value of field 'getresponse'. The field
     * 'getresponse' has the following description: Add information
     * about updated record in response or not
     *
     * @param getresponse the value of field 'getresponse'.
     */
    public void setGetresponse(java.lang.Boolean getresponse) {
        this._getresponse = getresponse;
    } //-- void setGetresponse(java.lang.Boolean) 

    /**
     * Sets the value of field 'name'.
     *
     * @param name the value of field 'name'.
     */
    public void setName(java.lang.String name) {
        this._name = name;
    } //-- void setName(java.lang.String) 

    /**
     * Method setSreqRecord
     *
     * @param index
     * @param vSreqRecord
     */
    public void setSreqRecord(int index,
                              com.queplix.core.modules.eqlext.jxb.sr.SreqRecord vSreqRecord)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _sreqRecordList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _sreqRecordList.set(index, vSreqRecord);
    } //-- void setSreqRecord(int, com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) 

    /**
     * Method setSreqRecord
     *
     * @param sreqRecordArray
     */
    public void setSreqRecord(
            com.queplix.core.modules.eqlext.jxb.sr.SreqRecord[] sreqRecordArray) {
        //-- copy array
        _sreqRecordList.clear();
        for(int i = 0; i < sreqRecordArray.length; i++) {
            _sreqRecordList.add(sreqRecordArray[i]);
        }
    } //-- void setSreqRecord(com.queplix.core.modules.eqlext.jxb.sr.SreqRecord) 

    /**
     * Method unmarshal
     *
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
            throws org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {
        return (com.queplix.core.modules.eqlext.jxb.sr.SreqType) Unmarshaller
                .unmarshal(
                        com.queplix.core.modules.eqlext.jxb.sr.SreqType.class,
                        reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     */
    public void validate()
            throws org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Validator validator
                = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
