Beispiel #1
0
            public Void execute(CommandContext commandContext)
            {
                DateTime calendar = new GregorianCalendar();


                EventSubscriptionEntity messageEventSubscriptionEntity1 = new EventSubscriptionEntity(EventType.MESSAGE);

                messageEventSubscriptionEntity1.EventName  = "messageName";
                messageEventSubscriptionEntity1.ActivityId = "someActivity";
                calendar = new DateTime(2001, 1, 1);
                messageEventSubscriptionEntity1.Created = calendar;
                messageEventSubscriptionEntity1.insert();

                EventSubscriptionEntity messageEventSubscriptionEntity2 = new EventSubscriptionEntity(EventType.MESSAGE);

                messageEventSubscriptionEntity2.EventName  = "messageName";
                messageEventSubscriptionEntity2.ActivityId = "someActivity";
                calendar = new DateTime(2000, 1, 1);
                messageEventSubscriptionEntity2.Created = calendar;
                messageEventSubscriptionEntity2.insert();

                EventSubscriptionEntity signalEventSubscriptionEntity3 = new EventSubscriptionEntity(EventType.SIGNAL);

                signalEventSubscriptionEntity3.EventName  = "messageName2";
                signalEventSubscriptionEntity3.ActivityId = "someOtherActivity";
                calendar = new DateTime(2002,1,1);
                signalEventSubscriptionEntity3.Created = calendar;
                signalEventSubscriptionEntity3.insert();

                return(null);
            }
Beispiel #2
0
        /// <summary>
        /// Creates and inserts a subscription entity depending on the message type of this declaration.
        /// </summary>
        public virtual EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution)
        {
            EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType);

            string eventName = resolveExpressionOfEventName(execution);

            eventSubscriptionEntity.EventName = eventName;
            if (!string.ReferenceEquals(activityId, null))
            {
                ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
                eventSubscriptionEntity.Activity = activity;
            }

            eventSubscriptionEntity.insert();
            LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity);

            return(eventSubscriptionEntity);
        }