コード例 #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        public override object Execute(CommandContext commandContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.migration.MigrationPlan migrationPlan = executionBuilder.getMigrationPlan();
            var migrationPlan = ExecutionBuilder.MigrationPlan;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.Util.Collection<String> processInstanceIds = collectProcessInstanceIds(commandContext);
            var processInstanceIds = CollectProcessInstanceIds(commandContext);

            EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "Migration plan cannot be null", "migration plan",
                                     migrationPlan);
            //EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Process instance ids cannot empty", "process instance ids", processInstanceIds);
            EnsureUtil.EnsureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null",
                                             "process instance ids", processInstanceIds);

            var sourceDefinition = ResolveSourceProcessDefinition(commandContext);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity targetDefinition = resolveTargetProcessDefinition(commandContext);
            var targetDefinition = ResolveTargetProcessDefinition(commandContext);

            CheckAuthorizations(commandContext, sourceDefinition, targetDefinition, processInstanceIds);
            if (WriteOperationLog)
            {
                WriteUserOperationLog(commandContext, sourceDefinition, targetDefinition, processInstanceIds.Count,
                                      false);
            }

            //commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, migrationPlan, processInstanceIds, targetDefinition));

            return(null);
        }
コード例 #2
0
        public override IBatch Execute(CommandContext commandContext)
        {
            var migrationPlan      = ExecutionBuilder.MigrationPlan;
            var processInstanceIds = CollectProcessInstanceIds(commandContext);

            EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "Migration plan cannot be null", "migration plan",
                                     migrationPlan);
            //EnsureUtil.EnsureNotEmpty(typeof (BadUserRequestException), "Process instance ids cannot empty",
            //    "process instance ids", processInstanceIds);
            EnsureUtil.EnsureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null",
                                             "process instance ids", processInstanceIds);

            var sourceProcessDefinition = ResolveSourceProcessDefinition(commandContext);
            var targetProcessDefinition = ResolveTargetProcessDefinition(commandContext);

            base.CheckAuthorizations(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds);
            WriteUserOperationLog(commandContext, sourceProcessDefinition, targetProcessDefinition,
                                  processInstanceIds.Count, true);

            var batch = CreateBatch(commandContext, migrationPlan, processInstanceIds, sourceProcessDefinition);

            batch.CreateSeedJobDefinition();
            batch.CreateMonitorJobDefinition();
            batch.CreateBatchJobDefinition();

            batch.FireHistoricStartEvent();

            batch.CreateSeedJob();

            return(batch);
        }
コード例 #3
0
        public override IBatch Execute(CommandContext commandContext)
        {
            IList <AbstractProcessInstanceModificationCommand> instructions = builder.Instructions;
            ICollection <string> processInstanceIds = CollectProcessInstanceIds(commandContext);

            EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Modification instructions cannot be empty", instructions);
            EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Process instance ids cannot be empty", "Process instance ids", processInstanceIds);
            EnsureUtil.EnsureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null", "Process instance ids", processInstanceIds);

            commandContext.AuthorizationManager.CheckAuthorization(Permissions.Create, Resources.Batch);

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

            EnsureUtil.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);
        }
コード例 #4
0
        public virtual IDeploymentBuilder AddDeploymentResourcesByName(string deploymentId, IList <string> resourceNames)
        {
            EnsureUtil.EnsureNotNull(typeof(NotValidException), "deploymentId", deploymentId);

            EnsureUtil.EnsureNotNull(typeof(NotValidException), "resourceNames", resourceNames);
            EnsureUtil.EnsureNotEmpty(typeof(NotValidException), "resourceNames", resourceNames);
            EnsureUtil.EnsureNotContainsNull(typeof(NotValidException), "resourceNames", resourceNames);

            CollectionUtil.AddCollectionToMapOfSets(deploymentResourcesByName, deploymentId, resourceNames);

            return(this);
        }
コード例 #5
0
        public override object Execute(CommandContext commandContext)
        {
            var processInstanceIds = CollectProcessInstanceIds();
            var instructions       = builder.Instructions;

            EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Restart instructions cannot be empty",
                                      "instructions", instructions);
            EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Process instance ids cannot be empty",
                                      "Process instance ids", processInstanceIds);
            EnsureUtil.EnsureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null",
                                             "Process instance ids", processInstanceIds);

            var processDefinition = GetProcessDefinition(commandContext, builder.ProcessDefinitionId);

            EnsureUtil.EnsureNotNull("Process definition cannot be found", "processDefinition", processDefinition);

            CheckAuthorization(commandContext, processDefinition);

            if (writeUserOperationLog)
            {
                WriteUserOperationLog(commandContext, processDefinition, processInstanceIds.Count, false);
            }

            var processDefinitionId = builder.ProcessDefinitionId;

            foreach (var processInstanceId in processInstanceIds)
            {
                var historicProcessInstance = GetHistoricProcessInstance(commandContext, processInstanceId);

                EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "Historic process instance cannot be found",
                                         "historicProcessInstanceId", historicProcessInstance);
                EnsureHistoricProcessInstanceNotActive(historicProcessInstance);
                EnsureSameProcessDefinition(historicProcessInstance, processDefinitionId);

                var instantiationBuilder = GetProcessInstantiationBuilder(commandExecutor, processDefinitionId);
                ApplyProperties(instantiationBuilder, processDefinition, historicProcessInstance);

                var modificationBuilder = instantiationBuilder.ModificationBuilder;
                modificationBuilder.ModificationOperations = instructions;

                var variables = CollectVariables(commandContext, historicProcessInstance);
                //instantiationBuilder.SetVariables(variables);

                instantiationBuilder.Execute(builder.SkipCustomListeners, builder.SkipIoMappings);
            }
            return(null);
        }
コード例 #6
0
        public override object Execute(CommandContext commandContext)
        {
            IList <AbstractProcessInstanceModificationCommand> instructions = builder.Instructions;
            ICollection <string> processInstanceIds = CollectProcessInstanceIds(commandContext);

            EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Modification instructions cannot be empty", instructions);
            EnsureUtil.EnsureNotEmpty(typeof(BadUserRequestException), "Process instance ids cannot be empty", "Process instance ids", processInstanceIds);
            EnsureUtil.EnsureNotContainsNull(typeof(BadUserRequestException), "Process instance ids cannot be null", "Process instance ids", processInstanceIds);

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

            EnsureUtil.EnsureNotNull(typeof(BadUserRequestException), "Process definition id cannot be null", processDefinition);

            if (writeUserOperationLog)
            {
                WriteUserOperationLog(commandContext, processDefinition, processInstanceIds.Count, false);
            }

            bool skipCustomListeners = builder.SkipCustomListeners;
            bool skipIoMappings      = builder.SkipIoMappings;

            foreach (string processInstanceId in processInstanceIds)
            {
                ExecutionEntity processInstance = commandContext.ExecutionManager.FindExecutionById(processInstanceId);

                EnsureProcessInstanceExist(processInstanceId, processInstance);
                EnsureSameProcessDefinition(processInstance, processDefinition.Id);

                ProcessInstanceModificationBuilderImpl builder = new ProcessInstanceModificationBuilderImpl(commandContext, processInstanceId);
                SetProcessInstanceId(instructions, processInstanceId);
                builder.ModificationOperations = instructions;

                builder.Execute(false, skipCustomListeners /*, skipIoMappings*/);
            }

            return(null);
        }