atg.commerce.order.processor
Class ProcRemoveExpiredCommerceItems

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.logging.ApplicationLoggingImpl
          extended by atg.commerce.order.processor.ProcRemoveExpiredCommerceItems
All Implemented Interfaces:
ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, PipelineProcessor

public class ProcRemoveExpiredCommerceItems
extends ApplicationLoggingImpl
implements PipelineProcessor

This processor is responsible for the removal of CommerceItems whose sku or product have been removed from the database from Orders whose states are specified in the @see OpenOrderStates. This processor works in conjunction with @see ProcSetCatalogRefs and @see ProcSetProductRefs which are responsible for the identification and substitution of the removed product and sku repository items from the commerce item object. If a sku is removed from the database and the order is in one of the states in the above list then the item is automatically removed. If a product is removed from the database then it is removed from the order only if the @see RemoveItemsWithDeletedProducts is set to true and the order state is in the @see OpenOrderStates list.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from interface atg.service.pipeline.PipelineProcessor
STOP_CHAIN_EXECUTION, STOP_CHAIN_EXECUTION_AND_COMMIT, STOP_CHAIN_EXECUTION_AND_ROLLBACK
 
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
ProcRemoveExpiredCommerceItems()
           
 
Method Summary
 java.lang.String getLoggingIdentifier()
          Returns property LoggingIdentifier
 java.lang.String[] getOpenOrderStates()
          A list of order states that determine whether an item can be removed from the order.
 java.lang.String getRemovedProductId()
          Value of the Repository id of the product item representing a removed product item.
 java.lang.String getRemovedSkuId()
          Value of the repository id of the sku item representing a removed sku item from the database.
 int[] getRetCodes()
          Returns the valid return codes 1 - The processor completed
 boolean isRemoveItemsWithDeletedProducts()
          If true then the commerceitem is removed from the order if the product has been removed from the database.
 boolean isTreatNullOrderStateAsModifiable()
          Specify whether orders whose order state is null should be considered modifiable or non-modifiable.
 boolean isWarnOnNullOrderState()
          Query whether to issue a warning if asked to oeprate on an order whose order state is null.
 int runProcess(java.lang.Object pParam, PipelineResult pResult)
          This method runs the actual processor and does the work.
 void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
          Sets property LoggingIdentifier
 void setOpenOrderStates(java.lang.String[] pOpenOrderStates)
           
 void setRemovedProductId(java.lang.String pRemovedProductId)
           
 void setRemovedSkuId(java.lang.String pRemovedSkuId)
           
 void setRemoveItemsWithDeletedProducts(boolean pRemoveItemsWithDeletedProducts)
           
 void setTreatNullOrderStateAsModifiable(boolean pTreatNullOrderStateAsModifiable)
          Specify whether orders whose order state is null should be considered modifiable or non-modifiable.
 void setWarnOnNullOrderState(boolean pWarnOnNullOrderState)
          Specify whether to issue a warning if asked to operate on an order whose order state is null.
 boolean shouldItemBeRemoved(CommerceItem pCommerceItem)
          Determines whether the CommerceItem that is being passed in should be removed based on whether the product or sku have been removed from the database.
 boolean shouldOrderBeModified(Order pOrder)
          This method is used to determine whether the order that is passed in is in a state that allows it to be modified.
 
Methods inherited from class atg.nucleus.logging.ApplicationLoggingImpl
addGlobalLogListeners, addLogListener, getLoggingForVlogging, getLoggingIdentifer, getLogListenerCount, getLogListeners, initializeFromServiceEvent, isAutoInitListeners, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, removeLogListener, sendLogEvent, setAutoInitListeners, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning
 
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

Constructor Detail

ProcRemoveExpiredCommerceItems

public ProcRemoveExpiredCommerceItems()
Method Detail

getRetCodes

public int[] getRetCodes()
Returns the valid return codes 1 - The processor completed

Specified by:
getRetCodes in interface PipelineProcessor
Returns:
an integer array of the valid return codes.

setOpenOrderStates

public void setOpenOrderStates(java.lang.String[] pOpenOrderStates)

getOpenOrderStates

public java.lang.String[] getOpenOrderStates()
A list of order states that determine whether an item can be removed from the order.

Returns:
a list of states

setRemoveItemsWithDeletedProducts

public void setRemoveItemsWithDeletedProducts(boolean pRemoveItemsWithDeletedProducts)

isRemoveItemsWithDeletedProducts

public boolean isRemoveItemsWithDeletedProducts()
If true then the commerceitem is removed from the order if the product has been removed from the database.

Returns:
true if the commerce items with removed products should be removed. (Default: false)

shouldOrderBeModified

public boolean shouldOrderBeModified(Order pOrder)
This method is used to determine whether the order that is passed in is in a state that allows it to be modified. This method uses the @see OpenOrderStates list to validate that the state of the passed order is in this list.

Parameters:
pOrder - - the order whose state is being checked.
Returns:
true if the order is in a state which allows it to be modified

setLoggingIdentifier

public void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
Sets property LoggingIdentifier

Overrides:
setLoggingIdentifier in class ApplicationLoggingImpl

getLoggingIdentifier

public java.lang.String getLoggingIdentifier()
Returns property LoggingIdentifier

Overrides:
getLoggingIdentifier in class ApplicationLoggingImpl

setRemovedSkuId

public void setRemovedSkuId(java.lang.String pRemovedSkuId)

getRemovedSkuId

public java.lang.String getRemovedSkuId()
Value of the repository id of the sku item representing a removed sku item from the database.

Returns:
the skuid representing the sku that has been removed from the database.

setRemovedProductId

public void setRemovedProductId(java.lang.String pRemovedProductId)

getRemovedProductId

public java.lang.String getRemovedProductId()
Value of the Repository id of the product item representing a removed product item.

Returns:
the repository id for the "removed" product

setWarnOnNullOrderState

public void setWarnOnNullOrderState(boolean pWarnOnNullOrderState)
Specify whether to issue a warning if asked to operate on an order whose order state is null. The default value is true, meaning that a warning message will be emitted.


isWarnOnNullOrderState

public boolean isWarnOnNullOrderState()
Query whether to issue a warning if asked to oeprate on an order whose order state is null.


setTreatNullOrderStateAsModifiable

public void setTreatNullOrderStateAsModifiable(boolean pTreatNullOrderStateAsModifiable)
Specify whether orders whose order state is null should be considered modifiable or non-modifiable. The default value is false, meaning that this processor will skip such orders. If your application can create legal orders with their order state set to null, and you want to remove expired items from such orders, set this property to true.


isTreatNullOrderStateAsModifiable

public boolean isTreatNullOrderStateAsModifiable()
Specify whether orders whose order state is null should be considered modifiable or non-modifiable.


shouldItemBeRemoved

public boolean shouldItemBeRemoved(CommerceItem pCommerceItem)
Determines whether the CommerceItem that is being passed in should be removed based on whether the product or sku have been removed from the database. This method uses the @see RemovedProductId and @see RemovedSkuId to determine whether the CommerceItem should be removed. CommerceItems with removed products are only removed from the order if the @see RemoveItemsWithDeletedProducts is set to true.

Parameters:
pCommerceItem - the item whose Product or Sku ids will be checked
Returns:
true if the item should be removed from the order.

runProcess

public int runProcess(java.lang.Object pParam,
                      PipelineResult pResult)
               throws java.lang.Exception
Description copied from interface: PipelineProcessor
This method runs the actual processor and does the work. pParam is user data and pResult is an object which contains result data. The return value of the method is what determines what the next link to be executed is.

Specified by:
runProcess in interface PipelineProcessor
Parameters:
pParam - an optional user parameter
pResult - the PipelineResult object which is used to return errors or other data
Returns:
an integer value which is mapped to the next processor to execute. STOP_CHAIN_EXECUTION will notify the PipelineManager to stop execution. An unmapped value will throw a RunProcessException.
Throws:
java.lang.Exception