public abstract class PayloadProvider extends Action
PayloadProvider is an element in the SCXML document
that can provide payload data for an event or an external process.| Constructor and Description |
|---|
PayloadProvider() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addToPayload(String attrName,
Object attrValue,
Map<String,Object> payload)
Adds an attribute and value to a payload data map.
|
protected Object |
clonePayloadValue(Object value)
Clones a value object for adding to a payload data map.
|
protected Object |
makeEventPayload(Evaluator evaluator,
Map<String,Object> payload)
Converts a payload data map to be used for an event payload.
|
execute, getNamespaces, getNamespacesKey, getParent, getParentEnterableState, getTextContentIfNodeResult, setNamespaces, setParentpublic PayloadProvider()
protected void addToPayload(String attrName, Object attrValue, Map<String,Object> payload)
As the SCXML specification allows for multiple payload attributes with the same name, this method takes care of merging multiple values for the same attribute in a list of values.
Furthermore, as modifications of payload data on either the sender or receiver side should affect the
the other side, attribute values (notably: Node value only for now) is cloned first before being added
to the payload data map. This includes 'nested' values within a NodeList, List or Map.
attrName - the name of the attribute to addattrValue - the value of the attribute to addpayload - the payload data map to be updatedprotected Object clonePayloadValue(Object value)
Currently only clones Node values.
If the value object is an instanceof NodeList, List or Map, its elements
are also cloned (if possible) through recursive invocation of this same method, and put in
a new List or Map before returning.
value - the value to be clonedprotected Object makeEventPayload(Evaluator evaluator, Map<String,Object> payload) throws ModelException
Event payload involving key-value pair attributes for an xpath datamodel requires special handling as the attributes needs to be contained and put in a "data" element under a 'root' Event payload element.
For non-xpath datamodels this method simply returns the original payload parameter unmodified.
evaluator - the evaluator to test for which datamodel type this event payload is intendedpayload - the payload data mapModelExceptionCopyright © 2005–2015 The Apache Software Foundation. All rights reserved.