commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dario D <darac1...@gmail.com>
Subject [scxml] Creating ad-hoc arrays in JEXL expressions
Date Mon, 09 May 2011 20:19:01 GMT
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!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message