private GraphNode GetGraphNode(IFlowNode node) { GraphNode graphNode; nodeList.TryGetValue(node.GetID(), out graphNode); return(graphNode); }
public static string ToCategory([NotNull] this IFlowNode node) { if (node is IFaultHandlerNode) { return(Categories.FaultHandlerNode); } switch (node.Kind) { case FlowNodeKind.Activity: return(Categories.ActivityNode); case FlowNodeKind.Condition: return(Categories.ConditionNode); case FlowNodeKind.Switch: return(Categories.SwitchNode); case FlowNodeKind.ForkJoin: return(Categories.ForkJoinNode); case FlowNodeKind.Block: return(Categories.BlockNode); default: throw new ArgumentOutOfRangeException(); } }
private void AddReachable(IFlowNode node) { if (node != null) { myReachableNodes.Add(node); } }
public FlowNodeStatusChangedEventArgs(IFlowNode node, FlowNodeStatus newStatus, MessageHeader header, IMessageBody body) { Node = node ?? throw new ArgumentNullException(nameof(node)); NewStatus = newStatus; Header = header; Body = body; }
public UnslicedNode(IFlowNode node, float width, float height, WrapMode forceWrap) { Node = node; Width = width; Height = height; ForceWrap = forceWrap; }
private void CheckSelfReference(IFlowNode from, IFlowNode to) { if (ReferenceEquals(from, to)) { Result.AddError(from, "Node points to itself"); } }
public void AddError([NotNull] IFlowNode node, [NotNull] string errorMessage) { node.AssertNotNull("node != null"); errorMessage.AssertNotNullOrEmpty("Error message cannot be null or empty"); myErrors.Add(new ValidationError(node, errorMessage)); }
private void CheckActivityType([NotNull] Type activityType, [NotNull] IFlowNode node) { #if PORTABLE var typeInfo = activityType.GetTypeInfo(); #else var typeInfo = activityType; #endif if (typeInfo.IsAbstract) { Result.AddError(node, $"Activity {activityType.Name} is abstract and cannot be instanciated"); return; } if (typeInfo.IsGenericTypeDefinition) { Result.AddError(node, $"Activity {activityType.Name} is generic type definition and cannot be instanciated"); return; } #if PORTABLE if (!typeInfo.DeclaredConstructors.Any(c => !c.IsStatic && c.IsPublic)) { Result.AddError(node, $"Activity {activityType.Name} has no public constructors"); } #else if (typeInfo.GetConstructors(BindingFlags.Public | BindingFlags.Instance).Length == 0) { Result.AddError(node, $"Activity {activityType.Name} has no public constructors"); } #endif }
private Task ExecuteNextNode([NotNull] IActivityNode node, [NotNull] Task task) { if (task.IsCanceled) { Log.Info("At node: {0}. Cancelled", node); IFlowNode handlerNode = node.CancellationHandler; Debug.Assert(handlerNode != null); return(handlerNode.Accept(this)); } if (task.IsFaulted) { string message = $"At node: {node}. Faulted"; Log.Exception(message, task.Exception); IFaultHandlerNode handlerNode = node.FaultHandler; Debug.Assert(handlerNode != null); return(handlerNode.Accept(this)); } Log.Info("At node: {0}. Completed", node); if (node.PointsTo != null) { return(node.PointsTo.Accept(this)); } return(TaskHelper.CompletedTask); }
public void CheckFlowWithBlock() { // Arrange var b = new FlowBuilder(); IFlowNode a = null; IFlowNode e = null; var block = b.Block("test", (_, builder) => { a = builder.DummyActivity(); e = builder.DummyActivity(); }); b.WithInitialNode(block); var validator = new ReachabilityValidator(); // Act validator.Validate(b.CreateFlow()); var result = validator.Result; // Assert Assert.That(result.GetErrorsOf(block), Is.Empty); Assert.That(result.GetErrorsOf(a), Is.Empty); Assert.That(result.GetErrorsOf(e), Is.Not.Empty); }
void CreateSMAction(IFlow flow, IFlowNode from, IFlowNode to, int beginIndex, int endIndex) { var fa = flow.CreateAction(from, to) as StateMachine.CIIPXpoTransition; fa.BeginItemPointIndex = beginIndex; fa.EndItemPointIndex = endIndex; }
private void AddLink( [NotNull] IFlowNode from, [CanBeNull] IFlowNode to, [CanBeNull] string category = null, [CanBeNull] string label = null) { AddLink(from.Id, to?.Id, category, label); }
void CreateAction(IFlow flow, IFlowNode from, IFlowNode to, int beginIndex, int endIndex) { var fa = flow.CreateAction(from, to) as FlowAction; fa.Created(); fa.BeginItemPointIndex = beginIndex; fa.EndItemPointIndex = endIndex; }
public ValidationError([NotNull] IFlowNode node, [NotNull] string message) { node.AssertNotNull("node != null"); NodeId = node.Id; NodeName = node.Name; Message = message.NotNull(); }
public SwitchNode <TChoice> ConnectDefaultTo([NotNull] IFlowNode node) { node.AssertNotNull("node != null"); DefaultCase.AssertIsNull("Default case is already set"); DefaultCase = node; return(this); }
public IFlowNode Select([NotNull] TChoice choice) { IFlowNode node = FindCaseHandler(choice) ?? DefaultCase; node.AssertNotNull("No such case handler"); return(node); }
public override void RemoveConnections() { DefaultCase = null; myCases.Clear(); Choice = null; myCompiledChoice = null; }
public SwitchNode <TChoice> To([NotNull] IFlowNode node) { node.AssertNotNull("node != null"); mySwitchNode.AddCase(myChoice, node); return(mySwitchNode); }
public BlockNode AddNode([NotNull] IFlowNode node) { node.AssertNotNull("node != null"); node.AssertIsNotItemOf(myNodes, "Node is already in the block"); myNodes.Add(node); return(this); }
public ConditionNode ConnectFalseTo([NotNull] IFlowNode node) { node.AssertNotNull("node != null"); WhenFalse.AssertIsNull("False branch is already set"); WhenFalse = node; return(this); }
public override void RemoveConnections() { WhenFalse = null; WhenTrue = null; Condition = null; myCompiledCondition = null; }
protected internal virtual void ConnectTarget(IFlowNode target) { CurrentSequenceFlowBuilder.From(element).To(target); ISequenceFlow sequenceFlow = CurrentSequenceFlowBuilder.element; CreateBpmnEdge(sequenceFlow); _currentSequenceFlowBuilder = null; }
IFlowAction IFlow.CreateAction(IFlowNode from, IFlowNode to) { var obj = new CIIPXpoTransition(Session); obj.SourceState = from as CIIPXpoState; obj.TargetState = to as CIIPXpoState; obj.Caption = obj.TargetState.Caption; return(obj); }
public static TNode ConnectTo <TNode>([NotNull] this TNode from, [NotNull] IFlowNode to) where TNode : ConnectableNode { from.AssertNotNull("from != null"); to.AssertNotNull("to != null"); from.PointsTo.AssertIsNull("Connection is already set"); from.PointsTo = to; return(from); }
public FlowNodePanel(string txt, int num, IFlowNode nodeControl, int LeftOrRight = 0, FlowNodeStatu statu = FlowNodeStatu.Default) { this._text = txt; this._step = num; this._leftOrRight = LeftOrRight; this._nodeControl = nodeControl; this._nodeControl.OnFinished += new EventHandler(_nodeControl_OnFinished); this.init(); this.SetStatu(statu, this._rightFinished); }
public BlockSelfContainednessValidator( [NotNull] BlockNode block, [CanBeNull] IFlowNode defaultFaultHandler, [CanBeNull] IFlowNode defaultCancellationHandler) { myBlock = block.NotNull(); myDefaultFaultHandler = defaultFaultHandler; myDefaultCancellationHandler = defaultCancellationHandler; Result = new ValidationResult(); }
public FlowBuilder WithInitialNode([NotNull] IFlowNode node) { node.AssertNotNull("node != null"); myInitialNode.AssertIsNull("Initial node is already specified"); node.AssertIsItemOf(myNodes, "Node must be part of the flow"); myIsFreezed.AssertFalse("Builder is freezed"); myInitialNode = node; return(this); }
IFlowAction IFlow.CreateAction(IFlowNode from, IFlowNode to) { var act = new FlowAction(Session) { From = (FlowNode)from, To = (FlowNode)to, Caption = "生成" + to.Caption }; act.Flow = this; act.GenerateMapping(CaptionHelper.ApplicationModel.BOModel); return(act); }
private void CheckIfNodeIsInsideBlock(IFlowNode node) { if (node == null || node == myDefaultFaultHandler || node == myDefaultCancellationHandler) { return; } if (myBlock.InnerNodes.IndexOf(node) == -1) { Result.AddError(node, "Node is out of block " + myBlock); } }
internal FlowDescription( [CanBeNull] IFlowNode initialNode, [CanBeNull] IFaultHandlerNode defaultFaultHandler, [CanBeNull] IActivityNode defaultCancellationHandler, [NotNull] ReadOnlyCollection <IFlowNode> nodes, [NotNull] ReadOnlyCollection <IVariable> globalVariables) { InitialNode = initialNode; DefaultFaultHandler = defaultFaultHandler; DefaultCancellationHandler = defaultCancellationHandler; Nodes = nodes; GlobalVariables = globalVariables; }
public void RemoveNode(IFlowNode node) { Nodes.Remove((NavigationMenuItem) node); }
public void RemoveNode(IFlowNode node) { }
public IFlowAction CreateAction(IFlowNode from, IFlowNode to) { return null; }
IFlowAction IFlow.CreateAction(IFlowNode from, IFlowNode to) { var act = new NavigationLine(Session) { From = (NavigationMenuItem) from, To = (NavigationMenuItem) to, //Caption = "����" + to.Caption }; this.Actions.Add(act); return act; }
void IFlow.RemoveNode(IFlowNode node) { Nodes.Remove((FlowNode)node); }
IFlowAction IFlow.CreateAction(IFlowNode from, IFlowNode to) { var act = new FlowAction(Session) {From = (FlowNode) from, To = (FlowNode) to, Caption = "生成" + to.Caption}; act.Flow = this; act.Created(); //act.GenerateMapping(CaptionHelper.ApplicationModel.BOModel); return act; }
IFlowAction IFlow.CreateAction(IFlowNode from, IFlowNode to) { var obj = new CIIPXpoTransition(Session); obj.SourceState = from as CIIPXpoState; obj.TargetState = to as CIIPXpoState; obj.Caption = obj.TargetState.Caption; return obj; }
void IFlow.RemoveNode(IFlowNode node) { States.Remove((CIIPXpoState)node); }