public void notify(DelegateExecution execution) { // Return value of expression is ignored expression.getValue(execution); }
protected String getStringFromField(Expression expression, DelegateExecution execution) { if (expression != null) { Object value = expression.getValue(execution); if (value != null) { return value.toString(); } } return null; }
protected String getStringFromField(Expression expression, DelegateExecution execution) { if (expression != null) { Object value = expression.getValue(execution); if (value != null) { return value.toString(); } } return null; }
@Override public void execute(DelegateExecution execution) { CALL_COUNT.incrementAndGet(); NAMES.add((String) name.getValue(execution)); }
protected Object resolveCollection(DelegateExecution execution) { Object collection = null; if (collectionExpression != null) { collection = collectionExpression.getValue(execution); } else if (collectionVariable != null) { collection = execution.getVariable(collectionVariable); } return collection; }
public void evaluate(DelegateExecution execution) { VariableScope variableScope = (VariableScope) execution; Object value = this.fromExpression.getValue(variableScope); this.toExpression.setValue(value, variableScope); } }
@Override public Map<String, Object> getCustomPropertiesMap(DelegateExecution execution) { Object expressionValue = expression.getValue(execution); if (expressionValue instanceof Map) { return (Map<String, Object>) expressionValue; } else { throw new ActivitiIllegalArgumentException("Custom properties resolver expression " + expression + " did not return a Map<String, Object>"); } }
protected int resolveLoopCardinality(DelegateExecution execution) { // Using Number since expr can evaluate to eg. Long (which is also the default for Juel) Object value = loopCardinalityExpression.getValue(execution); if (value instanceof Number) { return ((Number) value).intValue(); } else if (value instanceof String) { return Integer.valueOf((String) value); } else { throw new ActivitiIllegalArgumentException("Could not resolve loopCardinality expression '" + loopCardinalityExpression.getExpressionText() + "': not a number nor number String"); } }
public boolean evaluate(String sequenceFlowId, DelegateExecution execution) { Object result = expression.getValue(execution); if (result == null) { throw new ActivitiException("condition expression returns null (sequenceFlowId: " + sequenceFlowId + " execution: " + execution + ")"); } if (!(result instanceof Boolean)) { throw new ActivitiException("condition expression returns non-Boolean (sequenceFlowId: " + sequenceFlowId + " execution: " + execution + "): " + result + " (" + result.getClass().getName() + ")"); } return (Boolean) result; }
protected boolean completionConditionSatisfied(DelegateExecution execution) { if (completionConditionExpression != null) { Object value = completionConditionExpression.getValue(execution); if (!(value instanceof Boolean)) { throw new ActivitiIllegalArgumentException("completionCondition '" + completionConditionExpression.getExpressionText() + "' does not evaluate to a boolean value"); } Boolean booleanValue = (Boolean) value; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Completion condition of multi-instance satisfied: {}", booleanValue); } return booleanValue; } return false; }
public static boolean shouldSkipFlowElement(DelegateExecution execution, Expression skipExpression) { Object value = skipExpression.getValue(execution); if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } else { throw new ActivitiIllegalArgumentException("Skip expression does not resolve to a boolean: " + skipExpression.getExpressionText()); } } }
public void evaluate(DelegateExecution execution) { Object value = this.transformation.getValue(execution); execution.setVariable(this.getTarget(), value); } }
@Override public Map<String, Object> getCustomPropertiesMap(DelegateExecution execution) { // Note: we can't cache the result of the expression, because the // execution can change: eg. // delegateExpression='${mySpringBeanFactory.randomSpringBean()}' Object delegate = expression.getValue(execution); if (delegate instanceof CustomPropertiesResolver) { return ((CustomPropertiesResolver) delegate).getCustomPropertiesMap(execution); } else { throw new ActivitiIllegalArgumentException("Custom properties resolver delegate expression " + expression + " did not resolve to an implementation of " + CustomPropertiesResolver.class); } }
protected String getBusinessCalendarName(String calendarName, VariableScope variableScope) { String businessCalendarName = CycleBusinessCalendar.NAME; if (StringUtils.isNotEmpty(calendarName)) { businessCalendarName = (String) Context.getProcessEngineConfiguration().getExpressionManager() .createExpression(calendarName).getValue(variableScope); } return businessCalendarName; }
protected String getBusinessCalendarName(String calendarName, VariableScope variableScope) { String businessCalendarName = CycleBusinessCalendar.NAME; if (StringUtils.isNotEmpty(calendarName)) { businessCalendarName = (String) Context.getProcessEngineConfiguration().getExpressionManager() .createExpression(calendarName).getValue(variableScope); } return businessCalendarName; }
@Override public void notify(String processInstanceId, String executionId, FlowElement flowElement, Map<String, Object> executionVariables, Map<String, Object> customPropertiesMap) { NoExecutionVariableScope scope = new NoExecutionVariableScope(); Object delegate = expression.getValue(scope); if (delegate instanceof TransactionDependentExecutionListener) { ((TransactionDependentExecutionListener) delegate).notify(processInstanceId, executionId, flowElement, executionVariables, customPropertiesMap); } else { throw new ActivitiIllegalArgumentException("Delegate expression " + expression + " did not resolve to an implementation of " + TransactionDependentExecutionListener.class); } }
@Override public void notify(String processInstanceId, String executionId, Task task, Map<String, Object> executionVariables, Map<String, Object> customPropertiesMap) { NoExecutionVariableScope scope = new NoExecutionVariableScope(); Object delegate = expression.getValue(scope); if (delegate instanceof TransactionDependentTaskListener) { ((TransactionDependentTaskListener) delegate).notify(processInstanceId, executionId, task, executionVariables, customPropertiesMap); } else { throw new ActivitiIllegalArgumentException("Delegate expression " + expression + " did not resolve to an implementation of " + TransactionDependentTaskListener.class); } }
public static boolean shouldSkipFlowElement(CommandContext commandContext, DelegateExecution execution, String skipExpressionString) { Expression skipExpression = commandContext.getProcessEngineConfiguration().getExpressionManager().createExpression(skipExpressionString); Object value = skipExpression.getValue(execution); if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } else { throw new ActivitiIllegalArgumentException("Skip expression does not resolve to a boolean: " + skipExpression.getExpressionText()); } }
public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; if (StringUtils.isNotEmpty(signalEventDefinition.getSignalRef())) { signalName = signalEventDefinition.getSignalRef(); } else { Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); } commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); }
@Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; if (StringUtils.isNotEmpty(signalEventDefinition.getSignalRef())) { signalName = signalEventDefinition.getSignalRef(); } else { Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); } commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); }