/*
 * 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 org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

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

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

    /**
     * Chart's category field mapping
     */
    private com.queplix.core.modules.eqlext.jxb.gr.ChartCategoryField _chartCategoryField;

    /**
     * Chart's data fields mappings
     */
    private java.util.ArrayList _chartDataFieldList;

    /**
     * Warinig! Be informed that re-filter/@formId is required
     * attribute for chart definition
     */
    private com.queplix.core.modules.eqlext.jxb.gr.ReqFilters _reqFilters;

    /**
     * Chart's default additional eql filters
     */
    private java.lang.String _eqlFilters;

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

    public ChartReq() {
        super();
        _chartDataFieldList = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ChartReq()

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

    /**
     * Method addChartDataField
     *
     * @param vChartDataField
     */
    public void addChartDataField(
            com.queplix.core.modules.eqlext.jxb.gr.ChartDataField vChartDataField)
            throws java.lang.IndexOutOfBoundsException {
        _chartDataFieldList.add(vChartDataField);
    } //-- void addChartDataField(com.queplix.core.modules.eqlext.jxb.gr.ChartDataField) 

    /**
     * Method addChartDataField
     *
     * @param index
     * @param vChartDataField
     */
    public void addChartDataField(int index,
                                  com.queplix.core.modules.eqlext.jxb.gr.ChartDataField vChartDataField)
            throws java.lang.IndexOutOfBoundsException {
        _chartDataFieldList.add(index, vChartDataField);
    } //-- void addChartDataField(int, com.queplix.core.modules.eqlext.jxb.gr.ChartDataField) 

    /**
     * Method clearChartDataField
     */
    public void clearChartDataField() {
        _chartDataFieldList.clear();
    } //-- void clearChartDataField() 

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

    /**
     * Returns the value of field 'chartCategoryField'. The field
     * 'chartCategoryField' has the following description: Chart's
     * category field mapping
     *
     * @return the value of field 'chartCategoryField'.
     */
    public com.queplix.core.modules.eqlext.jxb.gr.ChartCategoryField getChartCategoryField() {
        return this._chartCategoryField;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ChartCategoryField getChartCategoryField() 

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

        return (com.queplix.core.modules.eqlext.jxb.gr.ChartDataField) _chartDataFieldList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ChartDataField getChartDataField(int) 

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

    /**
     * Method getChartDataFieldCount
     *
     * @return int
     */
    public int getChartDataFieldCount() {
        return _chartDataFieldList.size();
    } //-- int getChartDataFieldCount() 

    /**
     * Returns the value of field 'eqlFilters'. The field
     * 'eqlFilters' has the following description: Chart's default
     * additional eql filters
     *
     * @return the value of field 'eqlFilters'.
     */
    public java.lang.String getEqlFilters() {
        return this._eqlFilters;
    } //-- java.lang.String getEqlFilters() 

    /**
     * Returns the value of field 'reqFilters'. The field
     * 'reqFilters' has the following description: Warinig! Be
     * informed that re-filter/@formId is required attribute for
     * chart definition
     *
     * @return the value of field 'reqFilters'.
     */
    public com.queplix.core.modules.eqlext.jxb.gr.ReqFilters getReqFilters() {
        return this._reqFilters;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ReqFilters getReqFilters() 

    /**
     * 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 removeChartDataField
     *
     * @param vChartDataField
     * @return boolean
     */
    public boolean removeChartDataField(
            com.queplix.core.modules.eqlext.jxb.gr.ChartDataField vChartDataField) {
        boolean removed = _chartDataFieldList.remove(vChartDataField);
        return removed;
    } //-- boolean removeChartDataField(com.queplix.core.modules.eqlext.jxb.gr.ChartDataField) 

    /**
     * Sets the value of field 'chartCategoryField'. The field
     * 'chartCategoryField' has the following description: Chart's
     * category field mapping
     *
     * @param chartCategoryField the value of field
     *                           'chartCategoryField'.
     */
    public void setChartCategoryField(
            com.queplix.core.modules.eqlext.jxb.gr.ChartCategoryField chartCategoryField) {
        this._chartCategoryField = chartCategoryField;
    } //-- void setChartCategoryField(com.queplix.core.modules.eqlext.jxb.gr.ChartCategoryField) 

    /**
     * Method setChartDataField
     *
     * @param index
     * @param vChartDataField
     */
    public void setChartDataField(int index,
                                  com.queplix.core.modules.eqlext.jxb.gr.ChartDataField vChartDataField)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _chartDataFieldList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _chartDataFieldList.set(index, vChartDataField);
    } //-- void setChartDataField(int, com.queplix.core.modules.eqlext.jxb.gr.ChartDataField) 

    /**
     * Method setChartDataField
     *
     * @param chartDataFieldArray
     */
    public void setChartDataField(
            com.queplix.core.modules.eqlext.jxb.gr.ChartDataField[] chartDataFieldArray) {
        //-- copy array
        _chartDataFieldList.clear();
        for(int i = 0; i < chartDataFieldArray.length; i++) {
            _chartDataFieldList.add(chartDataFieldArray[i]);
        }
    } //-- void setChartDataField(com.queplix.core.modules.eqlext.jxb.gr.ChartDataField) 

    /**
     * Sets the value of field 'eqlFilters'. The field 'eqlFilters'
     * has the following description: Chart's default additional
     * eql filters
     *
     * @param eqlFilters the value of field 'eqlFilters'.
     */
    public void setEqlFilters(java.lang.String eqlFilters) {
        this._eqlFilters = eqlFilters;
    } //-- void setEqlFilters(java.lang.String) 

    /**
     * Sets the value of field 'reqFilters'. The field 'reqFilters'
     * has the following description: Warinig! Be informed that
     * re-filter/@formId is required attribute for chart definition
     *
     * @param reqFilters the value of field 'reqFilters'.
     */
    public void setReqFilters(
            com.queplix.core.modules.eqlext.jxb.gr.ReqFilters reqFilters) {
        this._reqFilters = reqFilters;
    } //-- void setReqFilters(com.queplix.core.modules.eqlext.jxb.gr.ReqFilters) 

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

}
