use of io.automatiko.engine.workflow.base.instance.ContextInstance in project automatiko-engine by automatiko-io.
the class CompositeContextNodeInstance method getContextInstance.
public ContextInstance getContextInstance(String contextId) {
ContextInstance contextInstance = this.contextInstances.get(contextId);
if (contextInstance != null) {
return contextInstance;
}
Context context = getCompositeContextNode().getDefaultContext(contextId);
if (context != null) {
contextInstance = getContextInstance(context);
return contextInstance;
}
return null;
}
use of io.automatiko.engine.workflow.base.instance.ContextInstance in project automatiko-engine by automatiko-io.
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 io.automatiko.engine.workflow.base.instance.ContextInstance in project automatiko-engine by automatiko-io.
the class ProcessInstanceImpl 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, this);
if (contextInstance == null) {
throw new IllegalArgumentException("Illegal context type (instance not found): " + context.getClass());
}
return contextInstance;
}
use of io.automatiko.engine.workflow.base.instance.ContextInstance in project automatiko-engine by automatiko-io.
the class ProcessInstanceImpl method getContextInstance.
public ContextInstance getContextInstance(String contextId) {
ContextInstance contextInstance = this.contextInstances.get(contextId);
if (contextInstance != null) {
return contextInstance;
}
Context context = ((ContextContainer) getProcess()).getDefaultContext(contextId);
if (context != null) {
contextInstance = getContextInstance(context);
return contextInstance;
}
return null;
}
use of io.automatiko.engine.workflow.base.instance.ContextInstance in project automatiko-engine by automatiko-io.
the class ContextInstanceFactoryRegistry method getContextInstance.
private static ContextInstance getContextInstance(Supplier<? extends ContextInstance> supplier, Context context, ContextInstanceContainer contextInstanceContainer, ProcessInstance processInstance) {
ContextInstance result = contextInstanceContainer.getContextInstance(context.getType(), context.getId());
if (result != null) {
return result;
}
AbstractContextInstance contextInstance = (AbstractContextInstance) supplier.get();
contextInstance.setProcessInstance(processInstance);
contextInstance.setContextId(context.getId());
contextInstance.setContextInstanceContainer(contextInstanceContainer);
contextInstanceContainer.addContextInstance(context.getType(), contextInstance);
return contextInstance;
}
Aggregations