@Override
  public void execute(
      BatchJobConfiguration configuration,
      ExecutionEntity execution,
      CommandContext commandContext,
      String tenantId) {
    ByteArrayEntity configurationEntity =
        commandContext
            .getDbEntityManager()
            .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());

    DeleteProcessInstanceBatchConfiguration batchConfiguration =
        readConfiguration(configurationEntity.getBytes());

    boolean initialLegacyRestrictions =
        commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
    commandContext.disableUserOperationLog();
    commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
    try {
      commandContext
          .getProcessEngineConfiguration()
          .getRuntimeService()
          .deleteProcessInstances(
              batchConfiguration.getIds(), batchConfiguration.deleteReason, true, true);
    } finally {
      commandContext.enableUserOperationLog();
      commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
    }

    commandContext.getByteArrayManager().delete(configurationEntity);
  }
 @Override
 protected DeleteProcessInstanceBatchConfiguration createJobConfiguration(
     DeleteProcessInstanceBatchConfiguration configuration, List<String> processIdsForJob) {
   return new DeleteProcessInstanceBatchConfiguration(
       processIdsForJob, configuration.getDeleteReason());
 }