Skip to content

Commit

Permalink
[Fix apache#3415] Allow constant values in user task assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Feb 26, 2024
1 parent 40f080f commit 9811102
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.jbpm.process.core.context.variable.Variable;
import org.jbpm.process.core.context.variable.VariableScope;
import org.jbpm.process.core.datatype.DataType;
import org.jbpm.process.core.datatype.DataTypeResolver;
import org.jbpm.util.PatternConstants;
import org.jbpm.workflow.core.node.HumanTaskNode;
Expand Down Expand Up @@ -199,14 +200,11 @@ private CompilationUnit compilationUnitInput() {
.orElse(processVariableScope.findVariable(entry.getValue()));

if (variable == null) {
Matcher matcher = PatternConstants.PARAMETER_MATCHER.matcher(entry.getValue());
if (matcher.find()) {
variable = new Variable();
variable.setName(entry.getKey());
variable.setType(DataTypeResolver.fromType(inputTypes.get(entry.getKey()), Thread.currentThread().getContextClassLoader()));
} else {
throw new IllegalStateException("Task " + humanTaskNode.getName() + " (input) " + entry.getKey() + " reference not existing variable " + entry.getValue());
}
variable = new Variable();
variable.setName(entry.getKey());
DataType type = DataTypeResolver.fromType(inputTypes.get(entry.getKey()), Thread.currentThread().getContextClassLoader());
variable.setType(type);
variable.setValue(PatternConstants.PARAMETER_MATCHER.matcher(entry.getValue()).find() ? entry.getValue() : type.readValue(entry.getValue()));
}

FieldDeclaration fd = new FieldDeclaration().addVariable(
Expand Down

0 comments on commit 9811102

Please sign in to comment.