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;
}
Aggregations