| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.commerce.order.edit.CloneEditManager
public class CloneEditManager
This class contains the api for applying updates to a persisted order by making a clone of the order and then reconciling the original order with the clone after updates are made.
The advantage of making order updates this way is that all the changes to the clone can be discarded leaving the original order in its original state or all changes can be applied to the original order at once in a single transaction.
 The edit process is done in two phases. Both phases are defined as pipelines that consist of several steps. Pipelines
 are mapped and executed based on the state of the order being edited using the initializeEditChains
 and reconcileOrderChains, which allows for executing custom pipelines for orders in
 different states. 
 
 
 The CloneEditHandler components, which are mapped to property cloneEditHandlers are
 executed in various steps of both phases. Each handler is responsible for handling specific facets of the
 order during both phases. This is the main integration point for handling customizations
 to the Order. 
 
In the first phase, the original order is cloned at the repository level. The OrderManager is used to load the clone order, which creates the Commerce Order objects. The clone edit state object is created in this phase and each clone edit is executed.
The second phase reconciles the changes in the clone order with the original order.
initializeOrderEdit(Order), 
reconcileOrder(CloneEditState, Map), 
CloneEditHandler, 
CloneEditState| Field Summary | |
|---|---|
| static java.lang.String | CLASS_VERSION | 
| static java.lang.String | CLONEDITMANAGERthe key used to store the CloneEditManager refernce in the pipeline extra parameters | 
| static java.lang.String | CLONEEDITSTATEthe key used to store the CloneEditState object in the pipeline extra parameters | 
| static java.lang.String | CLONEORDERthe key used to store a refernce to the clone order in the pipeline extra parameters | 
| static java.lang.String | CONSUMED_PROMOTIONSthe key used to store the Map of promotions there were considered used and should be consumed. | 
| protected  CatalogTools | mCatalogTools | 
| protected  CloneEditHandler[] | mCloneEditHandlers | 
| protected  java.util.Map | mInitializeEditChains | 
| protected  InventoryManager | mInventoryManager | 
| protected  OrderManager | mOrderManager | 
| protected  PipelineManager | mPipelineManager | 
| protected  ProfileTools | mProfileTools | 
| protected  java.util.Map | mReconcileOrderChains | 
| protected  javax.transaction.TransactionManager | mTransactionManager | 
| static java.lang.String | PROMOTION_COUNTS_BEFORE_UPDATEthe key used to store the Map of promotion counts on the original order before the updates are applied | 
| static java.lang.String | PROMOTION_COUPON_MAPthe key used to save the Map of promotion to coupon on the original order before the updates are applied | 
| Fields inherited from class atg.nucleus.GenericService | 
|---|
| SERVICE_INFO_KEY | 
| Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging | 
|---|
| DEFAULT_LOG_TRACE_STATUS | 
| Fields inherited from interface atg.nucleus.logging.ApplicationLogging | 
|---|
| DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS | 
| Constructor Summary | |
|---|---|
| CloneEditManager() | |
| Method Summary | |
|---|---|
|  void | adjustCloneCommerceIdReferences(CloneEditState pCloneEditState)This API calls the adjustCloneCommerceIdReferenceson each handler, so each handler can update any references
 to commerce ids in the clone order to the clone counterpart ids. | 
|  void | adjustOriginalCommerceIdReferences(CloneEditState pCloneEditState)This API calls the adjustOriginalCommerceIdReferenceson each handler, so each handler can update any references
 to commerce ids in the original order to the original counterpart ids. | 
|  void | applyChanges(CloneEditState pCloneEditState)Applies all the changes in the clone to the original order. | 
|  java.util.Map | buildPropertyValueMap(java.lang.Object pObject)Iterates over all the properties of the object and creates a map of their values. | 
|  Order | cloneOrder(Order pOrder,
           java.util.Map pPropExceptions,
           java.util.Map pExcludedProperties)Clones the order at the repository level and then calls the OrderManager to load the order and return it. | 
|  void | consumePromotions(CloneEditState pCloneEditState,
                  RepositoryItem pCustomerProfile,
                  java.lang.String pTicketId)Compares the promotion use counts on the original order before and after the updates were applied, and consumes each promotion that was newly applied or had its use count increased. | 
|  AddItem | createAddItem(CloneEditState pCloneEditState,
              java.lang.Object pItem,
              java.lang.Object pOriginalContainter,
              java.lang.Object pCloneContainer,
              int pOrdinalPosition,
              java.lang.String pPropertyName,
              boolean pAutoRecoveredItem)Creates an AddItem object that represents an object that's been added to a container. | 
|  CloneEditState | createCloneEditStateObject()Retuns a new CloneEditState. | 
|  DeleteItem | createDeleteItem(CloneEditState pCloneEditState,
                 java.lang.Object pItem,
                 java.lang.Object pOriginalContainter,
                 java.lang.Object pCloneContainer,
                 java.lang.String pPropertyName,
                 int pOrdinalPosition,
                 boolean pAutoDeletedItem)Creates a DeleteItem object that represents an object that's been removed to a particular list. | 
|  java.util.Map | createPromotionToCouponMap(Order pOrder)Maps each promotion applied to the order to its corresponding coupon specified in the PricingAdjustment | 
|  UpdateItem | createUpdateItem(CloneEditState pCloneEditState,
                 java.lang.Object pOriginalItem,
                 java.lang.Object pCloneItem,
                 int pOrdinalPosition,
                 java.lang.String pPropertyName,
                 java.lang.Object pOriginalContainter,
                 java.lang.Object pCloneContainer)Creates an UpdateItem object that represents an updated object. | 
| protected  java.util.List | detectUpdatesInFinalAmountInfo(java.lang.Object pClonedlPricedObject,
                               java.lang.Object pOriginalPricedObject,
                               java.lang.String pPropertyName)Creates a list of PropertyUpdates that reflect changes of amount and amountIsFinal in the price info property | 
|  atg.userprofiling.PropertyUpdate | findPropertyUpdate(java.lang.String pPropertyName,
                   java.util.Collection pPropertyUpdates)Finds the PropertyUpdateobject for the given property name. | 
|  CatalogTools | getCatalogTools()Returns the CatalogTools that's passed into the reconcileOrder pipeline execution. | 
|  CloneEditHandler[] | getCloneEditHandlers()Returns the clone edit handlers | 
|  java.util.Map | getInitializeEditChains()Map of init edit order chain ids. | 
|  java.lang.String | getInitializeOrderEditChainId(Order pOrder)Returns the init edit order chain id based on the state of the given order. | 
|  InventoryManager | getInventoryManager()Returns the InventoryManager that's passed into the reconcileOrder pipeline execution. | 
|  OrderManager | getOrderManager() | 
|  PipelineManager | getPipelineManager()Returns the pipelineManager | 
|  ProfileTools | getProfileTools()returns the configured profile tools component. | 
|  PromotionTools | getPromotionTools()Return the PromotionTools property. | 
|  java.lang.String | getReconcileOrderChainId(Order pOrder)Returns the reconcile order chain id based on the state of the given order. | 
|  java.util.Map | getReconcileOrderChains()Map of reconcile chain ids. | 
|  javax.transaction.TransactionManager | getTransactionManager()Transaction Manager | 
|  void | initializeCloneEditState(CloneEditState pCloneEditState,
                         Order pOriginalOrder,
                         Order pCloneOrder)Initializes the CloneEditState using the original and clone order | 
|  CloneEditState | initializeOrderEdit(Order pOrder)Executes the pipeline chain that initializes the order edit process. | 
|  CloneEditState | initializeOrderEdit(Order pOrder,
                    java.lang.String pChainId,
                    java.util.Map pExtraParameters) | 
|  void | initializeReconciliationProcess(CloneEditState pCloneEditState)Prepares the CloneEditState for the reconciliation process. | 
| static java.util.Collection | parseConfigurationString(java.lang.String pString)Parse a String which is delimited by "|" into a collection of strings. | 
|  PipelineResult | reconcileOrder(CloneEditState pCloneEditState,
               java.util.Map pExtraParameters) | 
|  PipelineResult | reconcileOrder(CloneEditState pCloneEditState,
               java.lang.String pChainId,
               java.util.Map pExtraParameters)Runs the pipeline to reconcile the original order with the clone order. | 
| protected  java.util.List | reconcileProperties(java.lang.Object pClone,
                    java.lang.Object pOrig,
                    java.lang.String[] pProperties)Reconciles the properties between the original and clone objects by copying the property values from the clone to the original. | 
|  void | restoreCouponReferences(Order pOrder,
                        java.util.Map pPromotionToCoupon)Iterates over the orders PriceAdjustmentobjects and fills in the
 coupon property based on the promotion referenced in the adjustment. | 
|  void | sendFulfillmentNotifications(CloneEditState pCloneEditState)Sends the ModifyOrderNotification for changes made to the original order. | 
|  void | setCatalogTools(CatalogTools pCatalogTools) | 
|  void | setCloneEditHandlers(CloneEditHandler[] pCloneEditHandlers)Sets the clone edit handlers | 
|  void | setInitializeEditChains(java.util.Map pInitializeEditChains)Sets the map of order edit chain ids | 
|  void | setInventoryManager(InventoryManager pInventoryManager) | 
|  void | setOrderManager(OrderManager pOrderManager) | 
|  void | setPipelineManager(PipelineManager pPipelineManager)Sets the pipelineManager | 
|  void | setProfileTools(ProfileTools pProfileTools) | 
|  void | setPromotionTools(PromotionTools pPromotionTools)Set the PromotionTools property. | 
|  void | setReconcileOrderChains(java.util.Map pReconcileOrderChains) | 
|  void | setTransactionManager(javax.transaction.TransactionManager pTransactionManager)Sets the Transaction Manager. | 
|  void | validateClonedOrder(Order pOriginalOrder,
                    Order pCloneOrder)Validates the clone order against the original order. | 
| Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl | 
|---|
| vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String CLASS_VERSION
public static final java.lang.String CLONEEDITSTATE
public static final java.lang.String CLONEDITMANAGER
public static final java.lang.String CLONEORDER
public static final java.lang.String PROMOTION_COUNTS_BEFORE_UPDATE
public static final java.lang.String PROMOTION_COUPON_MAP
public static final java.lang.String CONSUMED_PROMOTIONS
protected ProfileTools mProfileTools
protected CloneEditHandler[] mCloneEditHandlers
protected javax.transaction.TransactionManager mTransactionManager
protected InventoryManager mInventoryManager
protected CatalogTools mCatalogTools
protected java.util.Map mInitializeEditChains
protected java.util.Map mReconcileOrderChains
protected PipelineManager mPipelineManager
protected OrderManager mOrderManager
| Constructor Detail | 
|---|
public CloneEditManager()
| Method Detail | 
|---|
public void setPromotionTools(PromotionTools pPromotionTools)
public PromotionTools getPromotionTools()
public ProfileTools getProfileTools()
public void setProfileTools(ProfileTools pProfileTools)
public void setCloneEditHandlers(CloneEditHandler[] pCloneEditHandlers)
CloneEditHandlers are components that are called are various points in the clone edit process. They can be used to clone and reconcile data between the original and clone orders.
CloneEditHandlerpublic CloneEditHandler[] getCloneEditHandlers()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public InventoryManager getInventoryManager()
public void setInventoryManager(InventoryManager pInventoryManager)
public CatalogTools getCatalogTools()
public void setCatalogTools(CatalogTools pCatalogTools)
public java.util.Map getInitializeEditChains()
Chains are expected to be mapped by order state.
getInitializeOrderEditChainId(Order)public void setInitializeEditChains(java.util.Map pInitializeEditChains)
public java.util.Map getReconcileOrderChains()
Chains are expected to be mapped by order state.
getReconcileOrderChainId(Order)public void setReconcileOrderChains(java.util.Map pReconcileOrderChains)
public java.lang.String getInitializeOrderEditChainId(Order pOrder)
getInitializeEditChains()public java.lang.String getReconcileOrderChainId(Order pOrder)
getReconcileOrderChains()public PipelineManager getPipelineManager()
public void setPipelineManager(PipelineManager pPipelineManager)
public OrderManager getOrderManager()
public void setOrderManager(OrderManager pOrderManager)
public CloneEditState createCloneEditStateObject()
public CloneEditState initializeOrderEdit(Order pOrder)
                                   throws CommerceException
The CloneEditState is created, initialized and returned. This object is used as input to several of the API for this process.
Executes the configured pipeline for initializing the edit process.
pOrder - the original order
CommerceExceptiongetInitializeOrderEditChainId(Order)
public CloneEditState initializeOrderEdit(Order pOrder,
                                          java.lang.String pChainId,
                                          java.util.Map pExtraParameters)
                                   throws CommerceException
CommerceException
public Order cloneOrder(Order pOrder,
                        java.util.Map pPropExceptions,
                        java.util.Map pExcludedProperties)
                 throws CommerceException
 The cloneOrder method is executed
 on all the clone edit handlers. 
 
pOrder - the order to clonepPropExceptions - Optional. Map of property exceptions passed to the 
 repository cloning process .pExcludedProperties - Properties to exclude from repository cloning process
CommerceExceptionRepositoryUtils.cloneItem(RepositoryItem, boolean, Map, Map, MutableRepository, String)
public PipelineResult reconcileOrder(CloneEditState pCloneEditState,
                                     java.lang.String pChainId,
                                     java.util.Map pExtraParameters)
                              throws CommerceException
This method registers and transaction synchronization that's used to invalidate the original and clone orders when the transaction is rolled back due to errors.
All errors during this process will set the transaction to rollback only.
 
 Before reconciling, as a convenience, the CloneEditState is added as a local thread
 variable.
pCloneEditState - the clone edit state objectpChainId - optional. the pipeline chain to run.pExtraParameters - map of parameters passed to the pipeline execution
CommerceExceptionCloneOrderStateContext
public PipelineResult reconcileOrder(CloneEditState pCloneEditState,
                                     java.util.Map pExtraParameters)
                              throws CommerceException
CommerceExceptionreconcileOrder(CloneEditState, String, Map)
public void applyChanges(CloneEditState pCloneEditState)
                  throws CommerceException
 The applyChanges and adjustOriginalCommerceIdReferences method is executed
 on all the clone edit handlers. 
 
pCloneEditState - 
CommerceException
public void adjustCloneCommerceIdReferences(CloneEditState pCloneEditState)
                                     throws CommerceException
adjustCloneCommerceIdReferences on each handler, so each handler can update any references
 to commerce ids in the clone order to the clone counterpart ids. For example, a reference to a
 shipping group id can be updated to the shipping group's clone counterpart id.
pCloneEditState - 
CommerceException
public void adjustOriginalCommerceIdReferences(CloneEditState pCloneEditState)
                                        throws CommerceException
adjustOriginalCommerceIdReferences on each handler, so each handler can update any references
 to commerce ids in the original order to the original counterpart ids. For example, a reference to a
 shipping group id can be updated to the shipping group's original counterpart id.
pCloneEditState - 
CommerceException
protected java.util.List reconcileProperties(java.lang.Object pClone,
                                             java.lang.Object pOrig,
                                             java.lang.String[] pProperties)
pClone - pOrig - pProperties - an array of property names that are copied from the clone to the original object.
public void validateClonedOrder(Order pOriginalOrder,
                                Order pCloneOrder)
                         throws CommerceException
 Calls each CloneEditHandler's validateCloneOrder
 method.
pOriginalOrder - pCloneOrder - 
CommerceException - if sizes don't match
public void initializeCloneEditState(CloneEditState pCloneEditState,
                                     Order pOriginalOrder,
                                     Order pCloneOrder)
                              throws CommerceException
 Calls each CloneEditHandler's initializeCloneEditState and
 adjustCloneCommerceIdReferences method. 
 
pCloneEditState - state object to initializepOriginalOrder - the original orderpCloneOrder - the clone order
CommerceException
public void initializeReconciliationProcess(CloneEditState pCloneEditState)
                                     throws CommerceException
 Calls each CloneEditHandler's initializeReconciliationProcess
 method.
CommerceExceptionCloneEditHandler.initializeReconciliationProcess(CloneEditState)
public atg.userprofiling.PropertyUpdate findPropertyUpdate(java.lang.String pPropertyName,
                                                           java.util.Collection pPropertyUpdates)
PropertyUpdate object for the given property name.
pPropertyName - the property name to findpPropertyUpdates - the collection of PropertyUpdates
PropertyUpdate
public void sendFulfillmentNotifications(CloneEditState pCloneEditState)
                                  throws javax.jms.JMSException,
                                         CommerceException
CloneEditHandler's sendFulfillmentMessages
 method.
pCloneEditState - 
javax.jms.JMSException
CommerceException
protected java.util.List detectUpdatesInFinalAmountInfo(java.lang.Object pClonedlPricedObject,
                                                        java.lang.Object pOriginalPricedObject,
                                                        java.lang.String pPropertyName)
pClonedlPricedObject - the clone object that contains a price info propertypOriginalPricedObject - the original object that contains a price info propertypPropertyName - the name of the property containing the price info object.
public AddItem createAddItem(CloneEditState pCloneEditState,
                             java.lang.Object pItem,
                             java.lang.Object pOriginalContainter,
                             java.lang.Object pCloneContainer,
                             int pOrdinalPosition,
                             java.lang.String pPropertyName,
                             boolean pAutoRecoveredItem)
pCloneEditState - pItem - pOriginalContainter - pCloneContainer - pOrdinalPosition - pAutoRecoveredItem - 
public DeleteItem createDeleteItem(CloneEditState pCloneEditState,
                                   java.lang.Object pItem,
                                   java.lang.Object pOriginalContainter,
                                   java.lang.Object pCloneContainer,
                                   java.lang.String pPropertyName,
                                   int pOrdinalPosition,
                                   boolean pAutoDeletedItem)
pCloneEditState - pItem - pOriginalContainter - pOrdinalPosition - pAutoDeletedItem - 
public UpdateItem createUpdateItem(CloneEditState pCloneEditState,
                                   java.lang.Object pOriginalItem,
                                   java.lang.Object pCloneItem,
                                   int pOrdinalPosition,
                                   java.lang.String pPropertyName,
                                   java.lang.Object pOriginalContainter,
                                   java.lang.Object pCloneContainer)
pCloneEditState - pOriginalItem - the original object that was updatedpOrdinalPosition - the position in the containerpOriginalContainter - the original object containerpCloneContainer - the clone object container
public java.util.Map buildPropertyValueMap(java.lang.Object pObject)
pObject - 
public static java.util.Collection parseConfigurationString(java.lang.String pString)
public void consumePromotions(CloneEditState pCloneEditState,
                              RepositoryItem pCustomerProfile,
                              java.lang.String pTicketId)
                       throws CommerceException
This method will store a resulting Map of promotion id to use count for each promotion that was consumed in the given CloneEditState.
pCloneEditState - 
CommerceExceptionProcSetOriginalOrderPromotionCounts, 
atg.commerce.csr.order.edit.processor.ProcConsumeCouponPromotions, 
CONSUMED_PROMOTIONS
public java.util.Map createPromotionToCouponMap(Order pOrder)
                                         throws CommerceException
PricingAdjustment
pOrder - 
CommerceException
public void restoreCouponReferences(Order pOrder,
                                    java.util.Map pPromotionToCoupon)
                             throws CommerceException
PriceAdjustment objects and fills in the
 coupon property based on the promotion referenced in the adjustment. The given
 map contains the necessary promotion to coupon relationships.
pOrder - pPromotionToCoupon - 
CommerceException| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||