It is also possible to access the BPMN model instance by the process definition id using the Repository Service, as the following incomplete test sample code shows. Please see the generate-jsf-form quickstart for a complete example.
public void testRepositoryService() {
runtimeService.startProcessInstanceByKey(PROCESS_KEY);
String processDefinitionId = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey(PROCESS_KEY).singleResult().getId();
BpmnModelInstance modelInstance = repositoryService.getBpmnModelInstance(processDefinitionId);
}
原文: https://docs.camunda.org/manual/7.9/user-guide/model-api/bpmn-model-api/respository-service/