atg.commerce.csr.order
Class OrderComponentIsModifiable

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.commerce.csr.order.OrderComponentIsModifiable
All Implemented Interfaces:
atg.naming.AbsoluteNameable, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameContextParentable, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.Configured, 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, atg.servlet.ParameterServlet, java.util.EventListener, javax.servlet.Servlet
Direct Known Subclasses:
OrderIsCancelable, OrderIsModifiable, OrderIsReturnable

public class OrderComponentIsModifiable
extends atg.servlet.DynamoServlet

This is a superclass for droplets: PaymentGroupIsModifiable, ShippingGroupIsModifiable, etc. You can use an instance of this droplet to do the same operations as the droplets mentioned above, however, you would not have to pass in the type, and do type comparisons.

This droplet qualifies whether the given order component is in an "editable" state, e.g. the credit card could only be modified if it hasn't been charged yet, etc.

Example Usage:

 <droplet bean="OrderComponentIsModifiable">
      <param name="id" value="param:Group.id">
      <param name="type" value="shippingGroup">
      <oparam name="true">
        <a href="edit_shipping_group.jhtml">
          <param name="id" value="param:Group.id">
          Edit this shipping group
        </a>
       </oparam>
       <oparam name="false">
          You may no longer edit this shipping group
       </oparam>
       <oparam name="error">
          Oh oh... A better error message?
       </oparam>
 </droplet>
 

(you can set order bean of the droplet in the "order" input parameter, or in the .properties file)

See Also:
OrderIsCancelable, OrderIsModifiable, OrderIsReturnable

Field Summary
static java.lang.String CLASS_VERSION
           
protected static java.lang.String COMMERCE_ITEM_TYPE
           
static atg.nucleus.naming.ParameterName ERROR
           
static atg.nucleus.naming.ParameterName FALSE
           
static atg.nucleus.naming.ParameterName ID
           
static atg.nucleus.naming.ParameterName LOCALE_PARAM
           
protected static java.lang.String MSG_NO_GROUP_ID
           
protected static java.lang.String MSG_NO_ORDER
           
protected static java.lang.String MSG_UNKNOWN_TYPE
           
static atg.nucleus.naming.ParameterName ORDER
           
static atg.nucleus.naming.ParameterName ORDER_ITEM
           
protected static java.lang.String ORDER_TYPE
           
protected static java.lang.String PAYMENT_GROUP_TYPE
           
protected static java.lang.String SHIPPING_GROUP_TYPE
           
static atg.nucleus.naming.ParameterName TRUE
           
static atg.nucleus.naming.ParameterName TYPE
           
 
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
 
Fields inherited from class atg.nucleus.servlet.ServletService
SERVLET_INFO_KEY
 
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
OrderComponentIsModifiable()
           
 
Method Summary
protected  boolean commerceItemIsModifiable(atg.commerce.order.CommerceItem pCommerceItem)
          This method determines whether the given commerce item is in a modifiable state
 java.lang.String getComponentId()
           
 java.lang.String getComponentType()
           
 java.util.Locale getDefaultLocale()
           
 java.lang.String[] getNonModifiableOrderStates()
           
 java.lang.String[] getNonModifiablePaymentGroupStates()
           
 java.lang.String[] getNonModifiableShipItemRelationshipStates()
           
 java.lang.String[] getNonModifiableShippingGroupStates()
           
 atg.commerce.order.Order getOrder()
           
 java.util.Locale getUserLocale(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 boolean isUseRequestLocale()
           
protected  boolean orderIsModifiable(atg.commerce.order.Order pOrder)
          Given an order, this method determines whether the order is in a modifiable state
protected  boolean paymentGroupIsModifiable(atg.commerce.order.PaymentGroup pPaymentGroup)
          This method determines whether the given payment group is in a modifiable state
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Determines if the given order component is modifiable.
 void setComponentId(java.lang.String pComponentId)
          Sets the identifier of the component in question
 void setComponentType(java.lang.String pComponentType)
          Sets The type of the component in question (CommerceItem, ShippingGroup, PaymentGroup, or Order)
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets the default locale
 void setNonModifiableOrderStates(java.lang.String[] pNonModifiableOrderStates)
          Sets array of order states that indicate that an order is not modifiable
 void setNonModifiablePaymentGroupStates(java.lang.String[] pNonModifiablePaymentGroupStates)
          Sets array of payment group states that indicate that a payment group is not modifiable
 void setNonModifiableShipItemRelationshipStates(java.lang.String[] pNonModifiableShipItemRelationshipStates)
          Sets array of ShippingGroupCommerceItem relationship states that indicate that a commerce item is not modifiable
 void setNonModifiableShippingGroupStates(java.lang.String[] pNonModifiableShippingGroupStates)
          Sets array of shipping group states that indicate that a shipping group is not modifiable
 void setOrder(atg.commerce.order.Order pOrder)
          Sets The order whose component is in question
 void setUseRequestLocale(boolean pUseRequestLocale)
          Sets boolean indicating if the request locale should be used when finding resourced error messages.
protected  boolean shippingGroupIsModifiable(atg.commerce.order.ShippingGroup pShippingGroup)
          This method determines whether the given shipping group is in a modifiable state
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, init, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
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

ID

public static final atg.nucleus.naming.ParameterName ID

TYPE

public static final atg.nucleus.naming.ParameterName TYPE

ORDER

public static final atg.nucleus.naming.ParameterName ORDER

ORDER_ITEM

public static final atg.nucleus.naming.ParameterName ORDER_ITEM

LOCALE_PARAM

public static final atg.nucleus.naming.ParameterName LOCALE_PARAM

TRUE

public static final atg.nucleus.naming.ParameterName TRUE

FALSE

public static final atg.nucleus.naming.ParameterName FALSE

ERROR

public static final atg.nucleus.naming.ParameterName ERROR

MSG_NO_ORDER

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

MSG_NO_GROUP_ID

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

MSG_UNKNOWN_TYPE

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

SHIPPING_GROUP_TYPE

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

PAYMENT_GROUP_TYPE

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

COMMERCE_ITEM_TYPE

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

ORDER_TYPE

protected static final java.lang.String ORDER_TYPE
See Also:
Constant Field Values
Constructor Detail

OrderComponentIsModifiable

public OrderComponentIsModifiable()
Method Detail

setComponentId

public void setComponentId(java.lang.String pComponentId)
Sets the identifier of the component in question

Parameters:
pComponentId - the identifier of the component in question

getComponentId

public java.lang.String getComponentId()
Returns:
the identifier of the component in question

setComponentType

public void setComponentType(java.lang.String pComponentType)
Sets The type of the component in question (CommerceItem, ShippingGroup, PaymentGroup, or Order)

Parameters:
pComponentType - the type of the component in question (CommerceItem, ShippingGroup, PaymentGroup, or Order)

getComponentType

public java.lang.String getComponentType()
Returns:
The type of the component in question (CommerceItem, ShippingGroup, PaymentGroup, or Order)

setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets the default locale

Parameters:
pDefaultLocale - the default locale

getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns:
the default locale. If the property value is null, then JVM's default locale is returned.

setNonModifiableOrderStates

public void setNonModifiableOrderStates(java.lang.String[] pNonModifiableOrderStates)
Sets array of order states that indicate that an order is not modifiable

Parameters:
pNonModifiableOrderStates - an array of order statesthat indicate that an order is not modifiable

getNonModifiableOrderStates

public java.lang.String[] getNonModifiableOrderStates()
Returns:
array of order states that indicate that an order is not modifiable

setNonModifiablePaymentGroupStates

public void setNonModifiablePaymentGroupStates(java.lang.String[] pNonModifiablePaymentGroupStates)
Sets array of payment group states that indicate that a payment group is not modifiable

Parameters:
pNonModifiablePaymentGroupStates - an array of payment group states that indicate that a payment group is not modifiable

getNonModifiablePaymentGroupStates

public java.lang.String[] getNonModifiablePaymentGroupStates()
Returns:
array of payment group states that indicate that a payment group is not modifiable

setNonModifiableShipItemRelationshipStates

public void setNonModifiableShipItemRelationshipStates(java.lang.String[] pNonModifiableShipItemRelationshipStates)
Sets array of ShippingGroupCommerceItem relationship states that indicate that a commerce item is not modifiable

Parameters:
pNonModifiableShipItemRelationshipStates - an array of ShippingGroupCommerceItem relationship states that indicate that a commerce item is not modifiable

getNonModifiableShipItemRelationshipStates

public java.lang.String[] getNonModifiableShipItemRelationshipStates()
Returns:
an array of ShippingGroupCommerceItem relationship states that indicate that a commerce item is not modifiable

setNonModifiableShippingGroupStates

public void setNonModifiableShippingGroupStates(java.lang.String[] pNonModifiableShippingGroupStates)
Sets array of shipping group states that indicate that a shipping group is not modifiable

Parameters:
pNonModifiableShippingGroupStates - an array of shipping group states that indicate that a shipping group is not modifiable

getNonModifiableShippingGroupStates

public java.lang.String[] getNonModifiableShippingGroupStates()
Returns:
an array of shipping group states that indicate that a shipping group is not modifiable

setOrder

public void setOrder(atg.commerce.order.Order pOrder)
Sets The order whose component is in question

Parameters:
pOrder - the order whose component is in question

getOrder

public atg.commerce.order.Order getOrder()
Returns:
The order whose component is in question

setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
Sets boolean indicating if the request locale should be used when finding resourced error messages.

Parameters:
pUseRequestLocale - boolean that determines whether to use the request locale when finding resourced error messages.

isUseRequestLocale

public boolean isUseRequestLocale()
Returns:
boolean indicating if the request locale should be used when finding resourced error messages.

commerceItemIsModifiable

protected boolean commerceItemIsModifiable(atg.commerce.order.CommerceItem pCommerceItem)
                                    throws atg.commerce.CommerceException
This method determines whether the given commerce item is in a modifiable state

Parameters:
pCommerceItem - the commerce item
Returns:
whether the commerce item is modifiable
Throws:
CommerceException, - if the commerce item is null
atg.commerce.CommerceException

getUserLocale

public java.util.Locale getUserLocale(atg.servlet.DynamoHttpServletRequest pRequest,
                                      atg.servlet.DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Returns the locale associated with the request. The method first searches for a request paramater named locale. This value can be either a java.util.Locale object or a String which represents the locale. Next if the useRequestLocale property is true, then the locale of the request will be returned. Finally, if the locale cannot be determined, the the defaultLocale property is used.

Throws:
javax.servlet.ServletException
java.io.IOException

orderIsModifiable

protected boolean orderIsModifiable(atg.commerce.order.Order pOrder)
                             throws atg.commerce.CommerceException
Given an order, this method determines whether the order is in a modifiable state

Parameters:
pOrder - the order
Returns:
whether the order is modifiable
Throws:
CommerceException, - if the order is null
atg.commerce.CommerceException

paymentGroupIsModifiable

protected boolean paymentGroupIsModifiable(atg.commerce.order.PaymentGroup pPaymentGroup)
                                    throws atg.commerce.CommerceException
This method determines whether the given payment group is in a modifiable state

Parameters:
pPaymentGroup - the payment group
Returns:
whether the payment group is modifiable
Throws:
CommerceException, - if the payment group is null
atg.commerce.CommerceException

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Determines if the given order component is modifiable. Renders the appropriate open parameters.

Overrides:
service in class atg.servlet.DynamoServlet
Parameters:
pRequest - the HTTP request
pResponse - the HTTP response
Throws:
javax.servlet.ServletException
java.io.IOException

shippingGroupIsModifiable

protected boolean shippingGroupIsModifiable(atg.commerce.order.ShippingGroup pShippingGroup)
                                     throws atg.commerce.CommerceException
This method determines whether the given shipping group is in a modifiable state

Parameters:
pShippingGroup - the shipping group
Returns:
whether the shipping group is modifiable
Throws:
CommerceException, - if the shipping group is null
atg.commerce.CommerceException