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

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

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

import java.util.ArrayList;

/**
 * The custom update scripts description
 *
 * @version $Revision$ $Date$
 */
public class Scripts extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

    /**
     * Script which executes after get new record
     */
    private java.util.ArrayList _afternewList;

    /**
     * Script which executes before update/insert operations
     */
    private java.util.ArrayList _beforeupdateList;

    /**
     * Script which executes instead of update/insert operations
     */
    private com.queplix.core.jxb.entity.Update _update;

    /**
     * Script which executes after update/insert operations
     */
    private java.util.ArrayList _afterupdateList;

    /**
     * Script which executes before delete operation
     */
    private java.util.ArrayList _beforedeleteList;

    /**
     * Script which executes instead of delete operation
     */
    private com.queplix.core.jxb.entity.Delete _delete;

    /**
     * Script which executes after delete operation
     */
    private java.util.ArrayList _afterdeleteList;

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

    public Scripts() {
        super();
        _afternewList = new ArrayList();
        _beforeupdateList = new ArrayList();
        _afterupdateList = new ArrayList();
        _beforedeleteList = new ArrayList();
        _afterdeleteList = new ArrayList();
    } //-- com.queplix.core.jxb.entity.Scripts()

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

    /**
     * Method addAfterdelete
     *
     * @param vAfterdelete
     */
    public void addAfterdelete(
            com.queplix.core.jxb.entity.Afterdelete vAfterdelete)
            throws java.lang.IndexOutOfBoundsException {
        _afterdeleteList.add(vAfterdelete);
    } //-- void addAfterdelete(com.queplix.core.jxb.entity.Afterdelete) 

    /**
     * Method addAfterdelete
     *
     * @param index
     * @param vAfterdelete
     */
    public void addAfterdelete(int index,
                               com.queplix.core.jxb.entity.Afterdelete vAfterdelete)
            throws java.lang.IndexOutOfBoundsException {
        _afterdeleteList.add(index, vAfterdelete);
    } //-- void addAfterdelete(int, com.queplix.core.jxb.entity.Afterdelete) 

    /**
     * Method addAfternew
     *
     * @param vAfternew
     */
    public void addAfternew(com.queplix.core.jxb.entity.Afternew vAfternew)
            throws java.lang.IndexOutOfBoundsException {
        _afternewList.add(vAfternew);
    } //-- void addAfternew(com.queplix.core.jxb.entity.Afternew) 

    /**
     * Method addAfternew
     *
     * @param index
     * @param vAfternew
     */
    public void addAfternew(int index,
                            com.queplix.core.jxb.entity.Afternew vAfternew)
            throws java.lang.IndexOutOfBoundsException {
        _afternewList.add(index, vAfternew);
    } //-- void addAfternew(int, com.queplix.core.jxb.entity.Afternew) 

    /**
     * Method addAfterupdate
     *
     * @param vAfterupdate
     */
    public void addAfterupdate(
            com.queplix.core.jxb.entity.Afterupdate vAfterupdate)
            throws java.lang.IndexOutOfBoundsException {
        _afterupdateList.add(vAfterupdate);
    } //-- void addAfterupdate(com.queplix.core.jxb.entity.Afterupdate) 

    /**
     * Method addAfterupdate
     *
     * @param index
     * @param vAfterupdate
     */
    public void addAfterupdate(int index,
                               com.queplix.core.jxb.entity.Afterupdate vAfterupdate)
            throws java.lang.IndexOutOfBoundsException {
        _afterupdateList.add(index, vAfterupdate);
    } //-- void addAfterupdate(int, com.queplix.core.jxb.entity.Afterupdate) 

    /**
     * Method addBeforedelete
     *
     * @param vBeforedelete
     */
    public void addBeforedelete(
            com.queplix.core.jxb.entity.Beforedelete vBeforedelete)
            throws java.lang.IndexOutOfBoundsException {
        _beforedeleteList.add(vBeforedelete);
    } //-- void addBeforedelete(com.queplix.core.jxb.entity.Beforedelete) 

    /**
     * Method addBeforedelete
     *
     * @param index
     * @param vBeforedelete
     */
    public void addBeforedelete(int index,
                                com.queplix.core.jxb.entity.Beforedelete vBeforedelete)
            throws java.lang.IndexOutOfBoundsException {
        _beforedeleteList.add(index, vBeforedelete);
    } //-- void addBeforedelete(int, com.queplix.core.jxb.entity.Beforedelete) 

    /**
     * Method addBeforeupdate
     *
     * @param vBeforeupdate
     */
    public void addBeforeupdate(
            com.queplix.core.jxb.entity.Beforeupdate vBeforeupdate)
            throws java.lang.IndexOutOfBoundsException {
        _beforeupdateList.add(vBeforeupdate);
    } //-- void addBeforeupdate(com.queplix.core.jxb.entity.Beforeupdate) 

    /**
     * Method addBeforeupdate
     *
     * @param index
     * @param vBeforeupdate
     */
    public void addBeforeupdate(int index,
                                com.queplix.core.jxb.entity.Beforeupdate vBeforeupdate)
            throws java.lang.IndexOutOfBoundsException {
        _beforeupdateList.add(index, vBeforeupdate);
    } //-- void addBeforeupdate(int, com.queplix.core.jxb.entity.Beforeupdate) 

    /**
     * Method clearAfterdelete
     */
    public void clearAfterdelete() {
        _afterdeleteList.clear();
    } //-- void clearAfterdelete() 

    /**
     * Method clearAfternew
     */
    public void clearAfternew() {
        _afternewList.clear();
    } //-- void clearAfternew() 

    /**
     * Method clearAfterupdate
     */
    public void clearAfterupdate() {
        _afterupdateList.clear();
    } //-- void clearAfterupdate() 

    /**
     * Method clearBeforedelete
     */
    public void clearBeforedelete() {
        _beforedeleteList.clear();
    } //-- void clearBeforedelete() 

    /**
     * Method clearBeforeupdate
     */
    public void clearBeforeupdate() {
        _beforeupdateList.clear();
    } //-- void clearBeforeupdate() 

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

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

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

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

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

    /**
     * Method getAfterdelete
     *
     * @param index
     * @return Afterdelete
     */
    public com.queplix.core.jxb.entity.Afterdelete getAfterdelete(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _afterdeleteList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.jxb.entity.Afterdelete) _afterdeleteList.get(
                index);
    } //-- com.queplix.core.jxb.entity.Afterdelete getAfterdelete(int) 

    /**
     * Method getAfterdelete
     *
     * @return Afterdelete
     */
    public com.queplix.core.jxb.entity.Afterdelete[] getAfterdelete() {
        int size = _afterdeleteList.size();
        com.queplix.core.jxb.entity.Afterdelete[] mArray
                = new com.queplix.core.jxb.entity.Afterdelete[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.jxb.entity.Afterdelete) _afterdeleteList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.jxb.entity.Afterdelete[] getAfterdelete() 

    /**
     * Method getAfterdeleteCount
     *
     * @return int
     */
    public int getAfterdeleteCount() {
        return _afterdeleteList.size();
    } //-- int getAfterdeleteCount() 

    /**
     * Method getAfternew
     *
     * @param index
     * @return Afternew
     */
    public com.queplix.core.jxb.entity.Afternew getAfternew(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _afternewList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.jxb.entity.Afternew) _afternewList.get(index);
    } //-- com.queplix.core.jxb.entity.Afternew getAfternew(int) 

    /**
     * Method getAfternew
     *
     * @return Afternew
     */
    public com.queplix.core.jxb.entity.Afternew[] getAfternew() {
        int size = _afternewList.size();
        com.queplix.core.jxb.entity.Afternew[] mArray
                = new com.queplix.core.jxb.entity.Afternew[size];
        for(int index = 0; index < size; index++) {
            mArray[index] = (com.queplix.core.jxb.entity.Afternew) _afternewList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.jxb.entity.Afternew[] getAfternew() 

    /**
     * Method getAfternewCount
     *
     * @return int
     */
    public int getAfternewCount() {
        return _afternewList.size();
    } //-- int getAfternewCount() 

    /**
     * Method getAfterupdate
     *
     * @param index
     * @return Afterupdate
     */
    public com.queplix.core.jxb.entity.Afterupdate getAfterupdate(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _afterupdateList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.jxb.entity.Afterupdate) _afterupdateList.get(
                index);
    } //-- com.queplix.core.jxb.entity.Afterupdate getAfterupdate(int) 

    /**
     * Method getAfterupdate
     *
     * @return Afterupdate
     */
    public com.queplix.core.jxb.entity.Afterupdate[] getAfterupdate() {
        int size = _afterupdateList.size();
        com.queplix.core.jxb.entity.Afterupdate[] mArray
                = new com.queplix.core.jxb.entity.Afterupdate[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.jxb.entity.Afterupdate) _afterupdateList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.jxb.entity.Afterupdate[] getAfterupdate() 

    /**
     * Method getAfterupdateCount
     *
     * @return int
     */
    public int getAfterupdateCount() {
        return _afterupdateList.size();
    } //-- int getAfterupdateCount() 

    /**
     * Method getBeforedelete
     *
     * @param index
     * @return Beforedelete
     */
    public com.queplix.core.jxb.entity.Beforedelete getBeforedelete(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _beforedeleteList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.jxb.entity.Beforedelete) _beforedeleteList.get(
                index);
    } //-- com.queplix.core.jxb.entity.Beforedelete getBeforedelete(int) 

    /**
     * Method getBeforedelete
     *
     * @return Beforedelete
     */
    public com.queplix.core.jxb.entity.Beforedelete[] getBeforedelete() {
        int size = _beforedeleteList.size();
        com.queplix.core.jxb.entity.Beforedelete[] mArray
                = new com.queplix.core.jxb.entity.Beforedelete[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.jxb.entity.Beforedelete) _beforedeleteList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.jxb.entity.Beforedelete[] getBeforedelete() 

    /**
     * Method getBeforedeleteCount
     *
     * @return int
     */
    public int getBeforedeleteCount() {
        return _beforedeleteList.size();
    } //-- int getBeforedeleteCount() 

    /**
     * Method getBeforeupdate
     *
     * @param index
     * @return Beforeupdate
     */
    public com.queplix.core.jxb.entity.Beforeupdate getBeforeupdate(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _beforeupdateList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.jxb.entity.Beforeupdate) _beforeupdateList.get(
                index);
    } //-- com.queplix.core.jxb.entity.Beforeupdate getBeforeupdate(int) 

    /**
     * Method getBeforeupdate
     *
     * @return Beforeupdate
     */
    public com.queplix.core.jxb.entity.Beforeupdate[] getBeforeupdate() {
        int size = _beforeupdateList.size();
        com.queplix.core.jxb.entity.Beforeupdate[] mArray
                = new com.queplix.core.jxb.entity.Beforeupdate[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.jxb.entity.Beforeupdate) _beforeupdateList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.jxb.entity.Beforeupdate[] getBeforeupdate() 

    /**
     * Method getBeforeupdateCount
     *
     * @return int
     */
    public int getBeforeupdateCount() {
        return _beforeupdateList.size();
    } //-- int getBeforeupdateCount() 

    /**
     * Returns the value of field 'delete'. The field 'delete' has
     * the following description: Script which executes instead of
     * delete operation
     *
     * @return the value of field 'delete'.
     */
    public com.queplix.core.jxb.entity.Delete getDelete() {
        return this._delete;
    } //-- com.queplix.core.jxb.entity.Delete getDelete() 

    /**
     * Returns the value of field 'update'. The field 'update' has
     * the following description: Script which executes instead of
     * update/insert operations
     *
     * @return the value of field 'update'.
     */
    public com.queplix.core.jxb.entity.Update getUpdate() {
        return this._update;
    } //-- com.queplix.core.jxb.entity.Update getUpdate() 

    /**
     * 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 removeAfterdelete
     *
     * @param vAfterdelete
     * @return boolean
     */
    public boolean removeAfterdelete(
            com.queplix.core.jxb.entity.Afterdelete vAfterdelete) {
        boolean removed = _afterdeleteList.remove(vAfterdelete);
        return removed;
    } //-- boolean removeAfterdelete(com.queplix.core.jxb.entity.Afterdelete) 

    /**
     * Method removeAfternew
     *
     * @param vAfternew
     * @return boolean
     */
    public boolean removeAfternew(
            com.queplix.core.jxb.entity.Afternew vAfternew) {
        boolean removed = _afternewList.remove(vAfternew);
        return removed;
    } //-- boolean removeAfternew(com.queplix.core.jxb.entity.Afternew) 

    /**
     * Method removeAfterupdate
     *
     * @param vAfterupdate
     * @return boolean
     */
    public boolean removeAfterupdate(
            com.queplix.core.jxb.entity.Afterupdate vAfterupdate) {
        boolean removed = _afterupdateList.remove(vAfterupdate);
        return removed;
    } //-- boolean removeAfterupdate(com.queplix.core.jxb.entity.Afterupdate) 

    /**
     * Method removeBeforedelete
     *
     * @param vBeforedelete
     * @return boolean
     */
    public boolean removeBeforedelete(
            com.queplix.core.jxb.entity.Beforedelete vBeforedelete) {
        boolean removed = _beforedeleteList.remove(vBeforedelete);
        return removed;
    } //-- boolean removeBeforedelete(com.queplix.core.jxb.entity.Beforedelete) 

    /**
     * Method removeBeforeupdate
     *
     * @param vBeforeupdate
     * @return boolean
     */
    public boolean removeBeforeupdate(
            com.queplix.core.jxb.entity.Beforeupdate vBeforeupdate) {
        boolean removed = _beforeupdateList.remove(vBeforeupdate);
        return removed;
    } //-- boolean removeBeforeupdate(com.queplix.core.jxb.entity.Beforeupdate) 

    /**
     * Method setAfterdelete
     *
     * @param index
     * @param vAfterdelete
     */
    public void setAfterdelete(int index,
                               com.queplix.core.jxb.entity.Afterdelete vAfterdelete)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _afterdeleteList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _afterdeleteList.set(index, vAfterdelete);
    } //-- void setAfterdelete(int, com.queplix.core.jxb.entity.Afterdelete) 

    /**
     * Method setAfterdelete
     *
     * @param afterdeleteArray
     */
    public void setAfterdelete(
            com.queplix.core.jxb.entity.Afterdelete[] afterdeleteArray) {
        //-- copy array
        _afterdeleteList.clear();
        for(int i = 0; i < afterdeleteArray.length; i++) {
            _afterdeleteList.add(afterdeleteArray[i]);
        }
    } //-- void setAfterdelete(com.queplix.core.jxb.entity.Afterdelete) 

    /**
     * Method setAfternew
     *
     * @param index
     * @param vAfternew
     */
    public void setAfternew(int index,
                            com.queplix.core.jxb.entity.Afternew vAfternew)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _afternewList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _afternewList.set(index, vAfternew);
    } //-- void setAfternew(int, com.queplix.core.jxb.entity.Afternew) 

    /**
     * Method setAfternew
     *
     * @param afternewArray
     */
    public void setAfternew(
            com.queplix.core.jxb.entity.Afternew[] afternewArray) {
        //-- copy array
        _afternewList.clear();
        for(int i = 0; i < afternewArray.length; i++) {
            _afternewList.add(afternewArray[i]);
        }
    } //-- void setAfternew(com.queplix.core.jxb.entity.Afternew) 

    /**
     * Method setAfterupdate
     *
     * @param index
     * @param vAfterupdate
     */
    public void setAfterupdate(int index,
                               com.queplix.core.jxb.entity.Afterupdate vAfterupdate)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _afterupdateList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _afterupdateList.set(index, vAfterupdate);
    } //-- void setAfterupdate(int, com.queplix.core.jxb.entity.Afterupdate) 

    /**
     * Method setAfterupdate
     *
     * @param afterupdateArray
     */
    public void setAfterupdate(
            com.queplix.core.jxb.entity.Afterupdate[] afterupdateArray) {
        //-- copy array
        _afterupdateList.clear();
        for(int i = 0; i < afterupdateArray.length; i++) {
            _afterupdateList.add(afterupdateArray[i]);
        }
    } //-- void setAfterupdate(com.queplix.core.jxb.entity.Afterupdate) 

    /**
     * Method setBeforedelete
     *
     * @param index
     * @param vBeforedelete
     */
    public void setBeforedelete(int index,
                                com.queplix.core.jxb.entity.Beforedelete vBeforedelete)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _beforedeleteList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _beforedeleteList.set(index, vBeforedelete);
    } //-- void setBeforedelete(int, com.queplix.core.jxb.entity.Beforedelete) 

    /**
     * Method setBeforedelete
     *
     * @param beforedeleteArray
     */
    public void setBeforedelete(
            com.queplix.core.jxb.entity.Beforedelete[] beforedeleteArray) {
        //-- copy array
        _beforedeleteList.clear();
        for(int i = 0; i < beforedeleteArray.length; i++) {
            _beforedeleteList.add(beforedeleteArray[i]);
        }
    } //-- void setBeforedelete(com.queplix.core.jxb.entity.Beforedelete) 

    /**
     * Method setBeforeupdate
     *
     * @param index
     * @param vBeforeupdate
     */
    public void setBeforeupdate(int index,
                                com.queplix.core.jxb.entity.Beforeupdate vBeforeupdate)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _beforeupdateList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _beforeupdateList.set(index, vBeforeupdate);
    } //-- void setBeforeupdate(int, com.queplix.core.jxb.entity.Beforeupdate) 

    /**
     * Method setBeforeupdate
     *
     * @param beforeupdateArray
     */
    public void setBeforeupdate(
            com.queplix.core.jxb.entity.Beforeupdate[] beforeupdateArray) {
        //-- copy array
        _beforeupdateList.clear();
        for(int i = 0; i < beforeupdateArray.length; i++) {
            _beforeupdateList.add(beforeupdateArray[i]);
        }
    } //-- void setBeforeupdate(com.queplix.core.jxb.entity.Beforeupdate) 

    /**
     * Sets the value of field 'delete'. The field 'delete' has the
     * following description: Script which executes instead of
     * delete operation
     *
     * @param delete the value of field 'delete'.
     */
    public void setDelete(com.queplix.core.jxb.entity.Delete delete) {
        this._delete = delete;
    } //-- void setDelete(com.queplix.core.jxb.entity.Delete) 

    /**
     * Sets the value of field 'update'. The field 'update' has the
     * following description: Script which executes instead of
     * update/insert operations
     *
     * @param update the value of field 'update'.
     */
    public void setUpdate(com.queplix.core.jxb.entity.Update update) {
        this._update = update;
    } //-- void setUpdate(com.queplix.core.jxb.entity.Update) 

    /**
     * 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.jxb.entity.Scripts) Unmarshaller.unmarshal(
                com.queplix.core.jxb.entity.Scripts.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() 

}
