Style Intelligence v12.0

inetsoft.sree
Class RepletRequest

java.lang.Object
  extended by inetsoft.sree.RepletRequest
All Implemented Interfaces:
inetsoft.sree.internal.HttpXMLSerializable, inetsoft.util.XMLSerializable, Serializable, Cloneable

public class RepletRequest
extends Object
implements Serializable, Cloneable, inetsoft.sree.internal.HttpXMLSerializable

The RepletRequest holds the report request parameter values. If is created by the viewer to pass into a replet during report creation or customization. A replet can access the parameter values by calling one of the getter method.

Each request has a request name. It could not one of the pre-defined request names, such as CREATE or CUSTOMIZE. It could also be a form name if a request is submitted from a embedded form. It is up to the replet to check for request name to take appropriate actions.

If replet is running in a web environment, the request and response object can be retrieved using the special SERVICE_REQUEST and SERVICE_RESPONSE parameter name.

See Also:
Serialized Form

Field Summary
static String ADHOC
          Adhoc request name.
static String CREATE
          Default creation request name (first time a replet is created).
static String CUSTOMIZE
          Customization request name.
static String DATE_FORMAT
          The pattern used to format and parse date values.
static String DATE_TIME_FORMAT
          The pattern used to format and parse date/time values.
static String EMPTY
          empty request name.
static String HTTP_REQUEST
          Deprecated. use SERVICE_REQUEST.
static String HTTP_RESPONSE
          Deprecated. use SERVICE_RESPONSE.
static String INIT
          Initialization request name.
static String SERVICE_REQUEST
          The name for the ServiceRequest parameter.
static String SERVICE_RESPONSE
          The name for the ServiceResponse parameter.
static String TIME_FORMAT
          The pattern used to format and parse time values.
 
Constructor Summary
RepletRequest(String name)
          Create an empty request.
RepletRequest(String name, Map pairs)
          Create a request from the values in a hastable.
 
Method Summary
 String byteDecode(String encString)
          Convert the encoded string to the original unencoded string.
 String byteEncode(String source)
          Encode non-ascii characters to unicode enclosed in '[]'.
 Object clone()
           
 RepletRequest clone(String newname)
          Create a duplicate request with a new request name.
 boolean contains(String name)
          Check if the named value is set in the request.
 boolean equals(Object obj)
          Compare two requests to see if they contain the same parameters.
 Object[] getArray(String name)
          Get the parameter value as an array.
 boolean getBoolean(String name)
          Get the value of a parameter as a boolean.
 Date getDate(String name)
          Get a parameter value as a date.
 double getDouble(String name)
          Get the value of a parameter as an double.
 Object getHint(String name)
          Get a hint on how to process a report.
 int getInt(String name)
          Get the value of a parameter as an integer.
 long getLong(String name)
          Get the value of a parameter as a long.
 Object getParameter(String name)
          Get the value of a parameter.
 Object getParameter(String name, Object def)
          Get the value of a parameter.
 int getParameterCount()
          Get the number of parameters.
 Enumeration getParameterNames()
          Get the names of all parameters
static String getParameterValueDataType(Object val)
          Get data type of parameter value.
static String getParameterValueString(Object val)
          Get parameter value string.
 String getRequestName()
          Get the request name.
 String getString(String name)
          Get the value of a parameter as a string.
 Date getTime(String name)
          Get a parameter value as a time.
 boolean isEncoding()
          Check if this object should encoded when writing.
 boolean isInternalParameter(String name)
          Check if a parameter is kept in the session of the ServiceRequest parameter.
 void parseXML(Element req)
          Parse the XML element that contains info about this request.
 void remove(String name)
          Remove a parameter from the request.
 void removeAll()
          Remove all existing parameters.
 void removeParameters(RepletRequest req)
          Remove parameters from another replet request.
 void setEncoding(boolean encoding)
          Set encoding flag.
 void setHint(String name, Object value)
          Set a hint.
 void setParameter(String name, Object val)
          Set the value of a parameter.
 void setParameters(RepletRequest req)
          Set parameters from another replet request.
 void setRequestName(String name)
          Set the request name.
 String toString()
          To string.
 void writeXML(PrintWriter writer)
          Write the request to a xml file.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INIT

public static final String INIT
Initialization request name.

See Also:
Constant Field Values

CREATE

public static final String CREATE
Default creation request name (first time a replet is created).

See Also:
Constant Field Values

ADHOC

public static final String ADHOC
Adhoc request name.

See Also:
Constant Field Values

CUSTOMIZE

public static final String CUSTOMIZE
Customization request name.

See Also:
Constant Field Values

EMPTY

public static final String EMPTY
empty request name.

See Also:
Constant Field Values

HTTP_REQUEST

public static final String HTTP_REQUEST
Deprecated. use SERVICE_REQUEST.
The name for the HttpServletRequest parameter. This parameter is only available if the replet is running through the ServletRepository.

See Also:
Constant Field Values

HTTP_RESPONSE

public static final String HTTP_RESPONSE
Deprecated. use SERVICE_RESPONSE.
The name for the HttpServletResponse parameter. This parameter is only available if the replet is running through the ServletRepository.

See Also:
Constant Field Values

SERVICE_REQUEST

public static final String SERVICE_REQUEST
The name for the ServiceRequest parameter. This parameter is only available if the replet is running through one of the web clients.

See Also:
ServiceRequest, Constant Field Values

SERVICE_RESPONSE

public static final String SERVICE_RESPONSE
The name for the ServiceResponse parameter. This parameter is only available if the replet is running through one of the web clients.

See Also:
ServiceResponse, Constant Field Values

DATE_FORMAT

public static final String DATE_FORMAT
The pattern used to format and parse date values.

See Also:
Constant Field Values

TIME_FORMAT

public static final String TIME_FORMAT
The pattern used to format and parse time values.

See Also:
Constant Field Values

DATE_TIME_FORMAT

public static final String DATE_TIME_FORMAT
The pattern used to format and parse date/time values.

See Also:
Constant Field Values
Constructor Detail

RepletRequest

public RepletRequest(String name)
Create an empty request.

Parameters:
name - request name.

RepletRequest

public RepletRequest(String name,
                     Map pairs)
Create a request from the values in a hastable.

Parameters:
name - request name.
pairs - paramter values.
Method Detail

clone

public RepletRequest clone(String newname)
Create a duplicate request with a new request name.

Parameters:
newname - new request name.
Returns:
a new request object with the name.

getRequestName

public String getRequestName()
Get the request name.


setRequestName

public void setRequestName(String name)
Set the request name.


getParameter

public Object getParameter(String name)
Get the value of a parameter.

Parameters:
name - parameter name.
Returns:
parameter value.

getParameter

public Object getParameter(String name,
                           Object def)
Get the value of a parameter.

Parameters:
name - parameter name.
def - default value if the parameter is null.
Returns:
parameter value.

getBoolean

public boolean getBoolean(String name)
Get the value of a parameter as a boolean. If the value is not a booleam object, it is converted to a boolean by assigning true if the value is not null, false otherwise.

Parameters:
name - name of the parameter.
Returns:
boolean value.

getString

public String getString(String name)
Get the value of a parameter as a string. If the value is null, an empty string is returned.

Parameters:
name - parameter name.
Returns:
value as string.

getInt

public int getInt(String name)
Get the value of a parameter as an integer. If the value is does not contain a value integer, an exception is thrown.

Parameters:
name - parameter name.
Returns:
value as integer.

getLong

public long getLong(String name)
Get the value of a parameter as a long. If the value is does not contain a value integer, an exception is thrown.

Parameters:
name - parameter name.
Returns:
value as long.

getDouble

public double getDouble(String name)
Get the value of a parameter as an double. If the value is does not contain a value double, an exception is thrown.

Parameters:
name - parameter name.
Returns:
value as double.

getArray

public Object[] getArray(String name)
Get the parameter value as an array.

Parameters:
name - parameter name.
Returns:
an array. It could be null.

getDate

public Date getDate(String name)
Get a parameter value as a date. If the value is not a Date type, it is converted to a Date using the date format specified in the configuration file.

Parameters:
name - parameter name.
Returns:
date or null if the data is in wrong format.

getTime

public Date getTime(String name)
Get a parameter value as a time. If the value is not a Date type, it is converted to a Date using the date format specified in the configuration file.

Parameters:
name - parameter name.
Returns:
date or null if the data is in wrong format.

getParameterCount

public int getParameterCount()
Get the number of parameters.


getParameterNames

public Enumeration getParameterNames()
Get the names of all parameters


isInternalParameter

public boolean isInternalParameter(String name)
Check if a parameter is kept in the session of the ServiceRequest parameter.


setParameter

public void setParameter(String name,
                         Object val)
Set the value of a parameter.

Parameters:
name - parameter name.
val - parameter value.

setParameters

public void setParameters(RepletRequest req)
Set parameters from another replet request.

The method only accept not contained parameters.

Parameters:
req - the specified replet request

removeParameters

public void removeParameters(RepletRequest req)
Remove parameters from another replet request.

Parameters:
req - the specified replet request

remove

public void remove(String name)
Remove a parameter from the request.

Parameters:
name - parameter name.

contains

public boolean contains(String name)
Check if the named value is set in the request.


removeAll

public void removeAll()
Remove all existing parameters.


setHint

public void setHint(String name,
                    Object value)
Set a hint. The interpretation of hints are implementation dependent and are for internal use only.


getHint

public Object getHint(String name)
Get a hint on how to process a report.


toString

public String toString()
To string.

Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Compare two requests to see if they contain the same parameters.

Overrides:
equals in class Object

clone

public Object clone()
Overrides:
clone in class Object

parseXML

public void parseXML(Element req)
              throws Exception
Parse the XML element that contains info about this request.

Specified by:
parseXML in interface inetsoft.util.XMLSerializable
Throws:
Exception

writeXML

public void writeXML(PrintWriter writer)
Write the request to a xml file.

Specified by:
writeXML in interface inetsoft.util.XMLSerializable
Parameters:
writer - the PrintWriter

byteEncode

public String byteEncode(String source)
Encode non-ascii characters to unicode enclosed in '[]'.

Specified by:
byteEncode in interface inetsoft.sree.internal.HttpXMLSerializable
Parameters:
source - source string.
Returns:
encoded string.

byteDecode

public String byteDecode(String encString)
Convert the encoded string to the original unencoded string.

Specified by:
byteDecode in interface inetsoft.sree.internal.HttpXMLSerializable
Parameters:
encString - a string encoded using the byteEncode method.
Returns:
original string.

isEncoding

public boolean isEncoding()
Check if this object should encoded when writing.

Specified by:
isEncoding in interface inetsoft.sree.internal.HttpXMLSerializable
Returns:
true if should encoded, false otherwise.

setEncoding

public void setEncoding(boolean encoding)
Set encoding flag.

Specified by:
setEncoding in interface inetsoft.sree.internal.HttpXMLSerializable
Parameters:
encoding - true to encode.

getParameterValueDataType

public static String getParameterValueDataType(Object val)
Get data type of parameter value.


getParameterValueString

public static String getParameterValueString(Object val)
Get parameter value string.


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.