use of org.jbpm.process.instance.ProcessInstance in project jbpm by kiegroup.
the class SubProcessNodeInstance method getContextInstance.
@Override
public ContextInstance getContextInstance(Context context) {
ContextInstanceFactory conf = ContextInstanceFactoryRegistry.INSTANCE.getContextInstanceFactory(context);
if (conf == null) {
throw new IllegalArgumentException("Illegal context type (registry not found): " + context.getClass());
}
ContextInstance contextInstance = (ContextInstance) conf.getContextInstance(context, this, (ProcessInstance) getProcessInstance());
if (contextInstance == null) {
throw new IllegalArgumentException("Illegal context type (instance not found): " + context.getClass());
}
return contextInstance;
}
use of org.jbpm.process.instance.ProcessInstance in project jbpm by kiegroup.
the class CompositeContextNodeInstance method getContextInstance.
public ContextInstance getContextInstance(final Context context) {
ContextInstanceFactory conf = ContextInstanceFactoryRegistry.INSTANCE.getContextInstanceFactory(context);
if (conf == null) {
throw new IllegalArgumentException("Illegal context type (registry not found): " + context.getClass());
}
ContextInstance contextInstance = (ContextInstance) conf.getContextInstance(context, this, (ProcessInstance) getProcessInstance());
if (contextInstance == null) {
throw new IllegalArgumentException("Illegal context type (instance not found): " + context.getClass());
}
return contextInstance;
}
use of org.jbpm.process.instance.ProcessInstance in project jbpm by kiegroup.
the class NodeInstanceImpl method setVariable.
public void setVariable(String variableName, Object value) {
VariableScopeInstance variableScope = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
if (variableScope == null) {
variableScope = (VariableScopeInstance) getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE);
if (variableScope.getVariableScope().findVariable(variableName) == null) {
variableScope = null;
}
}
if (variableScope == null) {
logger.error("Could not find variable {}", variableName);
logger.error("Using process-level scope");
variableScope = (VariableScopeInstance) ((ProcessInstance) getProcessInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
}
variableScope.setVariable(variableName, value);
}
use of org.jbpm.process.instance.ProcessInstance in project jbpm by kiegroup.
the class RuleConstraintEvaluator method evaluate.
public boolean evaluate(NodeInstance instance, Connection connection, Constraint constraint) {
WorkflowProcessInstance processInstance = instance.getProcessInstance();
InternalAgenda agenda = (InternalAgenda) ((ProcessInstance) processInstance).getKnowledgeRuntime().getAgenda();
String rule = "RuleFlow-Split-" + processInstance.getProcessId() + "-" + ((Node) instance.getNode()).getUniqueId() + "-" + ((Node) connection.getTo()).getUniqueId() + "-" + connection.getToType();
return agenda.isRuleActiveInRuleFlowGroup("DROOLS_SYSTEM", rule, processInstance.getId());
}
Aggregations