com.ibm.commerce.pvc.commands
Class PVCRegisterDeviceCmdImpl

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

public class PVCRegisterDeviceCmdImpl
extends ControllerCommandImpl
implements PVCRegisterDeviceCmd

Registers or updates information of a users's pervasive computing(PvC) device in USERPVCDEV table.

Behaviour

  1. Checks value of registrationMode in XML configuration file. If the value is 0, this command does nothing.
  2. Checks STATUS of PVCSESSION. If STATUS is 0, the command tries to register new record into USERPVCDEV table with specified information. If STATUS is 1 , the command tires to update existing record in USERPVCDEV with specified information.
  3. Redirects to specified view.

New registration is done by registrationExec method.

Update is done by updateExec mehotd.


Field Summary
 boolean address1Nothing
          The flag of the devaddress1 parameter exist or not.
 boolean address2Nothing
          The flag of the devaddress2 parameter exist or not.
 boolean addrtype1Nothing
          The flag of the devaddrtype1 parameter exist or not.
 boolean addrtype2Nothing
          The flag of the devaddrtype2 parameter exist or not.
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.PVCRegisterDeviceCmd
defaultCommandClassName, NAME
 
Constructor Summary
PVCRegisterDeviceCmdImpl()
           
 
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.Integer getStatus()
          Get the status of PVCSESSION STATUS.
 java.lang.String getURL()
          Get the redirect URL for this command.
 java.lang.Long getUserId()
          Get the user ID.
 boolean isAddress1Nothing()
          Get the flag of the devaddress1 parameter exist or not.
 boolean isAddress2Nothing()
          Get the flag of the devaddress2 parameter exist or not.
 boolean isAddrtype1Nothing()
          Get the flag of the devaddrtype1 parameter exist or not.
 boolean isAddrtype2Nothing()
          Get the flag of the devaddrtype2 parameter exist or not.
 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 registrationExec()
          Register PvC device information.
 void setAddress1(java.lang.String newAddress1)
          Set the address 1.
 void setAddress1Nothing(boolean newAddress1Nothing)
          Set the flag of the devaddress1 parameter exist or not.
 void setAddress2(java.lang.String newAddress2)
          Set the address 2.
 void setAddress2Nothing(boolean newAddress2Nothing)
          Set the flag of the devaddress2 parameter exist or not.
 void setAddrType1(java.lang.String newAddrType1)
          Set the address type 1.
 void setAddrtype1Nothing(boolean newAddrtype1Nothing)
          Set the flag of the devaddrtype1 parameter exist or not.
 void setAddrType2(java.lang.String newAddrType2)
          Set the address type 2.
 void setAddrtype2Nothing(boolean newAddrtype2Nothing)
          Set the flag of the devaddrtype2 parameter exist or not.
 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)
          Recieve the parameters for this command, and stored into member varilables.
 void setStatus(java.lang.Integer newStatus)
          Set the status of PVCSESSION STATUS.
 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 updateExec()
          Update PvC device information.
 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

address1Nothing

public boolean address1Nothing
The flag of the devaddress1 parameter exist or not.

address2Nothing

public boolean address2Nothing
The flag of the devaddress2 parameter exist or not.

addrtype1Nothing

public boolean addrtype1Nothing
The flag of the devaddrtype1 parameter exist or not.

addrtype2Nothing

public boolean addrtype2Nothing
The flag of the devaddrtype2 parameter exist or not.

COPYRIGHT

public static final java.lang.String COPYRIGHT

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME
Constructor Detail

PVCRegisterDeviceCmdImpl

public PVCRegisterDeviceCmdImpl()
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.

getStatus

public java.lang.Integer getStatus()
Get the status of PVCSESSION STATUS. STATUS=0 is session logoff stauts, STATUS=1 is session logon status.
Returns:
The status of PVCSESSION STATUS.

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.

isAddress1Nothing

public boolean isAddress1Nothing()
Get the flag of the devaddress1 parameter exist or not.
Returns:
true if the devaddress1 parameter not exist; false otherwise.

isAddress2Nothing

public boolean isAddress2Nothing()
Get the flag of the devaddress2 parameter exist or not.
Returns:
true if the devaddress2 parameter not exist; false otherwise.

isAddrtype1Nothing

public boolean isAddrtype1Nothing()
Get the flag of the devaddrtype1 parameter exist or not.
Returns:
true if the devaddrtype1 parameter not exist; false otherwise.

isAddrtype2Nothing

public boolean isAddrtype2Nothing()
Get the flag of the devaddrtype2 parameter exist or not.
Returns:
true if the devaddrtype2 parameter not exist; false otherwise.

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. If the registration mode is 0, do nothing.
If the status is logoff, execute registrationExec method.
If the status is logon, execute updateExec method.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If an error occures while processing this method.

registrationExec

public void registrationExec()
                      throws ECException
Register PvC device information. Register PVCBINDING and USERPVCDEV by entered parameters.
Throws:
ECException - If an error occurs while processing this method.

setAddress1

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

setAddress1Nothing

public void setAddress1Nothing(boolean newAddress1Nothing)
Set the flag of the devaddress1 parameter exist or not.
Parameters:
newAddress1Nothing - The flag of the devaddress1 parameter exist or not.

setAddress2

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

setAddress2Nothing

public void setAddress2Nothing(boolean newAddress2Nothing)
Set the flag of the devaddress2 parameter exist or not.
Parameters:
newAddress2Nothing - The flag of the devaddress2 parameter exist or not.

setAddrType1

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

setAddrtype1Nothing

public void setAddrtype1Nothing(boolean newAddrtype1Nothing)
Set the flag of the devaddrtype1 parameter exist or not.
Parameters:
newAddrtype1Nothing - The flag of the devaddrtype1 parameter exist or not.

setAddrType2

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

setAddrtype2Nothing

public void setAddrtype2Nothing(boolean newAddrtype2Nothing)
Set the flag of the devaddrtype2 parameter exist or not.
Parameters:
newAddrtype2Nothing - The flag of the devaddrtype2 parameter exist or not.

setDeviceFmtId

public void setDeviceFmtId(java.lang.Integer newDeviceFmtId)
Set the device format ID.
Specified by:
setDeviceFmtId in interface PVCRegisterDeviceCmd
Parameters:
newDeviceFmtId - The device format ID.

setLogonId

public void setLogonId(java.lang.String newLogonId)
Set the logon ID.
Specified by:
setLogonId in interface PVCRegisterDeviceCmd
Parameters:
newLogonId - The logon ID.

setPassword

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

setPreferredTimeout

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

setProtect

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

setPvcRegMode

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

setPVCSessionId

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

setRequestProperties

public void setRequestProperties(TypedProperty hshReqParameters)
                          throws ECException
Recieve the parameters for this command, and stored into member varilables. The WebController calls the setRequestProperties method before invoking the execute method in this command.

This method does the following in the list.

  1. Get PVCAdapter object in CommandContext.
  2. Set the PvC registration mode, PVC session ID and the preferred timeout value from PVCAdapter.
  3. Set the URL, the logon ID, the password, the devaddress1, the devaddrtype1, the devaddress2 and the devaddrtype2 from requestProperties.
  4. Set the status of PVCSESSION STATUS.
  5. Set the protect, always 1.
  6. Set the device format ID from CommandContext.

Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
reqProp - The parameters for this command.
Throws:
ECException - If an error occurs while processing this method

setStatus

public void setStatus(java.lang.Integer newStatus)
Set the status of PVCSESSION STATUS.
STATUS=0 is session logoff stauts, STATUS=1 is session logon status.
Specified by:
setStatus in interface PVCRegisterDeviceCmd
Parameters:
newStatus - The status of PVCSESSION STATUS.

setURL

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

setUserId

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

updateCmdContext

protected void updateCmdContext()
                         throws ECException

updateExec

public void updateExec()
                throws ECException
Update PvC device information. Update USERPVCDEV by entered parameters.
Throws:
ECException - If an error occurs while processing this method.

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), do nothing.
  2. If ths session is logoff status, 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.