atg.commerce.csr.approvals.order
Class OrderApprovalTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.csr.approvals.order.OrderApprovalTools
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 OrderApprovalTools
extends atg.nucleus.GenericService

This class provides some helper methods and defines common properties for working with order approvals


Field Summary
static double APPROVAL_NOT_NEEDED
          Approval limit to return when an approval is not needed
static java.lang.String CLASS_VERSION
           
static java.lang.String CSC_BYPASS_APPROVAL_CHECK_PARAM
          The extra parameter name used to bypass approval checking in the submit order pipeline.
protected  java.lang.String mAppeasementTotalPropertyName
           
protected  ApprovalsManager mApprovalsManager
           
protected  CSRAgentTools mCSRAgentTools
           
protected  java.lang.String mCustomerEmailPropertyName
           
protected  java.lang.String mOrderApprovalItemDescriptorName
           
protected  java.lang.String mOrderIdPropertyName
           
protected  java.lang.String mOrderTotalPropertyName
           
 
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
OrderApprovalTools()
           
 
Method Summary
 java.util.Map addBypassOrderApprovalCheckParameter(java.util.Map pExtraParameters)
          Adds the parameter that will cause the processOrder pipeline to skip checking for approval for the order.
 Approval createOrderApproval(atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pAgentProfile, atg.repository.RepositoryItem pTicket, java.lang.String pSiteId, java.util.Map pExtraParameters)
          Creates an Approval object for the given Order that can be passed to the ApprovalManager to determine if approval is required.
 atg.repository.RepositoryItem findApprovalForOrder(java.lang.String pOrderId)
          Returns an Approval Repository Item.
 double getAgentAppeasementLimit(Approval pApproval)
          Gets the agent appeasement limit.
 java.lang.String getAppeasementTotalPropertyName()
           
 ApprovalsManager getApprovalsManager()
          Returns a reference to the ApprovalsManager used to manage order approvals.
 CSRAgentTools getCSRAgentTools()
           
 java.lang.String getCustomerEmailPropertyName()
           
 java.lang.String getOrderApprovalItemDescriptorName()
          Returns the repository item type for an order approval
 java.lang.String getOrderIdPropertyName()
          Returns the name of the property used to store the order id on the order approval item
 java.lang.String getOrderTotalPropertyName()
           
 void removeApprovalForOrder(java.lang.String pOrderId)
          Removes the order approval item that references the given order id.
 void setAppeasementTotalPropertyName(java.lang.String pAppeasementTotalPropertyName)
           
 void setApprovalsManager(ApprovalsManager mApprovalsManager)
           
 void setCSRAgentTools(CSRAgentTools pCSRAgentTools)
           
 void setCustomerEmailPropertyName(java.lang.String pCustomerEmailPropertyName)
           
 void setOrderApprovalItemDescriptorName(java.lang.String pOrderApprovalItemDescriptorName)
           
 void setOrderIdPropertyName(java.lang.String pOrderIdPropertyName)
           
 void setOrderTotalPropertyName(java.lang.String pOrderTotalPropertyName)
           
 void updateCustomerEmailOnOrderApproval(java.lang.String pApprovalId, java.lang.String pEmail)
          Updates the customer email for the given approval id
 
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 final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

CSC_BYPASS_APPROVAL_CHECK_PARAM

public static final java.lang.String CSC_BYPASS_APPROVAL_CHECK_PARAM
The extra parameter name used to bypass approval checking in the submit order pipeline.

See Also:
Constant Field Values

APPROVAL_NOT_NEEDED

public static final double APPROVAL_NOT_NEEDED
Approval limit to return when an approval is not needed

See Also:
Constant Field Values

mApprovalsManager

protected ApprovalsManager mApprovalsManager

mOrderApprovalItemDescriptorName

protected java.lang.String mOrderApprovalItemDescriptorName

mOrderIdPropertyName

protected java.lang.String mOrderIdPropertyName

mCustomerEmailPropertyName

protected java.lang.String mCustomerEmailPropertyName

mAppeasementTotalPropertyName

protected java.lang.String mAppeasementTotalPropertyName

mOrderTotalPropertyName

protected java.lang.String mOrderTotalPropertyName

mCSRAgentTools

protected CSRAgentTools mCSRAgentTools
Constructor Detail

OrderApprovalTools

public OrderApprovalTools()
Method Detail

setApprovalsManager

public void setApprovalsManager(ApprovalsManager mApprovalsManager)
Parameters:
mApprovalsManager - the mApprovalsManager to set

getApprovalsManager

public ApprovalsManager getApprovalsManager()
Returns a reference to the ApprovalsManager used to manage order approvals.


getOrderApprovalItemDescriptorName

public java.lang.String getOrderApprovalItemDescriptorName()
Returns the repository item type for an order approval


setOrderApprovalItemDescriptorName

public void setOrderApprovalItemDescriptorName(java.lang.String pOrderApprovalItemDescriptorName)

setOrderIdPropertyName

public void setOrderIdPropertyName(java.lang.String pOrderIdPropertyName)
Parameters:
mOrderIdPropertyName - the mOrderIdPropertyName to set

getOrderIdPropertyName

public java.lang.String getOrderIdPropertyName()
Returns the name of the property used to store the order id on the order approval item


setCustomerEmailPropertyName

public void setCustomerEmailPropertyName(java.lang.String pCustomerEmailPropertyName)
Parameters:
pCustomerEmailPropertyName - the CustomerEmailPropertyName to set

getCustomerEmailPropertyName

public java.lang.String getCustomerEmailPropertyName()
Returns:
the mCustomerEmailPropertyName

setAppeasementTotalPropertyName

public void setAppeasementTotalPropertyName(java.lang.String pAppeasementTotalPropertyName)
Parameters:
pAppeasementTotalPropertyName - the AppeasementTotalPropertyName to set

getAppeasementTotalPropertyName

public java.lang.String getAppeasementTotalPropertyName()
Returns:
the mAppeasementTotalPropertyName

setOrderTotalPropertyName

public void setOrderTotalPropertyName(java.lang.String pOrderTotalPropertyName)
Parameters:
pOrderTotalPropertyName - the OrderTotalPropertyName to set

getOrderTotalPropertyName

public java.lang.String getOrderTotalPropertyName()
Returns:
the mOrderTotalPropertyName

setCSRAgentTools

public void setCSRAgentTools(CSRAgentTools pCSRAgentTools)
Parameters:
mCSRAgentTools - the mCSRAgentTools to set

getCSRAgentTools

public CSRAgentTools getCSRAgentTools()
Returns:
the mCSRAgentTools

findApprovalForOrder

public atg.repository.RepositoryItem findApprovalForOrder(java.lang.String pOrderId)
                                                   throws ApprovalsException
Returns an Approval Repository Item. This will be the first RepositoryItem in the result set. If more than 1 are found, an exception is thrown, and if none are found, null is returned.

Parameters:
pOrderId -
Returns:
an Approval RepositoryItem.
Throws:
ApprovalsException

removeApprovalForOrder

public void removeApprovalForOrder(java.lang.String pOrderId)
                            throws ApprovalsException
Removes the order approval item that references the given order id.

Parameters:
pOrderId -
Throws:
ApprovalsException

addBypassOrderApprovalCheckParameter

public java.util.Map addBypassOrderApprovalCheckParameter(java.util.Map pExtraParameters)
Adds the parameter that will cause the processOrder pipeline to skip checking for approval for the order.

Parameters:
pExtraParameters -
Returns:
map with parameter added.
See Also:
CSC_BYPASS_APPROVAL_CHECK_PARAM

createOrderApproval

public Approval createOrderApproval(atg.commerce.order.Order pOrder,
                                    atg.repository.RepositoryItem pAgentProfile,
                                    atg.repository.RepositoryItem pTicket,
                                    java.lang.String pSiteId,
                                    java.util.Map pExtraParameters)
                             throws ApprovalsException
Creates an Approval object for the given Order that can be passed to the ApprovalManager to determine if approval is required.

Parameters:
pOrder -
pAgentProfile -
pTicket -
pSiteId -
pExtraParameters -
Returns:
Approval object
Throws:
ApprovalsException

updateCustomerEmailOnOrderApproval

public void updateCustomerEmailOnOrderApproval(java.lang.String pApprovalId,
                                               java.lang.String pEmail)
                                        throws ApprovalsException
Updates the customer email for the given approval id

Parameters:
pApprovalId -
pEmail -
Throws:
ApprovalsException

getAgentAppeasementLimit

public double getAgentAppeasementLimit(Approval pApproval)
                                throws ApprovalsException
Gets the agent appeasement limit. If the agent has a limit for this currency, then use that. If not use the default limit from the CSR Configurator. If an agent does not need approval, -1 is returned.

Parameters:
pApproval -
Returns:
Double resprenting the agent's appeasement limit, or -1 meaning an agent does not need approval
Throws:
ApprovalsException