/*
 * 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.gr;

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

import com.queplix.core.utils.log.AbstractLogger;
import com.queplix.core.utils.log.Log;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

/**
 * Class ReqFilterType.
 *
 * @version $Revision$ $Date$
 */
public class ReqFilterType extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {
    private static final AbstractLogger logger = Log.getLog(
            ReqFilterType.class);

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

    /**
     * Entity name
     */
    private java.lang.String _entity;

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

    /**
     * Takes listfield value instead field value
     */
    private java.lang.Boolean _usetextfield = new java.lang.Boolean("false");

    /**
     * How to chain req-filter-values
     */
    private com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType _conditiontype
            = com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType
            .valueOf("or");

    /**
     * Used on client side
     */
    private java.lang.String _formid;

    /**
     * Used on client side
     */
    private java.lang.String _tabid;

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

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

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

    public ReqFilterType() {
        super();
        setConditiontype(
                com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType.valueOf(
                        "or"));
        _reqFilterValueList = new ArrayList();
        _reqFilterTextList = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ReqFilterType()

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

    /**
     * Method addReqFilterText
     *
     * @param vReqFilterText
     */
    public void addReqFilterText(java.lang.String vReqFilterText)
            throws java.lang.IndexOutOfBoundsException {
        _reqFilterTextList.add(vReqFilterText);
    } //-- void addReqFilterText(java.lang.String) 

    /**
     * Method addReqFilterText
     *
     * @param index
     * @param vReqFilterText
     */
    public void addReqFilterText(int index, java.lang.String vReqFilterText)
            throws java.lang.IndexOutOfBoundsException {
        _reqFilterTextList.add(index, vReqFilterText);
    } //-- void addReqFilterText(int, java.lang.String) 

    /**
     * Method addReqFilterValue
     *
     * @param vReqFilterValue
     */
    public void addReqFilterValue(java.lang.String vReqFilterValue)
            throws java.lang.IndexOutOfBoundsException {
        _reqFilterValueList.add(vReqFilterValue);
    } //-- void addReqFilterValue(java.lang.String) 

    /**
     * Method addReqFilterValue
     *
     * @param index
     * @param vReqFilterValue
     */
    public void addReqFilterValue(int index, java.lang.String vReqFilterValue)
            throws java.lang.IndexOutOfBoundsException {
        _reqFilterValueList.add(index, vReqFilterValue);
    } //-- void addReqFilterValue(int, java.lang.String) 

    /**
     * Method clearReqFilterText
     */
    public void clearReqFilterText() {
        _reqFilterTextList.clear();
    } //-- void clearReqFilterText() 

    /**
     * Method clearReqFilterValue
     */
    public void clearReqFilterValue() {
        _reqFilterValueList.clear();
    } //-- void clearReqFilterValue() 

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

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

    /**
     * Returns the value of field 'conditiontype'. The field
     * 'conditiontype' has the following description: How to chain
     * req-filter-values
     *
     * @return the value of field 'conditiontype'.
     */
    public com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType getConditiontype() {
        return this._conditiontype;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType getConditiontype() 

    /**
     * Returns the value of field 'entity'. The field 'entity' has
     * the following description: Entity name
     *
     * @return the value of field 'entity'.
     */
    public java.lang.String getEntity() {
        return this._entity;
    } //-- java.lang.String getEntity() 

    /**
     * Returns the value of field 'formid'. The field 'formid' has
     * the following description: Used on client side
     *
     * @return the value of field 'formid'.
     */
    public java.lang.String getFormid() {
        return this._formid;
    } //-- java.lang.String getFormid() 

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

    /**
     * Method getReqFilterText
     *
     * @param index
     * @return String
     */
    public java.lang.String getReqFilterText(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _reqFilterTextList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (String) _reqFilterTextList.get(index);
    } //-- java.lang.String getReqFilterText(int) 

    /**
     * Method getReqFilterText
     *
     * @return String
     */
    public java.lang.String[] getReqFilterText() {
        int size = _reqFilterTextList.size();
        java.lang.String[] mArray = new java.lang.String[size];
        for(int index = 0; index < size; index++) {
            mArray[index] = (String) _reqFilterTextList.get(index);
        }
        return mArray;
    } //-- java.lang.String[] getReqFilterText() 

    /**
     * Method getReqFilterTextCount
     *
     * @return int
     */
    public int getReqFilterTextCount() {
        return _reqFilterTextList.size();
    } //-- int getReqFilterTextCount() 

    /**
     * Method getReqFilterValue
     *
     * @param index
     * @return String
     */
    public java.lang.String getReqFilterValue(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _reqFilterValueList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (String) _reqFilterValueList.get(index);
    } //-- java.lang.String getReqFilterValue(int) 

    /**
     * Method getReqFilterValue
     *
     * @return String
     */
    public java.lang.String[] getReqFilterValue() {
        int size = _reqFilterValueList.size();
        java.lang.String[] mArray = new java.lang.String[size];
        for(int index = 0; index < size; index++) {
            mArray[index] = (String) _reqFilterValueList.get(index);
        }
        return mArray;
    } //-- java.lang.String[] getReqFilterValue() 

    /**
     * Method getReqFilterValueCount
     *
     * @return int
     */
    public int getReqFilterValueCount() {
        return _reqFilterValueList.size();
    } //-- int getReqFilterValueCount() 

    /**
     * Returns the value of field 'tabid'. The field 'tabid' has
     * the following description: Used on client side
     *
     * @return the value of field 'tabid'.
     */
    public java.lang.String getTabid() {
        return this._tabid;
    } //-- java.lang.String getTabid() 

    /**
     * Returns the value of field 'usetextfield'. The field
     * 'usetextfield' has the following description: Takes
     * listfield value instead field value
     *
     * @return the value of field 'usetextfield'.
     */
    public java.lang.Boolean getUsetextfield() {
        return this._usetextfield;
    } //-- java.lang.Boolean getUsetextfield() 

    /**
     * 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 removeReqFilterText
     *
     * @param vReqFilterText
     * @return boolean
     */
    public boolean removeReqFilterText(java.lang.String vReqFilterText) {
        boolean removed = _reqFilterTextList.remove(vReqFilterText);
        return removed;
    } //-- boolean removeReqFilterText(java.lang.String) 

    /**
     * Method removeReqFilterValue
     *
     * @param vReqFilterValue
     * @return boolean
     */
    public boolean removeReqFilterValue(java.lang.String vReqFilterValue) {
        boolean removed = _reqFilterValueList.remove(vReqFilterValue);
        return removed;
    } //-- boolean removeReqFilterValue(java.lang.String) 

    /**
     * Sets the value of field 'conditiontype'. The field
     * 'conditiontype' has the following description: How to chain
     * req-filter-values
     *
     * @param conditiontype the value of field 'conditiontype'.
     */
    public void setConditiontype(
            com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType conditiontype) {
        this._conditiontype = conditiontype;
    } //-- void setConditiontype(com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType) 

    /**
     * Sets the value of field 'entity'. The field 'entity' has the
     * following description: Entity name
     *
     * @param entity the value of field 'entity'.
     */
    public void setEntity(java.lang.String entity) {
        this._entity = entity;
    } //-- void setForm(java.lang.String)

    /**
     * Sets the value of field 'formid'. The field 'formid' has the
     * following description: Used on client side
     *
     * @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 'name'. The field 'name' has the
     * following description: 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 setReqFilterText
     *
     * @param index
     * @param vReqFilterText
     */
    public void setReqFilterText(int index, java.lang.String vReqFilterText)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _reqFilterTextList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _reqFilterTextList.set(index, vReqFilterText);
    } //-- void setReqFilterText(int, java.lang.String) 

    /**
     * Method setReqFilterText
     *
     * @param reqFilterTextArray
     */
    public void setReqFilterText(java.lang.String[] reqFilterTextArray) {
        //-- copy array
        _reqFilterTextList.clear();
        for(int i = 0; i < reqFilterTextArray.length; i++) {
            _reqFilterTextList.add(reqFilterTextArray[i]);
        }
    } //-- void setReqFilterText(java.lang.String) 

    /**
     * Method setReqFilterValue
     *
     * @param index
     * @param vReqFilterValue
     */
    public void setReqFilterValue(int index, java.lang.String vReqFilterValue)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _reqFilterValueList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _reqFilterValueList.set(index, vReqFilterValue);
    } //-- void setReqFilterValue(int, java.lang.String) 

    /**
     * Method setReqFilterValue
     *
     * @param reqFilterValueArray
     */
    public void setReqFilterValue(java.lang.String[] reqFilterValueArray) {
        //-- copy array
        _reqFilterValueList.clear();
        for(int i = 0; i < reqFilterValueArray.length; i++) {
            _reqFilterValueList.add(reqFilterValueArray[i]);
        }
    } //-- void setReqFilterValue(java.lang.String) 

    /**
     * Sets the value of field 'tabid'. The field 'tabid' has the
     * following description: Used on client side
     *
     * @param tabid the value of field 'tabid'.
     */
    public void setTabid(java.lang.String tabid) {
        this._tabid = tabid;
    } //-- void setTabid(java.lang.String) 

    /**
     * Sets the value of field 'usetextfield'. The field
     * 'usetextfield' has the following description: Takes
     * listfield value instead field value
     *
     * @param usetextfield the value of field 'usetextfield'.
     */
    public void setUsetextfield(java.lang.Boolean usetextfield) {
        this._usetextfield = usetextfield;
    } //-- void setUsetextfield(java.lang.Boolean) 

    /**
     * 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.gr.ReqFilterType) Unmarshaller
                .unmarshal(
                        com.queplix.core.modules.eqlext.jxb.gr.ReqFilterType.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() 

}
