Search in sources :

Example 11 with ExportedProcessInstance

use of io.automatiko.engine.api.workflow.ExportedProcessInstance in project automatiko-engine by automatiko-io.

the class ProcessInstanceExporter method exportInstance.

@SuppressWarnings("unchecked")
public JsonExportedProcessInstance exportInstance(String id, ProcessInstance<?> processInstance) {
    Collection<ProcessInstance<? extends Model>> subInstances = processInstance.subprocesses();
    List<JsonExportedProcessInstance> subinstances = new ArrayList<JsonExportedProcessInstance>();
    if (!subInstances.isEmpty()) {
        for (ProcessInstance<? extends Model> si : subInstances) {
            JsonExportedProcessInstance subExported = exportInstance(id + ":" + si.id(), si);
            subinstances.add(subExported);
        }
    }
    ExportedProcessInstance<String> exported = processInstance.process().exportInstance(id, false);
    JsonExportedProcessInstance jsonExported = JsonExportedProcessInstance.of(exported);
    jsonExported.setSubInstances(subinstances);
    return jsonExported;
}
Also used : JsonExportedProcessInstance(io.automatiko.engine.addons.process.management.model.JsonExportedProcessInstance) Model(io.automatiko.engine.api.Model) ArrayList(java.util.ArrayList) JsonExportedProcessInstance(io.automatiko.engine.addons.process.management.model.JsonExportedProcessInstance) StringExportedProcessInstance(io.automatiko.engine.workflow.StringExportedProcessInstance) ExportedProcessInstance(io.automatiko.engine.api.workflow.ExportedProcessInstance) ProcessInstance(io.automatiko.engine.api.workflow.ProcessInstance)

Aggregations

ExportedProcessInstance (io.automatiko.engine.api.workflow.ExportedProcessInstance)11 ProcessInstance (io.automatiko.engine.api.workflow.ProcessInstance)9 AbstractProcessInstance (io.automatiko.engine.workflow.AbstractProcessInstance)7 ProcessInstanceDuplicatedException (io.automatiko.engine.api.workflow.ProcessInstanceDuplicatedException)6 Model (io.automatiko.engine.api.Model)5 WorkflowProcessInstance (io.automatiko.engine.api.runtime.process.WorkflowProcessInstance)4 HashMap (java.util.HashMap)4 StringExportedProcessInstance (io.automatiko.engine.workflow.StringExportedProcessInstance)3 Application (io.automatiko.engine.api.Application)2 ExpirationTime (io.automatiko.engine.api.jobs.ExpirationTime)2 JobsService (io.automatiko.engine.api.jobs.JobsService)2 WorkItem (io.automatiko.engine.api.workflow.WorkItem)2 AbstractCodegenTest (io.automatiko.engine.codegen.AbstractCodegenTest)2 AbstractProcess (io.automatiko.engine.workflow.AbstractProcess)2 Timer (io.automatiko.engine.workflow.base.core.timer.Timer)2 NodeInstanceImpl (io.automatiko.engine.workflow.process.instance.impl.NodeInstanceImpl)2 WorkflowProcessInstanceImpl (io.automatiko.engine.workflow.process.instance.impl.WorkflowProcessInstanceImpl)2 StateBasedNodeInstance (io.automatiko.engine.workflow.process.instance.node.StateBasedNodeInstance)2 TimerNodeInstance (io.automatiko.engine.workflow.process.instance.node.TimerNodeInstance)2 MessageOrBuilder (com.google.protobuf.MessageOrBuilder)1