List of usage examples for org.apache.commons.scxml2.model ModelException ModelException
public ModelException(final Throwable cause)
From source file:org.onehippo.repository.documentworkflow.action.RequestActionAction.java
@Override @SuppressWarnings("unchecked") protected void doExecute(ActionExecutionContext exctx) throws ModelException, SCXMLExpressionException { String identifier = (StringUtils.isBlank(getIdentifierExpr()) ? null : (String) eval(getIdentifierExpr())); if (StringUtils.isBlank(identifier)) { throw new ModelException("No identifier specified"); }/* ww w . ja va 2 s . c om*/ String action = getAction(); if (StringUtils.isBlank(action)) { throw new ModelException("No action specified"); } String enabledExpr = getEnabledExpr(); Boolean enabled = (StringUtils.isBlank(enabledExpr) ? null : (Boolean) eval(enabledExpr)); SCXMLWorkflowContext workflowContext = getSCXMLWorkflowContext(); Map<String, Map<String, Boolean>> requestsActionsMap = (Map<String, Map<String, Boolean>>) workflowContext .getFeedback().get("requests"); if (requestsActionsMap == null) { requestsActionsMap = new HashMap<>(); workflowContext.getFeedback().put("requests", (Serializable) requestsActionsMap); } Map<String, Boolean> requestActions = requestsActionsMap.get(identifier); if (requestActions == null) { requestActions = new HashMap<>(); requestsActionsMap.put(identifier, requestActions); } if (enabled == null) { requestActions.remove(action); } else { requestActions.put(action, enabled); } }
From source file:org.onehippo.repository.scxml.AbstractAction.java
@Override public final void execute(ActionExecutionContext exctx) throws ModelException, SCXMLExpressionException { try {//from w w w. ja v a 2s . c o m tlExCtx.set(exctx); if (getContext() == null) { tlContext.set(exctx.getContext(getParentEnterableState())); } synchronized (this) { if (!isImmutable()) { goImmutable(); if (parameters == null) { parameters = Collections.emptyMap(); } else { parameters = Collections.unmodifiableMap(parameters); } immutable = true; } } doExecute(exctx); } catch (WorkflowException | RepositoryException e) { throw new ModelException(e); } finally { tlContext.remove(); tlExCtx.remove(); } }
From source file:org.onehippo.repository.scxml.ActionAction.java
@Override protected void doExecute(ActionExecutionContext exctx) throws ModelException, SCXMLExpressionException { String action = getAction();//ww w . ja v a 2s . co m if (StringUtils.isBlank(action)) { throw new ModelException("No action specified"); } String enabledExpr = getEnabledExpr(); Boolean enabled = (StringUtils.isBlank(enabledExpr) ? null : (Boolean) eval(enabledExpr)); if (enabled == null) { getSCXMLWorkflowContext().getActions().remove(action); } else { getSCXMLWorkflowContext().getActions().put(action, enabled); } }
From source file:org.onehippo.repository.scxml.FeedbackAction.java
@Override protected void doExecute(ActionExecutionContext exctx) throws ModelException, SCXMLExpressionException { String key = getKey();/*from w w w . j a v a 2s . co m*/ if (StringUtils.isBlank(key)) { throw new ModelException("No feedback key specified"); } String valueExpr = getValue(); Serializable value = (Serializable) (StringUtils.isBlank(valueExpr) ? null : eval(valueExpr)); if (value == null) { getSCXMLWorkflowContext().getFeedback().remove(key); } else { getSCXMLWorkflowContext().getFeedback().put(key, value); } }
From source file:org.onehippo.repository.scxml.WorkflowExceptionAction.java
@Override protected void doExecute(ActionExecutionContext exctx) throws ModelException, SCXMLExpressionException, WorkflowException { String condExpr = getCond();//from w w w . j a v a 2 s. com if (!StringUtils.isBlank(condExpr) && !((Boolean) eval(condExpr))) { return; } String errorExpr = getErrorExpr(); if (StringUtils.isBlank(errorExpr)) { throw new ModelException("No error specified"); } throw new WorkflowException((String) eval(errorExpr)); }