private long getProcessInstanceIdThatCanContainBusinessData(long processInstanceId) throws SProcessInstanceReadException, SBonitaReadException, SProcessInstanceNotFoundException, SFlowNodeReadException, SFlowNodeNotFoundException { try { SProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId); if (isSubProcess(processInstance)) { return getParentOfSubProcess(processInstance); } return processInstanceId; } catch (SProcessInstanceNotFoundException e) { //No caller type in archived process instance, get archive business data not supported from event subprocess return processInstanceId; } }
private long getProcessInstanceIdThatCanContainBusinessData(long processInstanceId) throws SProcessInstanceReadException, SBonitaReadException, SProcessInstanceNotFoundException, SFlowNodeReadException, SFlowNodeNotFoundException { try { SProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId); if (isSubProcess(processInstance)) { return getParentOfSubProcess(processInstance); } return processInstanceId; } catch (SProcessInstanceNotFoundException e) { //No caller type in archived process instance, get archive business data not supported from event subprocess return processInstanceId; } }
private long getProcessInstanceIdFromFlowNode(BusinessDataContext context) throws SFlowNodeReadException, SBonitaReadException, SProcessInstanceReadException { try { SFlowNodeInstance flowNodeInstance = flowNodeInstanceService.getFlowNodeInstance(context.getContainer().getId()); SProcessInstance processInstance = processInstanceService.getProcessInstance(flowNodeInstance.getParentProcessInstanceId()); if (isSubProcess(processInstance)) { return getParentOfSubProcess(processInstance); } return flowNodeInstance.getParentProcessInstanceId(); } catch (SFlowNodeNotFoundException | SProcessInstanceNotFoundException e) { SAFlowNodeInstance lastArchivedFlowNodeInstance = flowNodeInstanceService .getLastArchivedFlowNodeInstance(SAFlowNodeInstance.class, context.getContainer().getId()); //No caller type in archived process instance, get archive business data not supported from event subprocess return lastArchivedFlowNodeInstance.getParentProcessInstanceId(); } }
private long getProcessInstanceIdFromFlowNode(BusinessDataContext context) throws SFlowNodeReadException, SBonitaReadException, SProcessInstanceReadException { try { SFlowNodeInstance flowNodeInstance = flowNodeInstanceService.getFlowNodeInstance(context.getContainer().getId()); SProcessInstance processInstance = processInstanceService.getProcessInstance(flowNodeInstance.getParentProcessInstanceId()); if (isSubProcess(processInstance)) { return getParentOfSubProcess(processInstance); } return flowNodeInstance.getParentProcessInstanceId(); } catch (SFlowNodeNotFoundException | SProcessInstanceNotFoundException e) { SAFlowNodeInstance lastArchivedFlowNodeInstance = flowNodeInstanceService .getLastArchivedFlowNodeInstance(SAFlowNodeInstance.class, context.getContainer().getId()); //No caller type in archived process instance, get archive business data not supported from event subprocess return lastArchivedFlowNodeInstance.getParentProcessInstanceId(); } }