} else { try { Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory((org.jbpm.workflow.instance.NodeInstance) nodeInstance)); String variableValueString = variableValue == null ? "" : variableValue.toString(); replacements.put(paramName, variableValueString);
@Override public VariableResolver getVariableResolver(String name) { if (tempVariables.containsKey(name)) { return new SimpleValueResolver(tempVariables.get(name)); } return super.getVariableResolver(name); }
@Override public boolean isResolveable(String name) { boolean result = tempVariables.containsKey(name); if (result) { return result; } return super.isResolveable(name); } @Override
} else { try { Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory(this)); String variableValueString = variableValue == null ? "" : variableValue.toString(); replacements.put(paramName, variableValueString);
@Override public boolean isResolveable(String name) { boolean result = tempVariables.containsKey(name); if (result) { return result; } return super.isResolveable(name); } @Override
@Override public VariableResolver getVariableResolver(String name) { if (tempVariables.containsKey(name)) { return new SimpleValueResolver(tempVariables.get(name)); } return super.getVariableResolver(name); }
} else { try { collection = MVELSafeHelper.getEvaluator().eval(collectionExpression, new NodeInstanceResolverFactory(this)); } catch (Throwable t) { throw new IllegalArgumentException(
private Function<String, String> getResolver(Node node, String type, List<NodeInstance> currentView) { if (node instanceof DynamicNode) { // special handling for dynamic node to allow to resolve variables from individual node instances of the dynamic node // instead of just relying on process instance's variables return (e) -> { List<NodeInstance> nodeInstances = getNodeInstances(node.getId(), currentView); if (nodeInstances != null && !nodeInstances.isEmpty()) { StringBuilder st = new StringBuilder(); for (NodeInstance ni : nodeInstances) { String result = resolveVariable(e, new NodeInstanceResolverFactory(ni)); st.append(result).append("###"); } return st.toString(); } else { return resolveVariable(e); } }; } else { return (e) -> resolveVariable(e); } }
Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory(this)); if (variableValue != null) { return variableValue;
protected Map<String, Object> getSourceParameters(DataAssociation association) { Map<String, Object> parameters = new HashMap<String, Object>(); for (String sourceParam : association.getSources()) { Object parameterValue = null; VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, sourceParam); if (variableScopeInstance != null) { parameterValue = variableScopeInstance.getVariable(sourceParam); } else { try { parameterValue = MVELSafeHelper.getEvaluator().eval(sourceParam, new NodeInstanceResolverFactory(this)); } catch (Throwable t) { logger.warn("Could not find variable scope for variable {}", sourceParam); } } if (parameterValue != null) { parameters.put(association.getTarget(), parameterValue); } } return parameters; }
protected Map<String, Object> getSourceParameters(DataAssociation association) { Map<String, Object> parameters = new HashMap<String, Object>(); for (String sourceParam : association.getSources()) { Object parameterValue = null; VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, sourceParam); if (variableScopeInstance != null) { parameterValue = variableScopeInstance.getVariable(sourceParam); } else { try { parameterValue = MVELSafeHelper.getEvaluator().eval(sourceParam, new NodeInstanceResolverFactory(this)); } catch (Throwable t) { logger.warn("Could not find variable scope for variable {}", sourceParam); } } if (parameterValue != null) { parameters.put(association.getTarget(), parameterValue); } } return parameters; }
protected Map<String, Object> getSourceParameters(DataAssociation association) { Map<String, Object> parameters = new HashMap<String, Object>(); for (String sourceParam : association.getSources()) { Object parameterValue = null; VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, sourceParam); if (variableScopeInstance != null) { parameterValue = variableScopeInstance.getVariable(sourceParam); } else { try { parameterValue = MVELSafeHelper.getEvaluator().eval(sourceParam, new NodeInstanceResolverFactory(this)); } catch (Throwable t) { logger.warn("Could not find variable scope for variable {}", sourceParam); } } if (parameterValue != null) { parameters.put(association.getTarget(), parameterValue); } } return parameters; }
} else { try { parameterValue = MVELSafeHelper.getEvaluator().eval(association.getSources().get(0), new NodeInstanceResolverFactory(this)); } catch (Throwable t) { logger.error("Could not find variable scope for variable {}", association.getSources().get(0));
} else { try { parameterValue = MVELSafeHelper.getEvaluator().eval(association.getSources().get(0), new NodeInstanceResolverFactory(this)); } catch (Throwable t) { logger.error("Could not find variable scope for variable {}", association.getSources().get(0)); } else { try { Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory(this)); String variableValueString = variableValue == null ? "" : variableValue.toString(); replacements.put(paramName, variableValueString);
public void nodeInstanceCompleted(org.jbpm.workflow.instance.NodeInstance nodeInstance, String outType) { Node nodeInstanceNode = nodeInstance.getNode(); if( nodeInstanceNode != null ) { Object compensationBoolObj = nodeInstanceNode.getMetaData().get("isForCompensation"); boolean isForCompensation = compensationBoolObj == null ? false : ((Boolean) compensationBoolObj); if( isForCompensation ) { return; } } String completionCondition = getDynamicNode().getCompletionExpression(); // TODO what if we reach the end of one branch but others might still need to be created ? // TODO are we sure there will always be node instances left if we are not done yet? if (isTerminated(nodeInstance)) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } else if (getDynamicNode().isAutoComplete() && getNodeInstances(false).isEmpty()) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } else if (completionCondition != null && "mvel".equals(getDynamicNode().getLanguage())) { Object value = MVELSafeHelper.getEvaluator().eval(completionCondition, new NodeInstanceResolverFactory(this)); if ( !(value instanceof Boolean) ) { throw new RuntimeException( "Completion condition expression must return boolean values: " + value + " for expression " + completionCondition); } if (((Boolean) value).booleanValue()) { triggerCompleted(NodeImpl.CONNECTION_DEFAULT_TYPE); } } }
} else { try { parameterValue = MVELSafeHelper.getEvaluator().eval(mapping.getSources().get(0), new NodeInstanceResolverFactory(this)); } catch (Throwable t) { parameterValue = VariableUtil.resolveVariable(mapping.getSources().get(0), this); } else { try { Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory(this)); String variableValueString = variableValue == null ? "" : variableValue.toString(); replacements.put(paramName, variableValueString);
} else { try { Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory((org.jbpm.workflow.instance.NodeInstance) nodeInstance)); String variableValueString = variableValue == null ? "" : variableValue.toString(); replacements.put(paramName, variableValueString);
} else { try { Object variableValue = MVELSafeHelper.getEvaluator().eval(paramName, new NodeInstanceResolverFactory(this)); String variableValueString = variableValue == null ? "" : variableValue.toString(); replacements.put(paramName, variableValueString);
} else { try { collection = MVELSafeHelper.getEvaluator().eval(collectionExpression, new NodeInstanceResolverFactory(this)); } catch (Throwable t) { throw new IllegalArgumentException(
private Function<String, String> getResolver(Node node, String type, List<NodeInstance> currentView) { if (node instanceof DynamicNode) { // special handling for dynamic node to allow to resolve variables from individual node instances of the dynamic node // instead of just relying on process instance's variables return (e) -> { List<NodeInstance> nodeInstances = getNodeInstances(node.getId(), currentView); if (nodeInstances != null && !nodeInstances.isEmpty()) { StringBuilder st = new StringBuilder(); for (NodeInstance ni : nodeInstances) { String result = resolveVariable(e, new NodeInstanceResolverFactory(ni)); st.append(result).append("###"); } return st.toString(); } else { return resolveVariable(e); } }; } else { return (e) -> resolveVariable(e); } }