Exemplo n.º 1
0
        protected internal virtual void CreateEventListeners(BpmnParse bpmnParse, IList <EventListener> eventListeners)
        {
            if (eventListeners != null && eventListeners.Count > 0)
            {
                foreach (EventListener eventListener in eventListeners)
                {
                    // Extract specific event-types (if any)
                    ActivitiEventType[] types = ActivitiEventType.GetTypesFromString(eventListener.Events);

                    if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.Equals(eventListener.ImplementationType))
                    {
                        GetEventSupport(bpmnParse.BpmnModel).AddEventListener(bpmnParse.ListenerFactory.CreateClassDelegateEventListener(eventListener), types);
                    }
                    else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.Equals(eventListener.ImplementationType))
                    {
                        GetEventSupport(bpmnParse.BpmnModel).AddEventListener(bpmnParse.ListenerFactory.CreateDelegateExpressionEventListener(eventListener), types);
                    }
                    else if (ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT.Equals(eventListener.ImplementationType) || ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT.Equals(eventListener.ImplementationType) || ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT.Equals(eventListener.ImplementationType) || ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT.Equals(eventListener.ImplementationType))
                    {
                        GetEventSupport(bpmnParse.BpmnModel).AddEventListener(bpmnParse.ListenerFactory.CreateEventThrowingEventListener(eventListener), types);
                    }
                    else
                    {
                        logger.LogWarning("Unsupported implementation type for EventListener: " + eventListener.ImplementationType + " for element " + bpmnParse.CurrentFlowElement.Id);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public CustomTaskCompletedEntityEventImpl(ITaskEntity entity, ActivitiEventType type) :
     base(entity, type)
 {
     ExecutionId         = entity.ExecutionId;
     ProcessInstanceId   = entity.ProcessInstanceId;
     ProcessDefinitionId = entity.ProcessDefinitionId;
 }
 public ActivitiEntityEventImpl(object entity, ActivitiEventType type) : base(type)
 {
     if (entity == null)
     {
         throw new ActivitiIllegalArgumentException("Entity cannot be null.");
     }
     this.entity = entity;
 }
Exemplo n.º 4
0
 public ActivitiTaskReturnToEventImpl(object entity, ActivitiEventType type, string activityId) : base(type)
 {
     if (entity == null)
     {
         throw new ActivitiIllegalArgumentException("Entity cannot be null.");
     }
     this.entity     = entity;
     this.activityId = activityId;
 }
Exemplo n.º 5
0
        /// <param name="type">
        ///          type of event </param>
        /// <param name="entity">
        ///          the entity this event targets </param>
        /// <returns> an <seealso cref="IActivitiEntityEvent"/>. In case an <seealso cref="ExecutionContext"/> is active, the execution related event fields will be populated. If not, execution details will be retrieved from the
        ///         <seealso cref="Object"/> if possible. </returns>
        public static IActivitiEntityEvent CreateEntityEvent(ActivitiEventType type, object entity)
        {
            ActivitiEntityEventImpl newEvent = new ActivitiEntityEventImpl(entity, type);

            // In case an execution-context is active, populate the event fields
            // related to the execution
            PopulateEventWithCurrentContext(newEvent);
            return(newEvent);
        }
Exemplo n.º 6
0
        public static IActivitiMembershipEvent CreateMembershipEvent(ActivitiEventType type, string groupId, string userId)
        {
            ActivitiMembershipEventImpl newEvent = new ActivitiMembershipEventImpl(type)
            {
                UserId  = userId,
                GroupId = groupId
            };

            return(newEvent);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new event implementation, part of an execution context.
 /// </summary>
 public ActivitiEventImpl(ActivitiEventType type, string executionId, string processInstanceId, string processDefinitionId)
 {
     if (type == null)
     {
         throw new ActivitiIllegalArgumentException("type is null");
     }
     this.type                = type;
     this.executionId         = executionId;
     this.processInstanceId   = processInstanceId;
     this.processDefinitionId = processDefinitionId;
 }
Exemplo n.º 8
0
        public static IActivitiEvent CreateEvent(ActivitiEventType type, string executionId, string processInstanceId, string processDefinitionId)
        {
            ActivitiEventImpl newEvent = new ActivitiEventImpl(type)
            {
                ExecutionId         = executionId,
                ProcessDefinitionId = processDefinitionId,
                ProcessInstanceId   = processInstanceId
            };

            return(newEvent);
        }
Exemplo n.º 9
0
        /// <param name="type">
        ///          type of event </param>
        /// <param name="entity">
        ///          the entity this event targets </param>
        /// <param name="cause">
        ///          the cause of the event </param>
        /// <returns> an <seealso cref="IActivitiEntityEvent"/> that is also instance of <seealso cref="IActivitiExceptionEvent"/>. </returns>
        public static IActivitiEntityEvent CreateEntityExceptionEvent(ActivitiEventType type, object entity, Exception cause, string executionId, string processInstanceId, string processDefinitionId)
        {
            ActivitiEntityExceptionEventImpl newEvent = new ActivitiEntityExceptionEventImpl(entity, type, cause)
            {
                ExecutionId         = executionId,
                ProcessInstanceId   = processInstanceId,
                ProcessDefinitionId = processDefinitionId
            };

            return(newEvent);
        }
Exemplo n.º 10
0
        public static IActivitiSignalEvent CreateSignalEvent(ActivitiEventType type, string activityId, string signalName, object signalData, string executionId, string processInstanceId, string processDefinitionId)
        {
            ActivitiSignalEventImpl newEvent = new ActivitiSignalEventImpl(type)
            {
                ActivityId          = activityId,
                ExecutionId         = executionId,
                ProcessDefinitionId = processDefinitionId,
                ProcessInstanceId   = processInstanceId,
                SignalName          = signalName,
                SignalData          = signalData
            };

            return(newEvent);
        }
Exemplo n.º 11
0
        public static IActivitiMessageEvent CreateMessageEvent(ActivitiEventType type, string activityId, string messageName, object payload, string executionId, string processInstanceId, string processDefinitionId)
        {
            ActivitiMessageEventImpl newEvent = new ActivitiMessageEventImpl(type)
            {
                ActivityId          = activityId,
                ExecutionId         = executionId,
                ProcessDefinitionId = processDefinitionId,
                ProcessInstanceId   = processInstanceId,
                MessageName         = messageName,
                MessageData         = payload
            };

            return(newEvent);
        }
Exemplo n.º 12
0
        public static IActivitiErrorEvent CreateErrorEvent(ActivitiEventType type, string activityId, string errorId, string errorCode, string executionId, string processInstanceId, string processDefinitionId)
        {
            ActivitiErrorEventImpl newEvent = new ActivitiErrorEventImpl(type)
            {
                ActivityId          = activityId,
                ExecutionId         = executionId,
                ProcessDefinitionId = processDefinitionId,
                ProcessInstanceId   = processInstanceId,
                ErrorId             = errorId,
                ErrorCode           = errorCode
            };

            return(newEvent);
        }
Exemplo n.º 13
0
        public static IActivitiVariableEvent CreateVariableEvent(ActivitiEventType type, string variableName, object variableValue, IVariableType variableType, string taskId, string executionId, string processInstanceId, string processDefinitionId)
        {
            ActivitiVariableEventImpl newEvent = new ActivitiVariableEventImpl(type)
            {
                VariableName        = variableName,
                VariableValue       = variableValue,
                VariableType        = variableType,
                TaskId              = taskId,
                ExecutionId         = executionId,
                ProcessDefinitionId = processDefinitionId,
                ProcessInstanceId   = processInstanceId
            };

            return(newEvent);
        }
Exemplo n.º 14
0
        public static IActivitiActivityEvent CreateActivityEvent(ActivitiEventType type, string activityId, string activityName, string executionId, string processInstanceId, string processDefinitionId, FlowElement flowElement)
        {
            ActivitiActivityEventImpl newEvent = new ActivitiActivityEventImpl(type)
            {
                ActivityId          = activityId,
                ActivityName        = activityName,
                ExecutionId         = executionId,
                ProcessDefinitionId = processDefinitionId,
                ProcessInstanceId   = processInstanceId
            };

            if (flowElement is FlowNode flowNode)
            {
                newEvent.ActivityType = ParseActivityType(flowNode);
                object behaviour = flowNode.Behavior;
                if (behaviour != null)
                {
                    newEvent.BehaviorClass = behaviour.GetType().FullName;
                }
            }

            return(newEvent);
        }
Exemplo n.º 15
0
 public virtual void AddEventHandler(ActivitiEventType eventType, Type eventHandlerClass)
 {
     eventHandlers[eventType] = eventHandlerClass;
 }
 public ActivitiEntityWithVariablesEventImpl(object entity, IDictionary <string, object> variables, bool localScope, ActivitiEventType type) : base(entity, type)
 {
     this.variables  = variables;
     this.localScope = localScope;
 }
Exemplo n.º 17
0
 public ActivitiErrorEventImpl(ActivitiEventType type) : base(type)
 {
 }
Exemplo n.º 18
0
 public ActivitiSignalEventImpl(ActivitiEventType type) : base(type)
 {
 }
 public ActivitiMembershipEventImpl(ActivitiEventType type) : base(type)
 {
 }
 public ActivitiVariableEventImpl(ActivitiEventType type) : base(type)
 {
 }
Exemplo n.º 21
0
        protected internal virtual void AddTypedEventListener(IActivitiEventListener listener, ActivitiEventType type)
        {
            typedListeners.TryGetValue(type, out IList <IActivitiEventListener> listeners);
            if (listeners == null)
            {
                // Add an empty list of listeners for this type
                listeners = new List <IActivitiEventListener>(); // SynchronizedCollection<IActivitiEventListener>();
                typedListeners.TryAdd(type, listeners);
            }

            if (!listeners.Contains(listener))
            {
                listeners.Add(listener);
            }
        }
Exemplo n.º 22
0
        /// <param name="type">
        ///          type of event </param>
        /// <returns> an <seealso cref="IActivitiEvent"/> that doesn't have it's execution context-fields filled, as the event is a global event, independent of any running execution. </returns>
        public static IActivitiEvent CreateGlobalEvent(ActivitiEventType type)
        {
            ActivitiEventImpl newEvent = new ActivitiEventImpl(type);

            return(newEvent);
        }
Exemplo n.º 23
0
 /// <summary>
 /// Creates a new event implementation, not part of an execution context.
 /// </summary>
 public ActivitiEventImpl(ActivitiEventType type) : this(type, null, null, null)
 {
 }
Exemplo n.º 24
0
        /// <param name="type">
        ///          type of event </param>
        /// <param name="entity">
        ///          the entity this event targets </param>
        /// <param name="variables">
        ///          the variables associated with this entity </param>
        /// <returns> an <seealso cref="IActivitiEntityEvent"/>. In case an <seealso cref="ExecutionContext"/> is active, the execution related event fields will be populated. If not, execution details will be retrieved from the
        ///         <seealso cref="Object"/> if possible. </returns>
        public static IActivitiEntityWithVariablesEvent CreateEntityWithVariablesEvent(ActivitiEventType type, object entity, IDictionary <string, object> variables, bool localScope)
        {
            ActivitiEntityWithVariablesEventImpl newEvent = new ActivitiEntityWithVariablesEventImpl(entity, variables, localScope, type);

            // In case an execution-context is active, populate the event fields
            // related to the execution
            PopulateEventWithCurrentContext(newEvent);
            return(newEvent);
        }
Exemplo n.º 25
0
        ///
        /// <returns> an <seealso cref="IActivitiEntityEvent"/> </returns>
        public static IActivitiEntityEvent CreateCustomTaskCompletedEvent(ITaskEntity entity, ActivitiEventType type)
        {
            CustomTaskCompletedEntityEventImpl newEvent = new CustomTaskCompletedEntityEventImpl(entity, type);

            return(newEvent);
        }
Exemplo n.º 26
0
        public static IActivitiSequenceFlowTakenEvent CreateSequenceFlowTakenEvent(IExecutionEntity executionEntity, ActivitiEventType type, string sequenceFlowId, string sourceActivityId, string sourceActivityName, string sourceActivityType, object sourceActivityBehavior, string targetActivityId, string targetActivityName, string targetActivityType, object targetActivityBehavior)
        {
            ActivitiSequenceFlowTakenEventImpl newEvent = new ActivitiSequenceFlowTakenEventImpl(type);

            if (executionEntity != null)
            {
                newEvent.ExecutionId         = executionEntity.Id;
                newEvent.ProcessInstanceId   = executionEntity.ProcessInstanceId;
                newEvent.ProcessDefinitionId = executionEntity.ProcessDefinitionId;
            }

            newEvent.Id = sequenceFlowId;
            newEvent.SourceActivityId            = sourceActivityId;
            newEvent.SourceActivityName          = sourceActivityName;
            newEvent.SourceActivityType          = sourceActivityType;
            newEvent.SourceActivityBehaviorClass = sourceActivityBehavior?.GetType().FullName;
            newEvent.TargetActivityId            = targetActivityId;
            newEvent.TargetActivityName          = targetActivityName;
            newEvent.TargetActivityType          = targetActivityType;
            newEvent.TargetActivityBehaviorClass = targetActivityBehavior?.GetType().FullName;

            return(newEvent);
        }
 public ActivitiSequenceFlowTakenEventImpl(ActivitiEventType type) : base(type)
 {
 }
Exemplo n.º 28
0
 public ActivitiActivityEventImpl(ActivitiEventType type) : base(type)
 {
 }
Exemplo n.º 29
0
 public ActivitiMessageEventImpl(ActivitiEventType type) : base(type)
 {
 }