com.ibm.commerce.me.commands

Class AuthenticationHelperCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, AuthenticationHelperCmd, 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 AuthenticationHelperCmdImpl
    extends TaskCommandImpl
    implements AuthenticationHelperCmd

    This command is invoked by the Business Direct commands to authenticate a Business Direct buyer. Before invoking this command the caller has to set the following parameters.

                    setLogonMode
                    setBuyerCredentials
                    setMarketPlaceBuyerCredentials
                    setSupplierCredentilas
                    setUpdateFlag
     

    After this command is executed, the following methods can be invoked to get the results of command execution.

                    isValidCredentials
                    getErrorCode
                    getBuyerId
                    getSupplierId
     
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • AuthenticationHelperCmdImpl

        public AuthenticationHelperCmdImpl()
    • Method Detail

      • getAuthType

        public int getAuthType()
        This method gets the authentication type.
        Returns:
        the authentication type
      • getBuyerCredentials

        public Credentials getBuyerCredentials()
        This method gets the buyer credential information that stores the buyer organization code, code type, user ID, and password.
        Specified by:
        getBuyerCredentials in interface AuthenticationHelperCmd
        Returns:
        the buyer credential information
      • getBuyerId

        public long getBuyerId()
        If the isValidCredentials() returns true (if the command succeeds) then this method can be called to get the buyer organization ID.
        Specified by:
        getBuyerId in interface AuthenticationHelperCmd
        Returns:
        the ID of the buyer organization.
      • getErrorCode

        public int getErrorCode()
        If the isValidCredentials() returns false (if authentication fails) then this method can be called to get the error code. This is required as the B2B scenario needs to know the exact reason for authentication failure.
        Specified by:
        getErrorCode in interface AuthenticationHelperCmd
        Returns:
        a code indicating the error status
      • getSupplierCredentials

        public Credentials getSupplierCredentials()
        This method gets the supplier credential information which stores the supplier organizations code, code type, user ID and password.
        Specified by:
        getSupplierCredentials in interface AuthenticationHelperCmd
        Returns:
        the supplier credential information
      • getSupplierId

        public long getSupplierId()
        If the isValidCredentials() returns true (if the command succeeds) then this method can be called to get the supplier organization ID.
        Specified by:
        getSupplierId in interface AuthenticationHelperCmd
        Returns:
        the ID of the supplier organization.
      • isValidCredentials

        public boolean isValidCredentials()
        After the task commands execute, a boolean result flag is set to indicate if authentication succeeds. This method returns the result flag to indicate if the authentication succeeds.
        Specified by:
        isValidCredentials in interface AuthenticationHelperCmd
        Returns:
        true if authentication succeeds, otherwise false
      • performExecute

        public void performExecute()
                            throws ECException
        The business logic for this task command. To see the details of the logic see the comments for the class.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException - is raised if checkCredentails() catches any exceptions.
      • setAuthType

        public void setAuthType(int anAuthType)
        This method sets the authentication type.
        Specified by:
        setAuthType in interface AuthenticationHelperCmd
        Parameters:
        the - authentication type
      • setBuyerCredentials

        public void setBuyerCredentials(Credentials buyerCredentials)
        This method sets the buyer credentials under which the current B2B user wishes to logon.
        Specified by:
        setBuyerCredentials in interface AuthenticationHelperCmd
        Parameters:
        buyerCredentials - the buyer credentials
      • setLogonMode

        public void setLogonMode(short logonMode)
        This method sets the logon mode.
        Specified by:
        setLogonMode in interface AuthenticationHelperCmd
        Parameters:
        logonMode - the new logon mode
      • setMarketPlaceBuyerCredentials

        public void setMarketPlaceBuyerCredentials(Credentials mpBuyerCredentials)
        Use this method if the buyer comes from a marketplace and wants to be authenticated against the marketplace credentials. This method will set the marketplace buyer credentials under which the current B2B user wishes to logon.
        Specified by:
        setMarketPlaceBuyerCredentials in interface AuthenticationHelperCmd
        Parameters:
        mpBuyerCredentials - the marketplace buyer credentials
      • setProtocolId

        public void setProtocolId(java.lang.Integer aProtocolId)
        This method sets the protocol ID.
        Specified by:
        setProtocolId in interface AuthenticationHelperCmd
        Parameters:
        aProtocolId - the protocol ID
      • setSupplierCredentials

        public void setSupplierCredentials(Credentials supplierCredentials)
        This method sets the supplier credentials for the store that the buyer wants to connect to.
        Specified by:
        setSupplierCredentials in interface AuthenticationHelperCmd
        Parameters:
        supplierCredentials - the supplier credential
      • setUpdateFlag

        public void setUpdateFlag()
        This method indicates that the credentials should be set in the database, instead of performing verification on the credentials.
        Specified by:
        setUpdateFlag in interface AuthenticationHelperCmd
      • validateParameters

        public void validateParameters()
                                throws ECException
        This method checks whether all the required parameters are available for authentication. To view the parameters required for each authentication level refer to the comments for the class. The checking includes: 1. buyer credential is not null and contains non empty code and code domain
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECException - is raised with message _ERR_PROCUREMENT_INVALID_CREDENTIAL if the check for buyer credential fails