com.ibm.commerce.me.commands
Class DBProcurementAuthenticationCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.me.commands.DBProcurementAuthenticationCmdImpl
All Implemented Interfaces:
DBProcurementAuthenticationCmd, ECCommand, ECTargetableCommand, TaskCommand

public class DBProcurementAuthenticationCmdImpl
extends TaskCommandImpl
implements DBProcurementAuthenticationCmd

When a requisitioner (a user of the B2B buyer org) logs on to the supplier system, if server is configured to authenticate against the databse then this task command will be called to perform either authentication or an update.

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

    setAuthenticationLevel
    setBuyerCredentials
    setMarketPlaceBuyerCredentials
    setSupplierCredentilas
    setUpdateFlag

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

If the setUpdateFlag is not called then, 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 Summary
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.me.commands. DBProcurementAuthenticationCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
DBProcurementAuthenticationCmdImpl()
          DBAuthenticationCmdImpl default constructor
 
Method Summary
protected  byte[] formatPassword(byte[] bytePassword)
          Padds the password to it's maximum lenght with the OS padding char
 long getBuyerId()
          If the isValidCredentilas() returns true (ie.
 int getErrorCode()
          If the isValidCredentilas() returns false (ie.
 long getSupplierId()
          If the isValidCredentilas() returns true (ie.
 boolean isValidCredentials()
          After the this task command is executed, a boolean result flag will be set to indicate if the authentication was successful.
 void performExecute()
          The business logic for this task command.
 void setAuthenticationType(int authenticationType)
          Sets the authentication level (See B2BLogonCmd for details about against which credentials the buyer and supplier are validated.)
 void setBuyerCredentials( Credentials buyerCredentials)
          Sets the buyer credentials under which the current B2B user wishes to logon.
 void setMarketPlaceBuyerCredentials( Credentials mpBuyerCredentials)
          In case the buyer comes from a marketplace and wants to be authenticated against the marketplace credentials, use this method.
 void setMerchantKey(java.lang.String merchantKey)
          Sets the Merchant Key to be used in the encryption of the password.
 void setSupplierCredentilas( Credentials supplierCredentials)
          Sets the supplier credentials for the store to which the buyer want to connect.
 void setUpdateFlag()
          This method is called to indicate instead of performing verification of the credentials, the credentials should be set in the database.
 void validateParameters()
          Check whether all the required parameters are available authentication.
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBProcurementAuthenticationCmdImpl

public DBProcurementAuthenticationCmdImpl()
DBAuthenticationCmdImpl default constructor
Method Detail

formatPassword

protected byte[] formatPassword(byte[] bytePassword)
Padds the password to it's maximum lenght with the OS padding char
Parameters:
bytePassword - The original password
Returns:
a formatted byte array containing the password with the padded characters

getBuyerId

public long getBuyerId()
If the isValidCredentilas() returns true (ie. if the command is successful) then 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 the isValidCredentilas() returns false (ie. if the command fails) then this method can be called to get the error code. This is required because in the B2B scenario we need to know what is the exact reason for which athentication failed.
Specified by:
getErrorCode in interface DBProcurementAuthenticationCmd
Returns:
an error code indicating the execution status

getSupplierId

public long getSupplierId()
If the isValidCredentilas() returns true (ie. if the command is successful) then 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 the this task command is executed, a boolean result flag will be set to indicate if the authentication was successful. This method will return the this result flag to indicate if the authentication was successful.
Specified by:
isValidCredentials in interface DBProcurementAuthenticationCmd
Returns:
true if authentication was successful false if otherwise

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
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)
Sets the authentication level (See B2BLogonCmd for details about against which credentials the buyer and supplier are validated.)
Specified by:
setAuthenticationType in interface DBProcurementAuthenticationCmd
Parameters:
authenticationType - The new authentication type

setBuyerCredentials

public void setBuyerCredentials(Credentials buyerCredentials)
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)
In case the buyer comes from a marketplace and wants to be authenticated against the marketplace credentials, use this method. This methode will set 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 merchantKey)
Sets the Merchant Key to be used 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:
merchantKey - the Merchant Key.

setSupplierCredentilas

public void setSupplierCredentilas(Credentials supplierCredentials)
Sets the supplier credentials for the store to which the buyer want to connect.
Specified by:
setSupplierCredentilas in interface DBProcurementAuthenticationCmd
Parameters:
supplierCredentials - the supplier credentials for the store to which the buyer want to connect

setUpdateFlag

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

validateParameters

public void validateParameters()
                        throws ECException
Check whether all the required parameters are available authentication. To see which all parameters are required for each authentication level see the comment for the class. The checking inclues: 1. buyer credential is not null and containg non empty code and code domain 1. supplier credential is not null and containg 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, supplier credential are null or empty.
ECException