コード例 #1
0
 public virtual IUpdateProcessInstanceSuspensionStateTenantBuilder ByProcessDefinitionKey(
     string processDefinitionKey)
 {
     EnsureUtil.EnsureNotNull("processDefinitionKey", processDefinitionKey);
     this.ProcessDefinitionKey = processDefinitionKey;
     return(this);
 }
コード例 #2
0
        public virtual object Execute(CommandContext commandContext)
        {
            ITaskManager taskManager = commandContext.TaskManager;
            TaskEntity   task        = taskManager.FindTaskById(TaskId);

            EnsureUtil.EnsureNotNull("ITask '" + TaskId + "' not found", "ITask", task);

            foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.CheckReadTask(task);
            }
            EnsureUtil.EnsureNotNull("ITask form definition for '" + TaskId + "' not found", "ITask.getTaskDefinition()",
                                     task.TaskDefinition);

            ITaskFormHandler taskFormHandler = task.TaskDefinition.TaskFormHandler;

            if (taskFormHandler == null)
            {
                return(null);
            }

            var formEngine = context.Impl.Context.ProcessEngineConfiguration.FormEngines[FormEngineName];

            EnsureUtil.EnsureNotNull("No formEngine '" + FormEngineName + "' defined process engine configuration",
                                     "formEngine", formEngine);

            var taskForm = taskFormHandler.CreateTaskForm(task);

            return(formEngine.RenderTaskForm(taskForm));
        }
コード例 #3
0
 public virtual TableMetaData Execute(CommandContext commandContext)
 {
     EnsureUtil.EnsureNotNull("tableName", TableName);
     commandContext.AuthorizationManager.CheckCamundaAdmin();
     throw new NotImplementedException();
     //return commandContext.TableDataManager.GetTableMetaData(TableName);
 }
コード例 #4
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);
        }
コード例 #5
0
        public virtual object Execute(CommandContext commandContext)
        {
            var                     processEngineConfiguration = context.Impl.Context.ProcessEngineConfiguration;
            DeploymentCache         deploymentCache            = processEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition          = deploymentCache.FindDeployedProcessDefinitionById(ProcessDefinitionId);

            EnsureUtil.EnsureNotNull("Process Definition '" + ProcessDefinitionId + "' not found", "processDefinition", processDefinition);

            foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.CheckReadProcessDefinition(processDefinition);
            }
            IStartFormHandler startFormHandler = processDefinition.StartFormHandler;

            if (startFormHandler == null)
            {
                return(null);
            }

            var formEngine = context.Impl.Context.ProcessEngineConfiguration.FormEngines[FormEngineName];

            EnsureUtil.EnsureNotNull("No formEngine '" + FormEngineName + "' defined process engine configuration",
                                     "formEngine", formEngine);

            IStartFormData startForm = startFormHandler.CreateStartFormData(processDefinition);

            return(formEngine.RenderStartForm(startForm));
        }
コード例 #6
0
        public virtual IDeploymentBuilder AddClasspathResource(string resource)
        {
            var inputStream = ReflectUtil.GetResourceAsStream(resource);

            EnsureUtil.EnsureNotNull("resource '" + resource + "' not found", "inputStream", inputStream);
            return(AddInputStream(resource, inputStream));
        }
コード例 #7
0
        public virtual IProcessInstance Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("messageName", MessageName);

            var correlationHandler = context.Impl.Context.ProcessEngineConfiguration.CorrelationHandler;
            var correlationSet     = new CorrelationSet(Builder);

            IList <CorrelationHandlerResult> correlationResults =
                commandContext.RunWithoutAuthorization(() => correlationHandler.CorrelateStartMessages(commandContext, MessageName, correlationSet));

            if (correlationResults.Count == 0)
            {
                throw new MismatchingMessageCorrelationException(MessageName,
                                                                 "No process definition matches the parameters");
            }
            if (correlationResults.Count > 1)
            {
                throw Log.ExceptionCorrelateMessageToSingleProcessDefinition(MessageName, correlationResults.Count,
                                                                             correlationSet);
            }
            var correlationResult = correlationResults[0];

            CheckAuthorization(correlationResult);

            var processInstance = InstantiateProcess(commandContext, correlationResult);

            return(processInstance);
        }
コード例 #8
0
 protected internal override object ExecuteCmd(CommandContext commandContext)
 {
     EnsureUtil.EnsureNotNull("userId", UserId);
     EnsureUtil.EnsureNotNull("groupId", GroupId);
     commandContext.WritableIdentityProvider.CreateMembership(UserId, GroupId);
     return(null);
 }
コード例 #9
0
 public virtual IDmnDecisionTableResult EvaluateDecisionTable(IDmnDecision decision,
                                                              IDictionary <string, ITypedValue> variables)
 {
     EnsureUtil.EnsureNotNull("decision", decision);
     EnsureUtil.EnsureNotNull("variables", variables);
     return(EvaluateDecisionTable(decision, Variables.FromMap(variables).AsVariableContext()));
 }
コード例 #10
0
ファイル: AddCommentCmd.cs プロジェクト: zf321/ESS.FW.Bpm
        public virtual IComment Execute(CommandContext commandContext)
        {
            if (ReferenceEquals(ProcessInstanceId, null) && ReferenceEquals(TaskId, null))
            {
                throw new ProcessEngineException("Process instance id and ITask id is null");
            }

            EnsureUtil.EnsureNotNull("Message", Message);

            var userId  = commandContext.AuthenticatedUserId;
            var comment = new CommentEntity();

            comment.UserId = userId;
            //comment.Type = CommentEntity.TYPE_COMMENT;
            comment.Time              = ClockUtil.CurrentTime;
            comment.TaskId            = TaskId;
            comment.ProcessInstanceId = ProcessInstanceId;
            comment.Action            = EventFields.ActionAddComment;

            var eventMessage = Message.Replace("\\s+", " ");

            if (eventMessage.Length > 163)
            {
                eventMessage = eventMessage.Substring(0, 160) + "...";
            }
            comment.Message = eventMessage;

            comment.FullMessage = Message;

            commandContext.CommentManager.Insert(comment);

            return((IComment)comment);
        }
コード例 #11
0
        protected internal virtual bool matchesSubscription(EventSubscriptionEntity subscription,string type,string eventName)
        {
            EnsureUtil.ensureNotNull("event type",type);
            string subscriptionEventName = subscription.EventName;

            return(type.Equals(subscription.EventType) && ((string.ReferenceEquals(eventName,null) && string.ReferenceEquals(subscriptionEventName,null)) || (!string.ReferenceEquals(eventName,null) && eventName.Equals(subscriptionEventName))));
        }
コード例 #12
0
        public virtual IProcessInstanceWithVariables ExecuteWithVariablesInReturn(bool skipCustomListeners, bool skipIoMappings)
        {
            EnsureUtil.EnsureOnlyOneNotNull("either process definition id or key must be set", ProcessDefinitionId, ProcessDefinitionKey);

            if (IsTenantIdSet && !ReferenceEquals(ProcessDefinitionId, null))
            {
                throw Log.ExceptionStartProcessInstanceByIdAndTenantId();
            }

            ICommand <IProcessInstanceWithVariables> command;

            if (ModificationBuilder.ModificationOperations.Count == 0)
            {
                if (skipCustomListeners || skipIoMappings)
                {
                    throw Log.ExceptionStartProcessInstanceAtStartActivityAndSkipListenersOrMapping();
                }
                // start at the default start activity
                command = new StartProcessInstanceCmd(this);
            }
            else
            {
                // start at any activity using the instructions
                ModificationBuilder.SkipCustomListeners = skipCustomListeners;
                ModificationBuilder.SkipIoMappings      = skipIoMappings;

                command = new StartProcessInstanceAtActivitiesCmd(this);
            }

            return(_commandExecutor.Execute(command));
        }
コード例 #13
0
 public virtual IMessageCorrelationBuilder SetVariable(string variableName, object variableValue)
 {
     EnsureUtil.EnsureNotNull("variableName", variableName);
     EnsurePayloadProcessInstanceVariablesInitialized();
     payloadProcessInstanceVariables.PutValue(variableName, variableValue);
     return(this);
 }
コード例 #14
0
        public virtual object Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull(typeof(NotValidException), "jobDefinitionId", JobDefinitionId);

            JobDefinitionEntity jobDefinition = commandContext.JobDefinitionManager.FindById(JobDefinitionId);

            EnsureUtil.EnsureNotNull(typeof(NotFoundException),
                                     "Job definition with id '" + JobDefinitionId + "' does not exist", "jobDefinition", jobDefinition);

            CheckUpdateProcess(commandContext, jobDefinition);

            long?currentPriority = jobDefinition.OverridingJobPriority;

            jobDefinition.JobPriority = Priority;

            var opLogContext = new UserOperationLogContext();

            CreateJobDefinitionOperationLogEntry(opLogContext, currentPriority, jobDefinition);

            if (Cascade && Priority != null)
            {
                commandContext.JobManager.UpdateJobPriorityByDefinitionId(JobDefinitionId, Priority.Value);
                CreateCascadeJobsOperationLogEntry(opLogContext, jobDefinition);
            }

            commandContext.OperationLogManager.LogUserOperations(opLogContext);

            return(null);
        }
コード例 #15
0
        protected internal virtual void HandleStartEvent(EventSubscriptionEntity eventSubscription, object payload,
                                                         CommandContext commandContext)
        {
            var processDefinitionId = eventSubscription.Configuration;

            EnsureUtil.EnsureNotNull(
                "Configuration of signal start event subscription '" + eventSubscription.Id +
                "' contains no process definition id.", processDefinitionId);

            DeploymentCache         deploymentCache   = Context.ProcessEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition =
                deploymentCache.FindDeployedProcessDefinitionById(processDefinitionId);

            if (processDefinition == null || processDefinition.Suspended)
            {
                // ignore event subscription
                Log.DebugIgnoringEventSubscription(eventSubscription, processDefinitionId);
            }
            else
            {
                ActivityImpl        signalStartEvent = (ActivityImpl)processDefinition.FindActivity(eventSubscription.ActivityId);
                IPvmProcessInstance processInstance  = processDefinition.CreateProcessInstanceForInitial(signalStartEvent);
                processInstance.Start();
            }
        }
コード例 #16
0
        /// <summary>
        /// .ctor
        /// </summary>
        /// <param name="dbProperty">数据库属性信息</param>
        /// <param name="isWrite">是否写连接(默认使用读连接)</param>
        public BaseDataAccess(DatabaseProperty dbProperty, bool isWrite = false)
        {
            EnsureUtil.NotNull(dbProperty, "dbProperty不能为空!");
            DatabaseConnection dbConnection = isWrite ? dbProperty.Writer : dbProperty.Reader;

            _conn = CreateConnection(dbConnection);
        }
コード例 #17
0
        public virtual BatchDto setRetries(SetJobRetriesDto setJobRetriesDto)
        {
            try
            {
                EnsureUtil.ensureNotNull("setJobRetriesDto", setJobRetriesDto);
                EnsureUtil.ensureNotNull("retries", setJobRetriesDto.Retries);
            }
            catch (NullValueException e)
            {
                throw new InvalidRequestException(Status.BAD_REQUEST, e.Message);
            }
            JobQuery jobQuery = null;

            if (setJobRetriesDto.JobQuery != null)
            {
                jobQuery = setJobRetriesDto.JobQuery.toQuery(ProcessEngine);
            }

            try
            {
                Batch batch = ProcessEngine.ManagementService.setJobRetriesAsync(setJobRetriesDto.JobIds, jobQuery, setJobRetriesDto.Retries.Value);
                return(BatchDto.fromBatch(batch));
            }
            catch (BadUserRequestException e)
            {
                throw new InvalidRequestException(Status.BAD_REQUEST, e.Message);
            }
        }
コード例 #18
0
 public RedisBaseRepository(IRedisProvider redisProvider, RedisConfig redisConfig)
 {
     EnsureUtil.NotNull(redisProvider, "IRedisProvider");
     EnsureUtil.NotNull(redisConfig, "RedisConfig");
     _redisProvider = redisProvider;
     _redisConfig   = redisConfig;
 }
コード例 #19
0
 public RpcClient(IPAddress hostIPAddress, int port)
 {
     EnsureUtil.NotNull(hostIPAddress, "hostIPAddress");
     EnsureUtil.Positive(port, "port");
     _hostIPAddress = hostIPAddress;
     _bindPort      = port;
 }
コード例 #20
0
ファイル: EventHandlerImpl.cs プロジェクト: zf321/ESS.FW.Bpm
        public virtual void HandleIntermediateEvent(EventSubscriptionEntity eventSubscription, object payload,
                                                    CommandContext commandContext)
        {
            PvmExecutionImpl execution = eventSubscription.Execution;
            ActivityImpl     activity  = eventSubscription.Activity;

            EnsureUtil.EnsureNotNull("Error while sending signal for event subscription '" + eventSubscription.Id + "': " + "no activity associated with event subscription", "activity", activity);

            if (payload is IDictionary)
            {
                var processVariables = payload as IDictionary <string, object>;
                execution.Variables = processVariables;
            }

            if (activity == execution.Activity)
            {
                execution.Signal("signal", null);
            }
            else
            {
                // hack around the fact that the start event is refrenced by event subscriptions for event subprocesses
                // and not the subprocess itself
                if (activity.ActivityBehavior is EventSubProcessStartEventActivityBehavior)
                {
                    activity = (ActivityImpl)activity.FlowScope;
                }

                execution.ExecuteEventHandlerActivity(activity);
            }
        }
コード例 #21
0
        protected internal virtual void ProcessEventSync(object payload)
        {
            IEventHandler eventHandler = context.Impl.Context.ProcessEngineConfiguration.getEventHandler(EventType);

            EnsureUtil.EnsureNotNull("Could not find eventhandler for event of type '" + EventType + "'", "eventHandler", eventHandler);
            eventHandler.HandleEvent(this, payload, context.Impl.Context.CommandContext);
        }
コード例 #22
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);
        }
コード例 #23
0
        public virtual object Execute(CommandContext commandContext)
        {
            var attachment =
                (AttachmentEntity)
                commandContext.AttachmentManager.FindAttachmentByTaskIdAndAttachmentId(TaskId, AttachmentId);

            EnsureUtil.EnsureNotNull(
                "No attachment exist for ITask id '" + TaskId + " and attachmentId '" + AttachmentId + "'.", "attachment",
                attachment);

            commandContext.AttachmentManager.Delete(attachment);

            if (!ReferenceEquals(attachment.ContentId, null))
            {
                commandContext.ByteArrayManager.DeleteByteArrayById(attachment.ContentId);
            }

            if (!ReferenceEquals(attachment.TaskId, null))
            {
                TaskEntity task = commandContext.TaskManager.FindTaskById(attachment.TaskId);

                PropertyChange propertyChange = new PropertyChange("name", null, attachment.Name);

                commandContext.OperationLogManager.LogAttachmentOperation(
                    UserOperationLogEntryFields.OperationTypeDeleteAttachment, task, propertyChange);
            }

            return(null);
        }
 public virtual IUpdateProcessDefinitionSuspensionStateBuilder /*UpdateProcessDefinitionSuspensionStateBuilderImpl*/ ByProcessDefinitionId(
     string processDefinitionId)
 {
     EnsureUtil.EnsureNotNull("processDefinitionId", processDefinitionId);
     this.processDefinitionId = processDefinitionId;
     return(this);
 }
コード例 #25
0
 protected internal virtual void Validate()
 {
     EnsureUtil.EnsureOnlyOneNotNull("Authorization must either have a 'userId' or a 'groupId'.", Authorization.UserId,
                                     Authorization.GroupId);
     EnsureUtil.EnsureNotNull("Authorization 'resourceType' cannot be null.", "authorization.getResource()",
                              Authorization.GetResource());
 }
 public virtual UpdateProcessDefinitionSuspensionStateBuilderImpl byProcessDefinitionKey(
     string processDefinitionKey)
 {
     EnsureUtil.EnsureNotNull("processDefinitionKey", processDefinitionKey);
     this.processDefinitionKey = processDefinitionKey;
     return(this);
 }
コード例 #27
0
        /// <param name="args"> </param>
        public static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                throw LOG.InvokeSchemaResourceToolException(args.Length);
            }

            var configurationFileResourceName = args[0];
            var schemaFileResourceName        = args[1];

            EnsureUtil.EnsureNotNull("Process engine configuration file name cannot be null",
                                     "configurationFileResourceName", configurationFileResourceName);
            EnsureUtil.EnsureNotNull("Schema resource file name cannot be null", "schemaFileResourceName",
                                     schemaFileResourceName);

            var configuration =
                (ProcessEngineConfigurationImpl)
                ProcessEngineConfiguration.CreateProcessEngineConfigurationFromResource(
                    configurationFileResourceName);
            var processEngine = configuration.BuildProcessEngine();

            configuration.CommandExecutorTxRequired.Execute(new CommandAnonymousInnerClass(schemaFileResourceName));

            processEngine.Close();
        }
コード例 #28
0
ファイル: DeleteGroupCmd.cs プロジェクト: zf321/ESS.FW.Bpm
        protected internal override object ExecuteCmd(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("groupId", GroupId);
            commandContext.WritableIdentityProvider.DeleteGroup(GroupId);

            return(null);
        }
コード例 #29
0
        public virtual object Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("userId", UserId);

            IdentityInfoEntity pictureInfo = commandContext.IdentityInfoManager.FindUserInfoByUserIdAndKey(UserId,
                                                                                                           "picture");

            if (pictureInfo != null)
            {
                string byteArrayId = pictureInfo.Value;
                if (!ReferenceEquals(byteArrayId, null))
                {
                    commandContext.ByteArrayManager.DeleteByteArrayById(byteArrayId);
                }
            }
            else
            {
                pictureInfo        = new IdentityInfoEntity();
                pictureInfo.UserId = UserId;
                pictureInfo.Key    = "picture";
                commandContext.IdentityInfoManager.Add(pictureInfo);
            }

            var byteArrayEntity = new ResourceEntity(Picture.MimeType, Picture.Bytes);

            commandContext.ByteArrayManager.Add(byteArrayEntity);

            pictureInfo.Value = byteArrayEntity.Id;
            return(null);
        }
コード例 #30
0
 protected internal override void CheckInvalidDefinitionWasCached(string deploymentId, string definitionId,
                                                                  DecisionDefinitionEntity definition)
 {
     EnsureUtil.EnsureNotNull(
         "deployment '" + deploymentId + "' didn't put decision definition '" + definitionId + "' in the cache",
         "cachedDecisionDefinition", definition);
 }