List of usage examples for org.apache.commons.scxml SCXMLExpressionException getLocalizedMessage
public String getLocalizedMessage()
From source file:de.dfki.iui.mmds.dialogue.SiamEvaluator.java
public boolean unifies(PPattern pattern, String transitionId, String event) { try {//from w ww . java 2s.c o m pattern = resolveJexlExpressions(pattern); } catch (SCXMLExpressionException e1) { Logger.getLogger(getClass()).warn(e1.getLocalizedMessage()); return false; } MatchReport matchReport = Matches .matches(((HashMap<String, ?>) siamStateMachine.getEngine().getRootContext().get("_eventdatamap")) .get(event), pattern); // save variables in cache. they are needed in onTransition if the // tranisition is actually fired if (matchReport.result == MatchResult.MATCH_SUCCESS) { if (!variableCache.containsKey(transitionId)) { variableCache.put(transitionId, matchReport.variables); } else { variableCache.get(transitionId).putAll(matchReport.variables); } return true; } else return false; }
From source file:de.dfki.iui.mmds.dialogue.SiamEvaluator.java
public boolean unifies(Object inst, PPattern pattern, String transitionId) { Context currentContext = siamStateMachine.getCurrentContext(); if (inst instanceof String) { try {//w w w . j a va 2 s .c o m inst = eval(currentContext, (String) inst); } catch (SCXMLExpressionException e) { Logger.getLogger(getClass()).warn(e.getLocalizedMessage()); } } else if (inst instanceof EObject) { List<EObject> res = DialogueComponent.INSTANCE.evaluationService.evaluateContents((EObject) inst, currentContext.getVars()); if (res.isEmpty()) { return false; } inst = res.get(0); } try { pattern = resolveJexlExpressions(pattern); } catch (SCXMLExpressionException e1) { Logger.getLogger(getClass()).warn(e1.getLocalizedMessage()); return false; } MatchReport matchReport = Matches.matches(inst, pattern); if (matchReport.result == MatchResult.MATCH_SUCCESS) { if (!variableCache.containsKey(transitionId)) { variableCache.put(transitionId, matchReport.variables); } else { variableCache.get(transitionId).putAll(matchReport.variables); } return true; } else { return false; } }