org.objectweb.telosys.rpl
Class ScreenRequest

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.rpl.ScreenRequest
All Implemented Interfaces:
IRequestParameters

public class ScreenRequest
extends TelosysObject
implements IRequestParameters

Request object for a Screen Action Request
It contains all informations sent by the client side,
the request is built by parsing the XML input flow.


Constructor Summary
ScreenRequest(javax.servlet.http.HttpServletRequest httpRequest)
          Constructor
 
Method Summary
 void addView(ScreenRequestView v)
          Adds a view to the request
 boolean elementsAttributeContains(java.lang.String sArgElementName)
          Returns true if the "elements" attribute of the request contains the given element name
 java.lang.String getAction()
          Returns the action attribute of the request
 ScreenDataElement getDataElement(java.lang.String sElementName)
          Returns the element having the given name (or null if not found)
If there's multiple elements with the same name, the first element found is returned.
 java.lang.Object getDataElementInstance(java.lang.String sElementName)
          Returns the element object having the given name (or null if not found)
If there's multiple elements with the same name, the first element found is returned.
 java.lang.Object getDataElementInstance(java.lang.String sElementName, java.lang.Class clazz)
          Returns the element object having the given name and an instance of the given class (or null if not found)
If there's multiple elements with the same name, the first element found is returned.
 ScreenDataElements getDataElements()
          Returns the Screen Data Elements held by the request
NB : returns null if there's no DataElements in the request
 java.lang.String getElements()
          Returns the "elements" attribute of the request
 java.lang.String[] getElementsArray()
          Returns an array of elements name containing each element of the "elements" attribute
 boolean getFlagClearData()
          Returns the status of the "clear" flag
 boolean getFlagGetData()
          Returns the status of the "GET" flag
 boolean getFlagSetData()
          Returns the status of the "SET" flag
 javax.servlet.http.HttpServletRequest getHttpRequest()
          Returns the standard HTTP servlet request
 javax.servlet.http.HttpSession getHttpSession()
          Returns the standard HTTP session or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way
 java.lang.String getHttpSessionId()
          Returns the ID of the standard HTTP session
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way
 int getIntParameter(java.lang.String sParamName)
          Deprecated. use getParamAsInt
 boolean getParamAsBoolean(java.lang.String paramName)
          Returns the boolean value of the given parameter name.
 boolean getParamAsBoolean(java.lang.String paramName, boolean defaultValue)
          Returns the boolean value of the given parameter name.
 byte getParamAsByte(java.lang.String paramName)
          Returns the byte value of the given parameter name.
 byte getParamAsByte(java.lang.String paramName, byte defaultValue)
          Returns the byte value of the given parameter name.
 char getParamAsChar(java.lang.String paramName)
          Returns the char value of the given parameter name.
 char getParamAsChar(java.lang.String paramName, char defaultValue)
          Returns the char value of the given parameter name.
 java.util.Date getParamAsDate(java.lang.String paramName)
          Returns the date/time/datetime value of the given parameter name.
 java.util.Date getParamAsDate(java.lang.String paramName, java.util.Date defaultValue)
          Returns the date/time/datetime value of the given parameter name.
 double getParamAsDouble(java.lang.String paramName)
          Returns the double value of the given parameter name.
 double getParamAsDouble(java.lang.String paramName, double defaultValue)
          Returns the double value of the given parameter name.
 float getParamAsFloat(java.lang.String paramName)
          Returns the float value of the given parameter name.
 float getParamAsFloat(java.lang.String paramName, float defaultValue)
          Returns the float value of the given parameter name.
 int getParamAsInt(java.lang.String paramName)
          Returns the int value of the given parameter name.
 int getParamAsInt(java.lang.String paramName, int defaultValue)
          Returns the int value of the given parameter name.
 long getParamAsLong(java.lang.String paramName)
          Returns the long value of the given parameter name.
 long getParamAsLong(java.lang.String paramName, long defaultValue)
          Returns the long value of the given parameter name.
 short getParamAsShort(java.lang.String paramName)
          Returns the short value of the given parameter name.
 short getParamAsShort(java.lang.String paramName, short defaultValue)
          Returns the short value of the given parameter name.
 java.lang.String getParameter(java.lang.String sParamName)
          Returns the value of the given parameter name, or NULL if not found
 java.lang.String getParameter(java.lang.String paramName, java.lang.String defaultValue)
          Returns the value of the given parameter name, or the default value if not found
 java.util.Map getParameterMap()
          Returns the parameters as a Map instance
 ScreenRequestParameters getParameters()
           
 java.lang.String getProcName()
          Returns the procedure attribute of the request
 ScreenApplication getScreenApplication()
          Returns the ScreenApplication object associated with the current web app
or null if the ScreenApplication has not yet been created (opened)
It cannot returns null, unless the ServletContext has been corrupted by an external way
 java.lang.String getScreenId()
           
 java.lang.String getScreenName()
           
 ScreenSession getScreenSession()
          Returns the current ScreenSession associated with the request
or null if the HttpSession doesn't exist or if it doesn't contain a ScreenSession attribute
It cannot returns null, unless the HttpSession has been corrupted by an external way
 javax.servlet.ServletContext getServletContext()
          Returns the standard web app ServletContext
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way
 ScreenRequestView[] getViews()
          Returns the "views" of the request, or null if none
 boolean hasElementsAttribute()
          Returns true if the request has an "element" attribute
 boolean hasParameter()
          Returns true if there's at least one parameter in the request
 boolean hasViews()
          Returns true if the request has one or more "view"
 void setAction(java.lang.String action)
          Set the action attribute of the request
 void setElements(java.lang.String v)
          Set the "elements" attribute of the request
 void setFlagClearData(java.lang.String v)
          Sets the status of the "clear" flag
 void setFlagGetData(java.lang.String v)
          Sets the status of the "GET" flag
 void setFlagSetData(java.lang.String v)
          Sets the status of the "SET" flag
 void setParameter(java.lang.String sParamName, java.lang.String sParamValue)
          Sets a parameter in the request
 void setProcName(java.lang.String procName)
          Set the procedure attribute of the request
 void setScreenId(java.lang.String screenId)
           
 void setScreenName(java.lang.String screenName)
           
 void storeDataElement(java.lang.String sTagName, java.lang.Object objData)
          Adds a new element in the request elements list
 java.lang.String toString()
           
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScreenRequest

public ScreenRequest(javax.servlet.http.HttpServletRequest httpRequest)
Constructor

Parameters:
httpRequest -
Method Detail

getHttpRequest

public javax.servlet.http.HttpServletRequest getHttpRequest()
Returns the standard HTTP servlet request

Returns:

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
Returns the standard HTTP session or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way

Returns:

getHttpSessionId

public java.lang.String getHttpSessionId()
Returns the ID of the standard HTTP session
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way

Returns:

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns the standard web app ServletContext
or null if the Http Session doesn't exist It cannot returns null, unless the HttpSession has been invalidate by an external way

Returns:

getScreenSession

public ScreenSession getScreenSession()
Returns the current ScreenSession associated with the request
or null if the HttpSession doesn't exist or if it doesn't contain a ScreenSession attribute
It cannot returns null, unless the HttpSession has been corrupted by an external way

Returns:

getScreenApplication

public ScreenApplication getScreenApplication()
Returns the ScreenApplication object associated with the current web app
or null if the ScreenApplication has not yet been created (opened)
It cannot returns null, unless the ServletContext has been corrupted by an external way

Returns:

getAction

public java.lang.String getAction()
Returns the action attribute of the request

Returns:
the action

setAction

public void setAction(java.lang.String action)
Set the action attribute of the request

Parameters:
action - the action to set.

getProcName

public java.lang.String getProcName()
Returns the procedure attribute of the request

Returns:
the procedure

setProcName

public void setProcName(java.lang.String procName)
Set the procedure attribute of the request

Parameters:
procName - the name of the procedure

getScreenId

public java.lang.String getScreenId()
Returns:
Returns the Screen Id.

setScreenId

public void setScreenId(java.lang.String screenId)
Parameters:
screenId - the Screen Id to set.

setScreenName

public void setScreenName(java.lang.String screenName)
Parameters:
screenName - the Screen Name to set.

getScreenName

public java.lang.String getScreenName()
Returns:
Returns the Screen Name.

setElements

public void setElements(java.lang.String v)
Set the "elements" attribute of the request

Parameters:
v -

getElements

public java.lang.String getElements()
Returns the "elements" attribute of the request

Returns:

hasElementsAttribute

public boolean hasElementsAttribute()
Returns true if the request has an "element" attribute

Returns:

getElementsArray

public java.lang.String[] getElementsArray()
Returns an array of elements name containing each element of the "elements" attribute

Returns:

elementsAttributeContains

public boolean elementsAttributeContains(java.lang.String sArgElementName)
Returns true if the "elements" attribute of the request contains the given element name

Parameters:
sArgElementName -
Returns:
true if the element is in the list (else false)

addView

public void addView(ScreenRequestView v)
Adds a view to the request

Parameters:
v -

getViews

public ScreenRequestView[] getViews()
Returns the "views" of the request, or null if none

Returns:

hasViews

public boolean hasViews()
Returns true if the request has one or more "view"

Returns:

getParameters

public ScreenRequestParameters getParameters()
Returns:
Returns the Request Parameters .

getParameterMap

public java.util.Map getParameterMap()
Returns the parameters as a Map instance

Specified by:
getParameterMap in interface IRequestParameters
Returns:
Since:
1.1.0

getFlagSetData

public boolean getFlagSetData()
Returns the status of the "SET" flag

Returns:

setFlagSetData

public void setFlagSetData(java.lang.String v)
Sets the status of the "SET" flag

Parameters:
v -

getFlagGetData

public boolean getFlagGetData()
Returns the status of the "GET" flag

Returns:

setFlagGetData

public void setFlagGetData(java.lang.String v)
Sets the status of the "GET" flag

Parameters:
v -

getFlagClearData

public boolean getFlagClearData()
Returns the status of the "clear" flag

Returns:

setFlagClearData

public void setFlagClearData(java.lang.String v)
Sets the status of the "clear" flag

Parameters:
v -

setParameter

public void setParameter(java.lang.String sParamName,
                         java.lang.String sParamValue)
Sets a parameter in the request

Parameters:
sParamName - parameter name
sParamValue - parameter value

hasParameter

public boolean hasParameter()
Description copied from interface: IRequestParameters
Returns true if there's at least one parameter in the request

Specified by:
hasParameter in interface IRequestParameters
Returns:

getParameter

public java.lang.String getParameter(java.lang.String sParamName)
Description copied from interface: IRequestParameters
Returns the value of the given parameter name, or NULL if not found

Specified by:
getParameter in interface IRequestParameters
Parameters:
sParamName -
Returns:

getParameter

public java.lang.String getParameter(java.lang.String paramName,
                                     java.lang.String defaultValue)
Description copied from interface: IRequestParameters
Returns the value of the given parameter name, or the default value if not found

Specified by:
getParameter in interface IRequestParameters
Parameters:
paramName -
defaultValue - : the default value used if the parameter is not found
Returns:

getParamAsInt

public int getParamAsInt(java.lang.String paramName)
Returns the int value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsInt in interface IRequestParameters
Parameters:
paramName -
Returns:
Throws:
TelosysRuntimeException - if not found or invalid
Since:
1.0.2

getParamAsInt

public int getParamAsInt(java.lang.String paramName,
                         int defaultValue)
Description copied from interface: IRequestParameters
Returns the int value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsInt in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsLong

public long getParamAsLong(java.lang.String paramName)
Returns the long value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsLong in interface IRequestParameters
Parameters:
paramName -
Returns:
Throws:
TelosysRuntimeException - if not found or invalid
Since:
1.0.2

getParamAsLong

public long getParamAsLong(java.lang.String paramName,
                           long defaultValue)
Description copied from interface: IRequestParameters
Returns the long value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsLong in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsShort

public short getParamAsShort(java.lang.String paramName)
Returns the short value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsShort in interface IRequestParameters
Parameters:
paramName -
Returns:
Throws:
TelosysRuntimeException - if not found or invalid
Since:
1.0.2

getParamAsShort

public short getParamAsShort(java.lang.String paramName,
                             short defaultValue)
Description copied from interface: IRequestParameters
Returns the short value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsShort in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsFloat

public float getParamAsFloat(java.lang.String paramName)
Returns the float value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsFloat in interface IRequestParameters
Parameters:
paramName -
Returns:
Throws:
TelosysRuntimeException - if not found or invalid
Since:
1.0.2

getParamAsFloat

public float getParamAsFloat(java.lang.String paramName,
                             float defaultValue)
Description copied from interface: IRequestParameters
Returns the float value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsFloat in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsDouble

public double getParamAsDouble(java.lang.String paramName)
Returns the double value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsDouble in interface IRequestParameters
Parameters:
paramName -
Returns:
Throws:
TelosysRuntimeException - if not found or invalid
Since:
1.0.2

getParamAsDouble

public double getParamAsDouble(java.lang.String paramName,
                               double defaultValue)
Description copied from interface: IRequestParameters
Returns the double value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsDouble in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsByte

public byte getParamAsByte(java.lang.String paramName)
Description copied from interface: IRequestParameters
Returns the byte value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsByte in interface IRequestParameters
Parameters:
paramName -
Returns:

getParamAsByte

public byte getParamAsByte(java.lang.String paramName,
                           byte defaultValue)
Description copied from interface: IRequestParameters
Returns the byte value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsByte in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsChar

public char getParamAsChar(java.lang.String paramName)
Description copied from interface: IRequestParameters
Returns the char value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsChar in interface IRequestParameters
Parameters:
paramName -
Returns:

getParamAsChar

public char getParamAsChar(java.lang.String paramName,
                           char defaultValue)
Description copied from interface: IRequestParameters
Returns the char value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsChar in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getParamAsBoolean

public boolean getParamAsBoolean(java.lang.String paramName)
Description copied from interface: IRequestParameters
Returns the boolean value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsBoolean in interface IRequestParameters
Parameters:
paramName -
Returns:
true if the parameter value is "1" or "true" ( ignore case ), else false

getParamAsBoolean

public boolean getParamAsBoolean(java.lang.String paramName,
                                 boolean defaultValue)
Description copied from interface: IRequestParameters
Returns the boolean value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsBoolean in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:
true if the parameter value is "1" or "true" ( ignore case ), else false

getParamAsDate

public java.util.Date getParamAsDate(java.lang.String paramName)
Description copied from interface: IRequestParameters
Returns the date/time/datetime value of the given parameter name.
Throws an exception if the parameter is not found or cannot be converted.

Specified by:
getParamAsDate in interface IRequestParameters
Parameters:
paramName -
Returns:

getParamAsDate

public java.util.Date getParamAsDate(java.lang.String paramName,
                                     java.util.Date defaultValue)
Description copied from interface: IRequestParameters
Returns the date/time/datetime value of the given parameter name.
Returns the given default value if the parameter cannot be found.
Throws an exception if the parameter cannot be converted.

Specified by:
getParamAsDate in interface IRequestParameters
Parameters:
paramName -
defaultValue -
Returns:

getIntParameter

public int getIntParameter(java.lang.String sParamName)
                    throws TelosysException
Deprecated. use getParamAsInt

Parameters:
sParamName -
Returns:
Throws:
TelosysException

getDataElements

public ScreenDataElements getDataElements()
Returns the Screen Data Elements held by the request
NB : returns null if there's no DataElements in the request

Returns:

getDataElement

public ScreenDataElement getDataElement(java.lang.String sElementName)
Returns the element having the given name (or null if not found)
If there's multiple elements with the same name, the first element found is returned.

Parameters:
sElementName -
Returns:

getDataElementInstance

public java.lang.Object getDataElementInstance(java.lang.String sElementName)
Returns the element object having the given name (or null if not found)
If there's multiple elements with the same name, the first element found is returned.

Parameters:
sElementName -
Returns:

getDataElementInstance

public java.lang.Object getDataElementInstance(java.lang.String sElementName,
                                               java.lang.Class clazz)
Returns the element object having the given name and an instance of the given class (or null if not found)
If there's multiple elements with the same name, the first element found is returned.

Parameters:
sElementName -
clazz - if null the type of the object is not checked
Returns:

storeDataElement

public void storeDataElement(java.lang.String sTagName,
                             java.lang.Object objData)
Adds a new element in the request elements list

Parameters:
sTagName -
objData -

toString

public java.lang.String toString()