|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.order.processor.ProcDispatchOnOrderState
public class ProcDispatchOnOrderState
Dispatch to the next processor element based on the string value of the order state.
This processor allows you to specify a list of order states and an associated integer return value for each one. If the order being processed through the pipeline is in one of the specified states, the corresponding value is returned. Otherwise, a default value is returned.
For example, a pipeline might branch based on whether an order requires
approval, has been approved, or has been rejected by configuring an instance
of this processor and including it in the pipeline as follows:
<pipelinelink name="DispatchOnOrderState">
<processor jndi="/atg/commerce/order/processor/DispatchOnOrderState"/>
<transition returnvalue="1" link="waitForApproval"/>
<transition returnvalue="2" link="notifyOrderApproved"/>
<transition returnvalue="3" link="notifyOrderRejected"/>
<transition returnvalue="4" link="continueProcessing"/>
</pipelinelink>
The mapping of order states to transition values is set through the
returnValues
property of this pipeline processor, e.g.:
returnValues=\
PENDING_APPROVAL=1,\
APPROVED=2,\
FAILED_APPROVAL=3
defaultReturnValue=4
You can assign the same return value to multiple state values if you want them to follow the same pipeline processor transition.
This processor assumes that the type of the pipeline arguments object is compatible with and may be cast to java.util.Map.
ProcDispatchOnProperty
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
protected static java.util.ResourceBundle |
sDefaultResources
|
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
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 | |
---|---|
ProcDispatchOnOrderState()
|
Method Summary | |
---|---|
protected void |
convertReturnValues(java.util.Properties pReturnValues)
Build the valueMap and retCodes objects from
the values specified in pReturnValues . |
int |
getDefaultReturnValue()
Get the default value to return if the order's state is not found in the lookup table. |
int[] |
getRetCodes()
Get the list of return values this processor can return. |
java.util.Properties |
getReturnValues()
Return the mapping between values of propertyName and
return values from runProcess . |
protected int |
getTransitionValue(java.lang.Object pPropertyValue)
Given a value for the property specified by propertyName ,
find the corresponding return value from returnValues ,
choosing the default value if the property value was not listed in
the lookup table. |
java.util.HashMap |
getValueMap()
Get the mapping from order states to Integer return codes. |
boolean |
isWarnOnDefaultValue()
Query whether or not to log a warning when returning defaultReturnValue for a property value that was
not found in the lookup table. |
int |
runProcess(java.lang.Object pParam,
PipelineResult pResult)
Look up the order in the pipeline arguments map, retrieve its order state as a string, and return a value based on that string. |
void |
setDefaultReturnValue(int pDefaultReturnValue)
Set the default value to return if the order's state is not found in the lookup table. |
void |
setReturnValues(java.util.Properties pReturnValues)
Specify the mapping between string values of the order state and return values from runProcess . |
void |
setWarnOnDefaultValue(boolean pWarnOnDefaultValue)
Specify whether or not to log a warning when returning defaultReturnValue for an order state that was
not found in the lookup table. |
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 |
---|
public static final java.lang.String CLASS_VERSION
protected static java.util.ResourceBundle sDefaultResources
Constructor Detail |
---|
public ProcDispatchOnOrderState()
Method Detail |
---|
public void setReturnValues(java.util.Properties pReturnValues)
runProcess
.
pReturnValues
- A properties object that specifies mappings between order
states and return values. Each value in the properties
object must be parsable as an integer. The
returnValues
object is of type Properties only
to simplify setting the values from a Nucleus configuration
file.public java.util.Properties getReturnValues()
propertyName
and
return values from runProcess
.
public void setDefaultReturnValue(int pDefaultReturnValue)
public int getDefaultReturnValue()
public void setWarnOnDefaultValue(boolean pWarnOnDefaultValue)
defaultReturnValue
for an order state that was
not found in the lookup table.
public boolean isWarnOnDefaultValue()
defaultReturnValue
for a property value that was
not found in the lookup table. The default value is false.
public java.util.HashMap getValueMap()
returnValues
Properties
object and building a parallel structure whose keys are strings, but
whose values are Integers instead of Strings, as in the Properties
object.
public int[] getRetCodes()
returnValues
Properties object and
the defaultReturnValue
and building an array containing
exactly one copy of each value that can be returned.
getRetCodes
in interface PipelineProcessor
public int runProcess(java.lang.Object pParam, PipelineResult pResult) throws java.lang.ClassCastException, InvalidParameterException
runProcess
in interface PipelineProcessor
pParam
- Pipeline arguments object, assumed to be of a type that can be
cast to java.util.MappResult
- Pipeline results object, not used by this method.
java.lang.ClassCastException
- If the type of pParam is not compatible with java.util.Map.
InvalidParameterException
- If the order object is null or is not of type atg.commerce.Order
in the parameter map.protected int getTransitionValue(java.lang.Object pPropertyValue)
propertyName
,
find the corresponding return value from returnValues
,
choosing the default value if the property value was not listed in
the lookup table.
pPropertyValue
- The value upon which to dispatch to the next pipeline processor.protected void convertReturnValues(java.util.Properties pReturnValues)
valueMap
and retCodes
objects from
the values specified in pReturnValues
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |