ProcessDefinitionEntity processDefinitionEntity = commandContext
.getProcessDefinitionEntityManager()
.findProcessDefinitionById(processDefinitionId);
if (processDefinitionEntity == null) {
throw new ActivitiObjectNotFoundException("Process definition does not exist: " + processDefinitionId, ProcessDefinitionEntity.class);
}
// Fetch the resource
String resourceName = processDefinitionEntity.getResourceName();
ResourceEntity resource = commandContext.getResourceEntityManager()
.findResourceByDeploymentIdAndResourceName(processDefinitionEntity.getDeploymentId(), resourceName);
if (resource == null) {
if (commandContext.getDeploymentEntityManager().findDeploymentById(processDefinitionEntity.getDeploymentId()) == null) {
throw new ActivitiObjectNotFoundException("deployment for process definition does not exist: "
+ processDefinitionEntity.getDeploymentId(), Deployment.class);
} else {
throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName
+ "' in deployment '" + processDefinitionEntity.getDeploymentId() + "'", InputStream.class);
}
}
// Convert the bpmn 2.0 xml to a bpmn model