code: protected Set<String> resumePreviousByProcessDefinitionKey(CommandContext commandContext, DeploymentEntity deployment, Set<String> processKeysToRegisterFor) {
      Set<String> processDefinitionKeys = new HashSet<String>(processKeysToRegisterFor);
  
      List<? extends ProcessDefinition> deployedProcesses = getDeployedProcesses(deployment);
      for (ProcessDefinition deployedProcess : deployedProcesses) {
        if (deployedProcess.getVersion() > 1) {
          processDefinitionKeys.add(deployedProcess.getKey());
        }
      }
  
      return findDeploymentIdsForProcessDefinitions(commandContext, processDefinitionKeys);
    }
docs: Searches in previous deployments for the same processes and retrieves the deployment ids.
  
  @param commandContext
  @param deployment
  the current deployment
  @param processKeysToRegisterFor
  the process keys this process application wants to register
  @param deployment
  the set where to add further deployments this process application
  should be registered for
  @return a set of deployment ids that contain versions of the
  processKeysToRegisterFor