Example usage for org.apache.commons.scxml.model Log getLabel

List of usage examples for org.apache.commons.scxml.model Log getLabel

Introduction

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

Prototype

public final String getLabel() 

Source Link

Document

Get the log label.

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()));
                }// ww  w . ja  va  2 s  . c  o  m
            }

        }
    }
    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(), "");
}