package org.apache.struts.webapp.example;


import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public final class ProjectForm extends ActionForm  {


    // --------------------------------------------------- Instance Variables


    /**
     * The maintenance action we are performing (Create or Edit).
     */
    private String action = "Create";


    /**
     * The Project ID.
     */
    private String prjId = null;


    /**
     * The Project name.
     */
    private String prjName = null;


    /**
     * The Module Id.
     */
    private String modId = null;


    /**
     * The Module Name.
     */
    private String modName = null;


    /**
     * The Sub-Module Id.
     */
    private String subModId = null;



    /**
     * The Sub-Module Name.
     */
    private String subModName = null;



    /**
     * The Sub-Module Type.
     */
    private String subModType = null;


    /**
     * The Sub-Module Specification.
     */
    private String subModSpec = null;

    /**
     * The Sub-Module Prototype.
     */
    private String subModProto = null;

    /**
     * The Sub-Module Development.
     */
    private String subModDev = null;

    /**
     * The Sub-Module Testing.
     */
    private String subModTst = null;


    /**
     * The Sub-Module Production.
     */
    private String subModProd = null;

    /**
     * The Sub-Module Announced.
     */
    private String subModAnc = null;

    // ----------------------------------------------------------- Properties


    /**
     * Return the maintenance action.
     */
    public String getAction() {

	return (this.action);

    }


    /**
     * Set the maintenance action.
     *
     * @param action The new maintenance action.
     */
    public void setAction(String action) {

        this.action = action;

    }


    /**
     * Return the Project ID.
     */
    public String getPrjId() {

	return (this.prjId);

    }


    /**
     * Set the Project Id.
     *
     */
    public void setPrjId(String prjId) {

        this.prjId = prjId;

    }

    /**
     * Return the Project Name.
     */
    public String getPrjName() {

	return (this.prjName);

    }


    /**
     * Set the Project Name.
     *
     */
    public void setPrjName(String prjName) {

        this.prjName = prjName;

    }

    /**
     * Return the Module Id.
     */
    public String getModId() {

	return (this.modId);

    }


    /**
     * Set the Module Id.
     *
     */
    public void setModId(String modId) {

        this.modId = modId;

    }

    /**
     * Return the Module Name.
     */
    public String getModName() {

	return (this.modName);

    }


    /**
     * Set the Module Name.
     *
     */
    public void setModName(String modName) {

        this.modName = modName;

    }

    /**
     * Return the Sub-Module Id.
     */
    public String getSubModId() {

	return (this.subModId);

    }


    /**
     * Set the Sub-Module Id.
     *
     */
    public void setSubModId(String subModId) {

        this.subModId = subModId;

    }

    /**
     * Return the Sub-Module Name.
     */
    public String getSubModName() {

	return (this.subModName);

    }


    /**
     * Set the Sub-Module Name.
     *
     */
    public void setSubModName(String subModName) {

        this.subModName = subModName;

    }

    /**
     * Return the Sub-Module Type.
     */
    public String getSubModType() {

	return (this.subModType);

    }


    /**
     * Set the Sub-Module Type.
     *
     */
    public void setSubModType(String subModType) {

        this.subModType = subModType;

    }

    /**
     * Return the Sub-Module Spec.
     */
    public String getSubModSpec() {

	return (this.subModSpec);

    }


    /**
     * Set the Sub-Module Spec.
     *
     */
    public void setSubModSpec(String subModSpec) {

        this.subModSpec = subModSpec;

    }

    /**
     * Return the Sub-Module Prototype.
     */
    public String getSubModProto() {

	return (this.subModProto);

    }


    /**
     * Set the Sub-Module Prototype.
     *
     */
    public void setSubModProto(String subModProto) {

        this.subModProto = subModProto;

    }

    /**
     * Return the Sub-Module Dev.
     */
    public String getSubModDev() {

	return (this.subModDev);

    }


    /**
     * Set the Sub-Module Dev.
     *
     */
    public void setSubModDev(String subModDev) {

        this.subModDev = subModDev;

    }

    /**
     * Return the Sub-Module Tst.
     */
    public String getSubModTst() {

	return (this.subModTst);

    }


    /**
     * Set the Sub-Module Tst.
     *
     */
    public void setSubModTst(String subModTst) {

        this.subModTst = subModTst;

    }

    /**
     * Return the Sub-Module Prod.
     */
    public String getSubModProd() {

	return (this.subModProd);

    }


    /**
     * Set the Sub-Module Prod.
     *
     */
    public void setSubModProd(String subModProd) {

        this.subModProd = subModProd;

    }

    /**
     * Return the Sub-Module Anc.
     */
    public String getSubModAnc() {

	return (this.subModAnc);

    }


    /**
     * Set the Sub-Module Anc.
     *
     */
    public void setSubModAnc(String subModAnc) {

        this.subModAnc = subModAnc;

    }




    // --------------------------------------------------------- Public Methods


    /**
     * Reset all properties to their default values.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {

        this.action = "Create";
        this.prjId = null;
        this.prjName = null;
        this.modId = null;
        this.modName = null;
        this.subModId = null;
        this.subModName = null;
        this.subModType = null;
        this.subModSpec = null;
        this.subModProto = null;
        this.subModDev = null;
        this.subModTst = null;
        this.subModProd = null;
        this.subModAnc = null;

    }


    /**
     * Validate the properties that have been set from this HTTP request,
     * and return an <code>ActionErrors</code> object that encapsulates any
     * validation errors that have been found.  If no errors are found, return
     * <code>null</code> or an <code>ActionErrors</code> object with no
     * recorded error messages.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
/*
        if ((prjId == null) || (prjId.length() < 1))
            errors.add("prjId",
                       new ActionError("error.prjId.required"));
*/
        if ((prjName == null) || (prjName.length() < 1))
            errors.add("prjName",
                       new ActionError("error.prjName.required"));
/*
        if ((modId == null) || (modId.length() < 1))
            errors.add("modId",
                       new ActionError("error.modId.required"));
*/

        return errors;

    }


}
