com.ibm.commerce.pvc.commands
Class PVCChangeDeviceCmdImpl

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

public class PVCChangeDeviceCmdImpl
extends ControllerCommandImpl
implements PVCChangeDeviceCmd

Cancel existing relationship between a user and a pervasive computing (PvC) device in PVCBINDING table. This command is required when registrationMode in XML configuration file is 2. If a user has a record in PVCBINDING table, the user can not use any devices for Logon other than a device registerd in PVCBINDING table. To change a device used for Logon, the user needs to executes PVCCahngeDevice command.

Behaviour

  1. Makes sure that registrationMode is 2. If registrationMode is not 2 , the command does nothing.
  2. Checks logon status of the user.
  3. Checks mandatory parameters.
  4. Executes VerifyCredentials to make sure validity of user ID and password. If a user of specified ID and paramter is not registered thorws an Exception.
  5. Checks if the device executing the command is not already registered in PVCBINDING. If already registered throws Excecption.
  6. Changes STATUS of an old record in PVCBINDING to 'S'
  7. Creates a new record in PVCBINDING with STATUS 'A'.
  8. Registers a new PVC device to USERPVCDEV table
  9. Sends redirects instruction to specified URL


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.PVCChangeDeviceCmd
defaultCommandClassName, NAME
 
Constructor Summary
PVCChangeDeviceCmdImpl()
           
 
Method Summary
 java.lang.String getAddress1()
          Get the address 1.
 java.lang.String getAddress2()
          Get the address 2.
 java.lang.String getAddrType1()
          Get the address type 1.
 java.lang.String getAddrType2()
          Get the address type 2.
 java.lang.Integer getDeviceFmtId()
          Get the device format ID
 java.lang.String getLogonId()
          Get the logon ID.
 java.lang.String getPassword()
          Get the password.
 java.lang.Integer getPreferredTimeout()
          Get the preferred timeout value.
 java.lang.Integer getProtect()
          Get the protect.
 java.lang.String getPvcRegMode()
          Get the PvC registration mode.
 java.lang.Long getPVCSessionId()
          Get the PVC session ID
 java.lang.String getURL()
          Get the redirect URL for this 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 setAddress1(java.lang.String newAddress1)
          Set the address 1.
 void setAddress2(java.lang.String newAddress2)
          Set the address 2.
 void setAddrType1(java.lang.String newAddrType1)
          Set the address type 1.
 void setAddrType2(java.lang.String newAddrType2)
          Set the address type2.
 void setDeviceFmtId(java.lang.Integer newDeviceFmtId)
          Set the device format ID.
 void setLogonId(java.lang.String newLogonId)
          Set the logon ID.
 void setPassword(java.lang.String newPassword)
          Set the password.
 void setPreferredTimeout(java.lang.Integer newPreferredTimeout)
          Set the preferred timeout value.
 void setProtect(java.lang.Integer newProtect)
          Set the protect.
 void setPvcRegMode(java.lang.String newPvcRegMode)
          Set the PvC registration mode.
 void setPVCSessionId(java.lang.Long newPVCSessionId)
          Set the PvC session ID.
 void setRequestProperties(TypedProperty hshReqParameters)
          Extracts parameters from the request, and stored them locally.
 void setURL(java.lang.String newURL)
          Set the redirect URL for this command.
 void setUserId(java.lang.Long newUserId)
          Set the user ID.
protected  void updateCmdContext()
           
 void validateParameters()
          Check the parameters for 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

PVCChangeDeviceCmdImpl

public PVCChangeDeviceCmdImpl()
Method Detail

getAddress1

public java.lang.String getAddress1()
Get the address 1.
Returns:
The address 1.

getAddress2

public java.lang.String getAddress2()
Get the address 2.
Returns:
The address 2.

getAddrType1

public java.lang.String getAddrType1()
Get the address type 1.
Returns:
The address type 1.

getAddrType2

public java.lang.String getAddrType2()
Get the address type 2.
Returns:
The address type 2.

getDeviceFmtId

public java.lang.Integer getDeviceFmtId()
Get the device format ID
Returns:
The device format ID.

getLogonId

public java.lang.String getLogonId()
Get the logon ID.
Returns:
The logon ID.

getPassword

public java.lang.String getPassword()
Get the password.
Returns:
The password.

getPreferredTimeout

public java.lang.Integer getPreferredTimeout()
Get the preferred timeout value.
Returns:
The preferred timeout value.

getProtect

public java.lang.Integer getProtect()
Get the protect.
Returns:
The protect.

getPvcRegMode

public java.lang.String getPvcRegMode()
Get the PvC registration mode.
Returns:
The PvC registration mode.

getPVCSessionId

public java.lang.Long getPVCSessionId()
Get the PVC session ID
Returns:
The PVC session ID.

getURL

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

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.

setAddress1

public void setAddress1(java.lang.String newAddress1)
Set the address 1.
Specified by:
setAddress1 in interface PVCChangeDeviceCmd
Parameters:
newAddress1 - The address 1.

setAddress2

public void setAddress2(java.lang.String newAddress2)
Set the address 2.
Specified by:
setAddress2 in interface PVCChangeDeviceCmd
Parameters:
newAddress2 - The address 2.

setAddrType1

public void setAddrType1(java.lang.String newAddrType1)
Set the address type 1.
Specified by:
setAddrType1 in interface PVCChangeDeviceCmd
Parameters:
newAddrType1 - The address type 1.

setAddrType2

public void setAddrType2(java.lang.String newAddrType2)
Set the address type2.
Specified by:
setAddrType2 in interface PVCChangeDeviceCmd
Parameters:
newAddrType2 - The address type 2.

setDeviceFmtId

public void setDeviceFmtId(java.lang.Integer newDeviceFmtId)
Set the device format ID.
Parameters:
newDeviceFmtId - The device format ID.

setLogonId

public void setLogonId(java.lang.String newLogonId)
Set the logon ID.
Parameters:
newLogonId - The logon ID.

setPassword

public void setPassword(java.lang.String newPassword)
Set the password.
Specified by:
setPassword in interface PVCChangeDeviceCmd
Parameters:
newPassword - The password.

setPreferredTimeout

public void setPreferredTimeout(java.lang.Integer newPreferredTimeout)
Set the preferred timeout value.
Specified by:
setPreferredTimeout in interface PVCChangeDeviceCmd
Parameters:
newPreferredTimeout - The preferred timeout value.

setProtect

public void setProtect(java.lang.Integer newProtect)
Set the protect.
Specified by:
setProtect in interface PVCChangeDeviceCmd
Parameters:
newProtect - The protect.

setPvcRegMode

public void setPvcRegMode(java.lang.String newPvcRegMode)
Set the PvC registration mode.
Specified by:
setPvcRegMode in interface PVCChangeDeviceCmd
Parameters:
newPvcRegMode - The PvC registration mode.

setPVCSessionId

public void setPVCSessionId(java.lang.Long newPVCSessionId)
Set the PvC session ID.
Specified by:
setPVCSessionId in interface PVCChangeDeviceCmd
Parameters:
newPVCSessionId - The PvC session ID.

setRequestProperties

public void setRequestProperties(TypedProperty hshReqParameters)
                          throws ECApplicationException
Extracts parameters from the request, and stored them locally. The WebController calls the setRequestProperties method before invoking the execute method in this command.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
reqProp - The parameters for this command.
Throws:
ECApplicationException - If an error occurs while processing this method.

setURL

public void setURL(java.lang.String newURL)
Set the redirect URL for this command.
Specified by:
setURL in interface PVCChangeDeviceCmd
Parameters:
newURL - The redirect URL.

setUserId

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

updateCmdContext

protected void updateCmdContext()
                         throws ECException

validateParameters

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

This method checks the following in the list. If an error occured, throws exception.

  1. If registrationMode of the configuration XML is 0(browser) or 1(multi mode), do nothing.
  2. Check to exist logonId and password parameters.
  3. Check to exist devaddress1, devaddrtype1,devaddress2 and devaddrtype2.

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