atg.commerce.csr.environment
Class CSREnvironmentTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.csr.environment.CSREnvironmentTools
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class CSREnvironmentTools
extends atg.nucleus.GenericService

This class provides util API for managing the CSR environment.

See Also:
CSREnvironmentConstants

Field Summary
static java.lang.String CATALOG_TREE_STATE_PATH
          The path to the environment's tree state component
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CSR_APP_NAME
          Commerce Application name
static java.lang.String CSR_ENVIRONMENTTOOLS_PATH
          The path to the CSREnvironmentTools component
protected  atg.commerce.catalog.CatalogTools mCatalogTools
           
protected  CSRAgentTools mCSRAgentTools
           
protected  java.lang.String mCSRApplicationName
           
protected  CSRScheduledOrderTools mCSRScheduledOrderTools
           
protected  atg.svc.agent.environment.EnvironmentTools mEnvironmentTools
           
protected  atg.commerce.pricing.priceLists.PriceListManager mPriceListManager
           
protected static java.lang.String MY_RESOURCES
           
static java.lang.String ORDER_HOLDER_PATH
          The path to the environment's order holder component
static java.lang.String PRICING_MODEL_PATH
          The path to the environment's pricing model component
static java.lang.String SUBMITTED_ORDER_PRICING_MODEL_PATH
          The path to the environment's submitted order pricing model component
static java.lang.String VIEW_ORDER_HOLDER_PATH
          The path to the environment's view order holder component
 
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
CSREnvironmentTools()
           
 
Method Summary
protected  void addChangeCatalogDetail(atg.repository.RepositoryItem pCatalog, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change detail for the given custom catalog.
 void addChangeCatalogDetail(java.lang.String pCatalogId, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change detail for a change in catalog
 void addChangeOrderDetail(atg.commerce.order.Order pOrder, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change order detail for loading an existing order.
 void addChangeOrderDetail(java.lang.String pOrderId, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change order detail for loading an existing order.
 void addChangePriceListDetail(atg.repository.RepositoryItem pPriceList, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change detail for the given price list.
 void addChangePriceListDetail(java.lang.String pPriceListId, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change detail for the price list with the given id.
 void addChangeSalePriceListDetail(atg.repository.RepositoryItem pPriceList, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change detail for the given sale price list.
 void addChangeSalePriceListDetail(java.lang.String pPriceListId, atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change detail for the sale price list with the given id.
 void addNewOrderDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Adds a change environment detail for a new order.
 void changeOrder(java.lang.String pApplicationName, atg.commerce.order.Order pOrder, atg.svc.agent.environment.TicketDispositionOptions pTicketDispositionOptions)
          Changes the environment's current order to the given order
 void changeOrder(java.lang.String pApplicationName, java.lang.String pOrderId, atg.svc.agent.environment.TicketDispositionOptions pTicketDispositionOptions)
          Changes the environment's current order to the given order
 void changeViewOrder(java.lang.String pViewOrderId)
          This method will change the current view order to the given order.
 void cleanCatalogTreeState(atg.web.tree.TreeState treeState)
          Nulls properties of catalog navigation tree
 void createNewOrder(java.lang.String pApplicationName)
          Creates a new order in the order holder.
 java.util.List createWarningsForCatalogSwitch(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Generates warnings for a change of catalog
 java.util.List createWarningsForChangeOrder(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Generates warnings for a change of order
protected  java.util.List createWarningsForCurrentOrder()
          Adds a warning for the current order if there are pending changes(to a submitted order) or if it's an unsaved new order with items in it.
protected  java.util.Collection createWarningsForItemRemoves(atg.commerce.order.Order pOrder, java.util.Collection pRemoveItems)
          Creates a warning message for each item that in the remove item collection.
protected  java.util.List createWarningsForNewOrder(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Create warnings for the order that will be loaded for the change.
 java.util.List createWarningsForPriceListSwitch(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Generates warnings for a change of price list
 boolean deleteItemsWithoutPrice(atg.commerce.order.Order pOrder)
          Deletes item from the order that cannot be priced by either the current price list or sale price list.
 java.util.Collection findItemsNotInPriceList(java.util.Collection pCommerceItems, atg.repository.RepositoryItem pPriceList)
          Finds the commerce items in the collection that cannot be priced using the provided price list.
 java.util.Collection findItemsWithoutPrice(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pListPriceList, atg.repository.RepositoryItem pSalePriceList)
          Returns commerce items in the order that cannot be priced by the given list price list or sale price list.
 atg.svc.agent.environment.EnvironmentChangeDetail getCatalogDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          returns the catalog EnvironmentChangeDetail if there is one in the state already
 atg.commerce.catalog.CatalogTools getCatalogTools()
           
 atg.web.tree.TreeState getCatalogTreeState()
          Returns the catalog tree state
 CSRAgentTools getCSRAgentTools()
           
 java.lang.String getCSRApplicationName()
           
 CSRScheduledOrderTools getCSRScheduledOrderTools()
          Returns a reference to the CSRScheduledOrderTools component
 atg.repository.RepositoryItem getCurrentCatalog()
          Returns the environment's current catalog.
 atg.commerce.order.Order getCurrentOrder()
          Returns the current order
 atg.commerce.pricing.PricingModelHolder getCurrentOrderPricingModelHolder()
          Returns the correct pricing model holder for the current order based on its state.
 atg.repository.RepositoryItem getCurrentPriceList()
          Returns the environment's current price list.
 atg.repository.RepositoryItem getCurrentSalePriceList()
          Returns the environment's current price list.
 atg.commerce.pricing.PricingModelHolder getCustomerPricingModels()
          Returns the customer pricing models
protected  atg.repository.RepositoryItem getDefaultCatalog()
          Returns the default catalog from configuration.
 atg.svc.agent.environment.EnvironmentTools getEnvironmentTools()
           
static CSREnvironmentTools getInstance()
          Returns the global CSREnvironmentTools component by resolving it from the current request.
 atg.repository.RepositoryItem getListPriceListFromOrder(atg.commerce.order.Order pOrder)
          Returns the list price list from the order.
 java.lang.String getOrderChangeId(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Convenience method for returning the order id of the order that will be loaded as part of the change.
 atg.svc.agent.environment.EnvironmentChangeDetail getOrderDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          returns the order EnvironmentChangeDetail if there is one in the state already
 CSROrderHolder getOrderHolder()
          Returns the current order holder
 atg.commerce.pricing.PricingModelHolder getOrderPricingModelHolder(atg.commerce.order.Order pOrder)
          Returns either the standard customer pricing model holder or the submitted order pricing model holder based on the state of the given order.
 atg.commerce.order.Order getOriginalOrder()
          This method returns the original order if the holder is in clone edit mode.
 atg.commerce.order.Order getOriginalOrder(atg.commerce.order.Order pOrder)
          If the given order is current in the cart and the cart is in clone edit mode, the original order is returned.
 atg.svc.agent.environment.EnvironmentChangeDetail getPriceListDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          returns the price list EnvironmentChangeDetail if there is one in the state already
 atg.repository.RepositoryItem getPriceListFromOrder(atg.commerce.order.Order pOrder)
          Returns the price list from the order.
 atg.commerce.pricing.priceLists.PriceListManager getPriceListManager()
           
 atg.svc.agent.environment.EnvironmentChangeDetail getSalePriceListDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          returns the sale price list EnvironmentChangeDetail if there is one in the state already
 atg.repository.RepositoryItem getSalePriceListFromOrder(atg.commerce.order.Order pOrder)
          Returns the sale price list from the order.
 SubmittedOrderPricingModelHolder getSubmittedOrderPricingModels()
          Returns the pricing model holder used for submitted orders
protected  java.util.Locale getUserLocale()
          This method gets the current Locale
 java.lang.String getUserResource(java.lang.String pKey, java.lang.Object[] pMsgArgs, java.util.Locale pLocale)
          Returns a resource from the user resource bundle
 atg.commerce.order.Order getViewOrder()
          Returns the view current order
 ViewOrderHolder getViewOrderHolder()
          Returns the current view order holder
 void initializeCustomerPricingModels()
          Initializes the customer pricing models
 void initializeDefaultsForProfile(atg.repository.MutableRepositoryItem pProfile)
          Set the default values for a new profile.
 boolean isActiveOrderOwnerChangeble()
          Determines if the active order may have a new owner assigned.
 boolean isActiveOrderUpdatedSinceLoad()
          Returns true if the orders last modification time is greater than the CSROrderHolder's loadTime.
 boolean isCatalogExplicitlySetForCall()
          Determines if the catalog has been explicity set by the agent for the current call.
 boolean isNewOrderDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
          Determines if a EnvironmentChangeDetail exists for a new order change.
protected  boolean isOwnerChangeable(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pNewOwnerProfile)
          Determines if an order may have the new owner assigned.
 boolean isPriceListExplicitlySetForCall()
          Determines if the price list has been explicity set by the agent for the current call.
 boolean isSalePriceListExplicitlySetForCall()
          Determines if the sale price list has been explicity set by the agent for the current call.
 void loadViewOrderAndProfile(atg.commerce.order.Order pOrder)
          Loads the given order into the view order holder and the order's owner into the view profile holder.
 void setCatalogTools(atg.commerce.catalog.CatalogTools pCatalogTools)
          Sets the catalog tools component
 void setCSRAgentTools(CSRAgentTools pCSRAgentTools)
          Sets the property CSRAgentTools.
 void setCSRApplicationName(java.lang.String pCSRApplicationName)
           
 void setCSRScheduledOrderTools(CSRScheduledOrderTools pCSRScheduledOrderTools)
           
 void setCurrentCatalog(atg.repository.RepositoryItem pCatalog)
          Sets the current catalog in global context by issuing an environment change request.
 void setCurrentPriceList(atg.repository.RepositoryItem pPriceList)
          Sets the current price list in global context by issuing an environment change request.
 void setCurrentSalePriceList(atg.repository.RepositoryItem pPriceList)
          Sets the current sale price list in global context by issuing an environment change request.
 void setEnvironmentTools(atg.svc.agent.environment.EnvironmentTools pEnvironmentTools)
          Sets the EnvironmentTools
 void setPriceListManager(atg.commerce.pricing.priceLists.PriceListManager pPriceListManager)
          Sets the Price List Manager
 void setViewOrder(atg.commerce.order.Order pViewOrder)
          Sets the view order as the the current view order in the Environment
 
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


CSR_APP_NAME

public static final java.lang.String CSR_APP_NAME
Commerce Application name

See Also:
Constant Field Values

CSR_ENVIRONMENTTOOLS_PATH

public static final java.lang.String CSR_ENVIRONMENTTOOLS_PATH
The path to the CSREnvironmentTools component

See Also:
Constant Field Values

ORDER_HOLDER_PATH

public static final java.lang.String ORDER_HOLDER_PATH
The path to the environment's order holder component

See Also:
Constant Field Values

VIEW_ORDER_HOLDER_PATH

public static final java.lang.String VIEW_ORDER_HOLDER_PATH
The path to the environment's view order holder component

See Also:
Constant Field Values

PRICING_MODEL_PATH

public static final java.lang.String PRICING_MODEL_PATH
The path to the environment's pricing model component

See Also:
Constant Field Values

SUBMITTED_ORDER_PRICING_MODEL_PATH

public static final java.lang.String SUBMITTED_ORDER_PRICING_MODEL_PATH
The path to the environment's submitted order pricing model component

See Also:
Constant Field Values

CATALOG_TREE_STATE_PATH

public static final java.lang.String CATALOG_TREE_STATE_PATH
The path to the environment's tree state component

See Also:
Constant Field Values

MY_RESOURCES

protected static final java.lang.String MY_RESOURCES
See Also:
Constant Field Values

mCSRApplicationName

protected java.lang.String mCSRApplicationName

mEnvironmentTools

protected atg.svc.agent.environment.EnvironmentTools mEnvironmentTools

mPriceListManager

protected atg.commerce.pricing.priceLists.PriceListManager mPriceListManager

mCatalogTools

protected atg.commerce.catalog.CatalogTools mCatalogTools

mCSRAgentTools

protected CSRAgentTools mCSRAgentTools

mCSRScheduledOrderTools

protected CSRScheduledOrderTools mCSRScheduledOrderTools
Constructor Detail

CSREnvironmentTools

public CSREnvironmentTools()
Method Detail

getUserLocale

protected java.util.Locale getUserLocale()
This method gets the current Locale

Returns:
the current Locale

getInstance

public static CSREnvironmentTools getInstance()
Returns the global CSREnvironmentTools component by resolving it from the current request.

Returns:
CSREnvironmentTools

getCSRApplicationName

public java.lang.String getCSRApplicationName()
Returns:
the name of the CSR application

setCSRApplicationName

public void setCSRApplicationName(java.lang.String pCSRApplicationName)

setEnvironmentTools

public void setEnvironmentTools(atg.svc.agent.environment.EnvironmentTools pEnvironmentTools)
Sets the EnvironmentTools

Parameters:
pEnvironmentTools - the EnvironmentTools in Service

getEnvironmentTools

public atg.svc.agent.environment.EnvironmentTools getEnvironmentTools()
Returns:
the EnvironmentTools in Service

setPriceListManager

public void setPriceListManager(atg.commerce.pricing.priceLists.PriceListManager pPriceListManager)
Sets the Price List Manager

Parameters:
pPriceListManager - the Price List Manager

getPriceListManager

public atg.commerce.pricing.priceLists.PriceListManager getPriceListManager()
Returns:
the Price List Manager

setCatalogTools

public void setCatalogTools(atg.commerce.catalog.CatalogTools pCatalogTools)
Sets the catalog tools component

Parameters:
pCatalogTools - the catalog tools component

getCatalogTools

public atg.commerce.catalog.CatalogTools getCatalogTools()
Returns:
the catalog tools component

setCSRAgentTools

public void setCSRAgentTools(CSRAgentTools pCSRAgentTools)
Sets the property CSRAgentTools.


getCSRAgentTools

public CSRAgentTools getCSRAgentTools()
Returns:
The value of the property CSRAgentTools.

getCSRScheduledOrderTools

public CSRScheduledOrderTools getCSRScheduledOrderTools()
Returns a reference to the CSRScheduledOrderTools component


setCSRScheduledOrderTools

public void setCSRScheduledOrderTools(CSRScheduledOrderTools pCSRScheduledOrderTools)

isActiveOrderUpdatedSinceLoad

public boolean isActiveOrderUpdatedSinceLoad()
Returns true if the orders last modification time is greater than the CSROrderHolder's loadTime.

Returns:
boolean

isNewOrderDetail

public boolean isNewOrderDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
Determines if a EnvironmentChangeDetail exists for a new order change.

Parameters:
pEnvironmentChangeState -
Returns:
boolean

isOwnerChangeable

protected boolean isOwnerChangeable(atg.commerce.order.Order pOrder,
                                    atg.repository.RepositoryItem pNewOwnerProfile)
Determines if an order may have the new owner assigned.

True is returned if the order is incomplete.

Parameters:
pOrder - the order
pNewOwnerProfile - repository item representing the potential new owner of the order. This can be null.
Returns:
boolean indicating if the order may have the new owner assigned to it

isActiveOrderOwnerChangeble

public boolean isActiveOrderOwnerChangeble()
Determines if the active order may have a new owner assigned.

True is returned if the active order is incomplete and return process is not started.

Returns:
boolean indicating if the active order may have a new owner assigned to it

getOrderDetail

public atg.svc.agent.environment.EnvironmentChangeDetail getOrderDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
returns the order EnvironmentChangeDetail if there is one in the state already

Parameters:
pEnvironmentChangeState -
Returns:
EnvironmentChangeDetail

getPriceListDetail

public atg.svc.agent.environment.EnvironmentChangeDetail getPriceListDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
returns the price list EnvironmentChangeDetail if there is one in the state already

Parameters:
pEnvironmentChangeState -
Returns:
EnvironmentChangeDetail

getSalePriceListDetail

public atg.svc.agent.environment.EnvironmentChangeDetail getSalePriceListDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
returns the sale price list EnvironmentChangeDetail if there is one in the state already

Parameters:
pEnvironmentChangeState -
Returns:
EnvironmentChangeDetail

getCatalogDetail

public atg.svc.agent.environment.EnvironmentChangeDetail getCatalogDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
returns the catalog EnvironmentChangeDetail if there is one in the state already

Parameters:
pEnvironmentChangeState -
Returns:
EnvironmentChangeDetail

getOrderChangeId

public java.lang.String getOrderChangeId(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
Convenience method for returning the order id of the order that will be loaded as part of the change.

Returns:
order id of the order that will be loaded as part of the change.

addNewOrderDetail

public void addNewOrderDetail(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                       throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                              atg.svc.agent.environment.EnvironmentException
Adds a change environment detail for a new order.

Parameters:
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangeOrderDetail

public void addChangeOrderDetail(java.lang.String pOrderId,
                                 atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                          throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                 atg.svc.agent.environment.EnvironmentException
Adds a change order detail for loading an existing order.

Parameters:
pOrderId -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangeOrderDetail

public void addChangeOrderDetail(atg.commerce.order.Order pOrder,
                                 atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                          throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                 atg.svc.agent.environment.EnvironmentException
Adds a change order detail for loading an existing order.

Parameters:
pOrder -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangeCatalogDetail

public void addChangeCatalogDetail(java.lang.String pCatalogId,
                                   atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                            throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                   atg.svc.agent.environment.EnvironmentException
Adds a change detail for a change in catalog

Parameters:
pCatalogId -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangePriceListDetail

public void addChangePriceListDetail(java.lang.String pPriceListId,
                                     atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                              throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                     atg.svc.agent.environment.EnvironmentException
Adds a change detail for the price list with the given id.

Parameters:
pPriceListId -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangePriceListDetail

public void addChangePriceListDetail(atg.repository.RepositoryItem pPriceList,
                                     atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                              throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                     atg.svc.agent.environment.EnvironmentException
Adds a change detail for the given price list.

Parameters:
pPriceList -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangeCatalogDetail

protected void addChangeCatalogDetail(atg.repository.RepositoryItem pCatalog,
                                      atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                               throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                      atg.svc.agent.environment.EnvironmentException
Adds a change detail for the given custom catalog.

Parameters:
pCatalog -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangeSalePriceListDetail

public void addChangeSalePriceListDetail(java.lang.String pPriceListId,
                                         atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                                  throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                         atg.svc.agent.environment.EnvironmentException
Adds a change detail for the sale price list with the given id.

Parameters:
pPriceListId -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

addChangeSalePriceListDetail

public void addChangeSalePriceListDetail(atg.repository.RepositoryItem pPriceList,
                                         atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
                                  throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                         atg.svc.agent.environment.EnvironmentException
Adds a change detail for the given sale price list.

Parameters:
pPriceList -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
atg.svc.agent.environment.EnvironmentException

getOrderHolder

public CSROrderHolder getOrderHolder()
Returns the current order holder

Returns:
OrderHolder

getCurrentOrder

public atg.commerce.order.Order getCurrentOrder()
Returns the current order

Returns:
Order

getViewOrderHolder

public ViewOrderHolder getViewOrderHolder()
Returns the current view order holder

Returns:
ViewOrderHolder

getViewOrder

public atg.commerce.order.Order getViewOrder()
Returns the view current order

Returns:
view order

setViewOrder

public void setViewOrder(atg.commerce.order.Order pViewOrder)
                  throws atg.svc.agent.environment.EnvironmentException
Sets the view order as the the current view order in the Environment

Parameters:
pViewOrder -
Throws:
atg.svc.agent.environment.EnvironmentException

getOriginalOrder

public atg.commerce.order.Order getOriginalOrder()
This method returns the original order if the holder is in clone edit mode. Otherwise is returns the current order.

Returns:
the current working order.

getCustomerPricingModels

public atg.commerce.pricing.PricingModelHolder getCustomerPricingModels()
Returns the customer pricing models

Returns:
PricingModelHolder

getSubmittedOrderPricingModels

public SubmittedOrderPricingModelHolder getSubmittedOrderPricingModels()
Returns the pricing model holder used for submitted orders

Returns:
SubmittedOrderPricingModelHolder

getCatalogTreeState

public atg.web.tree.TreeState getCatalogTreeState()
Returns the catalog tree state

Returns:
OrderHolder

getCurrentOrderPricingModelHolder

public atg.commerce.pricing.PricingModelHolder getCurrentOrderPricingModelHolder()
Returns the correct pricing model holder for the current order based on its state.

If the current order is incomplete the standard customer pricing model holder is returned. Otherwise, the submitted order pricing model holder is returned.

Returns:
PricingModelHolder

getOrderPricingModelHolder

public atg.commerce.pricing.PricingModelHolder getOrderPricingModelHolder(atg.commerce.order.Order pOrder)
Returns either the standard customer pricing model holder or the submitted order pricing model holder based on the state of the given order.

Parameters:
pOrder -
Returns:
PricingModelHolder

getCurrentPriceList

public atg.repository.RepositoryItem getCurrentPriceList()
Returns the environment's current price list.

Returns:
the current active price list

setCurrentPriceList

public void setCurrentPriceList(atg.repository.RepositoryItem pPriceList)
Sets the current price list in global context by issuing an environment change request.

Parameters:
pPriceList - the new price list to be set in global context

getCurrentSalePriceList

public atg.repository.RepositoryItem getCurrentSalePriceList()
Returns the environment's current price list.

Returns:
the current active price list

setCurrentSalePriceList

public void setCurrentSalePriceList(atg.repository.RepositoryItem pPriceList)
Sets the current sale price list in global context by issuing an environment change request.

Parameters:
pPriceList - the new sale price list to be set in global context

getDefaultCatalog

protected atg.repository.RepositoryItem getDefaultCatalog()
                                                   throws atg.svc.agent.environment.EnvironmentException
Returns the default catalog from configuration.

Returns:
RepositoryItem
Throws:
atg.svc.agent.environment.EnvironmentException
See Also:
CSRConfigurator.getDefaultCatalogId()

getCurrentCatalog

public atg.repository.RepositoryItem getCurrentCatalog()
Returns the environment's current catalog.

Returns:
the current active catalog


setCurrentCatalog

public void setCurrentCatalog(atg.repository.RepositoryItem pCatalog)
Sets the current catalog in global context by issuing an environment change request.

Parameters:
pCatalog - the new catalog to be set in global context

initializeDefaultsForProfile

public void initializeDefaultsForProfile(atg.repository.MutableRepositoryItem pProfile)
                                  throws atg.svc.agent.environment.EnvironmentException
Set the default values for a new profile.

Sends an initialization jms event to the application can apply their business rules to the process.

The caller is responsible for transaction demarcation and calling updateItem on the profile.

Parameters:
pProfile - the profile item to initialize
Throws:
atg.svc.agent.environment.EnvironmentException

getPriceListFromOrder

public atg.repository.RepositoryItem getPriceListFromOrder(atg.commerce.order.Order pOrder)
Returns the price list from the order.

The price list from the first commerce item in the order is returned.

Parameters:
pOrder -
Returns:
price list item

getListPriceListFromOrder

public atg.repository.RepositoryItem getListPriceListFromOrder(atg.commerce.order.Order pOrder)
Returns the list price list from the order.

The price list is found by looking for a commerce item that is not on sale with a price list associated.

Parameters:
pOrder -
Returns:
price list item
See Also:
PricingTools.getListPriceListFromOrder(Order)

getSalePriceListFromOrder

public atg.repository.RepositoryItem getSalePriceListFromOrder(atg.commerce.order.Order pOrder)
Returns the sale price list from the order.

The price list from the first on sale commerce item in the order is returned. with a price list associated.

Parameters:
pOrder -
Returns:
price list item
See Also:
PricingTools.getSalePriceListFromOrder(Order)

createWarningsForCatalogSwitch

public java.util.List createWarningsForCatalogSwitch(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
Generates warnings for a change of catalog

Returns:
List of string warnings

createWarningsForPriceListSwitch

public java.util.List createWarningsForPriceListSwitch(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
Generates warnings for a change of price list

Returns:
Collection of string warnings

createWarningsForItemRemoves

protected java.util.Collection createWarningsForItemRemoves(atg.commerce.order.Order pOrder,
                                                            java.util.Collection pRemoveItems)
Creates a warning message for each item that in the remove item collection.

Parameters:
pOrder -
pRemoveItems -
Returns:
collecton of warning messages

findItemsNotInPriceList

public java.util.Collection findItemsNotInPriceList(java.util.Collection pCommerceItems,
                                                    atg.repository.RepositoryItem pPriceList)
Finds the commerce items in the collection that cannot be priced using the provided price list.

Parameters:
pCommerceItems -
pPriceList -
Returns:
Collection of commerce items that couldn't be priced using the price list.

findItemsWithoutPrice

public java.util.Collection findItemsWithoutPrice(atg.commerce.order.Order pOrder,
                                                  atg.repository.RepositoryItem pListPriceList,
                                                  atg.repository.RepositoryItem pSalePriceList)
Returns commerce items in the order that cannot be priced by the given list price list or sale price list.

Parameters:
pOrder -
pListPriceList - the list price list
pSalePriceList - Optional sale price list
Returns:
items for which there was no price defined in the given price lists.

deleteItemsWithoutPrice

public boolean deleteItemsWithoutPrice(atg.commerce.order.Order pOrder)
                                throws atg.svc.agent.environment.EnvironmentException
Deletes item from the order that cannot be priced by either the current price list or sale price list.

The caller is responsible for transaction demarcation and calleding updateOrder.

Parameters:
pOrder -
Returns:
true if items were deleted
Throws:
atg.svc.agent.environment.EnvironmentException

createWarningsForChangeOrder

public java.util.List createWarningsForChangeOrder(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
Generates warnings for a change of order

Parameters:
pEnvironmentChangeState -

createWarningsForCurrentOrder

protected java.util.List createWarningsForCurrentOrder()
Adds a warning for the current order if there are pending changes(to a submitted order) or if it's an unsaved new order with items in it.

Returns:
List of warnings

createWarningsForNewOrder

protected java.util.List createWarningsForNewOrder(atg.svc.agent.environment.EnvironmentChangeState pEnvironmentChangeState)
Create warnings for the order that will be loaded for the change.

If price lists are in use and there's no price list changes included, the incoming order is checked to make sure all items in the order can be priced by the current price lists.

Parameters:
pEnvironmentChangeState -
Returns:
warnings

getOriginalOrder

public atg.commerce.order.Order getOriginalOrder(atg.commerce.order.Order pOrder)
If the given order is current in the cart and the cart is in clone edit mode, the original order is returned. Otherwise null.

Parameters:
pOrder -
Returns:
the original order is the given order is the current working clone.

initializeCustomerPricingModels

public void initializeCustomerPricingModels()
                                     throws atg.svc.agent.environment.EnvironmentException
Initializes the customer pricing models

Throws:
atg.svc.agent.environment.EnvironmentException

createNewOrder

public void createNewOrder(java.lang.String pApplicationName)
                    throws atg.svc.agent.environment.EnvironmentException
Creates a new order in the order holder.

Parameters:
pApplicationName - the application creating the new order in the environment
Throws:
atg.svc.agent.environment.EnvironmentException

changeOrder

public void changeOrder(java.lang.String pApplicationName,
                        java.lang.String pOrderId,
                        atg.svc.agent.environment.TicketDispositionOptions pTicketDispositionOptions)
                 throws atg.svc.agent.environment.EnvironmentException
Changes the environment's current order to the given order

Parameters:
pApplicationName -
pOrderId - id of the order to be loaded into the environment.
pTicketDispositionOptions - the options used to modify the disposition the currently active ticket if it needs to change when the order changes. This can be null to use the default handling behavior.
Throws:
atg.svc.agent.environment.EnvironmentException

changeOrder

public void changeOrder(java.lang.String pApplicationName,
                        atg.commerce.order.Order pOrder,
                        atg.svc.agent.environment.TicketDispositionOptions pTicketDispositionOptions)
                 throws atg.svc.agent.environment.EnvironmentException
Changes the environment's current order to the given order

Parameters:
pApplicationName -
pOrder - the order to be loaded into the environment.
pTicketDispositionOptions - the options used to modify the disposition the currently active ticket if it needs to change when the order changes. This can be null to use the default handling behavior.
Throws:
atg.svc.agent.environment.EnvironmentException

isCatalogExplicitlySetForCall

public boolean isCatalogExplicitlySetForCall()
Determines if the catalog has been explicity set by the agent for the current call.

Returns:
true if the catalog has been explicity set by the agent for the current call.

isPriceListExplicitlySetForCall

public boolean isPriceListExplicitlySetForCall()
Determines if the price list has been explicity set by the agent for the current call.

Returns:
true if the price list has been explicity set by the agent for the current call.

isSalePriceListExplicitlySetForCall

public boolean isSalePriceListExplicitlySetForCall()
Determines if the sale price list has been explicity set by the agent for the current call.

Returns:
true if the sale price list has been explicity set by the agent for the current call.

cleanCatalogTreeState

public void cleanCatalogTreeState(atg.web.tree.TreeState treeState)
Nulls properties of catalog navigation tree

Parameters:
treeState - tree state object

changeViewOrder

public void changeViewOrder(java.lang.String pViewOrderId)
                     throws atg.svc.agent.environment.EnvironmentException
This method will change the current view order to the given order. The view profile is also changed to be the order's owner.

Parameters:
pViewOrderId -
Throws:
atg.svc.agent.environment.EnvironmentException

loadViewOrderAndProfile

public void loadViewOrderAndProfile(atg.commerce.order.Order pOrder)
                             throws atg.svc.agent.environment.EnvironmentException
Loads the given order into the view order holder and the order's owner into the view profile holder.

Parameters:
pOrder -
Throws:
atg.svc.agent.environment.EnvironmentException

getUserResource

public java.lang.String getUserResource(java.lang.String pKey,
                                        java.lang.Object[] pMsgArgs,
                                        java.util.Locale pLocale)
Returns a resource from the user resource bundle

Parameters:
pKey -
pMsgArgs - msg arguments
pLocale - the locale
Returns:
String