atg.b2bcommerce.order
Class CostCenterManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.b2bcommerce.order.CostCenterManager
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class CostCenterManager
extends GenericService

This class is the business layer object for managing and manipulating Cost Centers. This class holds all the business logic for manipulating a Cost Center. The various types of methods in this class are used for creating cost centers, adding cost centers to an Order, adding CommerceItems to cost centers.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static CostCenterManager mCostCenterManager
           
protected static java.util.ResourceBundle sB2BResourceBundle
           
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
CostCenterManager()
          Constructs an CostCenterManager object.
 
Method Summary
 CostCenter addCostCenterToOrder(B2BOrder pOrder, CostCenter pCostCenter)
          Adds the given cost center to the given order.
 void addItemAmountToCostCenter(B2BOrder pOrder, java.lang.String pCommerceItemId, java.lang.String pCostCenterId, double pAmount)
          Adds the given amount of the CommerceItem with the given id to the CostCenter with the given id.
 void addItemQuantityToCostCenter(B2BOrder pOrder, java.lang.String pCommerceItemId, java.lang.String pCostCenterId, long pQuantity)
          Adds the given quantity of the CommerceItem with the given id to the CostCenter with the given id.
 void addOrderAmountToCostCenter(B2BOrder pOrder, java.lang.String pCostCenterId, double pAmount)
          Adds the given amount of the Order's cost to the CostCenter with the given id.
 void addRemainingItemAmountToCostCenter(B2BOrder pOrder, java.lang.String pCommerceItemId, java.lang.String pCostCenterId)
          Adds any unassigned amount of the CommerceItem with the given id to the CostCenter with the given id.
 void addRemainingItemQuantityToCostCenter(B2BOrder pOrder, java.lang.String pCommerceItemId, java.lang.String pCostCenterId)
          Adds any unassigned quantity of the CommerceItem with the given id to the CostCenter with the given id.
 void addRemainingOrderAmountToCostCenter(B2BOrder pOrder, java.lang.String pCostCenterId)
          Adds any unassigned amount of the Order's cost to the CostCenter with the given id.
 void addRemainingShippingCostToCostCenter(B2BOrder pOrder, java.lang.String pShippingGroupId, java.lang.String pCostCenterId)
          Adds any unassigned amount of the ShippingGroup's cost with the given id to the CostCenter with the given id.
 void addRemainingTaxAmountToCostCenter(B2BOrder pOrder, java.lang.String pCostCenterId)
          Adds any unassigned amount of the Order's tax to the CostCenter with the given id.
 void addShippingCostAmountToCostCenter(B2BOrder pOrder, java.lang.String pShippingGroupId, java.lang.String pCostCenterId, double pAmount)
          Adds the given amount of the ShippingGroup's cost with the given id to the CostCenter with the given id.
 void addTaxAmountToCostCenter(B2BOrder pOrder, java.lang.String pCostCenterId, double pAmount)
          Adds the given amount of the Order's tax to the CostCenter with the given id.
 CostCenter createCostCenter(java.lang.String pIdentifier)
          Creates a new CostCenter object using the default type specified in the OrderTools defaultCostCenterType property.
 CostCenter createCostCenter(java.lang.String pCostCenterType, java.lang.String pIdentifier)
          Creates a new CostCenter object using the class mapped to the given name in pCostCenterType.
protected  Relationship createRelationship(java.lang.String pRelationshipType)
          Creates a new Relationship object using the class type mapped to the type supplied in pShippingGroupType.
 CostCenter getCostCenterByIdentifier(java.util.List pCostCenters, java.lang.String pIdentifier)
          This method will return a CostCenter whose identifier is pIdentifier.
 CostCenterCommerceItemRelationship getCostCenterCommerceItemRelationship(B2BOrder pOrder, java.lang.String pCommerceItemId, java.lang.String pCostCenterId)
          Returns the relationship object which exists between the given CommerceItem and CostCenter.
static CostCenterManager getCostCenterManager()
           
 CostCenterOrderRelationship getCostCenterOrderRelationship(B2BOrder pOrder, java.lang.String pCostCenterId)
          Returns the relationship object which exists between the given Order and CostCenter.
 CostCenterShippingGroupRelationship getCostCenterShippingGroupRelationship(B2BOrder pOrder, java.lang.String pCostCenterId, java.lang.String pShippingGroupId)
          Returns the relationship object which exists between the given ShippingGroup and CostCenter.
 java.util.List getOrderIdsForCostCenter(java.lang.String pCostCenterId, int pStartIndex, int pNumOrders)
          Returns the order ids for the given cost center.
 OrderManager getOrderManager()
          Returns the OrderManager
 java.util.List getOrdersForCostCenter(java.lang.String pCostCenterId, int pStartIndex, int pNumOrders)
          Returns all the orders for the given cost center id.
 B2BOrderTools getOrderTools()
          Returns the OrderTools
 double getRemainingAmountForCostCenter(B2BCommerceItem pItem)
          Calculate the "amount remaining" for a given item.
 long getRemainingQuantityForCostCenter(B2BCommerceItem pItem)
          Calculate the "quantity remaining" for a given item.
 double getUnassignedAmountForCommerceItem(B2BCommerceItem pItem)
          This method returns the unassigned amount for a CommerceItem.
 long getUnassignedQuantityForCommerceItem(B2BCommerceItem pItem)
          This method returns the unassigned quantity for a CommerceItem.
 void moveItemToCostCenter(B2BOrder pOrder, B2BCommerceItem pCommerceItem, long pQuantity, CostCenter pSrcCostCenter, CostCenter pDestCostCenter)
          This method moves an item from one CostCenter to another.
 void moveItemToCostCenter(B2BOrder pOrder, java.lang.String pCatalogRefId, long pQuantity, java.lang.String pSrcCostCenterId, java.lang.String pDestCostCenterId)
          This method moves an item from one CostCenter to another.
 PipelineResult recalculateCostCenterAmounts(Order pOrder)
          Recalculates the amounts for each CostCenter supplied in pCostCenterList.
 void removeAllCostCentersFromOrder(B2BOrder pOrder)
          Removes all the CostCenters and their Relationships from an Order.
 void removeAllRelationshipsFromCostCenter(B2BOrder pOrder, java.lang.String pCostCenterId)
          Removes all the relationships from the CostCenter with the given id in the given order.
 void removeCostCenterFromOrder(B2BOrder pOrder, java.lang.String pCostCenterId)
          Removes the given CostCenter from the given order.
 void removeItemQuantityFromCostCenter(B2BOrder pOrder, java.lang.String pCommerceItemId, java.lang.String pCostCenterId, long pQuantity)
          Removes the given quantity of the CommerceItem with the given id from the CostCenter with the given id.
 void setOrderManager(OrderManager pOrderManager)
          Sets the OrderManager
 void setOrderTools(B2BOrderTools pOrderTools)
          Sets the OrderTools
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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


sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Resource Bundle


sB2BResourceBundle

protected static java.util.ResourceBundle sB2BResourceBundle

mCostCenterManager

protected static CostCenterManager mCostCenterManager
Constructor Detail

CostCenterManager

public CostCenterManager()
Constructs an CostCenterManager object.

Method Detail

getCostCenterManager

public static CostCenterManager getCostCenterManager()

getOrderManager

public OrderManager getOrderManager()
Returns the OrderManager


setOrderManager

public void setOrderManager(OrderManager pOrderManager)
Sets the OrderManager


getOrderTools

public B2BOrderTools getOrderTools()
Returns the OrderTools


setOrderTools

public void setOrderTools(B2BOrderTools pOrderTools)
Sets the OrderTools


createCostCenter

public CostCenter createCostCenter(java.lang.String pIdentifier)
                            throws CommerceException
Creates a new CostCenter object using the default type specified in the OrderTools defaultCostCenterType property.

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

createCostCenter

public CostCenter createCostCenter(java.lang.String pCostCenterType,
                                   java.lang.String pIdentifier)
                            throws CommerceException
Creates a new CostCenter object using the class mapped to the given name in pCostCenterType.

Parameters:
pIdentifier - the user-defined name of the CostCenter
pDescription - the description of the cost center
pCostCenterType - the name that is mapped in the OrderTools.properties file to the class of the desired type to create
Returns:
the CostCenter object which was created
Throws:
InvalidParameterException - thrown if any of the parameters are null
ObjectCreationException - if the instantiation of an object fails
CommerceException

addCostCenterToOrder

public CostCenter addCostCenterToOrder(B2BOrder pOrder,
                                       CostCenter pCostCenter)
                                throws CommerceException
Adds the given cost center to the given order.

Parameters:
pOrder - the Order to add the CommerceItem to
pCostCenter - the CostCenter to add to the Order
Returns:
the CostCenter which contains the cost center just added.
Throws:
InvalidParameterException - thrown if any of the parameters are null
CommerceException

removeCostCenterFromOrder

public void removeCostCenterFromOrder(B2BOrder pOrder,
                                      java.lang.String pCostCenterId)
                               throws CommerceException
Removes the given CostCenter from the given order. This method will also remove relationships which reference the CostCenter.

Parameters:
pOrder - the Order to remove the CostCenter from
pCostCenterId - the id of the CostCenter to remove from the Order
Throws:
InvalidParameterException - thrown if any of the parameters are null
CostCenterNotFoundException - if a CostCenter with the given id is not found in the given order
ObjectRemovalException - thrown if the CostCenter contains any relationships
CommerceException

removeAllCostCentersFromOrder

public void removeAllCostCentersFromOrder(B2BOrder pOrder)
                                   throws CommerceException
Removes all the CostCenters and their Relationships from an Order.

Parameters:
pOrder - the Order which contains the CostCenters to be removed
Throws:
InvalidParameterException - thrown if any of the parameters are null
ObjectRemovalException - thrown if a CostCenter cannot be removed
CommerceException

removeAllRelationshipsFromCostCenter

public void removeAllRelationshipsFromCostCenter(B2BOrder pOrder,
                                                 java.lang.String pCostCenterId)
                                          throws CommerceException
Removes all the relationships from the CostCenter with the given id in the given order.

Parameters:
pOrder - the Order which contains the CostCenter to remove the relationships from
pCostCenterId - the id of the CostCenter
Throws:
InvalidParameterException - thrown if any of the parameters are null
CostCenterNotFoundException - if a CostCenter with the given id is not found in the given order
ObjectRemovalException - thrown if a relationship cannot be removed
CommerceException

getCostCenterByIdentifier

public CostCenter getCostCenterByIdentifier(java.util.List pCostCenters,
                                            java.lang.String pIdentifier)
                                     throws CommerceException
This method will return a CostCenter whose identifier is pIdentifier.

Parameters:
pCostCenters - a List of CostCenters
pIdentifier - the identifier to search for in the List of CostCenters
Returns:
the CostCenter whose identifier is pIdentifier or null if it is not found
Throws:
InvalidParameterException - if any of the parameters are null
CommerceException

getCostCenterCommerceItemRelationship

public CostCenterCommerceItemRelationship getCostCenterCommerceItemRelationship(B2BOrder pOrder,
                                                                                java.lang.String pCommerceItemId,
                                                                                java.lang.String pCostCenterId)
                                                                         throws CommerceException
Returns the relationship object which exists between the given CommerceItem and CostCenter.

Parameters:
pCommerceItemId - the id of the CommerceItem which makes up a half of the relationship
pCostCenterId - the id of the CostCenter which makes up a half of the relationship
Returns:
the CostCenterCommerceItemRelationship object that exists between these two objects
Throws:
InvalidParameterException - thrown if any of the parameters are null
RelationshipNotFoundException - if a relationship is not found
CommerceException

getCostCenterOrderRelationship

public CostCenterOrderRelationship getCostCenterOrderRelationship(B2BOrder pOrder,
                                                                  java.lang.String pCostCenterId)
                                                           throws CommerceException
Returns the relationship object which exists between the given Order and CostCenter.

Parameters:
pOrder - the Order which makes up half of the relationship
pCostCenterId - the id of the CostCenter which makes up a half of the relationship
Returns:
the CostCenterOrderRelationship object that exists between these two objects
Throws:
InvalidParameterException - thrown if any of the parameters are null
RelationshipNotFoundException - if a relationship is not found
CommerceException

getCostCenterShippingGroupRelationship

public CostCenterShippingGroupRelationship getCostCenterShippingGroupRelationship(B2BOrder pOrder,
                                                                                  java.lang.String pCostCenterId,
                                                                                  java.lang.String pShippingGroupId)
                                                                           throws CommerceException
Returns the relationship object which exists between the given ShippingGroup and CostCenter.

Parameters:
pShippingGroupId - the id of the ShippingGroup which makes up a half of the relationship
pCostCenterId - the id of the CostCenter which makes up a half of the relationship
Returns:
the CostCenterShippingGroupRelationship object that exists between these two objects
Throws:
InvalidParameterException - thrown if any of the parameters are null
RelationshipNotFoundException - if a relationship is not found
CommerceException

moveItemToCostCenter

public void moveItemToCostCenter(B2BOrder pOrder,
                                 java.lang.String pCatalogRefId,
                                 long pQuantity,
                                 java.lang.String pSrcCostCenterId,
                                 java.lang.String pDestCostCenterId)
                          throws CommerceException
This method moves an item from one CostCenter 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
pSrcCostCenterId - the id of the costCenter to move the item from
pDestCostCenterId - the id of the costCenter to move the item to
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

moveItemToCostCenter

public void moveItemToCostCenter(B2BOrder pOrder,
                                 B2BCommerceItem pCommerceItem,
                                 long pQuantity,
                                 CostCenter pSrcCostCenter,
                                 CostCenter pDestCostCenter)
                          throws CommerceException
This method moves an item from one CostCenter 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
pSrcCostCenter - the costCenter to move the item from
pDestCostCenter - the costCenter to move the item to
Throws:
CommerceException - thrown if the operation could not be completed. More information can be found within the exception.

removeItemQuantityFromCostCenter

public void removeItemQuantityFromCostCenter(B2BOrder pOrder,
                                             java.lang.String pCommerceItemId,
                                             java.lang.String pCostCenterId,
                                             long pQuantity)
                                      throws CommerceException
Removes the given quantity of the CommerceItem with the given id from the CostCenter with the given id.

Parameters:
pOrder - the Order which the CommerceItem and CostCenter exist
pCommerceItemId - the id of the CommerceItem to to remove from the CostCenter
pCostCenterId - the id of the CostCenter which the CommerceItem will be removed from
pQuantity - the quantity of the CommerceItem which will be removed
Throws:
InvalidParameterException - thrown if any of the parameters are null
ObjectRemovalException - if the removal of the quantity fails
CommerceException

addItemQuantityToCostCenter

public void addItemQuantityToCostCenter(B2BOrder pOrder,
                                        java.lang.String pCommerceItemId,
                                        java.lang.String pCostCenterId,
                                        long pQuantity)
                                 throws CommerceException
Adds the given quantity of the CommerceItem with the given id to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterCommerceItemRelationship with type QUANTITY and sets the CostCenter, CommerceItem, and quantity properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CommerceItem and CostCenter exist
pCommerceItemId - the id of the CommerceItem to add
pCostCenterId - the id of the CostCenter which the CommerceItem will be added to
pQuantity - the quantity of the CommerceItem which will be added
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
atg.commerce.order.CostCenterCommerceItemRelationship

addRemainingItemQuantityToCostCenter

public void addRemainingItemQuantityToCostCenter(B2BOrder pOrder,
                                                 java.lang.String pCommerceItemId,
                                                 java.lang.String pCostCenterId)
                                          throws CommerceException
Adds any unassigned quantity of the CommerceItem with the given id to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterCommerceItemRelationship with type QUANTITYREMAINING and sets the CostCenter and CommerceItem properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CommerceItem and CostCenter exist
pCommerceItemId - the id of the CommerceItem to add
pCostCenterId - the id of the CostCenter which the CommerceItem will be added to
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterCommerceItemRelationship

addItemAmountToCostCenter

public void addItemAmountToCostCenter(B2BOrder pOrder,
                                      java.lang.String pCommerceItemId,
                                      java.lang.String pCostCenterId,
                                      double pAmount)
                               throws CommerceException
Adds the given amount of the CommerceItem with the given id to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterCommerceItemRelationship with type AMOUNT and sets the CostCenter, CommerceItem, and amount properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CommerceItem and CostCenter exist
pCommerceItemId - the id of the CommerceItem to add
pCostCenterId - the id of the CostCenter which the CommerceItem will be added to
pAmount - the amount of the CommerceItem which will be added
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
atg.commerce.order.CostCenterCommerceItemRelationship

addRemainingItemAmountToCostCenter

public void addRemainingItemAmountToCostCenter(B2BOrder pOrder,
                                               java.lang.String pCommerceItemId,
                                               java.lang.String pCostCenterId)
                                        throws CommerceException
Adds any unassigned amount of the CommerceItem with the given id to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterCommerceItemRelationship with type AMOUNTREMAINING and sets the CostCenter and CommerceItem properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CommerceItem and CostCenter exist
pCommerceItemId - the id of the CommerceItem to add
pCostCenterId - the id of the CostCenter which the CommerceItem will be added to
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterCommerceItemRelationship

getUnassignedQuantityForCommerceItem

public long getUnassignedQuantityForCommerceItem(B2BCommerceItem pItem)
This method returns the unassigned quantity for a CommerceItem. If a CommerceItem contains a CostCenterRelationship with type QuantityRemaining, then the unassigned quantity will always be 0. To determine the remaining quantity call getRemainingQuantityForCostCenter(CommerceItem). This method assumes that CostCenterCommerceItemRelationships have been created between the CommerceItem and CostCenter.

Parameters:
pItem - the CommerceItem we are checking
Returns:
the unassigned quantity.
See Also:
getRemainingQuantityForCostCenter(B2BCommerceItem)

getRemainingQuantityForCostCenter

public long getRemainingQuantityForCostCenter(B2BCommerceItem pItem)
Calculate the "quantity remaining" for a given item. Add up all the quantities in relationships of type QUANTITY then subtract from the CommerceItem's quantity. This method assumes that CostCenterCommerceItemRelationships have been created between the CommerceItem and CostCenter.

Parameters:
pItem - The CommerceItem we are checking
Returns:
The quantity remaining.

getUnassignedAmountForCommerceItem

public double getUnassignedAmountForCommerceItem(B2BCommerceItem pItem)
This method returns the unassigned amount for a CommerceItem. If a CommerceItem contains a CostCenterRelationship with type AmountRemaining, then the unassigned amount will always be 0. To determine the remaining amount call getRemainingAmountForCostCenter(B2BCommerceItem). This method assumes that CostCenterCommerceItemRelationships have been created between the CommerceItem and CostCenter.

Parameters:
pItem - the CommerceItem we are checking
Returns:
the unassigned amount.
See Also:
getRemainingAmountForCostCenter(B2BCommerceItem)

getRemainingAmountForCostCenter

public double getRemainingAmountForCostCenter(B2BCommerceItem pItem)
Calculate the "amount remaining" for a given item. Add up all the amounts in relationships of type AMOUNT then subtract from the CommerceItem's amount. This method assumes that CostCenterCommerceItemRelationships have been created between the CommerceItem and CostCenter.

Parameters:
pItem - The CommerceItem we are checking
Returns:
The amount remaining.

addShippingCostAmountToCostCenter

public void addShippingCostAmountToCostCenter(B2BOrder pOrder,
                                              java.lang.String pShippingGroupId,
                                              java.lang.String pCostCenterId,
                                              double pAmount)
                                       throws CommerceException
Adds the given amount of the ShippingGroup's cost with the given id to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterShippingGroupRelationship with type CCSHIPPINGAMOUNT and sets the CostCenter, ShippingGroup, and amount properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CostCenter and ShippingGroup exist
pShippingGroupId - the id of the ShippingGroup's cost to add
pCostCenterId - the id of the CostCenter which the ShippingGroup's cost will be added to
pAmount - the amount that is assigned for payment to the CostCenter
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterShippingGroupRelationship

addRemainingShippingCostToCostCenter

public void addRemainingShippingCostToCostCenter(B2BOrder pOrder,
                                                 java.lang.String pShippingGroupId,
                                                 java.lang.String pCostCenterId)
                                          throws CommerceException
Adds any unassigned amount of the ShippingGroup's cost with the given id to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterShippingGroupRelationship with type CCSHIPPINGAMOUNTREMAINING and sets the CostCenter and ShippingGroup properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CostCenter and ShippingGroup exist
pShippingGroupId - the id of the ShippingGroup's cost to add
pCostCenterId - the id of the CostCenter which the ShippingGroup's cost will be added to
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterShippingGroupRelationship

addTaxAmountToCostCenter

public void addTaxAmountToCostCenter(B2BOrder pOrder,
                                     java.lang.String pCostCenterId,
                                     double pAmount)
                              throws CommerceException
Adds the given amount of the Order's tax to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterOrderRelationship with type CCTAXAMOUNT and sets the CostCenter, Order, and amount properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CostCenter exists
pCostCenterId - the id of the CostCenter which the Order's tax will be added to
pAmount - the amount that is assigned for payment to the CostCenter
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterOrderRelationship

addRemainingTaxAmountToCostCenter

public void addRemainingTaxAmountToCostCenter(B2BOrder pOrder,
                                              java.lang.String pCostCenterId)
                                       throws CommerceException
Adds any unassigned amount of the Order's tax to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterOrderRelationship with type CCTAXAMOUNTREMAINING and sets the CostCenter property in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the PaymentGroup exists
pCostCenterId - the id of the CostCenter which the Order's tax will be added to
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterOrderRelationship

addOrderAmountToCostCenter

public void addOrderAmountToCostCenter(B2BOrder pOrder,
                                       java.lang.String pCostCenterId,
                                       double pAmount)
                                throws CommerceException
Adds the given amount of the Order's cost to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterOrderRelationship with type CCORDERAMOUNT and sets the CostCenter, Order, and amount properties in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CostCenter exists
pCostCenterId - the id of the CostCenter which the Order's cost will be added to
pAmount - the amount that is assigned for payment to the CostCenter
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
CostCenterOrderRelationship

addRemainingOrderAmountToCostCenter

public void addRemainingOrderAmountToCostCenter(B2BOrder pOrder,
                                                java.lang.String pCostCenterId)
                                         throws CommerceException
Adds any unassigned amount of the Order's cost to the CostCenter with the given id. Underneath the surface, this method creates a CostCenterOrderRelationship with type CCORDERAMOUNTREMAINING and sets the CostCenter property in that Relationship to those given as parameters in this method. The id parameters are resolved to the actual objects.

Parameters:
pOrder - the Order which the CostCenter exists
pCostCenterId - the id of the CostCenter which the Order's cost will be added to
Throws:
InvalidParameterException - thrown if any of the parameters are null
InvalidTypeException - thrown if more than one REMAINING relationship type is added to a CostCenter or if an invalid type is set to the Relationship
ObjectCreationException - if the instantiation of an object fails
CommerceException
See Also:
atg.commerce.order.CostCenterOrderRelationship

recalculateCostCenterAmounts

public PipelineResult recalculateCostCenterAmounts(Order pOrder)
                                            throws CommerceException
Recalculates the amounts for each CostCenter supplied in pCostCenterList.

Parameters:
pOrder - the Order to recalculate the CostCenters in
Returns:
the PipelineResult object from the execution of the pipeline
Throws:
CommerceException - thrown if an error occurs while recalculating the amounts

getOrdersForCostCenter

public java.util.List getOrdersForCostCenter(java.lang.String pCostCenterId,
                                             int pStartIndex,
                                             int pNumOrders)
                                      throws CommerceException
Returns all the orders for the given cost center id.

Parameters:
pCostCenterId - the CostCenter id
Returns:
a List of all the orders for the given cost center id
Throws:
InvalidParameterException - thrown if any of the parameters are null or empty string
CommerceException - thrown if an exception occurs while accessing the repository

getOrderIdsForCostCenter

public java.util.List getOrderIdsForCostCenter(java.lang.String pCostCenterId,
                                               int pStartIndex,
                                               int pNumOrders)
                                        throws CommerceException
Returns the order ids for the given cost center.

Parameters:
pCostCenterId - the CostCenter id
Returns:
a List of all the order ids for the given cost center id
Throws:
InvalidParameterException - thrown if any of the parameters are null or empty string
CommerceException - thrown if an exception occurs while accessing the repository

createRelationship

protected Relationship createRelationship(java.lang.String pRelationshipType)
                                   throws CommerceException
Creates a new Relationship object using the class type mapped to the type supplied in pShippingGroupType.

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