au.com.whitesquare.waf.command
Class ParameterRetriever

java.lang.Object
  extended byau.com.whitesquare.waf.command.ParameterRetriever
Direct Known Subclasses:
Action

public abstract class ParameterRetriever
extends Object


Last Modified $Date: 2006/08/09 22:17:24 $

Version:
$Revision: 1.8 $
Author:
Steve Mactaggart

Constructor Summary
ParameterRetriever()
           
 
Method Summary
protected  void addPostParseParameter(String code, int paramType, boolean mandatory, String description)
           
protected  void addRequestParameter(String code, int paramType)
          An overloaded version of the addRequestParameter method that defines the parameter as optional.
protected  void addRequestParameter(String code, int paramType, boolean mandatory, String description)
          Defines a parameter to be retreived from the request and mapped to a data type.
 Boolean getBoolean(String code)
           
 Float getFloat(String code)
           
 Integer getInteger(String code)
           
 Long getLong(String code)
           
 Object getObject(String code)
           
 Map getPostParseParams()
           
 String getRequestParameterCode(int i)
           
 int getRequestParameterCount()
           
protected  List getRequestParameters()
           
 Object getRequestParameterValue(int i)
           
 HttpSession getSession()
           
 String getString(String code)
           
 boolean isAddedToCommand()
           
protected  void setupPostParseFields()
          This function can be overridden in subclasses to allow parameter retrievers to setup post parse fields too.
protected  void setValidatedCommand(ValidatedCommand command)
           
protected  ParameterErrors validate()
          This method supports post parameter check validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterRetriever

public ParameterRetriever()
Method Detail

addRequestParameter

protected void addRequestParameter(String code,
                                   int paramType)
An overloaded version of the addRequestParameter method that defines the parameter as optional.

Parameters:
code - The data input field name/code to be parsed
paramType - A RequestParameter constant (INTEGER, STRING, etc..) to determine the fields datatype.

addRequestParameter

protected void addRequestParameter(String code,
                                   int paramType,
                                   boolean mandatory,
                                   String description)
Defines a parameter to be retreived from the request and mapped to a data type.
Automatic existance checking can be enabled by setting a mandatory flag to true. If the parameter is not supplied and marked as mandatory, a ParameterError will be generated and sent to the Command via the processParameterErrors() method.

Parameters:
code - The data input field name/code to be parsed
paramType - A RequestParameter constant (INTEGER, STRING, etc..) to determine the fields datatype.
mandatory - To flag that the parameter is required
description - The human readable name of the field.

getRequestParameters

protected List getRequestParameters()

getRequestParameterCount

public int getRequestParameterCount()

getRequestParameterCode

public String getRequestParameterCode(int i)

getRequestParameterValue

public Object getRequestParameterValue(int i)

setValidatedCommand

protected void setValidatedCommand(ValidatedCommand command)

isAddedToCommand

public boolean isAddedToCommand()

getString

public String getString(String code)

getLong

public Long getLong(String code)

getFloat

public Float getFloat(String code)

getObject

public Object getObject(String code)

getBoolean

public Boolean getBoolean(String code)

getInteger

public Integer getInteger(String code)

getSession

public HttpSession getSession()

validate

protected ParameterErrors validate()
This method supports post parameter check validation. If your command needs to do more complex validation than null and type checking, then by overriding this method you can implement your own manual checks, string length or that a parameter matches a specific pattern.

If any parameters are in error then return a ParameterErrors containing the errors that have occured and then parameterErrorExecute will be called.

Sub-classes should initise a ParameterErrors collection by calling super.validate().

Returns:
a set of errors on the current parameters;

setupPostParseFields

protected void setupPostParseFields()
This function can be overridden in subclasses to allow parameter retrievers to setup post parse fields too.


addPostParseParameter

protected final void addPostParseParameter(String code,
                                           int paramType,
                                           boolean mandatory,
                                           String description)

getPostParseParams

public Map getPostParseParams()
Returns:


Copyright © 2004 Whitesquare Software. All Rights Reserved.