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

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

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

import java.util.ArrayList;

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

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

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

    /**
     * Field _autoStart
     */
    private java.lang.Boolean _autoStart = new java.lang.Boolean("false");

    /**
     * Field _repeat
     */
    private java.lang.Boolean _repeat = new java.lang.Boolean("false");

    /**
     * Field _delay
     */
    private java.lang.Integer _delay;

    /**
     * Field _delayunit
     */
    private com.queplix.core.modules.services.jxb.types.DelayunitSType _delayunit;

    /**
     * Field _id
     */
    private java.lang.Long _id;

    /**
     * Field _scriptId
     */
    private java.lang.Integer _scriptId;

    /**
     * Field _status
     */
    private com.queplix.core.modules.services.jxb.types.StatusSType _status;

    /**
     * Field _firstStart
     */
    private java.lang.Long _firstStart;

    /**
     * Field _nextStart
     */
    private java.lang.Long _nextStart;

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

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

    public Task() {
        super();
        _paramList = new ArrayList();
    } //-- com.queplix.core.modules.services.jxb.Task()

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

    /**
     * Method addParam
     *
     * @param vParam
     */
    public void addParam(com.queplix.core.modules.services.jxb.Param vParam)
            throws java.lang.IndexOutOfBoundsException {
        _paramList.add(vParam);
    } //-- void addParam(com.queplix.core.modules.services.jxb.Param) 

    /**
     * Method addParam
     *
     * @param index
     * @param vParam
     */
    public void addParam(int index,
                         com.queplix.core.modules.services.jxb.Param vParam)
            throws java.lang.IndexOutOfBoundsException {
        _paramList.add(index, vParam);
    } //-- void addParam(int, com.queplix.core.modules.services.jxb.Param) 

    /**
     * Method clearParam
     */
    public void clearParam() {
        _paramList.clear();
    } //-- void clearParam() 

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

    /**
     * Returns the value of field 'autoStart'.
     *
     * @return the value of field 'autoStart'.
     */
    public java.lang.Boolean getAutoStart() {
        return this._autoStart;
    } //-- java.lang.Boolean getAutoStart() 

    /**
     * Returns the value of field 'delay'.
     *
     * @return the value of field 'delay'.
     */
    public java.lang.Integer getDelay() {
        return this._delay;
    } //-- java.lang.Integer getDelay() 

    /**
     * Returns the value of field 'delayunit'.
     *
     * @return the value of field 'delayunit'.
     */
    public com.queplix.core.modules.services.jxb.types.DelayunitSType getDelayunit() {
        return this._delayunit;
    } //-- com.queplix.core.modules.services.jxb.types.DelayunitSType getDelayunit() 

    /**
     * Returns the value of field 'firstStart'.
     *
     * @return the value of field 'firstStart'.
     */
    public java.lang.Long getFirstStart() {
        return this._firstStart;
    } //-- java.lang.Long getFirstStart() 

    /**
     * Returns the value of field 'id'.
     *
     * @return the value of field 'id'.
     */
    public java.lang.Long getId() {
        return this._id;
    } //-- java.lang.Long getId() 

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

    /**
     * Returns the value of field 'nextStart'.
     *
     * @return the value of field 'nextStart'.
     */
    public java.lang.Long getNextStart() {
        return this._nextStart;
    } //-- java.lang.Long getNextStart() 

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

        return (com.queplix.core.modules.services.jxb.Param) _paramList.get(
                index);
    } //-- com.queplix.core.modules.services.jxb.Param getParam(int) 

    /**
     * Method getParam
     *
     * @return Param
     */
    public com.queplix.core.modules.services.jxb.Param[] getParam() {
        int size = _paramList.size();
        com.queplix.core.modules.services.jxb.Param[] mArray
                = new com.queplix.core.modules.services.jxb.Param[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.services.jxb.Param) _paramList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.services.jxb.Param[] getParam() 

    /**
     * Method getParamCount
     *
     * @return int
     */
    public int getParamCount() {
        return _paramList.size();
    } //-- int getParamCount() 

    /**
     * Returns the value of field 'repeat'.
     *
     * @return the value of field 'repeat'.
     */
    public java.lang.Boolean getRepeat() {
        return this._repeat;
    } //-- java.lang.Boolean getRepeat() 

    /**
     * Returns the value of field 'scriptId'.
     *
     * @return the value of field 'scriptId'.
     */
    public java.lang.Integer getScriptId() {
        return this._scriptId;
    } //-- java.lang.Integer getScriptId() 

    /**
     * Returns the value of field 'status'.
     *
     * @return the value of field 'status'.
     */
    public com.queplix.core.modules.services.jxb.types.StatusSType getStatus() {
        return this._status;
    } //-- com.queplix.core.modules.services.jxb.types.StatusSType getStatus() 

    /**
     * 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 removeParam
     *
     * @param vParam
     * @return boolean
     */
    public boolean removeParam(
            com.queplix.core.modules.services.jxb.Param vParam) {
        boolean removed = _paramList.remove(vParam);
        return removed;
    } //-- boolean removeParam(com.queplix.core.modules.services.jxb.Param) 

    /**
     * Sets the value of field 'autoStart'.
     *
     * @param autoStart the value of field 'autoStart'.
     */
    public void setAutoStart(java.lang.Boolean autoStart) {
        this._autoStart = autoStart;
    } //-- void setAutoStart(java.lang.Boolean) 

    /**
     * Sets the value of field 'delay'.
     *
     * @param delay the value of field 'delay'.
     */
    public void setDelay(java.lang.Integer delay) {
        this._delay = delay;
    } //-- void setDelay(java.lang.Integer) 

    /**
     * Sets the value of field 'delayunit'.
     *
     * @param delayunit the value of field 'delayunit'.
     */
    public void setDelayunit(
            com.queplix.core.modules.services.jxb.types.DelayunitSType delayunit) {
        this._delayunit = delayunit;
    } //-- void setDelayunit(com.queplix.core.modules.services.jxb.types.DelayunitSType) 

    /**
     * Sets the value of field 'firstStart'.
     *
     * @param firstStart the value of field 'firstStart'.
     */
    public void setFirstStart(java.lang.Long firstStart) {
        this._firstStart = firstStart;
    } //-- void setFirstStart(java.lang.Long) 

    /**
     * Sets the value of field 'id'.
     *
     * @param id the value of field 'id'.
     */
    public void setId(java.lang.Long id) {
        this._id = id;
    } //-- void setId(java.lang.Long) 

    /**
     * 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) 

    /**
     * Sets the value of field 'nextStart'.
     *
     * @param nextStart the value of field 'nextStart'.
     */
    public void setNextStart(java.lang.Long nextStart) {
        this._nextStart = nextStart;
    } //-- void setNextStart(java.lang.Long) 

    /**
     * Method setParam
     *
     * @param index
     * @param vParam
     */
    public void setParam(int index,
                         com.queplix.core.modules.services.jxb.Param vParam)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _paramList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _paramList.set(index, vParam);
    } //-- void setParam(int, com.queplix.core.modules.services.jxb.Param) 

    /**
     * Method setParam
     *
     * @param paramArray
     */
    public void setParam(
            com.queplix.core.modules.services.jxb.Param[] paramArray) {
        //-- copy array
        _paramList.clear();
        for(int i = 0; i < paramArray.length; i++) {
            _paramList.add(paramArray[i]);
        }
    } //-- void setParam(com.queplix.core.modules.services.jxb.Param) 

    /**
     * Sets the value of field 'repeat'.
     *
     * @param repeat the value of field 'repeat'.
     */
    public void setRepeat(java.lang.Boolean repeat) {
        this._repeat = repeat;
    } //-- void setRepeat(java.lang.Boolean) 

    /**
     * Sets the value of field 'scriptId'.
     *
     * @param scriptId the value of field 'scriptId'.
     */
    public void setScriptId(java.lang.Integer scriptId) {
        this._scriptId = scriptId;
    } //-- void setScriptId(java.lang.Integer) 

    /**
     * Sets the value of field 'status'.
     *
     * @param status the value of field 'status'.
     */
    public void setStatus(
            com.queplix.core.modules.services.jxb.types.StatusSType status) {
        this._status = status;
    } //-- void setStatus(com.queplix.core.modules.services.jxb.types.StatusSType) 

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

}
