/// <summary> /// Creates next batch object for history cleanup. First searches for historic process instances ready for cleanup. If there is still some place left in batch (configured batch /// size was not reached), searches for historic decision instances and also adds them to the batch. Then if there is still some place left in batch, searches for historic case /// instances and historic batches - and adds them to the batch. /// </summary> /// <param name="commandContext"> /// @return </param> public static void prepareNextBatch(HistoryCleanupBatch historyCleanupBatch, CommandContext commandContext) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final HistoryCleanupJobHandlerConfiguration configuration = historyCleanupBatch.getConfiguration(); HistoryCleanupJobHandlerConfiguration configuration = historyCleanupBatch.Configuration; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final System.Nullable<int> batchSize = getHistoryCleanupBatchSize(commandContext); int?batchSize = getHistoryCleanupBatchSize(commandContext); ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration; //add process instance ids //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<String> historicProcessInstanceIds = commandContext.getHistoricProcessInstanceManager().findHistoricProcessInstanceIdsForCleanup(batchSize, configuration.getMinuteFrom(), configuration.getMinuteTo()); IList <string> historicProcessInstanceIds = commandContext.HistoricProcessInstanceManager.findHistoricProcessInstanceIdsForCleanup(batchSize, configuration.MinuteFrom, configuration.MinuteTo); if (historicProcessInstanceIds.Count > 0) { historyCleanupBatch.HistoricProcessInstanceIds = historicProcessInstanceIds; } //if batch is not full, add decision instance ids if (historyCleanupBatch.size() < batchSize.Value && processEngineConfiguration.DmnEnabled) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<String> historicDecisionInstanceIds = commandContext.getHistoricDecisionInstanceManager().findHistoricDecisionInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.getMinuteFrom(), configuration.getMinuteTo()); IList <string> historicDecisionInstanceIds = commandContext.HistoricDecisionInstanceManager.findHistoricDecisionInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.MinuteFrom, configuration.MinuteTo); if (historicDecisionInstanceIds.Count > 0) { historyCleanupBatch.HistoricDecisionInstanceIds = historicDecisionInstanceIds; } } //if batch is not full, add case instance ids if (historyCleanupBatch.size() < batchSize.Value && processEngineConfiguration.CmmnEnabled) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<String> historicCaseInstanceIds = commandContext.getHistoricCaseInstanceManager().findHistoricCaseInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.getMinuteFrom(), configuration.getMinuteTo()); IList <string> historicCaseInstanceIds = commandContext.HistoricCaseInstanceManager.findHistoricCaseInstanceIdsForCleanup(batchSize - historyCleanupBatch.size(), configuration.MinuteFrom, configuration.MinuteTo); if (historicCaseInstanceIds.Count > 0) { historyCleanupBatch.HistoricCaseInstanceIds = historicCaseInstanceIds; } } //if batch is not full, add batch ids IDictionary <string, int> batchOperationsForHistoryCleanup = processEngineConfiguration.ParsedBatchOperationsForHistoryCleanup; if (historyCleanupBatch.size() < batchSize.Value && batchOperationsForHistoryCleanup != null && batchOperationsForHistoryCleanup.Count > 0) { IList <string> historicBatchIds = commandContext.HistoricBatchManager.findHistoricBatchIdsForCleanup(batchSize - historyCleanupBatch.size(), batchOperationsForHistoryCleanup, configuration.MinuteFrom, configuration.MinuteTo); if (historicBatchIds.Count > 0) { historyCleanupBatch.HistoricBatchIds = historicBatchIds; } } }
protected internal virtual HistoryCleanupHandler initCleanupHandler(HistoryCleanupJobHandlerConfiguration configuration, CommandContext commandContext) { HistoryCleanupHandler cleanupHandler = null; if (isHistoryCleanupStrategyRemovalTimeBased(commandContext)) { cleanupHandler = new HistoryCleanupRemovalTime(); } else { cleanupHandler = new HistoryCleanupBatch(); } CommandExecutor commandExecutor = commandContext.ProcessEngineConfiguration.CommandExecutorTxRequiresNew; string jobId = commandContext.CurrentJob.Id; return(cleanupHandler.setConfiguration(configuration).setCommandExecutor(commandExecutor).setJobId(jobId)); }