So I've retrieved the calledElement sub-process names, and I deploy() them using the repositoryService.
But when I start the parent process (from the runtimeService derived from the very same repositoryService), I get an exception:
org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'tester'
I've tried this with and without a tenantId.
Note: There seems to be a mixing of names in Activiti as when I deploy a non-CallActivity process, the 'key' in startProcessInstanceByKey() is really the 'id' attribute inside the xml. Maybe the 'key' is meant to be something else? Semantics aside..in any case:
I can deploy the calledElement just fine using this code:
<code>
InputStream distream = new FileInputStream(BPMN_FOLDER + dependency + BPMN_EXTENSION);
DeploymentEntity depdeply = (DeploymentEntity) repositoryService.createDeployment().name(dependency).addInputStream(dependency, distream).tenantId(tenantId).deploy();
</code>
Where 'dependency' is the id of the calledElement value.
I deploy the parent process no problem with:
<code>
DeploymentEntity deployment = (DeploymentEntity) repositoryService.createDeployment().name(bpmnFile.getName().substring(0, bpmnFile.getName().lastIndexOf(".bpmn20"))).addInputStream(bpmnFile.getName(), istream).tenantId(tenantId).deploy();
</code>(note: same is true if I use the 'no-tenantid' version of the above)
The exception is thrown when I attempt to start the parent process:
<code>
processInstance = runtimeService.startProcessInstanceByKeyAndTenantId(key, key, variableMap, tenantId);
</code>
As I understand it, a call activity sub process needs to be deployed before its parent is deployed/started (but not starting the sub-process). The deploy() call seems to suggest it registers the deployment with the repositoryService, as it looks to be a wrapper for repositoryService.deploy(this).
Why is the parent start api call not finding the successfully deployed call activity sub-process?
Many thanks for any help/advice,
Peter