コード例 #1
0
        public override Batch execute(CommandContext commandContext)
        {
            IList <AbstractProcessInstanceModificationCommand> instructions = builder.Instructions;
            ICollection <string> processInstanceIds = collectProcessInstanceIds();

            ensureNotEmpty(typeof(BadUserRequestException), "Restart instructions cannot be empty", "instructions", instructions);
            ensureNotEmpty(typeof(BadUserRequestException), "Process instance ids cannot be empty", "processInstanceIds", processInstanceIds);
            ensureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null", "processInstanceIds", processInstanceIds);

            checkPermissions(commandContext);
            ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, builder.ProcessDefinitionId);

            ensureNotNull(typeof(BadUserRequestException), "Process definition cannot be null", processDefinition);
            ensureTenantAuthorized(commandContext, processDefinition);

            writeUserOperationLog(commandContext, processDefinition, processInstanceIds.Count, true);

            List <string> ids = new List <string>();

            ids.AddRange(processInstanceIds);
            BatchEntity batch = createBatch(commandContext, instructions, ids, processDefinition);

            batch.createSeedJobDefinition();
            batch.createMonitorJobDefinition();
            batch.createBatchJobDefinition();

            batch.fireHistoricStartEvent();

            batch.createSeedJob();
            return(batch);
        }
コード例 #2
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);
            }
        }