Example usage for org.apache.commons.scxml.model Transition getActions

List of usage examples for org.apache.commons.scxml.model Transition getActions

Introduction

In this page you can find the example usage for org.apache.commons.scxml.model Transition getActions.

Prototype

public final List<Action> getActions() 

Source Link

Document

Get the executable actions contained in this Executable.

Usage

From source file:de.dfki.iui.mmds.dialogue.ScxmlLogger.java

@Override
public void onTransition(TransitionTarget from, TransitionTarget to, Transition transition) {
    Log log = (Log) transition.getActions().get(0);
    logger.debug(String.format("TRANS %s: %s --> %s", log.getLabel(), from.getId(), to.getId()));
}

From source file:de.dfki.iui.mmds.dialogue.SiamEvaluator.java

@Override
public void onTransition(TransitionTarget from, TransitionTarget to, Transition transition) {
    // save variables of firing transition to context that were filled
    // during transition pattern matching process
    Context currentContext = siamStateMachine.getCurrentContext();
    Log log = (Log) transition.getActions().get(0);
    String transitionId = log.getLabel();
    if (variableCache.containsKey(transitionId)) {
        Map<String, Object> variables = variableCache.get(transitionId);
        // set context variables
        for (String key : variables.keySet()) {
            Variable variable = (Variable) currentContext.get("_variable$" + key);
            if (variable == null) {
                Logger.getLogger(this.getClass())
                        .warn(String.format(
                                "In transition \'%s': Variable \"%s\" is not defined for scope of state \"%s\"",
                                transitionId, key, currentContext.get("stateID")));
            } else {
                try {
                    currentContext.set(key, variables.get(key));
                } catch (IllegalArgumentException ex) {
                    Logger.getLogger(getClass()).warn(
                            String.format("In transition \'%s': %s", transitionId, ex.getLocalizedMessage()));
                }//from   w w w .  j a  v  a  2 s . c om
            }

        }
    }
    variableCache.remove(transitionId);
}

From source file:de.dfki.iui.mmds.application.ScxmlDebugGui.java

@Override
public void onTransition(TransitionTarget from, TransitionTarget to, Transition transition) {
    Log log = (Log) transition.getActions().get(0);
    append("TRANS ", log.getLabel() + ": " + from.getId() + " --> " + to.getId(), "");
}