((WorkItem) workItem).setParameters(new HashMap<String, Object>(work.getParameters()));
for (Iterator<DataAssociation> iterator = workItemNode.getInAssociations().iterator(); iterator.hasNext(); ) {
DataAssociation association = iterator.next();
if (association.getAssignments() == null || association.getAssignments().isEmpty()) {
Object parameterValue = null;
VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
resolveContextInstance(VariableScope.VARIABLE_SCOPE, association.getSources().get(0));
if (variableScopeInstance != null) {
parameterValue = variableScopeInstance.getVariable(association.getSources().get(0));
} else {
try {
parameterValue = MVEL.eval(association.getSources().get(0), new NodeInstanceResolverFactory(this));
} catch (Throwable t) {
System.err.println("Could not find variable scope for variable " + association.getSources().get(0));
System.err.println("when trying to execute Work Item " + work.getName());
System.err.println("Continuing without setting parameter.");
}
}
if (parameterValue != null) {
((WorkItem) workItem).setParameter(association.getTarget(), parameterValue);
}
} else {
for(Iterator<Assignment> it = association.getAssignments().iterator(); it.hasNext(); ) {
handleAssignment(it.next());
}
}
}
for (Map.Entry<String, Object> entry: workItem.getParameters().entrySet()) {
if (entry.getValue() instanceof String) {
String s = (String) entry.getValue();
Map<String, String> replacements = new HashMap<String, String>();
Matcher matcher = PARAMETER_MATCHER.matcher(s);
while (matcher.find()) {
String paramName = matcher.group(1);
if (replacements.get(paramName) == null) {
VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName);
if (variableScopeInstance != null) {
Object variableValue = variableScopeInstance.getVariable(paramName);
String variableValueString = variableValue == null ? "" : variableValue.toString();
replacements.put(paramName, variableValueString);
} else {
try {
Object variableValue = MVEL.eval(paramName, new NodeInstanceResolverFactory(this));