public static Object evaluate(String expression, ExecutionContext executionContext, VariableResolver variableResolver, FunctionMapper functionMapper) { return evaluate(expression, executionContext, Object.class, variableResolver, functionMapper); }
public static Object evaluate(String expression, ExecutionContext executionContext, VariableResolver variableResolver, FunctionMapper functionMapper) { return evaluate(expression, executionContext, Object.class, variableResolver, functionMapper); }
public static Object evaluate(String expression, ExecutionContext executionContext) { return evaluate(expression, executionContext, Object.class); }
public static Object evaluate(String expression, ExecutionContext executionContext) { return evaluate(expression, executionContext, Object.class); }
private boolean evaluateTaskCondition(String condition, ExecutionContext executionContext) { if (condition == null) return true; Boolean result = (Boolean) JbpmExpressionEvaluator .evaluate(condition, executionContext, Boolean.class); return Boolean.TRUE.equals(result); }
private boolean evaluateTaskCondition(String condition, ExecutionContext executionContext) { if (condition == null) return true; Boolean result = (Boolean) JbpmExpressionEvaluator .evaluate(condition, executionContext, Boolean.class); return Boolean.TRUE.equals(result); }
public static Object evaluate(String expression, ExecutionContext executionContext, Class expectedType) { return evaluate(expression, executionContext, expectedType, getVariableResolver(), getFunctionMapper()); }
private void performAssignmentActorIdExpr(String actorIdExpression, Assignable assignable, ExecutionContext executionContext) { String actorId = (String) JbpmExpressionEvaluator .evaluate(actorIdExpression, executionContext, String.class); if (actorId == null) { throw new JbpmException(actorIdExpression + " returned null"); } assignable.setActorId(actorId); }
private void performAssignmentActorIdExpr(String actorIdExpression, Assignable assignable, ExecutionContext executionContext) { String actorId = (String) JbpmExpressionEvaluator .evaluate(actorIdExpression, executionContext, String.class); if (actorId == null) { throw new JbpmException(actorIdExpression + " returned null"); } assignable.setActorId(actorId); }
public static Object evaluate(String expression, ExecutionContext executionContext, Class expectedType) { return evaluate(expression, executionContext, expectedType, getVariableResolver(), getFunctionMapper()); }
private void performAssignmentPooledActorsExpr(String pooledActorsExpression, Assignable assignable, ExecutionContext executionContext) { Object result = JbpmExpressionEvaluator.evaluate(pooledActorsExpression, executionContext); String[] pooledActors; if (result instanceof String) { String csv = (String) result; pooledActors = csv.split(","); for (int i = 0; i < pooledActors.length; i++) { pooledActors[i] = pooledActors[i].trim(); } } else if (result instanceof String[]) { pooledActors = (String[]) result; } else if (result instanceof Collection) { Collection collection = (Collection) result; pooledActors = (String[]) collection.toArray(new String[collection.size()]); } else { throw new JbpmException(pooledActorsExpression + " returned " + result + " instead of comma-separated string, collection or string array"); } assignable.setPooledActors(pooledActors); }
private void performAssignmentPooledActorsExpr(String pooledActorsExpression, Assignable assignable, ExecutionContext executionContext) { Object result = JbpmExpressionEvaluator.evaluate(pooledActorsExpression, executionContext); String[] pooledActors; if (result instanceof String) { String csv = (String) result; pooledActors = csv.split(","); for (int i = 0; i < pooledActors.length; i++) { pooledActors[i] = pooledActors[i].trim(); } } else if (result instanceof String[]) { pooledActors = (String[]) result; } else if (result instanceof Collection) { Collection collection = (Collection) result; pooledActors = (String[]) collection.toArray(new String[collection.size()]); } else { throw new JbpmException(pooledActorsExpression + " returned " + result + " instead of comma-separated string, collection or string array"); } assignable.setPooledActors(pooledActors); }
/** * Method added to assist in a refactoring. * Implementation had been failing when a Boolean was returned from * JbpmExpressionEvaluator.evaluate(). (Boolean couldn't be cast to String) */ private Transition evaluateDecisionExpression(ExecutionContext executionContext) { String transitionName = null; // evaluate expression try { transitionName = (String) JbpmExpressionEvaluator.evaluate(decisionExpression, executionContext, String.class); } catch (ClassCastException cce) { log.warn("Unexpected type found when using ExpressionEvaluator attempting a cast"); try { Boolean booleanTransition = (Boolean) JbpmExpressionEvaluator.evaluate(decisionExpression, executionContext, String.class); transitionName = booleanTransition.toString(); } catch(Exception e) { throw new JbpmException("Condition returned an object of unknown type when determining transition."); } } Transition transition = getLeavingTransition(transitionName); if (transition == null) { throw new JbpmException("no such transition: " + transitionName); } return transition; }
/** * adds available transitions of that node to the Set and after that calls itself recursively * for the SuperSate of the Node if it has a super state */ private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions) { List leavingTransitions = currentNode.getLeavingTransitions(); if (leavingTransitions != null) { for (Iterator iter = leavingTransitions.iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); String conditionExpression = transition.getCondition(); if (conditionExpression != null) { Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(this), Boolean.class); if (Boolean.TRUE.equals(result)) { availableTransitions.add(transition); } } else { availableTransitions.add(transition); } } } if (currentNode.getSuperState() != null) { addAvailableTransitionsOfNode(currentNode.getSuperState(), availableTransitions); } }
public void execute(ExecutionContext executionContext) throws Exception { Thread currentThread = Thread.currentThread(); ClassLoader contextClassLoader = currentThread.getContextClassLoader(); try { // set context class loader correctly for delegation class // (https://jira.jboss.org/jira/browse/JBPM-1448) ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(executionContext.getProcessDefinition()); currentThread.setContextClassLoader(processClassLoader); if (referencedAction != null) { referencedAction.execute(executionContext); } else if (actionExpression != null) { JbpmExpressionEvaluator.evaluate(actionExpression, executionContext); } else if (actionDelegation != null) { ActionHandler actionHandler = (ActionHandler) actionDelegation.getInstance(); actionHandler.execute(executionContext); } } finally { currentThread.setContextClassLoader(contextClassLoader); } }
/** * adds available transitions of that node to the Set and after that calls itself recursively * for the SuperSate of the Node if it has a super state */ private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions) { List leavingTransitions = currentNode.getLeavingTransitions(); if (leavingTransitions != null) { for (Iterator iter = leavingTransitions.iterator(); iter.hasNext();) { Transition transition = (Transition) iter.next(); String conditionExpression = transition.getCondition(); if (conditionExpression != null) { Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(this), Boolean.class); if (Boolean.TRUE.equals(result)) { availableTransitions.add(transition); } } else { availableTransitions.add(transition); } } } if (currentNode.getSuperState() != null) { addAvailableTransitionsOfNode(currentNode.getSuperState(), availableTransitions); } }
public void execute(ExecutionContext executionContext) throws Exception { Thread currentThread = Thread.currentThread(); ClassLoader contextClassLoader = currentThread.getContextClassLoader(); try { // set context class loader correctly for delegation class // (https://jira.jboss.org/jira/browse/JBPM-1448) ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(executionContext.getProcessDefinition()); currentThread.setContextClassLoader(processClassLoader); if (referencedAction != null) { referencedAction.execute(executionContext); } else if (actionExpression != null) { JbpmExpressionEvaluator.evaluate(actionExpression, executionContext); } else if (actionDelegation != null) { ActionHandler actionHandler = (ActionHandler) actionDelegation.getInstance(); actionHandler.execute(executionContext); } } finally { currentThread.setContextClassLoader(contextClassLoader); } }
private Object evaluate(String expression, Class expectedType) { VariableResolver variableResolver = new MailVariableResolver(MailTemplates.getTemplateVariables(), JbpmExpressionEvaluator.getVariableResolver()); return JbpmExpressionEvaluator.evaluate(expression, executionContext, expectedType, variableResolver, JbpmExpressionEvaluator.getFunctionMapper()); }
private Object evaluate(String expression, Class expectedType) { VariableResolver variableResolver = new MailVariableResolver(getTemplateVariables(), JbpmExpressionEvaluator.getVariableResolver()); return JbpmExpressionEvaluator.evaluate(expression, executionContext, expectedType, variableResolver, JbpmExpressionEvaluator.getFunctionMapper()); }
Boolean result = (Boolean) JbpmExpressionEvaluator.evaluate(condition, executionContext, Boolean.class); if (!Boolean.TRUE.equals(result)) { throw new JbpmException("condition '" + condition + "' guarding " + this + " not met");