Пример #1
0
        public virtual void delete(bool cascadeToHistory)
        {
            CommandContext commandContext = Context.CommandContext;

            deleteSeedJob();
            deleteMonitorJob();
            BatchJobHandler.deleteJobs(this);

            JobDefinitionManager jobDefinitionManager = commandContext.JobDefinitionManager;

            jobDefinitionManager.delete(SeedJobDefinition);
            jobDefinitionManager.delete(MonitorJobDefinition);
            jobDefinitionManager.delete(BatchJobDefinition);

            commandContext.BatchManager.delete(this);
            configuration.deleteByteArrayValue();

            fireHistoricEndEvent();

            if (cascadeToHistory)
            {
                HistoricIncidentManager historicIncidentManager = commandContext.HistoricIncidentManager;
                historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(seedJobDefinitionId);
                historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(monitorJobDefinitionId);
                historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(batchJobDefinitionId);

                HistoricJobLogManager historicJobLogManager = commandContext.HistoricJobLogManager;
                historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(seedJobDefinitionId);
                historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(monitorJobDefinitionId);
                historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(batchJobDefinitionId);

                commandContext.HistoricBatchManager.deleteHistoricBatchById(id);
            }
        }
Пример #2
0
        protected internal virtual BatchEntity createBatch(CommandContext commandContext, ICollection <string> processInstanceIds)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration      = commandContext.ProcessEngineConfiguration;
            BatchJobHandler <SetRetriesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);

            SetRetriesBatchConfiguration configuration = new SetRetriesBatchConfiguration(new List <string>(processInstanceIds), builder.Retries);

            BatchEntity batch = new BatchEntity();

            batch.Type                   = batchJobHandler.Type;
            batch.TotalJobs              = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration);
            batch.BatchJobsPerSeed       = processEngineConfiguration.BatchJobsPerSeed;
            batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob;
            batch.ConfigurationBytes     = batchJobHandler.writeConfiguration(configuration);
            commandContext.BatchManager.insertBatch(batch);

            return(batch);
        }
Пример #3
0
        protected internal virtual BatchEntity createBatch(CommandContext commandContext, IList <string> ids)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration;
            BatchJobHandler batchJobHandler = getBatchJobHandler(processEngineConfiguration);

            BatchConfiguration configuration = getAbstractIdsBatchConfiguration(ids);

            BatchEntity batch = new BatchEntity();

            batch.Type                   = batchJobHandler.Type;
            batch.TotalJobs              = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration);
            batch.BatchJobsPerSeed       = processEngineConfiguration.BatchJobsPerSeed;
            batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob;
            batch.ConfigurationBytes     = batchJobHandler.writeConfiguration(configuration);
            commandContext.BatchManager.insertBatch(batch);

            return(batch);
        }
Пример #4
0
        protected internal virtual BatchEntity createBatch(CommandContext commandContext, IList <AbstractProcessInstanceModificationCommand> instructions, IList <string> processInstanceIds, ProcessDefinitionEntity processDefinition)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration;
            BatchJobHandler <RestartProcessInstancesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);

            RestartProcessInstancesBatchConfiguration configuration = new RestartProcessInstancesBatchConfiguration(processInstanceIds, instructions, builder.ProcessDefinitionId, builder.InitialVariables, builder.SkipCustomListeners, builder.SkipIoMappings, builder.WithoutBusinessKey);

            BatchEntity batch = new BatchEntity();

            batch.Type                   = batchJobHandler.Type;
            batch.TotalJobs              = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration);
            batch.BatchJobsPerSeed       = processEngineConfiguration.BatchJobsPerSeed;
            batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob;
            batch.ConfigurationBytes     = batchJobHandler.writeConfiguration(configuration);
            batch.TenantId               = processDefinition.TenantId;
            commandContext.BatchManager.insertBatch(batch);

            return(batch);
        }
Пример #5
0
        protected internal virtual BatchEntity createBatch(CommandContext commandContext, MigrationPlan migrationPlan, ICollection <string> processInstanceIds, ProcessDefinitionEntity sourceProcessDefinition)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration     = commandContext.ProcessEngineConfiguration;
            BatchJobHandler <MigrationBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);

            MigrationBatchConfiguration configuration = new MigrationBatchConfiguration(new List <string>(processInstanceIds), migrationPlan, executionBuilder.SkipCustomListeners, executionBuilder.SkipIoMappings);

            BatchEntity batch = new BatchEntity();

            batch.Type                   = batchJobHandler.Type;
            batch.TotalJobs              = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration);
            batch.BatchJobsPerSeed       = processEngineConfiguration.BatchJobsPerSeed;
            batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob;
            batch.ConfigurationBytes     = batchJobHandler.writeConfiguration(configuration);
            batch.TenantId               = sourceProcessDefinition.TenantId;
            commandContext.BatchManager.insertBatch(batch);

            return(batch);
        }
Пример #6
0
        protected internal virtual BatchEntity createBatch(CommandContext commandContext, IList <AbstractProcessInstanceModificationCommand> instructions, ExecutionEntity processInstance)
        {
            string processInstanceId   = processInstance.ProcessInstanceId;
            string processDefinitionId = processInstance.ProcessDefinitionId;
            string tenantId            = processInstance.TenantId;

            ProcessEngineConfigurationImpl processEngineConfiguration        = commandContext.ProcessEngineConfiguration;
            BatchJobHandler <ModificationBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);

            ModificationBatchConfiguration configuration = new ModificationBatchConfiguration(Arrays.asList(processInstanceId), processDefinitionId, instructions, builder.SkipCustomListeners, builder.SkipIoMappings);

            BatchEntity batch = new BatchEntity();

            batch.Type                   = batchJobHandler.Type;
            batch.TotalJobs              = 1;
            batch.BatchJobsPerSeed       = processEngineConfiguration.BatchJobsPerSeed;
            batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob;
            batch.ConfigurationBytes     = batchJobHandler.writeConfiguration(configuration);
            batch.TenantId               = tenantId;
            commandContext.BatchManager.insertBatch(batch);

            return(batch);
        }
Пример #7
0
        public virtual void execute(BatchSeedJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId)
        {
            string      batchId = configuration.BatchId;
            BatchEntity batch   = commandContext.BatchManager.findBatchById(batchId);

            ensureNotNull("Batch with id '" + batchId + "' cannot be found", "batch", batch);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: BatchJobHandler<?> batchJobHandler = commandContext.getProcessEngineConfiguration().getBatchHandlers().get(batch.getType());
            BatchJobHandler <object> batchJobHandler = commandContext.ProcessEngineConfiguration.BatchHandlers[batch.Type];

            bool done = batchJobHandler.createJobs(batch);

            if (!done)
            {
                batch.createSeedJob();
            }
            else
            {
                // create monitor job initially without due date to
                // enable rapid completion of simple batches
                batch.createMonitorJob(false);
            }
        }