code: public ProcessDefinitionEntity getPersistedInstanceOfProcessDefinition(ProcessDefinitionEntity processDefinition) {
      String deploymentId = processDefinition.getDeploymentId();
      if (StringUtils.isEmpty(processDefinition.getDeploymentId())) {
        throw new IllegalStateException("Provided process definition must have a deployment id.");
      }
  
      ProcessDefinitionEntityManager processDefinitionManager 
        = Context.getCommandContext().getProcessEngineConfiguration().getProcessDefinitionEntityManager();
      ProcessDefinitionEntity persistedProcessDefinition = null;
      if (processDefinition.getTenantId() == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinition.getTenantId())) {
        persistedProcessDefinition = processDefinitionManager.findProcessDefinitionByDeploymentAndKey(deploymentId, processDefinition.getKey());
      } else {
        persistedProcessDefinition = processDefinitionManager.findProcessDefinitionByDeploymentAndKeyAndTenantId(deploymentId, processDefinition.getKey(), processDefinition.getTenantId());
      }
  
      return persistedProcessDefinition;
    }
docs: Gets the persisted version of the already-deployed process definition.  Note that this is
  different from {@link #getMostRecentVersionOfProcessDefinition} as it looks specifically for
  a process definition that is already persisted and attached to a particular deployment,
  rather than the latest version across all deployments.