com.ibm.commerce.order.commands
Class OrderProcessCheckApprovalCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.order.commands.OrderProcessCheckApprovalCmdImpl
All Implemented Interfaces:
ECCommand, OrderProcessCheckApprovalCmd, TaskCommand

public class OrderProcessCheckApprovalCmdImpl
extends TaskCommandImpl
implements OrderProcessCheckApprovalCmd

Check if the order requires approval.


Field Summary
static java.lang.String COPYRIGHT
           
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.order.commands.OrderProcessCheckApprovalCmd
defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command.ECCommand
defaultCommandClassName
 
Constructor Summary
OrderProcessCheckApprovalCmdImpl()
           
 
Method Summary
 boolean checkApproval()
          This method implemented the business logic of whether the order requires approval.
 java.lang.String getEventIdentifier()
          Allow the entry action to return an eventIdentifier to start an automatic transition.
 void performExecute()
          Calls checkApproval() to find out if the approval is required.
 void reset()
          This method is called after a command has been executed to reset its states variables.
 void setBusinessFlowEventData(com.ibm.commerce.ubf.event.BusinessFlowEventData anEventData)
          The BusinessFlowEventListener will use this method to pass in all data the command needs.
 void setEntityId(java.lang.Long anEntityId)
          Allow UBF passes an entity Id to the entry action command.
 void setEntityObject(java.lang.Object anEntityObject)
          Allow UBF passes an entity object to the entry action command to avoid instantiating another instance of entity object.
 void validateParameters()
          Performs server side parameter checking.
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, 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.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

OrderProcessCheckApprovalCmdImpl

public OrderProcessCheckApprovalCmdImpl()
Method Detail

checkApproval

public boolean checkApproval()
                      throws ECException
This method implemented the business logic of whether the order requires approval. For each order item in the order, check the contract in the order item. If there is an OrderApprovalTC, it check the amount specified the TC. If the amount is less than the total price of the order inlcuding shipping and tax, it returns true. If all order items are checked and cannot find any OrderApprovalTCs satisfy the above condition, it returns false.

getEventIdentifier

public java.lang.String getEventIdentifier()
Allow the entry action to return an eventIdentifier to start an automatic transition.
Returns:
The eventIdentifier for the automatic transition.

performExecute

public void performExecute()
                    throws ECException
Calls checkApproval() to find out if the approval is required. if checkApproval() returns true, it sets the eventIdentifier to be "BeginApproval". if checkApproval() returns false, it sets the eventIdentifier to be "NoApprovalNeeded".
Overrides:
performExecute in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

reset

public void reset()
Description copied from class: AbstractECCommand
This method is called after a command has been executed to reset its states variables. After the call to reset, we should be able to execute the command again.
Overrides:
reset in class AbstractECCommand

setBusinessFlowEventData

public void setBusinessFlowEventData(com.ibm.commerce.ubf.event.BusinessFlowEventData anEventData)
The BusinessFlowEventListener will use this method to pass in all data the command needs. .
Parameters:
anEventData - The business flow event data which includes all information, including requestPropoerties, commandContext etc.

setEntityId

public void setEntityId(java.lang.Long anEntityId)
Allow UBF passes an entity Id to the entry action command.
Parameters:
anEntityId - The entity Id.

setEntityObject

public void setEntityObject(java.lang.Object anEntityObject)
Allow UBF passes an entity object to the entry action command to avoid instantiating another instance of entity object.
Parameters:
anEntityObject - The entity object.

validateParameters

public void validateParameters()
                        throws ECException
Description copied from interface: ECCommand
Performs server side parameter checking. This method replaces the checkParameters() method in a previous version of the code.

Overrides:
validateParameters in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -