com.ibm.commerce.me.commands
Class PunchOutSetupCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.me.commands.PunchOutSetupCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, PunchOutSetupCmd

public class PunchOutSetupCmdImpl
extends ControllerCommandImpl
implements PunchOutSetupCmd

This is the implementation of PunchOutSetupCmd. It is used when the PunchOutSetup message is received from a procurement system for a requisitioning user. It performs the authentication of the buyer organization and registers the requisitioning user as a member of the buyer organization if the user is not already registered.

See Also:
Serialized Form

Field Summary
 
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.me.commands. PunchOutSetupCmd
COPYRIGHT, defaultCommandClassName, messageName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Constructor Summary
PunchOutSetupCmdImpl()
          PunchOutSetupCmdImpl constructor.
 
Method Summary
 int getAuthType()
          Gets authentication type
 java.lang.Long getOrganizationUnitId()
          Gets Organization unit Id
 java.lang.Integer getProtocolId()
          Gets protocol Id.
 java.lang.String getRequisitionerId()
          Gets requisitioner id.
 java.lang.Long getUsersId()
          Gets users id.
protected  void initializeInputData()
          Initialize InputData.
 boolean isGeneric()
          Check if it is a generic user or not.
 boolean isRetriable()
          Check to see if this command is retriable on transaction rollback exception.
protected  boolean isTwoStepProtocol()
          Checks whether the protocol currently used is single step or two step.
 void performExecute()
          The business logic for this controller command.
 void setAuthType(int anAuthType)
          Sets authentication type
protected  void setBuyerRequestProperties()
          Sets buyer request properties.
 void setOrganizationUnitId(java.lang.Long orgUnit)
          Sets the organization unit id
 void setRequestProperties( TypedProperty p)
          The WebController calls the setRequestProperties method before invoking the execute method in this command.
 void setRequisitionerId(java.lang.String requisitionerId)
          Sets requisitionerId.
 void setUsersId(java.lang.Long userId)
          Sets the User id of the ower of the order
protected  void updateCmdContext()
          Switches the current user identity to the identity associated with the LoginID supplied to this Logon command.
 void validateParameters()
          Validates the required parameters for this controller command.
 
Methods inherited from class com.ibm.commerce.command. ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
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
 
Methods inherited from interface com.ibm.commerce.command. ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command. AccCommand
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command. ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 

Constructor Detail

PunchOutSetupCmdImpl

public PunchOutSetupCmdImpl()
PunchOutSetupCmdImpl constructor.
Method Detail

getAuthType

public int getAuthType()
Gets authentication type
Returns:
authType The authentication type.

getOrganizationUnitId

public java.lang.Long getOrganizationUnitId()
Gets Organization unit Id
Returns:
organizationUnitId The organization unit Id.

getProtocolId

public java.lang.Integer getProtocolId()
Gets protocol Id.
Returns:
protocolId The protocol Id.

getRequisitionerId

public java.lang.String getRequisitionerId()
Gets requisitioner id.
Returns:
requisitionerId The requisitioner id.

getUsersId

public java.lang.Long getUsersId()
Gets users id.
Returns:
userId The user Id

initializeInputData

protected void initializeInputData()
Initialize InputData.

isGeneric

public boolean isGeneric()
Check if it is a generic user or not.
Specified by:
isGeneric in interface ControllerCommand
Overrides:
isGeneric in class ControllerCommandImpl
Returns:
Always true. A user is generic till he logs on, so always return true

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. This command is not retriable

isTwoStepProtocol

protected boolean isTwoStepProtocol()
Checks whether the protocol currently used is single step or two step.
Returns:
true if the protocol is two steps; false otherwise.

performExecute

public void performExecute()
                    throws ECException
The business logic for this controller command.

This method will do the following: 1. Gets sessionInfo from CIData 2. Stores the protocol table Id in the sessionInfo 3. Uses the Authentication Helper Command to Authenticate User 4. Sets the properties of the AuthenticationHelperCommand 5. If the user is authenticated, gets the procurement buyer profile properties 6. Invokes requisitioner registration command 7. Generates the supplier cookie: first we create the buyer request info object which will be referenced by the supplier cookie. The primary purpose of the buyer request info object is to pass relevant params onto the PunchOutCatalogDisplayCmdImpl command which will in turn call the store .jsps passing these parameteres to it.

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - Rasied when failed to register requisitioner; or failed to retrieve catalogId from BuyerSupplierMappingBean.

setAuthType

public void setAuthType(int anAuthType)
Sets authentication type
Parameters:
anAuthType - The authentication type

setBuyerRequestProperties

protected void setBuyerRequestProperties()
Sets buyer request properties.

setOrganizationUnitId

public void setOrganizationUnitId(java.lang.Long orgUnit)
Sets the organization unit id
Parameters:
orgUnit - The organization unit id.

setRequestProperties

public void setRequestProperties(TypedProperty p)
                          throws ECException
The WebController calls the setRequestProperties method before invoking the execute method in this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
p - request properties
Returns:
void
Throws:
com.ibm.commerce.exception.ECException.
ECException

setRequisitionerId

public void setRequisitionerId(java.lang.String requisitionerId)
Sets requisitionerId.
Parameters:
requisitionerId - The requisitioner id.

setUsersId

public void setUsersId(java.lang.Long userId)
Sets the User id of the ower of the order

updateCmdContext

protected void updateCmdContext()
                         throws ECException
Switches the current user identity to the identity associated with the LoginID supplied to this Logon command.
Throws:
ECException

validateParameters

public void validateParameters()
                        throws ECException
Validates the required parameters for this controller command. The required parameters are protocolName, protocolVersion, protocolType.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException.
ECException