use of org.jbpm.process.core.context.variable.Variable in project jbpm by kiegroup.
the class CompositeNodeFactory method variable.
public CompositeNodeFactory variable(String name, DataType type, Object value) {
Variable variable = new Variable();
variable.setName(name);
variable.setType(type);
variable.setValue(value);
VariableScope variableScope = (VariableScope) getCompositeNode().getDefaultContext(VariableScope.VARIABLE_SCOPE);
if (variableScope == null) {
variableScope = new VariableScope();
getCompositeNode().addContext(variableScope);
getCompositeNode().setDefaultContext(variableScope);
}
variableScope.getVariables().add(variable);
return this;
}
use of org.jbpm.process.core.context.variable.Variable in project jbpm by kiegroup.
the class DynamicNodeFactory method variable.
public DynamicNodeFactory variable(String name, DataType type, Object value) {
Variable variable = new Variable();
variable.setName(name);
variable.setType(type);
variable.setValue(value);
VariableScope variableScope = (VariableScope) getCompositeNode().getDefaultContext(VariableScope.VARIABLE_SCOPE);
if (variableScope == null) {
variableScope = new VariableScope();
getCompositeNode().addContext(variableScope);
getCompositeNode().setDefaultContext(variableScope);
}
variableScope.getVariables().add(variable);
return this;
}
use of org.jbpm.process.core.context.variable.Variable in project jbpm by kiegroup.
the class ProcessCreatorForHelp method newProcessWithOneVariableAndOneWork.
public static RuleFlowProcess newProcessWithOneVariableAndOneWork(String processId, String variableName, String workName) {
RuleFlowProcess process = new RuleFlowProcess();
process.setId(processId);
List<Variable> variables = new ArrayList<Variable>();
Variable variable = new Variable();
variable.setName(variableName);
ObjectDataType extendingSerializableDataType = new ObjectDataType();
extendingSerializableDataType.setClassName(Person.class.getName());
variable.setType(extendingSerializableDataType);
variables.add(variable);
process.getVariableScope().setVariables(variables);
StartNode startNode = new StartNode();
startNode.setName("Start");
startNode.setId(1);
WorkItemNode workItemNode = new WorkItemNode();
workItemNode.setName("workItemNode");
workItemNode.setId(2);
Work work = new WorkImpl();
work.setName(workName);
workItemNode.setWork(work);
EndNode endNode = new EndNode();
endNode.setName("EndNode");
endNode.setId(4);
connect(startNode, workItemNode);
connect(workItemNode, endNode);
process.addNode(startNode);
process.addNode(workItemNode);
process.addNode(endNode);
return process;
}
Aggregations