Hello,
I am trying to create an ad-hoc array in my workflow and provide it to a
custom action:
<state id="fetchCustomerData">
<onentry>
<log expr="'Customer - Fetching data'"/>
<al:fetchTableData select="['col1', 'col2']" />
</onentry>
</state>
In the custom action, I am evaluating this string through JEXL Evaluator:
public void execute(EventDispatcher eventDispatcher, ErrorReporter
errorReporter, SCInstance scInstance, Log log, Collection collection) throws
ModelException, SCXMLExpressionException {
log.info(scInstance.getEvaluator().eval(scInstance.getRootContext(),
this.getSelect()));
}
This throws an error:
WARNING: EXPRESSION_ERROR (eval('['col1', 'col2']'):Encountered "[" at line
1, column 1.
Was expecting one of:
<EOF>
<INTEGER_LITERAL> ...
<FLOAT_LITERAL> ...
"{" ...
"empty" ...
"(" ...
"size" ...
"-" ...
"~" ...
"!" ...
"not" ...
"null" ...
"true" ...
"false" ...
";" ...
"if" ...
"while" ...
"foreach" ...
<IDENTIFIER> ...
<STRING_LITERAL> ...
):
Is creating arrays (or HashMaps, for that matter) even possible like this in
SCXML? I was following the guide at:
http://commons.apache.org/jexl/reference/syntax.html
The executor was created like this:
SCXMLExecutor exec = null;
exec = new SCXMLExecutor(new JexlEvaluator(), new
SimpleDispatcher(), new SimpleErrorReporter());
Context ctx = new JexlContext();
exec.setRootContext(ctx);
exec.setStateMachine(scxml);
exec.setSuperStep(true);
Thank you!