private string TryAddExecutionPointer(string pathId, BaseFlowNode flowNode, ICollection <MessageToken> outcomeValues = null)
        {
            ICollection <MessageToken> incoming = new List <MessageToken>();

            if (outcomeValues != null)
            {
                incoming = outcomeValues;
            }

            var instanceId = string.Empty;

            if (!TryAddInstance(flowNode, pathId, out instanceId))
            {
                var pointer = GetActiveExecutionPointer(pathId, instanceId);
                if (pointer != null)
                {
                    var e = new IncomingTokenAddedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, pointer.ExecutionPathId, pointer.Id, JsonConvert.SerializeObject(incoming), DateTime.UtcNow);
                    Handle(e);
                    DomainEvents.Add(e);
                    return(pointer.Id);
                }
            }

            var id  = Guid.NewGuid().ToString();
            var evt = new ExecutionPointerAddedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, id, pathId, instanceId, flowNode.EltId, JsonConvert.SerializeObject(incoming), DateTime.UtcNow);

            Handle(evt);
            DomainEvents.Add(evt);
            return(id);
        }
        public void AddFlowNodeDef(BaseFlowNode node)
        {
            var evt = new FlowNodeDefCreatedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, JsonConvert.SerializeObject(node), DateTime.UtcNow);

            Handle(evt);
            DomainEvents.Add(evt);
        }
        private void Handle(FlowNodeDefCreatedEvent evt)
        {
            var elt = BaseFlowNode.Deserialize(evt.SerializedContent);

            ElementDefs.Add(elt);
            Version        = evt.Version;
            UpdateDateTime = evt.UpdateDateTime;
        }
 private bool TryAddInstance(BaseFlowNode node, string pathId, out string instanceId)
 {
     return(TryAddInstance(node.EltId, pathId, out instanceId));
 }
예제 #5
0
 protected void FeedFlowNode(BaseFlowNode node)
 {
     FeedFlowElt(node);
 }