atg.commerce.order
Class OrderTools

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

public class OrderTools
extends GenericService

This class is a low level business layer class. It provides the raw functionality for manipulating an Order. The methods in this class are not meant for direct use, but rather are used primarily by the OrderManager. This class does all the work like instantiating and creating the objects in the repository. In addition to the raw functionality, it also contains properties which control key parts of the commerce platform. For example, it contains the mappings for names to class types for the major objects, Order, CommerceItem, ShippingGroup, PaymentGroup, Relationship, and HandlingInstruction. In addition to mapping names it also contains the default types for each class type. It also contains the mapping for item descriptor names to class types. Other objects it contains are key components used in the commerce system, such as PipelineManager, GiftlistManager, ProfileTools, CatalogTools, OrderRepository, and ProfileRepository. The main functionality which this class provides is object construction and initialization. This is done by methods like createOrder(), createCommerceItem(), etc. The initialization methods provided are only for Relationships.

See Also:
OrderManager

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
OrderTools()
          Constructs an OrderTools object.
 
Method Summary
protected  void addManualAdjustment(Order pOrder, RepositoryItem pAdjustment)
          This method adds the manual adjustment to the order.
 void addManualAdjustment(Order pOrder, RepositoryItem pAdjustment, int pIndex)
          Adds an adjustment at a specific index in the List.
static void copyAddress(Address pSrcAddress, Address pDestAddress)
          This method, given two atg.core.util.Address or atg.core.util.ContactInfo objects, will copy the address information from the source to the destination object.
static void copyAddress(Address pAddress, RepositoryItem pProfileAddress)
          This method, given a Profile object and an atg.core.util.Address or atg.core.util.ContactInfo object, will copy the address information from the Address or ContactInfo object to the profile.
static void copyAddress(RepositoryItem pProfileAddress, Address pAddress)
          This method, given a ContactInfo iten descriptor and an atg.core.util.Address or atg.core.util.ContactInfo object, will copy the address information from the profile to the Address or ContactInfo object.
 CommerceItem createCommerceItem(java.lang.String pType)
          Returns a new instance of a CommerceItem whose class is mapped to the type supplied in pType.
 HandlingInstruction createHandlingInstruction(java.lang.String pType)
          Returns a new instance of a HandlingInstruction whose class is mapped to the type supplied in pType.
protected  MutableRepositoryItem createManualAdjustmentItem(java.lang.String pItemType, double pAmount, java.lang.String pAdjustmentType, java.lang.String pNotes, java.lang.String pReasonCode)
          Creates and returns a mutable, transient manual adjustment repository item of the specified type.
 Order createOrder(java.lang.String pType)
          Returns a new instance of an Order whose class is mapped to the type supplied in pType.
 Order createOrder(java.lang.String pType, ShippingPriceInfo pShippingPriceInfo)
          Returns a new instance of an Order whose class is mapped to the type supplied in pType.
 Order createOrder(java.lang.String pType, java.lang.String pOrderId)
          Returns a new instance of an Order whose class is mapped to the type supplied in pType and whose id will be that which is supplied in pOrderId.
 Order createOrder(java.lang.String pType, java.lang.String pOrderId, ShippingPriceInfo pShippingPriceInfo)
          Returns a new instance of an Order whose class is mapped to the type supplied in pType and whose id will be that which is supplied in pOrderId.
 RepositoryItem createOrderFixedAmountAdjustment(Order pOrder, double pAmount, java.lang.String pAdjustmentType, java.lang.String pNotes, java.lang.String pReasonCode)
          Creates a new fixed amount manual adjustment and adds it to the order.
 PaymentGroup createPaymentGroup(java.lang.String pType)
          Returns a new instance of a PaymentGroup whose class is mapped to the type supplied in pType.
 Relationship createRelationship(java.lang.String pType)
          Returns a new instance of a Relationship whose class is mapped to the type supplied in pType.
 ShippingGroup createShippingGroup(java.lang.String pType)
          Returns a new instance of a ShippingGroup whose class is mapped to the type supplied in pType.
 ShippingGroup createShippingGroup(java.lang.String pType, ShippingPriceInfo pShippingPriceInfo)
          Returns a new instance of a ShippingGroup whose class is mapped to the type supplied in pType.
 boolean deleteManualAdjustment(Order pOrder, java.lang.String pAdjustmentItemId)
          Deletes manual adjustments from the order's list of adjustments.
 void doStartService()
          Start the OrderTools component.
 java.util.Collection findShippingGroupsWithAddress(Order pOrder, Address pAddress, java.lang.String[] pPropertyNamesToCompare)
          Finds all hardgood shipping group in the order with a matching address
 java.util.Properties getBeanNameToItemDescriptorMap()
          Returns the beanNameToItemDescriptorMap
 CatalogTools getCatalogTools()
          Returns the catalogTools
 java.util.Properties getCommerceItemTypeClassMap()
          returns a java.util.Properties object of the type to classname map for Item classes.
 boolean getCreateDefaultPaymentGroup()
          Returns property createDefaultPaymentGroup
 boolean getCreateDefaultShippingGroup()
          Returns property createDefaultShippingGroup
 java.lang.String getDefaultCommerceItemType()
          Returns the defaultCommerceItemType
 java.lang.String getDefaultHandlingInstructionType()
          Returns the defaultHandlingInstructionType
 java.lang.Class getDefaultItemPriceInfoClass()
          Returns property defaultItemPriceInfoClass
 java.lang.Class getDefaultOrderPriceInfoClass()
          Returns property defaultOrderPriceInfoClass
 java.lang.String getDefaultOrderType()
          Returns the defaultOrderType
 java.lang.String getDefaultPaymentGroupAddressType()
          Returns property defaultPaymentGroupAddressType
 java.lang.String getDefaultPaymentGroupType()
          Returns the defaultPaymentGroupType
 java.lang.String getDefaultProfileType()
          Returns the defaultProfileType
 java.lang.String getDefaultShippingGroupAddressType()
          Returns property defaultShippingGroupAddressType
 java.lang.String getDefaultShippingGroupType()
          Returns the defaultShippingGroupType
 java.lang.Class getDefaultShippingPriceInfoClass()
          Returns property defaultShippingPriceInfoClass
 java.lang.Class getDefaultTaxPriceInfoClass()
          Returns property defaultTaxPriceInfoClass
 GiftlistManager getGiftlistManager()
          Returns the giftlistManager
 java.util.Properties getHandlingTypeClassMap()
          returns a java.util.Properties object of the type to classname map for HandlingInstruction classes.
 InventoryManager getInventoryManager()
          Returns the InventoryManager
 java.lang.String getItemDescriptorForCommerceItemType(java.lang.String pCommerceItemType)
          Return the item descriptor used for a specified commerce item type.
 java.lang.String getItemDescriptorForOrderType(java.lang.String pOrderType)
          Return the item descriptor used for a specified order type.
 java.lang.String getItemDescriptorForPaymentType(java.lang.String pPaymentType)
          Return the item descriptor used for a specified payment group type.
 java.lang.String getItemDescriptorForShippingType(java.lang.String pShippingType)
          Return the item descriptor used for a specified shipping group type.
 java.util.Properties getItemDescriptorToBeanNameMap()
          Returns the itemDescriptorToBeanNameMap
 java.lang.String getMappedBeanName(java.lang.String pRepItemName)
          Returns the bean name mapped to the repository item name.
 java.lang.String getMappedItemDescriptorName(java.lang.String pBeanName)
          Returns the repository item name mapped to the bean name.
 java.lang.String getOrderFixedAmountAdjustmentType()
          Returns the OrderFixedAmountAdjustmentType
 java.lang.String getOrderItemDescriptorName()
          Returns the OrderItemDescriptorName
 atg.commerce.order.OrderLookupService getOrderLookupService()
          The service that is actually used to find the desired orders
 Repository getOrderRepository()
          Returns the orderRepository
 java.util.Properties getOrderTypeClassMap()
          returns a java.util.Properties object of the type to classname map for Order classes.
 java.util.Properties getPaymentGroupBillingAddressClassNameMap()
          Returns property paymentGroupBillingAddressClassNameMap
 java.util.Properties getPaymentTypeClassMap()
          returns a java.util.Properties object of the type to classname map for PaymentGroup classes.
 PipelineManager getPipelineManager()
          Returns the pipelineManager
 Repository getProfileRepository()
          Returns the profileRepository
 CommerceProfileTools getProfileTools()
          Returns the profileTools
 java.util.Properties getRelationshipTypeClassMap()
          returns a java.util.Properties object of the type to classname map for Relationship classes.
 java.util.Properties getShippingGroupShippingAddressClassNameMap()
          Returns property shippingGroupShippingAddressClassNameMap
 java.util.Properties getShippingTypeClassMap()
          returns a java.util.Properties object of the type to classname map for ShippingGroup classes.
 javax.transaction.TransactionManager getTransactionManager()
          The service used to manage all transactions
 void initializeRelationship(Order pOrder, PaymentGroupCommerceItemRelationship pRelationship, java.lang.String pPaymentGroupId, java.lang.String pCommerceItemId)
          This method initializes the Relationship to contain a PaymentGroup and a CommerceItem.
 void initializeRelationship(Order pOrder, PaymentGroupOrderRelationship pRelationship, java.lang.String pPaymentGroupId)
          This method initializes the Relationship to contain a PaymentGroup and an Order.
 void initializeRelationship(Order pOrder, PaymentGroupShippingGroupRelationship pRelationship, java.lang.String pPaymentGroupId, java.lang.String pShippingGroupId)
          This method initializes the Relationship to contain a PaymentGroup and a ShippingGroup.
 void initializeRelationship(Order pOrder, ShippingGroupCommerceItemRelationship pRelationship, java.lang.String pShippingGroupId, java.lang.String pCommerceItemId)
          This method initializes the Relationship to contain a ShippingGroup and a CommerceItem.
protected  java.util.Properties invertBeanToItemMap(java.util.Properties pBeanToItemMap)
          Invert the key/value pairs in pBeanToItemMap and return a new Properties object containing the inverted map.
 boolean isAssignCatalogInCommerceItem()
          If this is true, then newly created commerce items will have the 'catalogId' property automatically populated with the catalog for the current user The default is false.
protected  boolean isNullAddress(Address pAddress)
          Query whether an Address object is null or empty.
protected  boolean isNullCreditCard(CreditCard pCreditCard)
          Query whether a CreditCard object is null or empty.
 boolean isOrderState(Order pOrder, java.lang.String[] pStates)
          Determines if an order is in one of the provided states
 void registerSynchronization(Order pOrder)
          Registers the given order as a synchronization on the current transaction.
 void setAssignCatalogInCommerceItem(boolean pAssignCatalogInCommerceItem)
           
 void setBeanNameToItemDescriptorMap(java.util.Properties pBeanNameToItemDescriptorMap)
          Sets the beanNameToItemDescriptorMap
 void setCatalogTools(CatalogTools pCatalogTools)
          Sets the catalogTools
 void setCommerceItemTypeClassMap(java.util.Properties pProp)
          sets a java.util.Properties object to contain the type to classname map for Items.
 void setCreateDefaultPaymentGroup(boolean pCreateDefaultPaymentGroup)
          Sets property createDefaultPaymentGroup
 void setCreateDefaultShippingGroup(boolean pCreateDefaultShippingGroup)
          Sets property createDefaultShippingGroup
 void setDefaultCommerceItemType(java.lang.String pDefaultCommerceItemType)
          Sets the defaultCommerceItemType
 void setDefaultHandlingInstructionType(java.lang.String pDefaultHandlingInstructionType)
          Sets the defaultHandlingInstructionType
 void setDefaultItemPriceInfoClass(java.lang.Class pDefaultItemPriceInfoClass)
          Sets property defaultItemPriceInfoClass
 void setDefaultOrderPriceInfoClass(java.lang.Class pDefaultOrderPriceInfoClass)
          Sets property defaultOrderPriceInfoClass
 void setDefaultOrderType(java.lang.String pDefaultOrderType)
          Sets the defaultOrderType
 void setDefaultPaymentGroupAddressType(java.lang.String pDefaultPaymentGroupAddressType)
          Sets property defaultPaymentGroupAddressType
 void setDefaultPaymentGroupType(java.lang.String pDefaultPaymentGroupType)
          Sets the defaultPaymentGroupType
 void setDefaultProfileType(java.lang.String pDefaultProfileType)
          Sets the defaultProfileType
 void setDefaultShippingGroupAddressType(java.lang.String pDefaultShippingGroupAddressType)
          Sets property defaultShippingGroupAddressType
 void setDefaultShippingGroupType(java.lang.String pDefaultShippingGroupType)
          Sets the defaultShippingGroupType
 void setDefaultShippingPriceInfoClass(java.lang.Class pDefaultShippingPriceInfoClass)
          Sets property defaultShippingPriceInfoClass
 void setDefaultTaxPriceInfoClass(java.lang.Class pDefaultTaxPriceInfoClass)
          Sets property defaultTaxPriceInfoClass
 void setGiftlistManager(GiftlistManager pGiftlistManager)
          Sets the giftlistManager
 void setHandlingTypeClassMap(java.util.Properties pProp)
          sets a java.util.Properties object to contain the type to classname map for HandlingInstructions.
 void setInventoryManager(InventoryManager pInventoryManager)
          Sets the InventoryManager
 void setItemDescriptorToBeanNameMap(java.util.Properties pItemToBeanMap)
          Set the map that maps item descriptor names to the corresponding bean implementation classes.
 void setOrderFixedAmountAdjustmentType(java.lang.String pOrderFixedAmountAdjustmentType)
          Sets the OrderFixedAmountAdjustmentType
 void setOrderItemDescriptorName(java.lang.String pOrderItemDescriptorName)
          Sets the OrderItemDescriptorName
 void setOrderLookupService(atg.commerce.order.OrderLookupService pOrderLookupService)
          The service that is actually used to find the desired orders
 void setOrderRepository(Repository pOrderRepository)
          Sets the orderRepository
 void setOrderTypeClassMap(java.util.Properties pProp)
          sets a java.util.Properties object to contain the type to classname map for Orders.
 void setPaymentGroupBillingAddressClassNameMap(java.util.Properties pPaymentGroupBillingAddressClassNameMap)
          Sets property paymentGroupBillingAddressClassNameMap
 void setPaymentTypeClassMap(java.util.Properties pProp)
          sets a java.util.Properties object to contain the type to classname map for PaymentGroups.
 void setPipelineManager(PipelineManager pPipelineManager)
          Sets the pipelineManager
 void setProfileRepository(Repository pProfileRepository)
          Sets the profileRepository
 void setProfileTools(CommerceProfileTools pProfileTools)
          Sets the profileTools
 void setRelationshipTypeClassMap(java.util.Properties pProp)
          sets a java.util.Properties object to contain the type to classname map for Relationships.
 void setShippingGroupShippingAddressClassNameMap(java.util.Properties pShippingGroupShippingAddressClassNameMap)
          Sets property shippingGroupShippingAddressClassNameMap
 void setShippingTypeClassMap(java.util.Properties pProp)
          sets a java.util.Properties object to contain the type to classname map for ShippingGroups.
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
           
 
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, reResolveThis, 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

OrderTools

public OrderTools()
Constructs an OrderTools object.

Method Detail

getOrderFixedAmountAdjustmentType

public java.lang.String getOrderFixedAmountAdjustmentType()
Returns the OrderFixedAmountAdjustmentType


setOrderFixedAmountAdjustmentType

public void setOrderFixedAmountAdjustmentType(java.lang.String pOrderFixedAmountAdjustmentType)
Sets the OrderFixedAmountAdjustmentType


setOrderLookupService

public void setOrderLookupService(atg.commerce.order.OrderLookupService pOrderLookupService)
The service that is actually used to find the desired orders

Parameters:
pOrderLookupService - the OrderLookupService component. Usually /atg/commerce/order/OrderLookupService

getOrderLookupService

public atg.commerce.order.OrderLookupService getOrderLookupService()
The service that is actually used to find the desired orders


getPipelineManager

public PipelineManager getPipelineManager()
Returns the pipelineManager


setPipelineManager

public void setPipelineManager(PipelineManager pPipelineManager)
Sets the pipelineManager


getGiftlistManager

public GiftlistManager getGiftlistManager()
Returns the giftlistManager


setGiftlistManager

public void setGiftlistManager(GiftlistManager pGiftlistManager)
Sets the giftlistManager


getInventoryManager

public InventoryManager getInventoryManager()
Returns the InventoryManager


setInventoryManager

public void setInventoryManager(InventoryManager pInventoryManager)
Sets the InventoryManager


setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
The service used to manage all transactions


getProfileTools

public CommerceProfileTools getProfileTools()
Returns the profileTools


setProfileTools

public void setProfileTools(CommerceProfileTools pProfileTools)
Sets the profileTools


getCatalogTools

public CatalogTools getCatalogTools()
Returns the catalogTools


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)
Sets the catalogTools


getOrderRepository

public Repository getOrderRepository()
Returns the orderRepository


setOrderRepository

public void setOrderRepository(Repository pOrderRepository)
Sets the orderRepository


getProfileRepository

public Repository getProfileRepository()
Returns the profileRepository


setProfileRepository

public void setProfileRepository(Repository pProfileRepository)
Sets the profileRepository


getOrderItemDescriptorName

public java.lang.String getOrderItemDescriptorName()
Returns the OrderItemDescriptorName


setOrderItemDescriptorName

public void setOrderItemDescriptorName(java.lang.String pOrderItemDescriptorName)
Sets the OrderItemDescriptorName


getDefaultProfileType

public java.lang.String getDefaultProfileType()
Returns the defaultProfileType


setDefaultProfileType

public void setDefaultProfileType(java.lang.String pDefaultProfileType)
Sets the defaultProfileType


getDefaultOrderPriceInfoClass

public java.lang.Class getDefaultOrderPriceInfoClass()
Returns property defaultOrderPriceInfoClass

Returns:
returns property defaultOrderPriceInfoClass

setDefaultOrderPriceInfoClass

public void setDefaultOrderPriceInfoClass(java.lang.Class pDefaultOrderPriceInfoClass)
Sets property defaultOrderPriceInfoClass

Parameters:
pDefaultOrderPriceInfoClass - the value to set for property defaultOrderPriceInfoClass

getDefaultItemPriceInfoClass

public java.lang.Class getDefaultItemPriceInfoClass()
Returns property defaultItemPriceInfoClass

Returns:
returns property defaultItemPriceInfoClass

setDefaultItemPriceInfoClass

public void setDefaultItemPriceInfoClass(java.lang.Class pDefaultItemPriceInfoClass)
Sets property defaultItemPriceInfoClass

Parameters:
pDefaultItemPriceInfoClass - the value to set for property defaultItemPriceInfoClass

getDefaultShippingPriceInfoClass

public java.lang.Class getDefaultShippingPriceInfoClass()
Returns property defaultShippingPriceInfoClass

Returns:
returns property defaultShippingPriceInfoClass

setDefaultShippingPriceInfoClass

public void setDefaultShippingPriceInfoClass(java.lang.Class pDefaultShippingPriceInfoClass)
Sets property defaultShippingPriceInfoClass

Parameters:
pDefaultShippingPriceInfoClass - the value to set for property defaultShippingPriceInfoClass

getDefaultTaxPriceInfoClass

public java.lang.Class getDefaultTaxPriceInfoClass()
Returns property defaultTaxPriceInfoClass

Returns:
returns property defaultTaxPriceInfoClass

setDefaultTaxPriceInfoClass

public void setDefaultTaxPriceInfoClass(java.lang.Class pDefaultTaxPriceInfoClass)
Sets property defaultTaxPriceInfoClass

Parameters:
pDefaultTaxPriceInfoClass - the value to set for property defaultTaxPriceInfoClass

getOrderTypeClassMap

public java.util.Properties getOrderTypeClassMap()
returns a java.util.Properties object of the type to classname map for Order classes.


setOrderTypeClassMap

public void setOrderTypeClassMap(java.util.Properties pProp)
sets a java.util.Properties object to contain the type to classname map for Orders.


getCommerceItemTypeClassMap

public java.util.Properties getCommerceItemTypeClassMap()
returns a java.util.Properties object of the type to classname map for Item classes.


setCommerceItemTypeClassMap

public void setCommerceItemTypeClassMap(java.util.Properties pProp)
sets a java.util.Properties object to contain the type to classname map for Items.


getShippingTypeClassMap

public java.util.Properties getShippingTypeClassMap()
returns a java.util.Properties object of the type to classname map for ShippingGroup classes.


setShippingTypeClassMap

public void setShippingTypeClassMap(java.util.Properties pProp)
sets a java.util.Properties object to contain the type to classname map for ShippingGroups.


getPaymentTypeClassMap

public java.util.Properties getPaymentTypeClassMap()
returns a java.util.Properties object of the type to classname map for PaymentGroup classes.


setPaymentTypeClassMap

public void setPaymentTypeClassMap(java.util.Properties pProp)
sets a java.util.Properties object to contain the type to classname map for PaymentGroups.


getHandlingTypeClassMap

public java.util.Properties getHandlingTypeClassMap()
returns a java.util.Properties object of the type to classname map for HandlingInstruction classes.


setHandlingTypeClassMap

public void setHandlingTypeClassMap(java.util.Properties pProp)
sets a java.util.Properties object to contain the type to classname map for HandlingInstructions.


getRelationshipTypeClassMap

public java.util.Properties getRelationshipTypeClassMap()
returns a java.util.Properties object of the type to classname map for Relationship classes.


setRelationshipTypeClassMap

public void setRelationshipTypeClassMap(java.util.Properties pProp)
sets a java.util.Properties object to contain the type to classname map for Relationships.


getBeanNameToItemDescriptorMap

public java.util.Properties getBeanNameToItemDescriptorMap()
Returns the beanNameToItemDescriptorMap


setBeanNameToItemDescriptorMap

public void setBeanNameToItemDescriptorMap(java.util.Properties pBeanNameToItemDescriptorMap)
Sets the beanNameToItemDescriptorMap


getItemDescriptorToBeanNameMap

public java.util.Properties getItemDescriptorToBeanNameMap()
Returns the itemDescriptorToBeanNameMap


setItemDescriptorToBeanNameMap

public void setItemDescriptorToBeanNameMap(java.util.Properties pItemToBeanMap)
Set the map that maps item descriptor names to the corresponding bean implementation classes. Applications should not normally set this property since the map will normally be computed by inverting beanNameToItemDescriptorMap. This method is provided for applications that must explicitly override the default reverse mapping for some reason.


getMappedItemDescriptorName

public java.lang.String getMappedItemDescriptorName(java.lang.String pBeanName)
Returns the repository item name mapped to the bean name. If there is no name mapped then the value supplied in pBeanName is returned because that is assumed to be the repository item name also.

Parameters:
pBeanName - the bean name
Returns:
the repository item name

getMappedBeanName

public java.lang.String getMappedBeanName(java.lang.String pRepItemName)
Returns the bean name mapped to the repository item name. If there is no name mapped then the value supplied in pRepItemName is returned because that is assumed to be the bean name also.

Parameters:
pRepItemName - the repository item name
Returns:
the bean name

getItemDescriptorForOrderType

public java.lang.String getItemDescriptorForOrderType(java.lang.String pOrderType)
                                               throws CommerceException
Return the item descriptor used for a specified order type. This method looks up the corresponding implementation class in the orderTypeClassMap, then returns the matching repository item descriptor name from the beanNameToItemDescriptorMap.

Parameters:
pOrderType - An order type key, e.g. "default" or "b2bOrder".
Returns:
The item descriptor used to store orders of the specified type in the order repository.
Throws:
CommerceException

getItemDescriptorForCommerceItemType

public java.lang.String getItemDescriptorForCommerceItemType(java.lang.String pCommerceItemType)
                                                      throws CommerceException
Return the item descriptor used for a specified commerce item type. This method looks up the corresponding implementation class in the commerceItemTypeClassMap, then returns the matching repository item descriptor name from the beanNameToItemDescriptorMap.

Parameters:
pCommerceItemType - A commerce item type key, e.g. "default" or "configurableCommerceItem".
Returns:
The item descriptor used to store commerce items of the specified type in the order repository.
Throws:
CommerceException

getItemDescriptorForShippingType

public java.lang.String getItemDescriptorForShippingType(java.lang.String pShippingType)
                                                  throws CommerceException
Return the item descriptor used for a specified shipping group type. This method looks up the corresponding implementation class in the shippingTypeClassMap, then returns the matching repository item descriptor name from the beanNameToItemDescriptorMap.

Parameters:
pShippingType - A shipping group type key, e.g. "hardgoodShippingGroup".
Returns:
The item descriptor used to store shipping groups of the specified type in the order repository.
Throws:
CommerceException

getItemDescriptorForPaymentType

public java.lang.String getItemDescriptorForPaymentType(java.lang.String pPaymentType)
                                                 throws CommerceException
Return the item descriptor used for a specified payment group type. This method looks up the corresponding implementation class in the paymentTypeClassMap, then returns the matching repository item descriptor name from the beanNameToItemDescriptorMap.

Parameters:
pPaymentType - A shipping group type key, e.g. "creditCard" or "storeCredit".
Returns:
The item descriptor used to store payment groups of the specified type in the order repository.
Throws:
CommerceException

getDefaultOrderType

public java.lang.String getDefaultOrderType()
Returns the defaultOrderType


setDefaultOrderType

public void setDefaultOrderType(java.lang.String pDefaultOrderType)
Sets the defaultOrderType


getDefaultCommerceItemType

public java.lang.String getDefaultCommerceItemType()
Returns the defaultCommerceItemType


setDefaultCommerceItemType

public void setDefaultCommerceItemType(java.lang.String pDefaultCommerceItemType)
Sets the defaultCommerceItemType


getDefaultShippingGroupType

public java.lang.String getDefaultShippingGroupType()
Returns the defaultShippingGroupType


setDefaultShippingGroupType

public void setDefaultShippingGroupType(java.lang.String pDefaultShippingGroupType)
Sets the defaultShippingGroupType


getDefaultPaymentGroupType

public java.lang.String getDefaultPaymentGroupType()
Returns the defaultPaymentGroupType


setDefaultPaymentGroupType

public void setDefaultPaymentGroupType(java.lang.String pDefaultPaymentGroupType)
Sets the defaultPaymentGroupType


getDefaultHandlingInstructionType

public java.lang.String getDefaultHandlingInstructionType()
Returns the defaultHandlingInstructionType


setDefaultHandlingInstructionType

public void setDefaultHandlingInstructionType(java.lang.String pDefaultHandlingInstructionType)
Sets the defaultHandlingInstructionType


getCreateDefaultShippingGroup

public boolean getCreateDefaultShippingGroup()
Returns property createDefaultShippingGroup

Returns:
returns property createDefaultShippingGroup

setCreateDefaultShippingGroup

public void setCreateDefaultShippingGroup(boolean pCreateDefaultShippingGroup)
Sets property createDefaultShippingGroup

Parameters:
pCreateDefaultShippingGroup - the value to set for property createDefaultShippingGroup

getCreateDefaultPaymentGroup

public boolean getCreateDefaultPaymentGroup()
Returns property createDefaultPaymentGroup

Returns:
returns property createDefaultPaymentGroup

setCreateDefaultPaymentGroup

public void setCreateDefaultPaymentGroup(boolean pCreateDefaultPaymentGroup)
Sets property createDefaultPaymentGroup

Parameters:
pCreateDefaultPaymentGroup - the value to set for property createDefaultPaymentGroup

getPaymentGroupBillingAddressClassNameMap

public java.util.Properties getPaymentGroupBillingAddressClassNameMap()
Returns property paymentGroupBillingAddressClassNameMap

Returns:
returns property paymentGroupBillingAddressClassNameMap

setPaymentGroupBillingAddressClassNameMap

public void setPaymentGroupBillingAddressClassNameMap(java.util.Properties pPaymentGroupBillingAddressClassNameMap)
Sets property paymentGroupBillingAddressClassNameMap

Parameters:
pPaymentGroupBillingAddressClassNameMap - the value to set for property paymentGroupBillingAddressClassNameMap

getShippingGroupShippingAddressClassNameMap

public java.util.Properties getShippingGroupShippingAddressClassNameMap()
Returns property shippingGroupShippingAddressClassNameMap

Returns:
returns property shippingGroupShippingAddressClassNameMap

setShippingGroupShippingAddressClassNameMap

public void setShippingGroupShippingAddressClassNameMap(java.util.Properties pShippingGroupShippingAddressClassNameMap)
Sets property shippingGroupShippingAddressClassNameMap

Parameters:
pShippingGroupShippingAddressClassNameMap - the value to set for property shippingGroupShippingAddressClassNameMap

getDefaultPaymentGroupAddressType

public java.lang.String getDefaultPaymentGroupAddressType()
Returns property defaultPaymentGroupAddressType

Returns:
returns property defaultPaymentGroupAddressType

setDefaultPaymentGroupAddressType

public void setDefaultPaymentGroupAddressType(java.lang.String pDefaultPaymentGroupAddressType)
Sets property defaultPaymentGroupAddressType

Parameters:
pDefaultPaymentGroupAddressType - the value to set for property defaultPaymentGroupAddressType

getDefaultShippingGroupAddressType

public java.lang.String getDefaultShippingGroupAddressType()
Returns property defaultShippingGroupAddressType

Returns:
returns property defaultShippingGroupAddressType

setDefaultShippingGroupAddressType

public void setDefaultShippingGroupAddressType(java.lang.String pDefaultShippingGroupAddressType)
Sets property defaultShippingGroupAddressType

Parameters:
pDefaultShippingGroupAddressType - the value to set for property defaultShippingGroupAddressType

setAssignCatalogInCommerceItem

public void setAssignCatalogInCommerceItem(boolean pAssignCatalogInCommerceItem)

isAssignCatalogInCommerceItem

public boolean isAssignCatalogInCommerceItem()
If this is true, then newly created commerce items will have the 'catalogId' property automatically populated with the catalog for the current user The default is false.


doStartService

public void doStartService()
Start the OrderTools component. This method checks to see if the itemDescriptorToBeanNameMap was set explicitly in the component's configuration file. If it was not, the map contents are computed at startup by inverting the key/value pairs in beanNameToItemDescriptorMap.

Overrides:
doStartService in class GenericService

invertBeanToItemMap

protected java.util.Properties invertBeanToItemMap(java.util.Properties pBeanToItemMap)
Invert the key/value pairs in pBeanToItemMap and return a new Properties object containing the inverted map.


createOrder

public Order createOrder(java.lang.String pType)
                  throws CommerceException
Returns a new instance of an Order whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.Order. The type to class mapping is defined in the property orderTypeClassMap. The Order object which is created contains one ShippingGroup and one PaymentGroup, each of which are the defaults. If the defaults are null, then the ShippingGroup and PaymentGroup will not be created.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the Order object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createOrder

public Order createOrder(java.lang.String pType,
                         java.lang.String pOrderId)
                  throws CommerceException
Returns a new instance of an Order whose class is mapped to the type supplied in pType and whose id will be that which is supplied in pOrderId. The class must be an instance of atg.commerce.order.Order. The type to class mapping is defined in the property orderTypeClassMap. The Order object which is created contains one ShippingGroup and one PaymentGroup, each of which are the defaults. If the defaults are null, then the ShippingGroup and PaymentGroup will not be created.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the Order object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createOrder

public Order createOrder(java.lang.String pType,
                         ShippingPriceInfo pShippingPriceInfo)
                  throws CommerceException
Returns a new instance of an Order whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.Order. The type to class mapping is defined in the property orderTypeClassMap. The Order object which is created contains one ShippingGroup and one PaymentGroup, each of which are the defaults. If the defaults are null, then the ShippingGroup and PaymentGroup will not be created.

Parameters:
pType - the type which is mapped to the class to use
pShippingPriceInfo - the priceInfo to set into the ShippingGroup
Returns:
the Order object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createOrder

public Order createOrder(java.lang.String pType,
                         java.lang.String pOrderId,
                         ShippingPriceInfo pShippingPriceInfo)
                  throws CommerceException
Returns a new instance of an Order whose class is mapped to the type supplied in pType and whose id will be that which is supplied in pOrderId. The class must be an instance of atg.commerce.order.Order. The type to class mapping is defined in the property orderTypeClassMap. The Order object which is created contains one ShippingGroup and one PaymentGroup, each of which are the defaults. If the defaults are null, then the ShippingGroup and PaymentGroup will not be created.

Parameters:
pType - the type which is mapped to the class to use
pOrderId - the order id to assign to this new Order
pShippingPriceInfo - the priceInfo to set into the ShippingGroup
Returns:
the Order object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createCommerceItem

public CommerceItem createCommerceItem(java.lang.String pType)
                                throws CommerceException
Returns a new instance of a CommerceItem whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.CommerceItem. The name to class mapping is defined in the property itemTypeClassMap.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the CommerceItem object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createShippingGroup

public ShippingGroup createShippingGroup(java.lang.String pType)
                                  throws CommerceException
Returns a new instance of a ShippingGroup whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.ShippingGroup. The name to class mapping is defined in the property shippingTypeClassMap.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the ShippingGroup object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createShippingGroup

public ShippingGroup createShippingGroup(java.lang.String pType,
                                         ShippingPriceInfo pShippingPriceInfo)
                                  throws CommerceException
Returns a new instance of a ShippingGroup whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.ShippingGroup. The type to class mapping is defined in the property shippingTypeClassMap.

Parameters:
pType - the type which is mapped to the class to use
pShippingPriceInfo - the price info to set into the ShippingGroup
Returns:
the ShippingGroup object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createPaymentGroup

public PaymentGroup createPaymentGroup(java.lang.String pType)
                                throws CommerceException
Returns a new instance of a PaymentGroup whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.PaymentGroup. The type to class mapping is defined in the property PaymentTypeClassMap.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the PaymentGroup object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createHandlingInstruction

public HandlingInstruction createHandlingInstruction(java.lang.String pType)
                                              throws CommerceException
Returns a new instance of a HandlingInstruction whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.HandlingInstruction. The type to class mapping is defined in the property handlingTypeClassMap.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the HandlingInstruction object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

createRelationship

public Relationship createRelationship(java.lang.String pType)
                                throws CommerceException
Returns a new instance of a Relationship whose class is mapped to the type supplied in pType. The class must be an instance of atg.commerce.order.Relationship. The type to class mapping is defined in the property relationshipTypeClassMap.

Parameters:
pType - the type which is mapped to the class to use
Returns:
the Relationship object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidTypeException - if the supplied type is not mapped to any class
CommerceException

initializeRelationship

public void initializeRelationship(Order pOrder,
                                   ShippingGroupCommerceItemRelationship pRelationship,
                                   java.lang.String pShippingGroupId,
                                   java.lang.String pCommerceItemId)
                            throws CommerceException
This method initializes the Relationship to contain a ShippingGroup and a CommerceItem. This initialization sets the above fields in the Relationship object and also adds the Relationship to the ShippingGroup, CommerceItem, and Order.

Parameters:
pOrder - the Order object which contains the CommerceItem and ShippingGroup to add the Relationship to
pRelationship - the relationship object to add to the Order.
pShippingGroupId - the id of the ShippingGroup object which makes up a half of the relationship
pCommerceItemId - the id of the CommerceItem object which makes up a half of the relationship
Throws:
InvalidParameterException - if any of the given method parameters are invalid
InvalidTypeException - if there is more than one SHIPPINGQUANTITYREMAINING relationship type in the CommerceItem
CommerceException

initializeRelationship

public void initializeRelationship(Order pOrder,
                                   PaymentGroupCommerceItemRelationship pRelationship,
                                   java.lang.String pPaymentGroupId,
                                   java.lang.String pCommerceItemId)
                            throws CommerceException
This method initializes the Relationship to contain a PaymentGroup and a CommerceItem. This initialization sets the above fields in the Relationship object and also adds the Relationship to the PaymentGroup, CommerceItem, and Order.

Parameters:
pOrder - the Order object which contains the CommerceItem and PaymentGroup to add the Relationship to
pRelationship - the relationship object to add to the Order.
pPaymentGroupId - the id of the PaymentGroup object which makes up a half of the relationship
pCommerceItemId - the id of the CommerceItem object which makes up a half of the relationship
Throws:
InvalidParameterException - if any of the given method parameters are invalid
InvalidTypeException - if there is more than one PAYMENTAMOUNTREMAINING relationship type in the CommerceItem
CommerceException

initializeRelationship

public void initializeRelationship(Order pOrder,
                                   PaymentGroupShippingGroupRelationship pRelationship,
                                   java.lang.String pPaymentGroupId,
                                   java.lang.String pShippingGroupId)
                            throws CommerceException
This method initializes the Relationship to contain a PaymentGroup and a ShippingGroup. This initialization sets the above fields in the Relationship object and also adds the Relationship to the PaymentGroup, ShippingGroup, and Order. The relationship represents how shipping costs will be paid for.

Parameters:
pOrder - the Order object which contains the ShippingGroup and PaymentGroup to add the Relationship to
pRelationship - the relationship object to add to the Order.
pPaymentGroupId - the id of the PaymentGroup object which makes up a half of the relationship
pShippingGroupId - the id of the ShippingGroup object which makes up a half of the relationship
Throws:
InvalidParameterException - if any of the given method parameters are invalid
InvalidTypeException - if there is more than one SHIPPINGPRICEREMAINING relationship type in the ShippingGroup
CommerceException

initializeRelationship

public void initializeRelationship(Order pOrder,
                                   PaymentGroupOrderRelationship pRelationship,
                                   java.lang.String pPaymentGroupId)
                            throws CommerceException
This method initializes the Relationship to contain a PaymentGroup and an Order. This initialization sets the above fields in the Relationship object and also adds the Relationship to the PaymentGroup and Order.

Parameters:
pOrder - the Order object which contains the PaymentGroup to add the Relationship to
pRelationship - the relationship object to add to the Order.
pPaymentGroupId - the id of the PaymentGroup object which makes up a half of the relationship
Throws:
InvalidParameterException - if any of the given method parameters are invalid
InvalidTypeException - if there is more than one TAXAMOUNTREMAINING relationship type in the Order
CommerceException

copyAddress

public static void copyAddress(RepositoryItem pProfileAddress,
                               Address pAddress)
                        throws CommerceException
This method, given a ContactInfo iten descriptor and an atg.core.util.Address or atg.core.util.ContactInfo object, will copy the address information from the profile to the Address or ContactInfo object. If pAddress is a ContactInfo then the phoneNumber and email address will also be copied.

Parameters:
pProfile - a profile object that contains user information
pAddress - the Address or ContactInfo to copy the user data into
Throws:
CommerceException - if an error occurs while copying

copyAddress

public static void copyAddress(Address pAddress,
                               RepositoryItem pProfileAddress)
                        throws CommerceException
This method, given a Profile object and an atg.core.util.Address or atg.core.util.ContactInfo object, will copy the address information from the Address or ContactInfo object to the profile. If pAddress is a ContactInfo then the phoneNumber and email address will also be copied.

Parameters:
pAddress - the Address or ContactInfo to copy the data from
pProfileAddress - a profile object to copy the data to
Throws:
CommerceException - if an error occurs while copying

copyAddress

public static void copyAddress(Address pSrcAddress,
                               Address pDestAddress)
                        throws CommerceException
This method, given two atg.core.util.Address or atg.core.util.ContactInfo objects, will copy the address information from the source to the destination object. If pAddress is a ContactInfo then the phoneNumber and email address will also be copied.

Parameters:
pSrcAddress - the object that the data will be copied from
pDestAddress - the object that the data will be copied into
Throws:
CommerceException - if an error occurs while copying

isNullAddress

protected boolean isNullAddress(Address pAddress)
Query whether an Address object is null or empty.

Returns:
true if the address object is null or if every property in the address is null, false otherwise.

isNullCreditCard

protected boolean isNullCreditCard(CreditCard pCreditCard)
Query whether a CreditCard object is null or empty.

Returns:
true if the CreditCard object is null or the credit card properties are null

isOrderState

public boolean isOrderState(Order pOrder,
                            java.lang.String[] pStates)
Determines if an order is in one of the provided states

Parameters:
pOrder -
pStates - array of states.
Returns:
true if the order is in one of the given states

createOrderFixedAmountAdjustment

public RepositoryItem createOrderFixedAmountAdjustment(Order pOrder,
                                                       double pAmount,
                                                       java.lang.String pAdjustmentType,
                                                       java.lang.String pNotes,
                                                       java.lang.String pReasonCode)
                                                throws RepositoryException
Creates a new fixed amount manual adjustment and adds it to the order.

Note that transaction boundaries are not demarcated and updateOrder is not called by this method. Both are expected to be handled by the caller.

Creates an item based on the type defined by the property orderFixedAmountAdjustmentType

Parameters:
pOrder -
pAmount -
pAdjustmentType -
pNotes -
pReasonCode -
Returns:
a transient order fixed amount manual adjustment repository item
Throws:
RepositoryException

addManualAdjustment

protected void addManualAdjustment(Order pOrder,
                                   RepositoryItem pAdjustment)
This method adds the manual adjustment to the order. It also initializes the List of manual adjustments, if necessary.

Parameters:
pOrder -
pAdjustment -

addManualAdjustment

public void addManualAdjustment(Order pOrder,
                                RepositoryItem pAdjustment,
                                int pIndex)
Adds an adjustment at a specific index in the List. This method assumes the initial List has already been created.

Parameters:
pOrder -
pAdjustment -
pIndex -

createManualAdjustmentItem

protected MutableRepositoryItem createManualAdjustmentItem(java.lang.String pItemType,
                                                           double pAmount,
                                                           java.lang.String pAdjustmentType,
                                                           java.lang.String pNotes,
                                                           java.lang.String pReasonCode)
                                                    throws RepositoryException
Creates and returns a mutable, transient manual adjustment repository item of the specified type.

Parameters:
pItemType -
pOrder -
pAmount -
pAdjustmentType -
pNotes -
pReasonCode -
Returns:
mutable, transient manual adjustment item
Throws:
RepositoryException

deleteManualAdjustment

public boolean deleteManualAdjustment(Order pOrder,
                                      java.lang.String pAdjustmentItemId)
                               throws RepositoryException
Deletes manual adjustments from the order's list of adjustments. All adjustments in the list with a matching id are removed from the list. The adjustments are not explicitly deleted from the repository by this method. Cascade delete on the order's manual adjustment property definition is expected to handle that.

Note that transaction boundaries are not demarcated and updateOrder is not called by this method. Both are expected to be handled by the caller.

Parameters:
pAdjustmentItem -
pOrder -
Returns:
true if at least one adjustment with a matching id was found and removed from the order's list of manual adjustments
Throws:
RepositoryException

registerSynchronization

public void registerSynchronization(Order pOrder)
Registers the given order as a synchronization on the current transaction.

Parameters:
pOrder - the order which is used for synchronization

findShippingGroupsWithAddress

public java.util.Collection findShippingGroupsWithAddress(Order pOrder,
                                                          Address pAddress,
                                                          java.lang.String[] pPropertyNamesToCompare)
Finds all hardgood shipping group in the order with a matching address

Parameters:
pOrder - the order containing the shipping groups
pAddress - the address to compare to shipping group addresses
pPropertyNamesToCompare - the properties of the address that are used to determine equality
Returns:
a collection HardgoodShippingGroup that match