atg.commerce.order
Class HandlingInstructionManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.order.HandlingInstructionManager
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class HandlingInstructionManager
extends GenericService

This class is the business layer object for managing and manipulating HandlingInstructions. This class holds all the business logic for manipulating all types of HandlingInstructions.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.util.ResourceBundle sResourceBundle
          Resource Bundle
 
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
HandlingInstructionManager()
          Constructs a HandlingInstructionManager object.
 
Method Summary
 void addHandlingInstructionToShippingGroup(Order pOrder, HandlingInstruction pHandlingInstruction)
          Adds the given HandlingInstruction to the ShippingGroup in the given Order.
 boolean areHandlingInstructionsEqual(HandlingInstruction pHandling1, HandlingInstruction pHandling2)
          determines if the two handling instructions are equal based on their constant properties.
 HandlingInstruction copyHandlingInstruction(HandlingInstruction pHandlingInstruction)
          Copy a handling object.
 HandlingInstruction createHandlingInstruction()
          Creates a new HandlingInstruction object using the type mapped to the defaultHandlingInstructionType property in OrderTools.
 HandlingInstruction createHandlingInstruction(java.lang.String pHandlingInstructionType)
          Creates a new HandlingInstruction object using the type mapped to the type supplied in pHandlingInstructionType.
 HandlingInstruction createHandlingInstruction(java.lang.String pShippingGroupId, java.lang.String pCommerceItemId, long pQuantity)
          Creates a new HandlingInstruction object of the default type and populates the HandlingInstruction with the supplied data.
 HandlingInstruction createHandlingInstruction(java.lang.String pHandlingInstructionType, java.lang.String pShippingGroupId, java.lang.String pCommerceItemId, long pQuantity)
          Creates a new HandlingInstruction object using the class mapped to the given name.
 java.util.List getAllHandlingInstructionsForCommerceItem(Order pOrder, java.lang.String pCommerceItemId)
          Return a list of handlingInstructions for the given commerce item, if it exists.
 java.util.List getHandlingInstructionsForCommerceItem(ShippingGroup pShippingGroup, java.lang.String pCommerceItemId)
          Return a list of handlingInstructions for the given commerce item, if it exists.
 OrderTools getOrderTools()
          Returns property orderTools
 ShippingGroupManager getShippingGroupManager()
          Returns property shippingGroupManager
 void removeAllHandlingInstructionsFromShippingGroup(Order pOrder, java.lang.String pShippingGroupId)
          Removes all the HandlingInstructions and from a ShippingGroup.
 void removeHandlingInstructionFromShippingGroup(Order pOrder, java.lang.String pShippingGroupId, java.lang.String pHandlingInstructionId)
          Removes the HandlingInstruction with the given id from the ShippingGroup with the given id in the Order.
 void removeHandlingInstructionsFromShippingGroup(Order pOrder, java.lang.String pShippingGroupId, java.lang.String pCommerceItemId)
          Removes the HandlingInstructions from the ShippingGroup in the given Order which belong to the CommerceItem with the given id.
 void setOrderTools(OrderTools pOrderTools)
          Sets property orderTools
 void setShippingGroupManager(ShippingGroupManager pShippingGroupManager)
          Sets property shippingGroupManager
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Resource Bundle

Constructor Detail

HandlingInstructionManager

public HandlingInstructionManager()
Constructs a HandlingInstructionManager object.

Method Detail

getOrderTools

public OrderTools getOrderTools()
Returns property orderTools

Returns:
returns property orderTools

setOrderTools

public void setOrderTools(OrderTools pOrderTools)
Sets property orderTools

Parameters:
pOrderTools - the value to set for property orderTools

getShippingGroupManager

public ShippingGroupManager getShippingGroupManager()
Returns property shippingGroupManager

Returns:
returns property shippingGroupManager

setShippingGroupManager

public void setShippingGroupManager(ShippingGroupManager pShippingGroupManager)
Sets property shippingGroupManager

Parameters:
pShippingGroupManager - the value to set for property shippingGroupManager

createHandlingInstruction

public HandlingInstruction createHandlingInstruction()
                                              throws CommerceException
Creates a new HandlingInstruction object using the type mapped to the defaultHandlingInstructionType property in OrderTools.

Returns:
the HandlingInstruction object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidParameterException - thrown if any of the parameters are null
CommerceException
See Also:
OrderTools.getDefaultHandlingInstructionType()

createHandlingInstruction

public HandlingInstruction createHandlingInstruction(java.lang.String pHandlingInstructionType)
                                              throws CommerceException
Creates a new HandlingInstruction object using the type mapped to the type supplied in pHandlingInstructionType.

Parameters:
pHandlingInstructionType - the name that is mapped in the OrderTools.properties file to the class of the desired type to create
Returns:
the HandlingInstruction object which was created
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidParameterException - thrown if any of the parameters are null
CommerceException

createHandlingInstruction

public HandlingInstruction createHandlingInstruction(java.lang.String pShippingGroupId,
                                                     java.lang.String pCommerceItemId,
                                                     long pQuantity)
                                              throws CommerceException
Creates a new HandlingInstruction object of the default type and populates the HandlingInstruction with the supplied data.

Parameters:
pShippingGroupId - the id of the ShippingGroup which contains the CommerceItem which this HandlingInstruction applies to
pCommerceItemId - the id of the CommerceItem which this HandlingInstruction applies to
pQuantity - the quantity of CommerceItems which this HandlingInstruction applies to
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidParameterException - thrown if any of the parameters are null
CommerceException
See Also:
OrderTools.getDefaultHandlingInstructionType()

createHandlingInstruction

public HandlingInstruction createHandlingInstruction(java.lang.String pHandlingInstructionType,
                                                     java.lang.String pShippingGroupId,
                                                     java.lang.String pCommerceItemId,
                                                     long pQuantity)
                                              throws CommerceException
Creates a new HandlingInstruction object using the class mapped to the given name. Populates the HandlingInstruction with the supplied data.

Parameters:
pHandlingInstructionType - the name that is mapped in the OrderTools.properties file to the class of the desired type to create
pShippingGroupId - the id of the ShippingGroup which contains the CommerceItem which this HandlingInstruction applies to
pCommerceItemId - the id of the CommerceItem which this HandlingInstruction applies to
pQuantity - the quantity of CommerceItems which this HandlingInstruction applies to
Throws:
ObjectCreationException - if the instantiation of an object fails
InvalidParameterException - thrown if any of the parameters are null
CommerceException

addHandlingInstructionToShippingGroup

public void addHandlingInstructionToShippingGroup(Order pOrder,
                                                  HandlingInstruction pHandlingInstruction)
                                           throws CommerceException
Adds the given HandlingInstruction to the ShippingGroup in the given Order. The shippingGroupId property in the HandlingInstruction specifies which ShippingGroup this HandlingInstruction will be added to. By default this method will check that the commerceItemId specified in the HandlingInstruction refers to a CommerceItem which is in the ShippingGroup.

Parameters:
pOrder - the Order which contains the ShippingGroup that this HandlingInstruction will be added to
pHandlingInstruction - the HandlingInstruction to add to the ShippingGroup in the Order
Throws:
InvalidParameterException - thrown if any of the parameters are null
CommerceException

removeAllHandlingInstructionsFromShippingGroup

public void removeAllHandlingInstructionsFromShippingGroup(Order pOrder,
                                                           java.lang.String pShippingGroupId)
                                                    throws CommerceException
Removes all the HandlingInstructions and from a ShippingGroup.

Parameters:
pOrder - the Order which contains the ShippingGroup which contains the HandlingInstructions to be removed
pShippingGroupId - the id of the ShippingGroup which contains the HandlingInstructions
Throws:
InvalidParameterException - thrown if any of the parameters are null
ObjectRemovalException - thrown if a HandlingInstruction cannot be removed
CommerceException

removeHandlingInstructionFromShippingGroup

public void removeHandlingInstructionFromShippingGroup(Order pOrder,
                                                       java.lang.String pShippingGroupId,
                                                       java.lang.String pHandlingInstructionId)
                                                throws CommerceException
Removes the HandlingInstruction with the given id from the ShippingGroup with the given id in the Order.

Parameters:
pOrder - the Order which contains the ShippingGroup to remove the HandlingInstruction from
pShippingGroupId - the id of the ShippingGroup which contains the HandlingInstruction
pHandlingInstructionId - the id of the HandlingInstruction
Throws:
InvalidParameterException - thrown if any of the parameters are null
ShippingGroupNotFoundException - if a ShippingGroup with the given id is not found in the given order
CommerceException

removeHandlingInstructionsFromShippingGroup

public void removeHandlingInstructionsFromShippingGroup(Order pOrder,
                                                        java.lang.String pShippingGroupId,
                                                        java.lang.String pCommerceItemId)
                                                 throws CommerceException
Removes the HandlingInstructions from the ShippingGroup in the given Order which belong to the CommerceItem with the given id.

Parameters:
pOrder - the Order which contains the ShippingGroup to remove the HandlingInstruction from
pShippingGroupId - the id of the ShippingGroup which contains the HandlingInstructions
pCommerceItemId - the id of the CommerceItem which the HandlingInstructions reference
Throws:
InvalidParameterException - thrown if any of the parameters are null
ShippingGroupNotFoundException - if a ShippingGroup with the given id is not found in the given order
CommerceException

copyHandlingInstruction

public HandlingInstruction copyHandlingInstruction(HandlingInstruction pHandlingInstruction)
Copy a handling object. Also copies GiftlistHandlingInstruction properties If new HandlingInstructions are created, this should be extended. If the HandlingInstruction is not a GiftlistHandlingInstruction, only properties of the base class are copied

Parameters:
pHandlingInstruction - The handlingInstruction to copy
Returns:
A new HandlingInstruciton

getHandlingInstructionsForCommerceItem

public java.util.List getHandlingInstructionsForCommerceItem(ShippingGroup pShippingGroup,
                                                             java.lang.String pCommerceItemId)
Return a list of handlingInstructions for the given commerce item, if it exists.

Parameters:
pShippingGroup - the shipping group containing the handling instruction
pCommerceItemId - The id of the item
Returns:
a list of HandlingInstructions for the CommerceItem whose id is pCommerceItemId

getAllHandlingInstructionsForCommerceItem

public java.util.List getAllHandlingInstructionsForCommerceItem(Order pOrder,
                                                                java.lang.String pCommerceItemId)
Return a list of handlingInstructions for the given commerce item, if it exists.

Parameters:
pOrder - the order containing the item
pCommerceItemId - The id of the item
Returns:
a list of HandlingInstructions for the CommerceItem whose id is pCommerceItemId

areHandlingInstructionsEqual

public boolean areHandlingInstructionsEqual(HandlingInstruction pHandling1,
                                            HandlingInstruction pHandling2)
determines if the two handling instructions are equal based on their constant properties.

For all handling instructions the class type, commerce item id, shipping group id and handling method must be the same.

For gift handling instructions the gift list id and gift item must also match.

Parameters:
pHandling1 -
pHandling2 -
Returns:
true if the two handling instructions are equal