com.ibm.commerce.pvc.commands
Class PVCBufferUrlCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.pvc.commands.PVCBufferUrlCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, PVCBufferUrlCmd

public class PVCBufferUrlCmdImpl
extends ControllerCommandImpl
implements PVCBufferUrlCmd

Buffers parameters in the request and executes target command with buffered parameters. This command is provided for cecular phones which have limitation in length of HTTP request header. The command enables to input long value of parameters by buffering parameters in database.

Behaviour

  1. Checks parameters and changes succeeding process
  2. If parameter b_new is specified:
    1. Creates a new record in PVCBUFFER table and redirects to specified URL
    2. Redirects to the URL specified by b_new
  3. If parameter b_update is specified:
    1. Checks expiration of buffered parameters
    2. Merge parameters in request with parameters in database and stores merged parameter to the database
    3. Redirects to the URL specified by b_update
  4. If parameter b_exec is specified:
    1. Checks expiration of buffered parameters
    2. Merge parameters in request with parameters in database and stores merged parameter to the database
    3. Add buffered parameters to the target command and executes target command.


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String ERRTASK_NAME
           
 
Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.pvc.commands.PVCBufferUrlCmd
defaultCommandClassName, NAME
 
Constructor Summary
PVCBufferUrlCmdImpl()
           
 
Method Summary
 java.lang.String buildParameters(java.lang.String bufParams, java.lang.String inParams)
          Merges parameters stored in PVCBUFFER.PARAMETERS2K and parameters sent to the command.
 java.lang.String changeReqPropToString(TypedProperty reqProp)
          Convert name and value pairs in TypedProperty object to string format.
 TypedProperty changeStringToReqProp(java.lang.String strParm)
          Convert parameter string to TypedProperty object.
 boolean checkTimeout(java.sql.Timestamp now, java.sql.Timestamp create)
          Check if data in buffer has expired.
 PVCAdapter getAdapter()
          Get PVC adapter set in command context.
 java.lang.String getB_exec()
          Get the value of the b_exec parameter.
 java.lang.String getB_new()
          Get the value of the b_new parameter.
 java.lang.String getB_update()
          Get the value of the b_update parameter.
 java.lang.String getErrUrl()
          Get the redirect view name, if an error occurs while processing this command.
 java.lang.String getNo()
          Get the string of b_no parameter value.
 java.lang.String[] getNoArray()
          Get the string array of the b_no parameters string.
 java.lang.String getParameters()
          Set the parameters string.
 java.lang.String getPostUrl()
          Get the redirect URL of this command.
 long getTimeout()
          Get the buffer timeout value.
 java.lang.String getUrl()
          Get the URL of the target command.
 java.lang.Long getUserId()
          Get the user ID.
 boolean isGeneric()
          Check to see if this is a generic command.
 boolean isRetriable()
          Check to see if this command is retriable on transaction rollback exception.
 void performExecute()
          The business logic for this command.
 void setAdapter(PVCAdapter newAdapter)
          Set the PVC adapter object.
 void setB_exec(java.lang.String newB_exec)
          Set the value of the b_exec parameter.
 void setB_new(java.lang.String newB_new)
          Set the value of the b_new parameter.
 void setB_update(java.lang.String newB_update)
          Set the value of the b_update paramter.
 void setErrUrl(java.lang.String newErrUrl)
          Set the redirect view name.
 void setNo(java.lang.String newNo)
          Set the string of b_no parameter value.
 void setParameters(java.lang.String newParameters)
          Set the parameters string.
 void setPostUrl(java.lang.String newPostUrl)
          Set the redirect URL of this command.
 void setRequestProperties(TypedProperty hshReqParameters)
          Extracts parameter from request properties.
 void setTimeout(long newTimeout)
          Set the buffer timeout value.
 void setUrl(java.lang.String newUrl)
          Set the redirect URL of the targetale command.
 void setUserId(java.lang.Long newUserId)
          Set the user ID.
 void validateParameters()
          Check valicidy of parameters sent to this command.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME
Constructor Detail

PVCBufferUrlCmdImpl

public PVCBufferUrlCmdImpl()
Method Detail

buildParameters

public java.lang.String buildParameters(java.lang.String bufParams,
                                        java.lang.String inParams)
Merges parameters stored in PVCBUFFER.PARAMETERS2K and parameters sent to the command. Parameters in inParams and not in bufParams will be appended. Parameters in bufParams will be orver written with parameters in inParams.
Parameters:
bufParams - Buffered parameters in PVCBUFFER.PARAMETER2K
inParams - Parameters sent to the command
Returns:
Merged parameter string.

changeReqPropToString

public java.lang.String changeReqPropToString(TypedProperty reqProp)
Convert name and value pairs in TypedProperty object to string format.
Parameters:
Name - and value pairs
Returns:
URL encoded parameter string

changeStringToReqProp

public TypedProperty changeStringToReqProp(java.lang.String strParm)
Convert parameter string to TypedProperty object.
Parameters:
strParam - URL encoded parameter string
Returns:
Name and value pairs in TypedProperty object.

checkTimeout

public boolean checkTimeout(java.sql.Timestamp now,
                            java.sql.Timestamp create)
Check if data in buffer has expired.
Parameters:
now - Current timestamp
create - Creation date of the record in PVCBUFFER table, value of PVCBUFFER.CREATED
Returns:
true: expired; false: not expired

getAdapter

public PVCAdapter getAdapter()
Get PVC adapter set in command context.
Returns:
PVC adapter used for current session.

getB_exec

public java.lang.String getB_exec()
Get the value of the b_exec parameter.
Returns:
The value of the b_exec parameter.

getB_new

public java.lang.String getB_new()
Get the value of the b_new parameter.
Returns:
The value of the b_new parameter.

getB_update

public java.lang.String getB_update()
Get the value of the b_update parameter.
Returns:
The value of the b_update parameter.

getErrUrl

public java.lang.String getErrUrl()
Get the redirect view name, if an error occurs while processing this command.
Returns:
The redirect view name.

getNo

public java.lang.String getNo()
Get the string of b_no parameter value.
Returns:
The the string of b_no parameter value.

getNoArray

public java.lang.String[] getNoArray()
Get the string array of the b_no parameters string.
Returns:
The string array of the b_no parameters string.

getParameters

public java.lang.String getParameters()
Set the parameters string. This string is the parameters while processing this command.
Returns:
The parameters string.

getPostUrl

public java.lang.String getPostUrl()
Get the redirect URL of this command.
Returns:
The redirect URL of this command.

getTimeout

public long getTimeout()
Get the buffer timeout value.
Returns:
The buffer timeout value.

getUrl

public java.lang.String getUrl()
Get the URL of the target command.
Returns:
The URL of the target command.

getUserId

public java.lang.Long getUserId()
Get the user ID.
Specified by:
getUserId in interface ECCommand
Overrides:
getUserId in class AbstractECTargetableCommand
Returns:
The user ID.

isGeneric

public boolean isGeneric()
Check to see if this is a generic command. A generic command is a command that can be invoked by a generic user. The default is false for all controller commands and true for all view commands.
Specified by:
isGeneric in interface ControllerCommand
Overrides:
isGeneric in class ControllerCommandImpl
Returns:
Always false.

isRetriable

public boolean isRetriable()
Check to see if this command is retriable on transaction rollback exception. A retriable command will be retried once on transaction rollback exception.
Specified by:
isRetriable in interface ControllerCommand
Overrides:
isRetriable in class ControllerCommandImpl
Returns:
Always false.

performExecute

public void performExecute()
                    throws ECException
The business logic for this command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If an error occures while processing this method.

setAdapter

public void setAdapter(PVCAdapter newAdapter)
Set the PVC adapter object.
Parameters:
newAdapter - The PVC adapter object.

setB_exec

public void setB_exec(java.lang.String newB_exec)
Set the value of the b_exec parameter.
Specified by:
setB_exec in interface PVCBufferUrlCmd
Parameters:
newB_exec - The value of the b_exec parameter.

setB_new

public void setB_new(java.lang.String newB_new)
Set the value of the b_new parameter.
Specified by:
setB_new in interface PVCBufferUrlCmd
Parameters:
newB_new - The value of the b_new parameter.

setB_update

public void setB_update(java.lang.String newB_update)
Set the value of the b_update paramter.
Specified by:
setB_update in interface PVCBufferUrlCmd
Parameters:
newB_update - The value of the b_update paramter.

setErrUrl

public void setErrUrl(java.lang.String newErrUrl)
Set the redirect view name. if an error occurs while processing this command, redirect this URL.
Specified by:
setErrUrl in interface PVCBufferUrlCmd
Parameters:
newErrUrl - The redirect view name.

setNo

public void setNo(java.lang.String newNo)
Set the string of b_no parameter value.
Parameters:
newNo - The the string of b_no parameter value.

setParameters

public void setParameters(java.lang.String newParameters)
Set the parameters string. This string is the parameters while processing this command.
Specified by:
setParameters in interface PVCBufferUrlCmd
Parameters:
newParameters - The parameters string.

setPostUrl

public void setPostUrl(java.lang.String newPostUrl)
Set the redirect URL of this command.
Parameters:
newPointUrl - The redirect URL of this command.

setRequestProperties

public void setRequestProperties(TypedProperty hshReqParameters)
                          throws ECApplicationException
Extracts parameter from request properties. Extracted parameters are set loccaly throgh setter functions.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
reqProp - The parameters sent to the command.
Throws:
ECApplicationException - If an error occurs while processing the method

setTimeout

public void setTimeout(long newTimeout)
Set the buffer timeout value.
Specified by:
setTimeout in interface PVCBufferUrlCmd
Parameters:
newTimeout - The buffer timeout value.

setUrl

public void setUrl(java.lang.String newUrl)
Set the redirect URL of the targetale command.
Specified by:
setUrl in interface PVCBufferUrlCmd
Parameters:
newUrl - The target redirect URL.

setUserId

public void setUserId(java.lang.Long newUserId)
Set the user ID.
Specified by:
setUserId in interface PVCBufferUrlCmd
Parameters:
newUserId - The user ID.

validateParameters

public void validateParameters()
                        throws ECException
Check valicidy of parameters sent to this command. The WebController calls the validateParameters method before invoking the execute method in this command.

This method does following checks. If an error occures the method throws ECException.

  1. Check to exist the b_new, b_update or b_exec parameter
  2. If the b_new, check to exist the b_url and b_err parameter.
  3. If the b_update, check to exist the b_err parameter.
  4. If the b_exec, check to exist the b_err parameter.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - If an error occurs while processing this method