com.ibm.commerce.pvc.commands

Class PVCRegisterDeviceCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, PVCRegisterDeviceCmd, Protectable, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class PVCRegisterDeviceCmdImpl
    extends ControllerCommandImpl
    implements PVCRegisterDeviceCmd
    Registers or updates information of a user'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 method.

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field
        See Also:
        Constant Field Values
      • ERRTASK_NAME

        public static final java.lang.String ERRTASK_NAME
        The viewname that is called in an error occurs.
        See Also:
        Constant Field Values
      • address1Nothing

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

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

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

        public boolean addrtype2Nothing
        The flag of the devaddrtype2 parameter exist or not.
    • 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 status, 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.
      • 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()
        Checks 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.
      • 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
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException - If an error occurs 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)
        Sets the address 1.
        Specified by:
        setAddress1 in interface PVCRegisterDeviceCmd
        Parameters:
        newAddress1 - The address1.
      • setAddress1Nothing

        public void setAddress1Nothing(boolean newAddress1Nothing)
        Sets 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)
        Sets the address 2.
        Specified by:
        setAddress2 in interface PVCRegisterDeviceCmd
        Parameters:
        newAddress2 - The address 2.
      • setAddress2Nothing

        public void setAddress2Nothing(boolean newAddress2Nothing)
        Sets 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)
        Sets the address type 1.
        Specified by:
        setAddrType1 in interface PVCRegisterDeviceCmd
        Parameters:
        newAddrType1 - The address type 1.
      • setAddrtype1Nothing

        public void setAddrtype1Nothing(boolean newAddrtype1Nothing)
        Sets 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)
        Sets the address type 2.
        Specified by:
        setAddrType2 in interface PVCRegisterDeviceCmd
        Parameters:
        newAddrType2 - The address type 2.
      • setAddrtype2Nothing

        public void setAddrtype2Nothing(boolean newAddrtype2Nothing)
        Sets 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)
        Sets the device format ID.
        Specified by:
        setDeviceFmtId in interface PVCRegisterDeviceCmd
        Parameters:
        newDeviceFmtId - The device format ID.
      • setLogonId

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

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

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

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

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

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

        public void setRequestProperties(TypedProperty hshReqParameters)
                                  throws ECException
        Receives the parameters for this command, and stored into member variables. 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)
        Sets the status of PVCSESSION STATUS.
        STATUS=0 is session logoff status, 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)
        Sets 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)
        Sets the user ID.
        Specified by:
        setUserId in interface PVCRegisterDeviceCmd
        Parameters:
        newUserId - The user ID.
      • updateExec

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

        public void validateParameters()
                                throws ECException
        Checks 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 this 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.