atg.commerce.fulfillment
Class OrderFulfillmentTools

java.lang.Object
  extended by atg.commerce.fulfillment.OrderFulfillmentTools

public class OrderFulfillmentTools
extends java.lang.Object

This class contains convenience methods for various tasks that occur frequently during the order fulfillment process. Examples include changing the states of objects, preparing messages. OrderFulfiller and HardgoodFulfiller both use this class.

See Also:
OrderFulfiller, HardgoodFulfiller

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
OrderFulfillmentTools()
           
 
Method Summary
 boolean areAllGroupsPendingRemove(Order pOrder)
          Check if all the groups in this object are PENDING_REMOVE
 boolean areAllGroupsRemoved(Order pOrder)
          Check if all the groups in this object are REMOVED
 boolean checkIfAllGroupsAreShipped(Order pOrder)
          Loop through all the shipping groups in an order, returning true if the state of all those groups is set to NO_PENDING_ACTION, otherwise return false
 GenericAdd createGenericAddIdToValueModification(int pTargetType, java.lang.String pTarget, int pContainerType, java.io.Serializable pContainer)
          This method creates a GenericAdd message and sets all the properties accordingly.
 GenericAdd createGenericAddValueToIdModification(int pTargetType, java.io.Serializable pTarget, int pContainerType, java.lang.String pContainer)
          This method creates a GenericAdd message and sets all the properties accordingly.
 GenericAdd createGenericAddValueToValueModification(int pTargetType, java.io.Serializable pTarget, int pContainerType, java.io.Serializable pContainer)
          This method creates a GenericAdd message and sets all the properties accordingly.
 GenericRemove createGenericRemoveModification(int pTargetType, java.lang.String pTarget, int pContainerType, java.lang.String pContainer)
          This method creates a GenericRemove message and sets all the properties accordingly.
 GenericUpdate createGenericUpdateModification(java.lang.String pPropertyName, java.io.Serializable pOriginalValue, java.io.Serializable pNewValue, java.lang.String pTargetId, int pTargetType, boolean pSuccess)
          This method creates a GenericUpdate message and sets all the properties accordingly.
 Modification createItemUpdateModification(java.lang.String pPropertyName, java.io.Serializable pOriginalValue, java.io.Serializable pNewValue, java.lang.String pTargetId)
          A convenience method which in the reference implementation will return a GenericuUpdate Modification object targeting items.
 Modification createOrderUpdateModification(java.lang.String pPropertyName, java.io.Serializable pOriginalValue, java.io.Serializable pNewValue, java.lang.String pTargetId)
          A convenience method which in the reference implementation will return a GenericUpdate Modification object targeting order objects.
 Modification createPayUpdateModification(java.lang.String pPropertyName, java.io.Serializable pOriginalValue, java.io.Serializable pNewValue, java.lang.String pTargetId)
          A convenience method which in the reference implementation will return a GenericUpdate Modification object targeting payment groups
 Modification createRelationshipUpdateModification(java.lang.String pPropertyName, java.io.Serializable pOriginalValue, java.io.Serializable pNewValue, java.lang.String pTargetId)
          A convenience method which in the reference implementation will return a GenericuUpdate Modification object targeting items.
 Modification createShipUpdateModification(java.lang.String pPropertyName, java.io.Serializable pOriginalValue, java.io.Serializable pNewValue, java.lang.String pTargetId)
          A convenience method which in the reference implementation will return a GenericUpdate Modification object targeting shipping groups
 java.util.List extractShippingGroupIds(java.util.List pShippingGroups)
          Returns a list of shipping group ids from a given list of shipping groups.
 java.lang.Object getCatalogRef(CommerceItem pItem)
          This gets a CatalogRef object for a given item.
 CatalogTools getCatalogTools()
          The tools for getting items out of the catalog
 CommerceItemStates getCommerceItemStates()
          The object containing all the states of an item
 java.lang.String getDefaultFulfiller()
          This is the default fulfiller.
 java.lang.String getFulfillerForItem(CommerceItem pItem)
           This method returns the fulfiller for a given CommerceItem.
 java.lang.String getFulfillerForShippingGroup(ShippingGroup pShippingGroup)
          Return the fulfiller for the given shipping group.
 java.lang.String getFulfillerPort(java.lang.String pFulfiller)
           Maps the fulfiller name to the port on which it should be sent.
 java.util.Properties getFulfillerPortNameMap()
          This mapping defines what ports that messages designated for certain fulfillers should use.
 java.util.HashMap getFulfillersForShippingGroups(java.util.List pShipGroupList)
          This method returns a HashMap whose key is the fulfiller and the value is a List of the ShippingGroups.
 java.util.HashMap getFulfillerShippingGroupClassHashMap()
           
 java.util.Properties getFulfillerShippingGroupClassMap()
          This mapping defines which shipping group classes can be fulfilled by each fulfiller.
 java.lang.String getGiftCertificateClassType()
          The PaymentGroupClassType of gift certificates.
 java.util.HashMap getItemFulfillerMap(Order pOrder, ShippingGroup pShippingGroup)
           Given an order and a shipping group will generate a HashMap where the keys are the fulfillers an the values are the List of item ids which belong to that fulfiller.
 IdGenerator getMessageIdGenerator()
          The service that generates Ids for all messages.
 java.lang.String getMessageIdSpaceName()
          The name of the idspace to get our message ids from
 java.lang.String getNextMessageId()
          Returns the next unique Id for commerce messages.
 OrderManager getOrderManager()
          The order manager controls access to the order and all objects within an order.
 OrderStates getOrderStates()
          The object containing all the states of an order
 PaymentGroupStates getPaymentGroupStates()
          The object containing all the states of an payment group
 ShipItemRelationshipStates getShipItemRelationshipStates()
          The object containing all the states of a shipping group / item relationship
 ShippingGroupStates getShippingGroupStates()
          The object containing all the states of an shipping group
 boolean hasAnyGroupShipped(Order pOrder)
          Loop through all the shipping groups in an order, returning false if the state of one of those groups is set to NO_PENDING_ACTION, otherwise return true
 boolean hasOrderSettled(Order pOrder)
          This returns true if every payment group in the order has settled.
 boolean isAnyGroupPendingShipment(Order pOrder)
          Loop through all the shipping groups in an order, returning false if the state of one of those groups is set to PENDING_SHIPMENT, otherwise return true
 boolean isOrderFinished(Order pOrder)
          This method returns false if there is any work left to be done on any of the objects within an order.
 boolean isOrderSettleable(Order pOrder, boolean pSettleOnFirstShipment)
          This method is called to determine whether the shipping group should be settled at this time or not.
 boolean isShippingGroupSingleFulfiller(ShippingGroup pShipGroup)
          This method checks how many fulfillers that the items within the given shipping group are fulfilled by.
 void modificationFailed(Modification pModification, java.util.List pModificationList, java.lang.String pStatusText)
          Sets the status of the given modification to Modification.STATUS_FAILED then adds it to the given list.
 void modificationSucceeded(Modification pModification, java.util.List pModificationList)
          Sets the status of the given modification to Modification.STATUS_SUCCESS then addes it to the given list.
 void printOrder(Order pOrder)
          For debugging purposes, print out all the order information for the given order to standard out
 void sendModifyOrder(java.lang.String pOrderId, java.util.List pModificationList, SourceSinkTemplate pMessageSource, java.lang.String pMessagePort, ModifyOrder pOriginalMessage)
           This method will send an ModifyOrder message
 void sendModifyOrderNotification(java.lang.String pOrderId, java.util.List pModificationList, ModifyOrder pModifyOrder, SourceSinkTemplate pMessageSource, java.lang.String pMessagePort, ModifyOrderNotification pOriginalMessage)
           This method will send an ModifyOrderNotification message
 void sendShippingGroupUpdateModification(Order pOrder, java.util.List pShippingGroupList, SourceSinkTemplate pMessageSource, ModifyOrderNotification pOriginalMessage)
          This method takes a list of shipping groups, and sends a ShippingGroupUpdate modification to the appropriate fulfillers.
 void setCatalogTools(CatalogTools pCatalogTools)
           
 void setCommerceItemStates(CommerceItemStates pCommerceItemStates)
           
 void setDefaultFulfiller(java.lang.String pDefaultFulfiller)
           
 void setFulfillerPortNameMap(java.util.Properties pFulfillerPortNameMap)
           
 void setFulfillerShippingGroupClassMap(java.util.Properties pFulfillerShippingGroupClassMap)
           
 void setGiftCertificateClassType(java.lang.String pGiftCertificateClassType)
           
 void setItemRelationshipState(ShippingGroupCommerceItemRelationship pShippingGroupItemRelationship, int pNewState, java.lang.String pDetail, java.util.List pModificationList)
          Set the state of the item relationship.
 void setItemState(CommerceItem pItem, int pNewState, java.lang.String pDetail, java.util.List pModificationList)
          Set the state of the item.
 void setMessageIdGenerator(IdGenerator pMessageIdGenerator)
           
 void setMessageIdSpaceName(java.lang.String pMessageIdSpaceName)
           
 void setOrderManager(OrderManager pOrderManager)
           
 void setOrderState(Order pOrder, int pNewState, java.lang.String pDetail, java.util.List pModificationList)
          Set the state of the order.
 void setOrderStates(OrderStates pOrderStates)
           
 void setPaymentGroupState(PaymentGroup pPaymentGroup, int pNewState, java.lang.String pDetail, java.util.List pModificationList)
          Set the state of the payment group.
 void setPaymentGroupStates(PaymentGroupStates pPaymentGroupStates)
           
 void setShipItemRelationshipStates(ShipItemRelationshipStates pShipItemRelationshipStates)
           
 void setShippingGroupState(ShippingGroup pShippingGroup, int pNewState, java.lang.String pDetail, java.util.List pModificationList)
          Set the state of the shipping group.
 void setShippingGroupStates(ShippingGroupStates pShippingGroupStates)
           
 void setSubSkuItemState(SubSkuCommerceItem pItem, ShippingGroup pShippingGroup, int pNewState, java.lang.String pDetail, java.util.List pModificationList)
          Set the state of the item relationship.
 java.util.List splitShippingGroupsByFulfiller(Order pOrder, java.util.List pShippingGroups, java.util.List pModificationList)
           This method will split the shipping groups such that none of the shipping groups will contain items from multiple shipping groups.
 void verifyOrderFulfillment(Order pOrder)
           This method verifies that the order to be fulfilled is in a state which allows it to be fulfilled.
 void verifyShippingGroupsForFulfiller(Order pOrder, java.lang.String pFulfiller, java.util.List pShippingGroupIds)
          Using the fulfillerShippingGroupClassMap, this method will verify that each shipping group is of a type that the fulfiller can handle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

OrderFulfillmentTools

public OrderFulfillmentTools()
Method Detail

setFulfillerPortNameMap

public void setFulfillerPortNameMap(java.util.Properties pFulfillerPortNameMap)

getFulfillerPortNameMap

public java.util.Properties getFulfillerPortNameMap()
This mapping defines what ports that messages designated for certain fulfillers should use.


setFulfillerShippingGroupClassMap

public void setFulfillerShippingGroupClassMap(java.util.Properties pFulfillerShippingGroupClassMap)

getFulfillerShippingGroupClassMap

public java.util.Properties getFulfillerShippingGroupClassMap()
This mapping defines which shipping group classes can be fulfilled by each fulfiller. This map is consulted before a FulfillOrderFragment message is sent to ensure the fulfiller does not get a shipping group that it cannot handle.


getFulfillerShippingGroupClassHashMap

public java.util.HashMap getFulfillerShippingGroupClassHashMap()

setDefaultFulfiller

public void setDefaultFulfiller(java.lang.String pDefaultFulfiller)

getDefaultFulfiller

public java.lang.String getDefaultFulfiller()
This is the default fulfiller. If a repository item does not specify what fulfiller should be used, this is what is used.


setOrderManager

public void setOrderManager(OrderManager pOrderManager)

getOrderManager

public OrderManager getOrderManager()
The order manager controls access to the order and all objects within an order.


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)

getCatalogTools

public CatalogTools getCatalogTools()
The tools for getting items out of the catalog


setGiftCertificateClassType

public void setGiftCertificateClassType(java.lang.String pGiftCertificateClassType)

getGiftCertificateClassType

public java.lang.String getGiftCertificateClassType()
The PaymentGroupClassType of gift certificates. Used when crediting, after a cancellation


setMessageIdGenerator

public void setMessageIdGenerator(IdGenerator pMessageIdGenerator)

getMessageIdGenerator

public IdGenerator getMessageIdGenerator()
The service that generates Ids for all messages.


setMessageIdSpaceName

public void setMessageIdSpaceName(java.lang.String pMessageIdSpaceName)

getMessageIdSpaceName

public java.lang.String getMessageIdSpaceName()
The name of the idspace to get our message ids from


setOrderStates

public void setOrderStates(OrderStates pOrderStates)

getOrderStates

public OrderStates getOrderStates()
The object containing all the states of an order


setCommerceItemStates

public void setCommerceItemStates(CommerceItemStates pCommerceItemStates)

getCommerceItemStates

public CommerceItemStates getCommerceItemStates()
The object containing all the states of an item


setShippingGroupStates

public void setShippingGroupStates(ShippingGroupStates pShippingGroupStates)

getShippingGroupStates

public ShippingGroupStates getShippingGroupStates()
The object containing all the states of an shipping group


setPaymentGroupStates

public void setPaymentGroupStates(PaymentGroupStates pPaymentGroupStates)

getPaymentGroupStates

public PaymentGroupStates getPaymentGroupStates()
The object containing all the states of an payment group


setShipItemRelationshipStates

public void setShipItemRelationshipStates(ShipItemRelationshipStates pShipItemRelationshipStates)

getShipItemRelationshipStates

public ShipItemRelationshipStates getShipItemRelationshipStates()
The object containing all the states of a shipping group / item relationship


createOrderUpdateModification

public Modification createOrderUpdateModification(java.lang.String pPropertyName,
                                                  java.io.Serializable pOriginalValue,
                                                  java.io.Serializable pNewValue,
                                                  java.lang.String pTargetId)
A convenience method which in the reference implementation will return a GenericUpdate Modification object targeting order objects.

Parameters:
pPropertyName - the property of the Order object that was modified
pOriginalValue - the original value of the property that was modified
pNewValue - the new value of the property that was modified
pTargetId - the id of the target to be modified
See Also:
GenericUpdate

createShipUpdateModification

public Modification createShipUpdateModification(java.lang.String pPropertyName,
                                                 java.io.Serializable pOriginalValue,
                                                 java.io.Serializable pNewValue,
                                                 java.lang.String pTargetId)
A convenience method which in the reference implementation will return a GenericUpdate Modification object targeting shipping groups

Parameters:
pPropertyName - the property of the Order object that was modified
pOriginalValue - the original value of the property that was modified
pNewValue - the new value of the property that was modified
pTargetId - the id of the target to be modified
See Also:
GenericUpdate

createPayUpdateModification

public Modification createPayUpdateModification(java.lang.String pPropertyName,
                                                java.io.Serializable pOriginalValue,
                                                java.io.Serializable pNewValue,
                                                java.lang.String pTargetId)
A convenience method which in the reference implementation will return a GenericUpdate Modification object targeting payment groups

Parameters:
pPropertyName - the property of the Order object that was modified
pOriginalValue - the original value of the property that was modified
pNewValue - the new value of the property that was modified
pTargetId - the id of the target to be modified
See Also:
GenericUpdate

createItemUpdateModification

public Modification createItemUpdateModification(java.lang.String pPropertyName,
                                                 java.io.Serializable pOriginalValue,
                                                 java.io.Serializable pNewValue,
                                                 java.lang.String pTargetId)
A convenience method which in the reference implementation will return a GenericuUpdate Modification object targeting items.

Parameters:
pPropertyName - the property of the Order object that was modified
pOriginalValue - the original value of the property that was modified
pNewValue - the new value of the property that was modified
pTargetId - the id of the target to be modified
See Also:
GenericUpdate

createRelationshipUpdateModification

public Modification createRelationshipUpdateModification(java.lang.String pPropertyName,
                                                         java.io.Serializable pOriginalValue,
                                                         java.io.Serializable pNewValue,
                                                         java.lang.String pTargetId)
A convenience method which in the reference implementation will return a GenericuUpdate Modification object targeting items.

Parameters:
pPropertyName - the property of the Order object that was modified
pOriginalValue - the original value of the property that was modified
pNewValue - the new value of the property that was modified
pTargetId - the id of the target to be modified
See Also:
GenericUpdate

createGenericUpdateModification

public GenericUpdate createGenericUpdateModification(java.lang.String pPropertyName,
                                                     java.io.Serializable pOriginalValue,
                                                     java.io.Serializable pNewValue,
                                                     java.lang.String pTargetId,
                                                     int pTargetType,
                                                     boolean pSuccess)
This method creates a GenericUpdate message and sets all the properties accordingly.

Parameters:
pPropertyName - The name of the property being updated.
pOriginalValue - The original value of the property
pNewValue - The new value of the property
pTargetId - The id of the object being updated.
pTargetType - The tpye of the object being updated.
pSuccess - a boolean indicating whether the modification was a successful one or not
Returns:
The newly created GenericUpdate object.
See Also:
GenericUpdate

createGenericRemoveModification

public GenericRemove createGenericRemoveModification(int pTargetType,
                                                     java.lang.String pTarget,
                                                     int pContainerType,
                                                     java.lang.String pContainer)
This method creates a GenericRemove message and sets all the properties accordingly.

Parameters:
pTargetType - the type of the object being removed
pTarget - the id of the object being removed
pContainerType - the type of the container of the object being removed
pContainer - the id of the container
Returns:
The newly created GenericRemove object.
See Also:
GenericRemove

createGenericAddValueToValueModification

public GenericAdd createGenericAddValueToValueModification(int pTargetType,
                                                           java.io.Serializable pTarget,
                                                           int pContainerType,
                                                           java.io.Serializable pContainer)
This method creates a GenericAdd message and sets all the properties accordingly. The target is a value, the container is a value

Parameters:
pTargetType - the type of the object being added
pTarget - the id of the object being added
pContainerType - the type of the container of the object being added
pContainer - the id of the container
Returns:
The newly created GenericAdd object.
See Also:
GenericAdd

createGenericAddValueToIdModification

public GenericAdd createGenericAddValueToIdModification(int pTargetType,
                                                        java.io.Serializable pTarget,
                                                        int pContainerType,
                                                        java.lang.String pContainer)
This method creates a GenericAdd message and sets all the properties accordingly. The target is a value, the container is an id

Parameters:
pTargetType - the type of the object being added
pTarget - the id of the object being added
pContainerType - the type of the container of the object being added
pContainer - the id of the container
Returns:
The newly created GenericAdd object.
See Also:
GenericAdd

createGenericAddIdToValueModification

public GenericAdd createGenericAddIdToValueModification(int pTargetType,
                                                        java.lang.String pTarget,
                                                        int pContainerType,
                                                        java.io.Serializable pContainer)
This method creates a GenericAdd message and sets all the properties accordingly. The target is an id, the container is a value

Parameters:
pTargetType - the type of the object being added
pTarget - the id of the object being added
pContainerType - the type of the container of the object being added
pContainer - the id of the container
Returns:
The newly created GenericAdd object.
See Also:
GenericAdd

setItemRelationshipState

public void setItemRelationshipState(ShippingGroupCommerceItemRelationship pShippingGroupItemRelationship,
                                     int pNewState,
                                     java.lang.String pDetail,
                                     java.util.List pModificationList)
Set the state of the item relationship. Two modifications are added to pModificationList. One for the state and one for the state detail.

Parameters:
pShippingGroupItemRelationship - The item to update
pNewState - The state to set the item to.
pDetail - The state detail message to use. If null, a default will be used.
pModificationList - The place to save the modification

setSubSkuItemState

public void setSubSkuItemState(SubSkuCommerceItem pItem,
                               ShippingGroup pShippingGroup,
                               int pNewState,
                               java.lang.String pDetail,
                               java.util.List pModificationList)
Set the state of the item relationship. Two modifications are added to pModificationList. One for the state and one for the state detail.

Parameters:
pShippingGroupItemRelationship - The item to update
pNewState - The state to set the item to.
pDetail - The state detail message to use. If null, a default will be used.
pModificationList - The place to save the modification

setItemState

public void setItemState(CommerceItem pItem,
                         int pNewState,
                         java.lang.String pDetail,
                         java.util.List pModificationList)
Set the state of the item. Two modifications are added to pModificationList. One for the state and one for the state detail.

Parameters:
pItem - The item to update
pNewState - The state to set the item to.
pDetail - The state detail message to use. If null, a default will be used.
pModificationList - The place to save the modification

setShippingGroupState

public void setShippingGroupState(ShippingGroup pShippingGroup,
                                  int pNewState,
                                  java.lang.String pDetail,
                                  java.util.List pModificationList)
Set the state of the shipping group. Two modifications are added to pModificationList. One for the state and one for the state detail.

Parameters:
pShippingGroup - The shipping group to update
pNewState - The state to set the shipping group to.
pDetail - The state detail message to use. If null, a default will be used.
pModificationList - The place to save the modification

setPaymentGroupState

public void setPaymentGroupState(PaymentGroup pPaymentGroup,
                                 int pNewState,
                                 java.lang.String pDetail,
                                 java.util.List pModificationList)
Set the state of the payment group. Two modifications are added to pModificationList. One for the state and one for the state detail.

Parameters:
pPaymentGroup - The shipping group to update
pNewState - The state to set the shipping group to.
pDetail - The state detail message to use. If null, a default will be used.
pModificationList - The place to save the modification

setOrderState

public void setOrderState(Order pOrder,
                          int pNewState,
                          java.lang.String pDetail,
                          java.util.List pModificationList)
Set the state of the order. Two modifications are added to pModificationList. One for the state and one for the state detail.

Parameters:
pOrder - The order to update
pNewState - The state to set the shipping group to.
pDetail - The state detail message to use. If null, a default will be used.
pModificationList - The place to save the modification

isShippingGroupSingleFulfiller

public boolean isShippingGroupSingleFulfiller(ShippingGroup pShipGroup)
                                       throws CommerceException
This method checks how many fulfillers that the items within the given shipping group are fulfilled by. If all items use the same fulfiller, the true is returned. If some items use a different fulfiller than other items, then false is returned.

Parameters:
pShipGroup - The shipping group being checked.
Returns:
true if shipping group uses a single fulfiller, false otherwise
Throws:
CommerceException

getFulfillersForShippingGroups

public java.util.HashMap getFulfillersForShippingGroups(java.util.List pShipGroupList)
This method returns a HashMap whose key is the fulfiller and the value is a List of the ShippingGroups. This method assumes that every shipping group passed in contains items for one and only one fulfiller.

Parameters:
pShipGroupList - - a List of the shipping groups to be parsed.
Returns:
the HashMap

getFulfillerPort

public java.lang.String getFulfillerPort(java.lang.String pFulfiller)

Maps the fulfiller name to the port on which it should be sent.

Parameters:
pFulfiller - - the name of the fulfiller
Returns:
the portname on which the message will be sent.

extractShippingGroupIds

public java.util.List extractShippingGroupIds(java.util.List pShippingGroups)
Returns a list of shipping group ids from a given list of shipping groups.

Parameters:
pShippingGroups - - a List of ShippingGroups
See Also:
ShippingGroup

splitShippingGroupsByFulfiller

public java.util.List splitShippingGroupsByFulfiller(Order pOrder,
                                                     java.util.List pShippingGroups,
                                                     java.util.List pModificationList)
                                              throws CommerceException

This method will split the shipping groups such that none of the shipping groups will contain items from multiple shipping groups. This method assumes that the caller will write the order back to permanent storage.

Parameters:
pOrder - - the order containing the shipping groups
pShippingGroups - - a List of the shipping groups that require some form of splitting
pModificationList - - A place holder for all new modifications
Throws:
CommerceException

getItemFulfillerMap

public java.util.HashMap getItemFulfillerMap(Order pOrder,
                                             ShippingGroup pShippingGroup)
                                      throws CommerceException,
                                             InvalidParameterException

Given an order and a shipping group will generate a HashMap where the keys are the fulfillers an the values are the List of item ids which belong to that fulfiller.

Parameters:
pOrder - - the order containing the shipping gorup
pShippingGroup - - the shipping group passed
Returns:
a HashMap where the keys are the fulfillers and the values are Lists of item ids belonging to that shipping group.
Throws:
CommerceException
InvalidParameterException

modificationFailed

public void modificationFailed(Modification pModification,
                               java.util.List pModificationList,
                               java.lang.String pStatusText)
Sets the status of the given modification to Modification.STATUS_FAILED then adds it to the given list.

Parameters:
pModification - The modification that failed.
pModificationList - The list to add the modification to
pStatusText - The text to set the modifications statusText property to
See Also:
Modification.STATUS_FAILED

modificationSucceeded

public void modificationSucceeded(Modification pModification,
                                  java.util.List pModificationList)
Sets the status of the given modification to Modification.STATUS_SUCCESS then addes it to the given list.

Parameters:
pModification - The modification that failed.
pModificationList - The list to add the modification to
See Also:
Modification.STATUS_SUCCESS

getFulfillerForItem

public java.lang.String getFulfillerForItem(CommerceItem pItem)
                                     throws CommerceException

This method returns the fulfiller for a given CommerceItem. The standard implementation uses the AuxiliaryData and the catalog ref to get a hold of the fulfiller.

Parameters:
pItem - the item whose fulfiller is needed
Returns:
the fulfiller name
Throws:
CommerceException

getFulfillerForShippingGroup

public java.lang.String getFulfillerForShippingGroup(ShippingGroup pShippingGroup)
Return the fulfiller for the given shipping group. This method assumes that this shipping group uses one and only one fulfiller. This method assumes the shipping group is not empty.

Parameters:
pShippingGroup - The shipping group whose fulfiller is needed
Returns:
The fulfiller

verifyShippingGroupsForFulfiller

public void verifyShippingGroupsForFulfiller(Order pOrder,
                                             java.lang.String pFulfiller,
                                             java.util.List pShippingGroupIds)
                                      throws CommerceException
Using the fulfillerShippingGroupClassMap, this method will verify that each shipping group is of a type that the fulfiller can handle. Assumes the order is not null.

Parameters:
pOrder - The order containing the shipping groups
pFulfiller - The name of the fulfiller
pShippingGroupIds - The list of shipping groups destined for this fulfiller
Throws:
InvalidShippingGroupTypeException - Thrown if the shipping group is of an incorrect type
CommerceException

printOrder

public void printOrder(Order pOrder)
For debugging purposes, print out all the order information for the given order to standard out

Parameters:
pOrder - The order to print

getCatalogRef

public java.lang.Object getCatalogRef(CommerceItem pItem)
                               throws CommerceException
This gets a CatalogRef object for a given item.

Parameters:
pItem - The item we want the CatalogRef from
Returns:
a CatalogRef object
Throws:
CommerceException

sendModifyOrderNotification

public void sendModifyOrderNotification(java.lang.String pOrderId,
                                        java.util.List pModificationList,
                                        ModifyOrder pModifyOrder,
                                        SourceSinkTemplate pMessageSource,
                                        java.lang.String pMessagePort,
                                        ModifyOrderNotification pOriginalMessage)
                                 throws javax.jms.JMSException

This method will send an ModifyOrderNotification message

Parameters:
pOrderId - The order that was modified
pModificationList - The modifications that were made
pModifyOrder - The request that initiated these modifications. This is null if these changes were not requested by an incoming message.
pMessageSource - The source of the message.
pMessagePort - the port to send the message out on
pOriginalMessage - if this message is being forwarded, this is the original message that was received. If method call is creating the original message, this parameter should be null
Throws:
javax.jms.JMSException

sendModifyOrder

public void sendModifyOrder(java.lang.String pOrderId,
                            java.util.List pModificationList,
                            SourceSinkTemplate pMessageSource,
                            java.lang.String pMessagePort,
                            ModifyOrder pOriginalMessage)
                     throws javax.jms.JMSException

This method will send an ModifyOrder message

Parameters:
pOrderId - The order that was modified
pModificationList - The modifications that were made
pMessageSource - The source of the message.
pMessagePort - the port to send the message out on
pOriginalMessage - if this message is being forwarded, this is the original message that was received. If method call is creating the original message, this parameter should be null
Throws:
javax.jms.JMSException

sendShippingGroupUpdateModification

public void sendShippingGroupUpdateModification(Order pOrder,
                                                java.util.List pShippingGroupList,
                                                SourceSinkTemplate pMessageSource,
                                                ModifyOrderNotification pOriginalMessage)
                                         throws javax.jms.JMSException
This method takes a list of shipping groups, and sends a ShippingGroupUpdate modification to the appropriate fulfillers. If this modification is being forwarded, the appropriate attributes are used from the original modification.

Parameters:
pOrder - the order containing all the shipping groups.
pShippingGroupList - The list of shipping groups to send
pMessageSource - The source of the new message.
pOriginalMessage - The original message, null if irrelevant
Throws:
javax.jms.JMSException

areAllGroupsPendingRemove

public boolean areAllGroupsPendingRemove(Order pOrder)
Check if all the groups in this object are PENDING_REMOVE

Parameters:
pOrder - The order we are checking
Returns:
true if all groups are removed, false otherwise

areAllGroupsRemoved

public boolean areAllGroupsRemoved(Order pOrder)
Check if all the groups in this object are REMOVED

Parameters:
pOrder - The order we are checking
Returns:
true if all groups are removed, false otherwise

checkIfAllGroupsAreShipped

public boolean checkIfAllGroupsAreShipped(Order pOrder)
Loop through all the shipping groups in an order, returning true if the state of all those groups is set to NO_PENDING_ACTION, otherwise return false

Parameters:
pOrder - The order we are interested in
Returns:
true if all groups are done, false otherwise

hasAnyGroupShipped

public boolean hasAnyGroupShipped(Order pOrder)
Loop through all the shipping groups in an order, returning false if the state of one of those groups is set to NO_PENDING_ACTION, otherwise return true

Parameters:
pOrder - The order we are interested in
Returns:
true if no groups are done, false otherwise

isAnyGroupPendingShipment

public boolean isAnyGroupPendingShipment(Order pOrder)
Loop through all the shipping groups in an order, returning false if the state of one of those groups is set to PENDING_SHIPMENT, otherwise return true

Parameters:
pOrder - The order we are interested in
Returns:
true if no groups are done, false otherwise

verifyOrderFulfillment

public void verifyOrderFulfillment(Order pOrder)
                            throws IllegalOrderStateException

This method verifies that the order to be fulfilled is in a state which allows it to be fulfilled. If the order is in an incomplete state or a no pending action state then an exception is thrown.

Parameters:
pOrder - - the order to be verified.
Throws:
atg.commerce.IllegalOrderStateException - if the order is in an illegal state
IllegalOrderStateException

isOrderFinished

public boolean isOrderFinished(Order pOrder)
This method returns false if there is any work left to be done on any of the objects within an order. It pays no attention to the actual state of the order, but looks at each of the PaymentGroups and ShippingGroups contained therein.


isOrderSettleable

public boolean isOrderSettleable(Order pOrder,
                                 boolean pSettleOnFirstShipment)
This method is called to determine whether the shipping group should be settled at this time or not. In our default implementation this method will return true on the shipment of the first shipping group, or on the shipment of the last shipping group. If the order is already settled, this returns false.

Parameters:
pOrder - - the order to be settled
pSettleOnFirstShipment - true if the order should be settle after the first shipping group ship.
Returns:
true if the order should be settled now, false otherwise

hasOrderSettled

public boolean hasOrderSettled(Order pOrder)
This returns true if every payment group in the order has settled.

Parameters:
pOrder - The order we are checking.
Returns:
true if the order has settled, false otherwise

getNextMessageId

public java.lang.String getNextMessageId()
Returns the next unique Id for commerce messages.