コード例 #1
0
        public override Void execute(CommandContext commandContext)
        {
            ICollection <string> processInstanceIds = collectProcessInstanceIds();

            EnsureUtil.ensureNotEmpty(typeof(BadUserRequestException), "No process instance ids given", "Process Instance ids", processInstanceIds);
            EnsureUtil.ensureNotContainsNull(typeof(BadUserRequestException), "Cannot be null.", "Process Instance ids", processInstanceIds);

            writeUserOperationLog(commandContext, processInstanceIds.Count, false);

            UpdateProcessInstanceSuspensionStateBuilderImpl suspensionStateBuilder = new UpdateProcessInstanceSuspensionStateBuilderImpl(commandExecutor);

            if (suspending)
            {
                // suspending
                foreach (string processInstanceId in processInstanceIds)
                {
                    suspensionStateBuilder.byProcessInstanceId(processInstanceId).suspend();
                }
            }
            else
            {
                // activating
                foreach (string processInstanceId in processInstanceIds)
                {
                    suspensionStateBuilder.byProcessInstanceId(processInstanceId).activate();
                }
            }

            return(null);
        }
コード例 #2
0
        public override Batch execute(CommandContext commandContext)
        {
            ICollection <string> processInstanceIds = collectProcessInstanceIds();

            EnsureUtil.ensureNotEmpty(typeof(BadUserRequestException), "No process instance ids given", "process Instance Ids", processInstanceIds);
            EnsureUtil.ensureNotContainsNull(typeof(BadUserRequestException), "Cannot be null.", "Process Instance ids", processInstanceIds);
            checkAuthorizations(commandContext);
            writeUserOperationLog(commandContext, processInstanceIds.Count, true);
            BatchEntity batch = createBatch(commandContext, processInstanceIds);

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();
            return(batch);
        }