Exemplo n.º 1
0
        protected internal virtual SignalEventDefinition createSignalEventDefinition(string signalName)
        {
            Signal signal = findSignalForName(signalName);
            SignalEventDefinition signalEventDefinition = createInstance(typeof(SignalEventDefinition));

            signalEventDefinition.Signal = signal;
            return(signalEventDefinition);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets an event definition for the given signal name. If already a signal
        /// with this name exists it will be used, otherwise a new signal is created.
        /// </summary>
        /// <param name="signalName"> the name of the signal </param>
        /// <returns> the builder object </returns>
        public virtual B signal(string signalName)
        {
            SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);

            element.EventDefinitions.add(signalEventDefinition);

            return(myself);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets an event definition for the given Signal name. If a signal with this
        /// name already exists it will be used, otherwise a new signal is created.
        /// It returns a builder for the Signal Event Definition.
        /// </summary>
        /// <param name="signalName"> the name of the signal </param>
        /// <returns> the signal event definition builder object </returns>
        public virtual SignalEventDefinitionBuilder signalEventDefinition(string signalName)
        {
            SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);

            element.EventDefinitions.add(signalEventDefinition);

            return(new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition));
        }
Exemplo n.º 4
0
        public override BaseElement Clone()
        {
            SignalEventDefinition clone = new SignalEventDefinition
            {
                Values = this
            };

            return(clone);
        }
Exemplo n.º 5
0
        protected internal virtual void WriteSignalDefinition(Event parentEvent, SignalEventDefinition signalDefinition, XMLStreamWriter xtw)
        {
            xtw.WriteStartElement(BpmnXMLConstants.BPMN_PREFIX, BpmnXMLConstants.ELEMENT_EVENT_SIGNALDEFINITION, BpmnXMLConstants.BPMN2_NAMESPACE);
            WriteDefaultAttribute(BpmnXMLConstants.ATTRIBUTE_SIGNAL_REF, signalDefinition.SignalRef, xtw);
            if (parentEvent is ThrowEvent && signalDefinition.Async)
            {
                BpmnXMLUtil.WriteQualifiedAttribute(BpmnXMLConstants.ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, "true", xtw);
            }
            bool didWriteExtensionStartElement = BpmnXMLUtil.WriteExtensionElements(signalDefinition, false, xtw);

            if (didWriteExtensionStartElement)
            {
                xtw.WriteEndElement();
            }
            xtw.WriteEndElement();
        }
Exemplo n.º 6
0
        protected internal virtual void HandleSignalEventDefinition(BpmnModel bpmnModel, Process process, Event @event, EventDefinition eventDefinition, IList <ValidationError> errors)
        {
            SignalEventDefinition signalEventDefinition = (SignalEventDefinition)eventDefinition;

            if (string.IsNullOrWhiteSpace(signalEventDefinition.SignalRef))
            {
                if (string.IsNullOrWhiteSpace(signalEventDefinition.SignalExpression))
                {
                    AddError(errors, ProblemsConstants.SIGNAL_EVENT_MISSING_SIGNAL_REF, process, @event, ProcessValidatorResource.SIGNAL_EVENT_MISSING_SIGNAL_REF);
                }
            }
            else if (!bpmnModel.ContainsSignalId(signalEventDefinition.SignalRef))
            {
                AddError(errors, ProblemsConstants.SIGNAL_EVENT_INVALID_SIGNAL_REF, process, @event, ProcessValidatorResource.SIGNAL_EVENT_INVALID_SIGNAL_REF);
            }
        }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void getEventDefinition()
        public virtual void getEventDefinition()
        {
            SignalEventDefinition eventDefinition = eventDefinitionQuery.filterByType(typeof(SignalEventDefinition)).singleResult();

            assertThat(eventDefinition).NotNull;
            assertThat(eventDefinition.CamundaAsync).False;

            eventDefinition.CamundaAsync = true;
            assertThat(eventDefinition.CamundaAsync).True;

            Signal signal = eventDefinition.Signal;

            assertThat(signal).NotNull;
            assertThat(signal.Id).isEqualTo("signal");
            assertThat(signal.Name).isEqualTo("signal");
            assertThat(signal.Structure.Id).isEqualTo("itemDef");
        }
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Event))
            {
                return;
            }

            SignalEventDefinition eventDefinition = new SignalEventDefinition();

            BpmnXMLUtil.AddXMLLocation(eventDefinition, xtr);
            eventDefinition.SignalRef        = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_SIGNAL_REF);
            eventDefinition.SignalExpression = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_SIGNAL_EXPRESSION);
            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_ACTIVITY_ASYNCHRONOUS)))
            {
                eventDefinition.Async = bool.Parse(xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_ACTIVITY_ASYNCHRONOUS));
            }

            BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_EVENT_SIGNALDEFINITION, eventDefinition, xtr, model);

            ((Event)parentElement).EventDefinitions.Add(eventDefinition);
        }
        public IntermediateThrowSignalEventActivityBehavior(SignalEventDefinition signalEventDefinition, Signal signal)
        {
            if (signal != null)
            {
                signalEventName = signal.Name;
                if (Signal.SCOPE_PROCESS_INSTANCE.Equals(signal.Scope))
                {
                    this.processInstanceScope = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(signalEventDefinition.SignalRef))
            {
                signalEventName = signalEventDefinition.SignalRef;
            }
            else
            {
                signalExpression = signalEventDefinition.SignalExpression;
            }

            this.signalEventDefinition = signalEventDefinition;
        }
Exemplo n.º 10
0
        protected internal virtual void restoreSignalStartEvent(IProcessDefinition previousProcessDefinition, BpmnModel bpmnModel, StartEvent startEvent, EventDefinition eventDefinition)
        {
            SignalEventDefinition          signalEventDefinition = (SignalEventDefinition)eventDefinition;
            ISignalEventSubscriptionEntity subscriptionEntity    = EventSubscriptionEntityManager.CreateSignalEventSubscription();
            Signal signal = bpmnModel.GetSignal(signalEventDefinition.SignalRef);

            if (signal != null)
            {
                subscriptionEntity.EventName = signal.Name;
            }
            else
            {
                subscriptionEntity.EventName = signalEventDefinition.SignalRef;
            }
            subscriptionEntity.ActivityId          = startEvent.Id;
            subscriptionEntity.ProcessDefinitionId = previousProcessDefinition.Id;
            if (!ReferenceEquals(previousProcessDefinition.TenantId, null))
            {
                subscriptionEntity.TenantId = previousProcessDefinition.TenantId;
            }

            EventSubscriptionEntityManager.Insert(subscriptionEntity);
        }
Exemplo n.º 11
0
 protected internal AbstractSignalEventDefinitionBuilder(BpmnModelInstance modelInstance, SignalEventDefinition element, Type selfType) : base(modelInstance, element, selfType)
 {
 }
 public virtual BoundarySignalEventActivityBehavior CreateBoundarySignalEventActivityBehavior(BoundaryEvent boundaryEvent, SignalEventDefinition signalEventDefinition, Signal signal, bool interrupting)
 {
     return(new BoundarySignalEventActivityBehavior(signalEventDefinition, signal, interrupting));
 }
 public BoundarySignalEventActivityBehavior(SignalEventDefinition signalEventDefinition, Signal signal, bool interrupting) : base(interrupting)
 {
     this.signalEventDefinition = signalEventDefinition;
     this.signal = signal;
 }
 public virtual IntermediateCatchSignalEventActivityBehavior CreateIntermediateCatchSignalEventActivityBehavior(IntermediateCatchEvent intermediateCatchEvent, SignalEventDefinition signalEventDefinition, Signal signal)
 {
     return(new IntermediateCatchSignalEventActivityBehavior(signalEventDefinition, signal));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="eventPublisher"></param>
 /// <param name="signalEventDefinition"></param>
 /// <param name="signal"></param>
 public BroadcastSignalEventActivityBehavior(IApplicationEventPublisher eventPublisher, SignalEventDefinition signalEventDefinition, Signal signal) : base(signalEventDefinition, signal)
 {
     this.eventPublisher = eventPublisher;
 }
        public override object Create(object parent, IParseContext context, XElement element)
        {
            EventDefinition eventDefinition = null;
            var             localName       = Helper.GetRealLocalName(element);

            switch (localName)
            {
            case "cancelEventDefinition":
                eventDefinition = new CancelEventDefinition();
                break;

            case "errorEventDefinition":
                var errorEventDefinition = new ErrorEventDefinition();
                eventDefinition = errorEventDefinition;
                var errorRef = element.GetAttribute("errorRef");
                if (errorRef != null)
                {
                    context.AddReferenceRequest <Error>(errorRef, x => errorEventDefinition.ErrorRef = x);
                }
                break;

            case "timerEventDefinition":
                eventDefinition = new TimerEventDefinition();
                break;

            case "terminateEventDefinition":
                eventDefinition = new TerminateEventDefinition();
                break;

            case "messageEventDefinition":
                var messageEventDefinition = new MessageEventDefinition();
                eventDefinition = messageEventDefinition;

                var operationRef = element.GetAttribute("operationRef");
                if (operationRef != null)
                {
                    context.AddReferenceRequest <Operation>(operationRef, x => messageEventDefinition.OperationRef = x);
                }

                var messageRef = element.GetAttribute("messageRef");
                if (messageRef != null)
                {
                    context.AddReferenceRequest <Message>(messageRef, x => messageEventDefinition.MessageRef = x);
                }
                break;

            case "conditionalEventDefinition":
                eventDefinition = new ConditionalEventDefinition();
                break;

            case "compensateEventDefinition":
                var compensateEventDefinition = new CompensateEventDefinition();
                eventDefinition = compensateEventDefinition;

                compensateEventDefinition.WaitForCompletion = element.GetBoolean("waitForCompletion");
                var activityRef = element.GetAttribute("activityRef");
                if (activityRef != null)
                {
                    context.AddReferenceRequest <Activity>(activityRef, x => compensateEventDefinition.ActivityRef = x);
                }
                break;

            case "signalEventDefinition":
                var signalEventDefinition = new SignalEventDefinition();
                eventDefinition = signalEventDefinition;

                var signalRef = element.GetAttribute("signalRef");
                if (signalRef != null)
                {
                    context.AddReferenceRequest <Signal>(signalRef, x => signalEventDefinition.SignalRef = x);
                }
                break;

            case "escalationEventDefinition":
                eventDefinition = new EscalationEventDefinition()
                {
                    EscalationRef = element.GetAttribute("escalationRef")
                };
                break;

            case "linkEventDefinition":
                eventDefinition = new LinkEventDefinition()
                {
                    Name   = element.GetAttribute("name"),
                    Target = element.GetAttribute("target")
                };
                break;
            }

            if (this.callback != null)
            {
                this.callback(parent, context, element, eventDefinition);
            }

            base.Init(eventDefinition, context, element);

            context.Push(eventDefinition);

            return(eventDefinition);
        }
 public IntermediateCatchSignalEventActivityBehavior(SignalEventDefinition signalEventDefinition, Signal signal)
 {
     this.signalEventDefinition = signalEventDefinition;
     this.signal = signal;
 }
 public virtual IntermediateThrowSignalEventActivityBehavior CreateIntermediateThrowSignalEventActivityBehavior(ThrowEvent throwEvent, SignalEventDefinition signalEventDefinition, Signal signal)
 {
     return(new IntermediateThrowSignalEventActivityBehavior(signalEventDefinition, signal));
 }