com.ibm.commerce.fulfillment.commands
Class AllocateExistingInventoryCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.fulfillment.commands.AllocateExistingInventoryCmdImpl
All Implemented Interfaces:
AllocateExistingInventoryCmd, ECCommand, ECTargetableCommand, TaskCommand

public class AllocateExistingInventoryCmdImpl
extends TaskCommandImpl
implements AllocateExistingInventoryCmd

The default implementation of the AllocateExistingInventory task command interface. Refer to the performExecute method for a description of its behaviour.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field.
protected static java.lang.String istrCheckParametersFunc
          Deprecated. Will be changed to private.
protected static java.lang.String istrPerformFunc
          Deprecated. Will be changed to private.
protected static java.lang.String istrThisClass
          Deprecated. Will be changed to private.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.fulfillment.commands. AllocateExistingInventoryCmd
defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
AllocateExistingInventoryCmdImpl()
           
 
Method Summary
 java.util.Vector getFulfillmentCenters()
          Deprecated. This method will be changed to protected.
 java.lang.Integer getNextStrategy()
          Gets the next allocation strategy set by the command.
  OrderItemAccessBean getOrderItem()
          Deprecated. This method will be changed to protected.
 java.lang.Integer getStrategy()
          Deprecated. This method will be changed to protected.
 void performExecute()
          Performs the actual business logic of the command.
 void reset()
          This method should be called after a command has been executed to reset its instance variables.
 void setFulfillmentCenters(java.util.Vector newFulfillmentCenters)
          Sets a prioritized list of fulfillment centers from which the inventory should be allocated.
 void setNextStrategy(java.lang.Integer newNextStrategy)
          Deprecated. This method will be changed to protected.
 void setOrderItem( OrderItemAccessBean anOrderItem)
          Sets the order item for which existing inventory is to be allocated.
 void setStrategy(java.lang.Integer newStrategy)
          Sets the allocation strategy to be used.
 void validateParameters()
          Performs server side parameter checking.
 
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, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

istrThisClass

protected static java.lang.String istrThisClass
Deprecated. Will be changed to private.

istrPerformFunc

protected static java.lang.String istrPerformFunc
Deprecated. Will be changed to private.

istrCheckParametersFunc

protected static java.lang.String istrCheckParametersFunc
Deprecated. Will be changed to private.
Constructor Detail

AllocateExistingInventoryCmdImpl

public AllocateExistingInventoryCmdImpl()
Method Detail

getFulfillmentCenters

public java.util.Vector getFulfillmentCenters()
Deprecated. This method will be changed to protected.
Gets a prioritized list of fulfillment centers from which the inventory should be allocated.
Returns:
a prioritized list of fulfillment center identifiers (Vector of Integer).

getNextStrategy

public java.lang.Integer getNextStrategy()
Gets the next allocation strategy set by the command. A changed strategy indicates to the caller that if the allocation performed by this task command is unacceptable to the caller, the caller can call this task command again (after reversing the unacceptable allocation) to perhaps achieve a more acceptable allocation.
Specified by:
getNextStrategy in interface AllocateExistingInventoryCmd
Returns:
the next stategy.

getOrderItem

public OrderItemAccessBean getOrderItem()
Deprecated. This method will be changed to protected.
Gets the order item for which existing inventory is to be allocated.
Returns:
the order item.

getStrategy

public java.lang.Integer getStrategy()
Deprecated. This method will be changed to protected.
Gets the allocation strategy set by the caller.
Returns:
the allocation strategy.

performExecute

public void performExecute()
                    throws ECException
Performs the actual business logic of the command. Behaviour
  1. Set next strategy to input strategy.
  2. If the order item is suitable for allocation (i.e. its inventory status attribute specifies unallocated or backordered), and there is sufficient existing inventory at one of the specified fulfillment centers (searching in order from first to last in the input fulfillment centers), to completely allocate the quantity needed by the order item, allocate it and update the order item to reflect the allocation.
  3. If the order item is still unallocated or backordered and there is sufficient existing inventory at one of the specified fulfillment centers (searching in order from first to last in the list of input fulfillment centers), to partially or fully allocate the quantity needed by the order item, allocate that amount, rounded down as explained in the next sentence, and update the order item to reflect the allocation. When the amount to allocate cannot be allocated fully, the amount actually allocated is rounded down to the nearest multiple of a floating point number obtained by converting the CatEntShip.QuantityMultiple for the CatEntry of the order item to the unit of measure specified by BaseItem, and divided by BaseItem.QuantityMultiple, and then that multiple is rounded to the nearest integer. When there is no CatEntShip for the order item's CatEntry, CatEntShip.QuantityMultiple is assumed to be 1, and CatEntShip.QuantityMeasure is assumed to be 'C62'. However, when the order item has no CatEntry, the amount to allocate is not rounded down at all (i.e. it is rounded down to the nearest multiple of 1).
  4. If none of the needed quantity can be allocated, the order item is not changed.

This default implementation of the AllocateExistingInventory task command calls the getitems database stored procedure.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException

reset

public void reset()
This method should be called after a command has been executed to reset its instance variables.
Overrides:
reset in class AbstractECTargetableCommand

setFulfillmentCenters

public void setFulfillmentCenters(java.util.Vector newFulfillmentCenters)
Sets a prioritized list of fulfillment centers from which the inventory should be allocated.
Specified by:
setFulfillmentCenters in interface AllocateExistingInventoryCmd
Parameters:
newFulfillmentCenters - a prioritized list of fulfillment center identifiers (Vector of Integer).

setNextStrategy

public void setNextStrategy(java.lang.Integer newNextStrategy)
Deprecated. This method will be changed to protected.
Sets the next allocation strategy.
Parameters:
newNextStrategy - the next allocation strategy.

setOrderItem

public void setOrderItem(OrderItemAccessBean anOrderItem)
Sets the order item for which existing inventory is to be allocated.
Specified by:
setOrderItem in interface AllocateExistingInventoryCmd
Parameters:
anOrderItem - the order item.

setStrategy

public void setStrategy(java.lang.Integer newStrategy)
Sets the allocation strategy to be used. Zero must be an acceptable value. The caller can specify zero, or a value returned by the getStrategy method after a previous execution of this task command.
Specified by:
setStrategy in interface AllocateExistingInventoryCmd
Parameters:
newStrategy - the strategy to be used.

validateParameters

public void validateParameters()
                        throws ECException
Performs server side parameter checking.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - thrown when the order item or the fulfillment centers have not been set.