Search in sources :

Example 11 with ContextInstance

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;
}
Also used : Context(io.automatiko.engine.workflow.base.core.Context) ProcessContext(io.automatiko.engine.workflow.base.core.context.ProcessContext) ContextInstance(io.automatiko.engine.workflow.base.instance.ContextInstance)

Example 12 with ContextInstance

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;
}
Also used : ContextInstance(io.automatiko.engine.workflow.base.instance.ContextInstance) ProcessInstance(io.automatiko.engine.workflow.base.instance.ProcessInstance) ContextInstanceFactory(io.automatiko.engine.workflow.base.instance.impl.ContextInstanceFactory)

Example 13 with 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;
}
Also used : ContextInstance(io.automatiko.engine.workflow.base.instance.ContextInstance)

Example 14 with 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;
}
Also used : Context(io.automatiko.engine.workflow.base.core.Context) ContextContainer(io.automatiko.engine.workflow.base.core.ContextContainer) ContextInstance(io.automatiko.engine.workflow.base.instance.ContextInstance)

Example 15 with ContextInstance

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;
}
Also used : AbstractContextInstance(io.automatiko.engine.workflow.base.instance.context.AbstractContextInstance) AbstractContextInstance(io.automatiko.engine.workflow.base.instance.context.AbstractContextInstance) SwimlaneContextInstance(io.automatiko.engine.workflow.base.instance.context.swimlane.SwimlaneContextInstance) ContextInstance(io.automatiko.engine.workflow.base.instance.ContextInstance)

Aggregations

ContextInstance (io.automatiko.engine.workflow.base.instance.ContextInstance)16 ContextInstanceFactory (io.automatiko.engine.workflow.base.instance.impl.ContextInstanceFactory)5 AbstractContextInstance (io.automatiko.engine.workflow.base.instance.context.AbstractContextInstance)4 ProcessInstance (io.automatiko.engine.workflow.base.instance.ProcessInstance)3 SwimlaneContextInstance (io.automatiko.engine.workflow.base.instance.context.swimlane.SwimlaneContextInstance)3 HashMap (java.util.HashMap)3 NodeInstance (io.automatiko.engine.api.runtime.process.NodeInstance)2 ProcessInstance (io.automatiko.engine.api.runtime.process.ProcessInstance)2 WorkflowProcessInstance (io.automatiko.engine.api.runtime.process.WorkflowProcessInstance)2 Context (io.automatiko.engine.workflow.base.core.Context)2 ExclusiveGroupInstance (io.automatiko.engine.workflow.base.instance.context.exclusive.ExclusiveGroupInstance)2 VariableScopeInstance (io.automatiko.engine.workflow.base.instance.context.variable.VariableScopeInstance)2 CompositeContextNodeInstance (io.automatiko.engine.workflow.process.instance.node.CompositeContextNodeInstance)2 DynamicNodeInstance (io.automatiko.engine.workflow.process.instance.node.DynamicNodeInstance)2 EventNodeInstance (io.automatiko.engine.workflow.process.instance.node.EventNodeInstance)2 EventSubProcessNodeInstance (io.automatiko.engine.workflow.process.instance.node.EventSubProcessNodeInstance)2 ForEachNodeInstance (io.automatiko.engine.workflow.process.instance.node.ForEachNodeInstance)2 HumanTaskNodeInstance (io.automatiko.engine.workflow.process.instance.node.HumanTaskNodeInstance)2 LambdaSubProcessNodeInstance (io.automatiko.engine.workflow.process.instance.node.LambdaSubProcessNodeInstance)2 MilestoneNodeInstance (io.automatiko.engine.workflow.process.instance.node.MilestoneNodeInstance)2