atg.commerce.order
Class SimpleOrderManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.order.OrderManager
              extended by atg.commerce.order.SimpleOrderManager
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
B2BOrderManager

public class SimpleOrderManager
extends OrderManager

This class is the business layer object for Order manipulation. Use of this class eliminates the need to know about Relationships and only requires basic knowledge of the commerce class hierarchy. Logically, this class is one level above the OrderManager class and attempts to do as much as possible for the user. The methods in the class allow CommerceItems to be added to or removed from an Order and ShippingGroup with a single call. It also allows movement of CommerceItems between ShippingGroups. Below is an example of using the SimpleOrderManager. OrderManager om = getOrderManager(); String profileId = "10000"; String catalogRefId1 = "sku-1"; String catalogRefId2 = "sku-2"; String productId1 = "product-1"; String productId2 = "product-2"; long quantity1 = 1; long quantity2 = 2; // create the Order. The Order has a ShippingGroup and PaymentGroup in it when // constructed Order order = om.createOrder(profileId); // get the ShippingGroup and add the items to it ShippingGroup sg = (ShippingGroup) order.getShippingGroups().get(0); item1 = om.addItemToShippingGroup(order, catalogRefId1, productId1, quantity1, sg.getId()); item2 = om.addItemToShippingGroup(order, catalogRefId2, productId2, quantity2, sg.getId()); // checkout the Order and iterate through the result object displaying errors PipelineResult pr = om.processOrder(order); if (pr.hasErrors()) { Object[] keys = pr.getErrorKeys(); for (int i = 0; i < keys.length; i++) System.out.println(pr.getError(keys[i])); }

See Also:
OrderManager

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.commerce.order.OrderManager
mOrderManager, mOrderMergeListeners, mUserPricingModelsPath, sResourceBundle
 
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
SimpleOrderManager()
          Constructs a SimpleOrderManager object.
 
Method Summary
 CommerceItem addItemToShippingGroup(Order pOrder, java.lang.String pCatalogRefId, java.lang.String pProductId, long pQuantity, ShippingGroup pShippingGroup)
          This method adds a new item to the order and shippingGroup.
 CommerceItem addItemToShippingGroup(Order pOrder, java.lang.String pCatalogRefId, java.lang.String pProductId, long pQuantity, java.lang.String pShippingGroupId)
          This method adds a new item to the order and shippingGroup.
 void moveItemToShippingGroup(Order pOrder, CommerceItem pCommerceItem, long pQuantity, ShippingGroup pSrcShippingGroup, ShippingGroup pDestShippingGroup)
          This method moves an item from one ShippingGroup to another.
 void moveItemToShippingGroup(Order pOrder, java.lang.String pCatalogRefId, long pQuantity, java.lang.String pSrcShippingGroupId, java.lang.String pDestShippingGroupId)
          This method moves an item from one ShippingGroup to another.
 void removeItemFromShippingGroup(Order pOrder, CommerceItem pCommerceItem, ShippingGroup pShippingGroup, long pQuantity)
          This method removes an item from the order and shippingGroup.
 void removeItemFromShippingGroup(Order pOrder, java.lang.String pCommerceItemId, java.lang.String pShippingGroupId, long pQuantity)
          This method removes an item from the order and shippingGroup.
 
Methods inherited from class atg.commerce.order.OrderManager
addAsSeparateItemToOrder, addHandlingInstructionToShippingGroup, addItemAmountToPaymentGroup, addItemQuantityToShippingGroup, addItemToOrder, addOrder, addOrderAmountToPaymentGroup, addOrderMergeListener, addPaymentGroupToOrder, addPaymentGroupToOrder, addRemainingItemAmountToPaymentGroup, addRemainingItemQuantityToShippingGroup, addRemainingOrderAmountToPaymentGroup, addRemainingShippingCostToPaymentGroup, addRemainingTaxAmountToPaymentGroup, addShippingCostAmountToPaymentGroup, addShippingGroupToOrder, addTaxAmountToPaymentGroup, areOrdersMergeable, cloneShippingGroup, copyAddress, copyAddress, copyAddress, copyHandlingInstruction, createCommerceItem, createCommerceItem, createCommerceItem, createCommerceItem, createCommerceItem, createCommerceItem, createCommerceItem, createCommerceItem, createHandlingInstruction, createHandlingInstruction, createHandlingInstruction, createHandlingInstruction, createOrder, createOrder, createOrder, createOrder, createOrder, createOrder, createPaymentGroup, createPaymentGroup, createRelationship, createShippingGroup, createShippingGroup, createShippingGroup, doStartService, getAllCommerceItemRelationships, getAllOrderRelationships, getAllPaymentGroupRelationships, getAllShippingGroupRelationships, getCatalogTools, getCommerceItemItemDescriptorName, getCommerceItemManager, getCommerceItemOrderPropertyName, getCommerceItemsFromPaymentGroup, getCommerceItemsFromShippingGroup, getDateRangeQuery, getDebugOrderRepositoryItemUpdateTransaction, getDefaultLocale, getDefaultOrderByDirection, getDefaultOrderByProperty, getHandlingInstructionManager, getHandlingInstructionsForCommerceItem, getJNDIContext, getOrderCommerceItemsPropertyName, getOrderCountForProfile, getOrderCountForProfileInState, getOrderForCommerceItem, getOrderForPaymentGroup, getOrderForRelationship, getOrderForShippingGroup, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfile, getOrderIdsForProfileWithinDateRange, getOrderIdsWithinDateRange, getOrderItemDescriptorName, getOrderManager, getOrderPaymentGroupsPropertyName, getOrderQueries, getOrderRelationshipsPropertyName, getOrdersForProfile, getOrdersForProfile, getOrdersForProfile, getOrdersForProfile, getOrdersForProfileInState, getOrdersForProfileInState, getOrdersForProfileInState, getOrdersForProfileInState, getOrdersForProfileInState, getOrdersForProfileInState, getOrdersForProfileInState, getOrdersForProfileInState, getOrderShippingGroupsPropertyName, getOrderTools, getOrderVersionPropertyName, getPaymentGroupCommerceItemRelationship, getPaymentGroupItemDescriptorName, getPaymentGroupManager, getPaymentGroupOrderPropertyName, getPaymentGroupOrderRelationship, getPaymentGroupShippingGroupRelationship, getPipelineManager, getRelationshipItemDescriptorName, getRelationshipOrderPropertyName, getRemainingQuantityForShippingGroup, getShipItemRelsForRange, getShippingGroupByDescription, getShippingGroupCommerceItemRelationship, getShippingGroupItemDescriptorName, getShippingGroupManager, getShippingGroupOrderPropertyName, getUnassignedQuantityForCommerceItem, getUniqueCatalogRefIds, getUserPricingModelsPath, getValidOrderProcessingStates, getValidProcessOrderErrorStates, initializeCreditCard, initializeDefaultPropertyValues, initializeGiftCertificate, isCreateSGRelationshipsOnMerge, isOrderStateValidForProcessing, isTransactionMarkedAsRollBack, loadOrder, markTransactionForRollback, mergeOrders, mergeOrders, orderExists, processOrder, processOrder, processOrder, processOrder, processOrderWithReprice, processOrderWithReprice, recalculatePaymentGroupAmounts, removeAllCommerceItemsFromOrder, removeAllHandlingInstructionsFromShippingGroup, removeAllPaymentGroupsFromOrder, removeAllRelationshipsFromCommerceItem, removeAllRelationshipsFromPaymentGroup, removeAllRelationshipsFromShippingGroup, removeAllShippingGroupsFromOrder, removeEmptyPaymentGroups, removeEmptyShippingGroups, removeHandlingInstructionFromShippingGroup, removeHandlingInstructionsFromShippingGroup, removeItemAmountFromPaymentGroup, removeItemFromOrder, removeItemFromPaymentGroupInternal, removeItemQuantityFromShippingGroup, removeOrder, removeOrderAmountFromPaymentGroup, removeOrderFromPaymentGroupInternal, removeOrderMergeListener, removePaymentGroupFromOrder, removeRemainingItemAmountFromPaymentGroup, removeRemainingItemQuantityFromShippingGroup, removeRemainingOrderAmountFromPaymentGroup, removeRemainingShippingCostFromPaymentGroup, removeRemainingTaxAmountFromPaymentGroup, removeShippingCostAmountFromPaymentGroup, removeShippingCostFromPaymentGroupInternal, removeShippingGroupFromOrder, removeTaxAmountFromPaymentGroup, resetOrder, returnCommerceItem, sendOrderMergeEvent, setCommerceItemItemDescriptorName, setCommerceItemManager, setCommerceItemOrderPropertyName, setCreateSGRelationshipsOnMerge, setDebugOrderRepositoryItemUpdateTransaction, setDefaultLocale, setDefaultOrderByDirection, setDefaultOrderByProperty, setHandlingInstructionManager, setOrderCommerceItemsPropertyName, setOrderItemDescriptorName, setOrderPaymentGroupsPropertyName, setOrderQueries, setOrderRelationshipsPropertyName, setOrderShippingGroupsPropertyName, setOrderTools, setOrderVersionPropertyName, setPaymentGroupItemDescriptorName, setPaymentGroupManager, setPaymentGroupOrderPropertyName, setRelationshipItemDescriptorName, setRelationshipOrderPropertyName, setShippingGroupItemDescriptorName, setShippingGroupManager, setShippingGroupOrderPropertyName, setUserPricingModelsPath, setValidOrderProcessingStates, setValidProcessOrderErrorStates, splitShippingGroup, splitShippingGroup, splitShippingGroupWithImplicitRelationships, updateOrder, validateOrder, validateOrder, validateOrder
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

SimpleOrderManager

public SimpleOrderManager()
Constructs a SimpleOrderManager object.

Method Detail

addItemToShippingGroup

public CommerceItem addItemToShippingGroup(Order pOrder,
                                           java.lang.String pCatalogRefId,
                                           java.lang.String pProductId,
                                           long pQuantity,
                                           java.lang.String pShippingGroupId)
                                    throws CommerceException
This method adds a new item to the order and shippingGroup. If an item with the catalogRefId already exists in the order then the quantity is just updated. The item and the given quantity are then added to the given shippingGroup. If the item existed then the quantity is added to the shippingGroup only.

Parameters:
pOrder - the order which the item is to be added to
pCatalogRefId - the catalogRefId of the item being added
pProductId - the productId of the item being added
pQuantity - the quantity to add
pShippingGroupId - the id of the shippingGroup to add the item to
Returns:
CommerceItem the CommerceItem which was added or the one which the quantity was updated
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

addItemToShippingGroup

public CommerceItem addItemToShippingGroup(Order pOrder,
                                           java.lang.String pCatalogRefId,
                                           java.lang.String pProductId,
                                           long pQuantity,
                                           ShippingGroup pShippingGroup)
                                    throws CommerceException
This method adds a new item to the order and shippingGroup. If an item with the catalogRefId already exists in the order then the quantity is just updated. The item and the given quantity are then added to the given shippingGroup. If the item existed then the quantity is added to the shippingGroup only.

Parameters:
pOrder - the order which the item is to be added to
pCatalogRefId - the catalogRefId of the item being added
pProductId - the productId of the item being added
pQuantity - the quantity to add
pShippingGroup - the shippingGroup to add the item to
Returns:
CommerceItem the CommerceItem which was added or the one which the quantity was updated
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

removeItemFromShippingGroup

public void removeItemFromShippingGroup(Order pOrder,
                                        java.lang.String pCommerceItemId,
                                        java.lang.String pShippingGroupId,
                                        long pQuantity)
                                 throws CommerceException
This method removes an item from the order and shippingGroup. If the quantity in the item exceeds the given quantity, then the quantity is just updated.

Parameters:
pOrder - the order which the item is to be added to
pCommerceItem - the CommerceItem to remove
pShippingGroup - the shippingGroup to remove the item from
pQuantity - the quantity to remove
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

removeItemFromShippingGroup

public void removeItemFromShippingGroup(Order pOrder,
                                        CommerceItem pCommerceItem,
                                        ShippingGroup pShippingGroup,
                                        long pQuantity)
                                 throws CommerceException
This method removes an item from the order and shippingGroup. If the quantity in the item exceeds the given quantity, then the quantity is just updated.

Parameters:
pOrder - the order which the item is to be added to
pCommerceItem - the CommerceItem to remove
pShippingGroup - the shippingGroup to remove the item from
pQuantity - the quantity to remove
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

moveItemToShippingGroup

public void moveItemToShippingGroup(Order pOrder,
                                    java.lang.String pCatalogRefId,
                                    long pQuantity,
                                    java.lang.String pSrcShippingGroupId,
                                    java.lang.String pDestShippingGroupId)
                             throws CommerceException
This method moves an item from one ShippingGroup to another. If the quantity in the item exceeds the given quantity, then only that quantity is moved.

Parameters:
pOrder - the order which the item exists in
pCatalogRefId - the catalogRefId of the item to move
pQuantity - the quantity to move
pSrcShippingGroupId - the id of the shippingGroup to move the item from
pDestShippingGroupId - the id of the shippingGroup to move the item to
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

moveItemToShippingGroup

public void moveItemToShippingGroup(Order pOrder,
                                    CommerceItem pCommerceItem,
                                    long pQuantity,
                                    ShippingGroup pSrcShippingGroup,
                                    ShippingGroup pDestShippingGroup)
                             throws CommerceException
This method moves an item from one ShippingGroup to another. If the quantity in the item exceeds the given quantity, then only that quantity is moved.

Parameters:
pOrder - the order which the item exists in
pCatalogRefId - the catalogRefId of the item to move
pQuantity - the quantity to move
pSrcShippingGroup - the shippingGroup to move the item from
pDestShippingGroup - the shippingGroup to move the item to
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.