com.ibm.commerce.me.commands

Class DBProcurementAuthenticationCmdImpl

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

    A requisitioner is a user of a Business-to-Business buyer organization. Upon requisitioner logon via the supplier system, this task command will perform either an authentication or an update. This task command runs only if the server is configured to authenticate against the database.

    Before executing this task command the following set operations should be performed:

    • setAuthenticationLevel
    • setBuyerCredentials
    • setMarketPlaceBuyerCredentials
    • setSupplierCredentials
    • setUpdateFlag

    If the setUpdateFlag method is called, upon execution of this task command, the credentials set are updated in the database.

    If the setUpdateFlag method is not called, upon execution of this task command, verification of the credentials is performed. To determine whether the authentication was successful, a call should be made to isValidCredentials().

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • DBProcurementAuthenticationCmdImpl

        public DBProcurementAuthenticationCmdImpl()
        DBAuthenticationCmdImpl default constructor
    • Method Detail

      • getBuyerId

        public long getBuyerId()
        If isValidCredentials() returns true (the command is successful), this method can be called to get the buyer organization ID.
        Specified by:
        getBuyerId in interface DBProcurementAuthenticationCmd
        Returns:
        ID of the buyer organization.
      • getErrorCode

        public int getErrorCode()
        If isValidCredentials() returns false (the command fails), this method can be called to get the error code. This is required because the B2B scenario needs to know the exact reason for authentication failure.
        Specified by:
        getErrorCode in interface DBProcurementAuthenticationCmd
        Returns:
        an error code indicating the execution status
      • getSupplierId

        public long getSupplierId()
        If isValidCredentials() returns true (the command is successful), this method can be called to get the supplier organization ID.
        Specified by:
        getSupplierId in interface DBProcurementAuthenticationCmd
        Returns:
        ID of the supplier organization.
      • isValidCredentials

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

        public void performExecute()
                            throws ECException
        This method contains the business logic for this task command. The details of the logic can be found in 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 - Raised with _ERR_FINDER_EXCEPTION, _ERR_CREATE_EXCEPTION, _ERR_REMOTE_EXCEPTION, _ERR_NAMING_EXCEPTION if the EJB catches any exceptions
      • setAuthenticationType

        public void setAuthenticationType(int authenticationType)
        This method sets the authentication level for this user. See B2BLogonCmd for details regarding the credentials the buyer and supplier are validated against.
        Specified by:
        setAuthenticationType in interface DBProcurementAuthenticationCmd
        Parameters:
        authenticationType - The new 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 DBProcurementAuthenticationCmd
        Parameters:
        buyerCredentials - buyer credentials under which the current B2B user wishes to logon
      • 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 sets the marketplace buyer credentials under which the current B2B user wishes to logon.
        Specified by:
        setMarketPlaceBuyerCredentials in interface DBProcurementAuthenticationCmd
        Parameters:
        mpBuyerCredentials - the marketplace buyer credentials under which the current B2B user wishes to logon
      • setMerchantKey

        public void setMerchantKey(java.lang.String aMerchantKey)
        This method sets the Merchant Key to use in the encryption of the password. This should only be set if an Enciphered Merchant key was not set.
        Specified by:
        setMerchantKey in interface DBProcurementAuthenticationCmd
        Parameters:
        aMerchantKey - the Merchant Key.
      • setSupplierCredentilas

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

        public void setUpdateFlag()
        This method is called to indicate that the credentials should be set in the database, instead of performing verification of the credentials.
        Specified by:
        setUpdateFlag in interface DBProcurementAuthenticationCmd
      • validateParameters

        public void validateParameters()
                                throws ECException
        This method checks whether all the required parameters are available for authentication. The required parameters for each authentication level can be found in the comments for the class. The checking includes: 1. buyer credential is not null, containing non-empty code and code domain 1. supplier credential is not null, and containing non-empty code and code domain

        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECException. - Raised with messages _ERR_PROCUREMENT_INVALID_BUYER_CREDENTIAL, _ERR_PROCUREMENT_INVALID_SUPPLIER_CREDENTIAL if either buyer credential or supplier credential are null or empty.
        ECException