Esempio n. 1
0
        public virtual Batch execute(CommandContext commandContext)
        {
            string processInstanceId = builder.ProcessInstanceId;

            ExecutionManager executionManager = commandContext.ExecutionManager;
            ExecutionEntity  processInstance  = executionManager.findExecutionById(processInstanceId);

            ensureProcessInstanceExists(processInstanceId, processInstance);

            checkPermissions(commandContext);

            commandContext.OperationLogManager.logProcessInstanceOperation(LogEntryOperation, processInstanceId, null, null, Collections.singletonList(PropertyChange.EMPTY_CHANGE));

            IList <AbstractProcessInstanceModificationCommand> instructions = builder.ModificationOperations;
            BatchEntity batch = createBatch(commandContext, instructions, processInstance);

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();
            return(batch);
        }
Esempio n. 2
0
        public override Batch execute(CommandContext commandContext)
        {
            MigrationPlan        migrationPlan      = executionBuilder.MigrationPlan;
            ICollection <string> processInstanceIds = collectProcessInstanceIds(commandContext);

            ensureNotNull(typeof(BadUserRequestException), "Migration plan cannot be null", "migration plan", migrationPlan);
            ensureNotEmpty(typeof(BadUserRequestException), "Process instance ids cannot empty", "process instance ids", processInstanceIds);
            ensureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null", "process instance ids", processInstanceIds);

            ProcessDefinitionEntity sourceProcessDefinition = resolveSourceProcessDefinition(commandContext);
            ProcessDefinitionEntity targetProcessDefinition = resolveTargetProcessDefinition(commandContext);

            checkAuthorizations(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds);
            writeUserOperationLog(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds.Count, true);

            BatchEntity batch = createBatch(commandContext, migrationPlan, processInstanceIds, sourceProcessDefinition);

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();

            return(batch);
        }
Esempio n. 3
0
        public override Batch execute(CommandContext commandContext)
        {
            IList <AbstractProcessInstanceModificationCommand> instructions = builder.Instructions;
            ICollection <string> processInstanceIds = collectProcessInstanceIds(commandContext);

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

            checkPermissions(commandContext);

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

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

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

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

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();
            return(batch);
        }
Esempio n. 4
0
        public override Batch execute(CommandContext commandContext)
        {
            ISet <string> historicDecisionInstanceIds = new HashSet <string>();

            IList <string> instanceIds = builder.Ids;
            HistoricDecisionInstanceQuery instanceQuery = builder.Query;

            if (instanceQuery == null && instanceIds == null)
            {
                throw new BadUserRequestException("Either query nor ids provided.");
            }

            if (instanceQuery != null)
            {
                foreach (HistoricDecisionInstance historicDecisionInstance in instanceQuery.list())
                {
                    historicDecisionInstanceIds.Add(historicDecisionInstance.Id);
                }
            }

            if (instanceIds != null)
            {
                historicDecisionInstanceIds.addAll(findHistoricInstanceIds(instanceIds, commandContext));
            }

            ensureNotNull(typeof(BadUserRequestException), "removalTime", builder.getMode());
            ensureNotEmpty(typeof(BadUserRequestException), "historicDecisionInstances", historicDecisionInstanceIds);

            checkAuthorizations(commandContext, BatchPermissions.CREATE_BATCH_SET_REMOVAL_TIME);

            writeUserOperationLog(commandContext, historicDecisionInstanceIds.Count, builder.getMode(), builder.RemovalTime, builder.Hierarchical, true);

            BatchEntity batch = createBatch(commandContext, new List <>(historicDecisionInstanceIds));

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();

            return(batch);
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public override Batch execute(CommandContext commandContext)
        {
            IList <string> processInstanceIds = collectHistoricProcessInstanceIds();

            ensureNotEmpty(typeof(BadUserRequestException), "historicProcessInstanceIds", processInstanceIds);
            checkAuthorizations(commandContext, BatchPermissions.CREATE_BATCH_DELETE_FINISHED_PROCESS_INSTANCES);
            writeUserOperationLog(commandContext, deleteReason, processInstanceIds.Count, true);

            BatchEntity batch = createBatch(commandContext, processInstanceIds);

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();

            return(batch);
        }
Esempio n. 7
0
        public override Batch execute(CommandContext commandContext)
        {
            IList <string> jobIds = collectJobIds(commandContext);

            ensureNotEmpty(typeof(BadUserRequestException), "jobIds", jobIds);
            EnsureUtil.ensureGreaterThanOrEqual("Retries count", retries, 0);
            checkAuthorizations(commandContext, BatchPermissions.CREATE_BATCH_SET_JOB_RETRIES);
            writeUserOperationLog(commandContext, retries, jobIds.Count, true);

            BatchEntity batch = createBatch(commandContext, jobIds);

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();

            return(batch);
        }
Esempio n. 8
0
        public override Batch execute(CommandContext commandContext)
        {
            IList <string> externalTaskIds = collectExternalTaskIds();

            ensureNotEmpty(typeof(BadUserRequestException), "externalTaskIds", externalTaskIds);

            checkPermissions(commandContext);

            writeUserOperationLog(commandContext, builder.Retries, externalTaskIds.Count, true);

            BatchEntity batch = createBatch(commandContext, externalTaskIds);

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

            batch.fireHistoricStartEvent();

            batch.createSeedJob();

            return(batch);
        }