query.processDefinitionWithoutTenantId();
} else {
query.processDefinitionTenantId(tenantId);
}
List<ProcessDefinition> processDefinitions = query.list();
if(processDefinitions.isEmpty()) {
throw new ActivitiException("Cannot find process definition for key '"+processDefinitionKey+"'");
}
for (ProcessDefinition processDefinition : processDefinitions) {