docs: public static void prepareNextBatch(HistoryCleanupBatch historyCleanupBatch, CommandContext commandContext) {
      final HistoryCleanupJobHandlerConfiguration configuration = historyCleanupBatch.getConfiguration();
      final Integer batchSize = getHistoryCleanupBatchSize(commandContext);
      ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
  
      //add process instance ids
      final List<String> historicProcessInstanceIds = commandContext.getHistoricProcessInstanceManager()
          .findHistoricProcessInstanceIdsForCleanup(batchSize, configuration.getMinuteFrom(), configuration.getMinuteTo());
      if (historicProcessInstanceIds.size() > 0) {
        historyCleanupBatch.setHistoricProcessInstanceIds(historicProcessInstanceIds);
      }
  
      //if batch is not full, add decision instance ids
      if (historyCleanupBatch.size() < batchSize && processEngineConfiguration.isDmnEnabled()) {
        final List<String> historicDecisionInstanceIds = commandContext.getHistoricDecisionInstanceManager()
            .findHistoricDecisionInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.getMinuteFrom(), configuration.getMinuteTo());
        if (historicDecisionInstanceIds.size() > 0) {
          historyCleanupBatch.setHistoricDecisionInstanceIds(historicDecisionInstanceIds);
        }
      }
  
      //if batch is not full, add case instance ids
      if (historyCleanupBatch.size() < batchSize && processEngineConfiguration.isCmmnEnabled()) {
        final List<String> historicCaseInstanceIds = commandContext.getHistoricCaseInstanceManager()
            .findHistoricCaseInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.getMinuteFrom(), configuration.getMinuteTo());
        if (historicCaseInstanceIds.size() > 0) {
          historyCleanupBatch.setHistoricCaseInstanceIds(historicCaseInstanceIds);
        }
      }
  
      //if batch is not full, add batch ids
      Map<String, Integer> batchOperationsForHistoryCleanup = processEngineConfiguration.getParsedBatchOperationsForHistoryCleanup();
      if (historyCleanupBatch.size() < batchSize && batchOperationsForHistoryCleanup != null && !batchOperationsForHistoryCleanup.isEmpty()) {
        List<String> historicBatchIds = commandContext
            .getHistoricBatchManager()
            .findHistoricBatchIdsForCleanup(batchSize - historyCleanupBatch.size(), batchOperationsForHistoryCleanup, configuration.getMinuteFrom(), configuration.getMinuteTo());
        if (historicBatchIds.size() > 0) {
          historyCleanupBatch.setHistoricBatchIds(historicBatchIds);
        }
      }
    }