forkimpl.cs

来自「工作流的基本资料(文档资料」· CS 代码 · 共 60 行

CS
60
字号
using System;
using System.Collections;
using NetBpm.Util.Xml;
using NetBpm.Workflow.Delegation.Impl;

namespace NetBpm.Workflow.Definition.Impl
{
	public class ForkImpl : NodeImpl, IFork
	{
		[NonSerialized()] private DelegationImpl _forkDelegation = null;

		public DelegationImpl ForkDelegation
		{
			get { return _forkDelegation; }
			set { this._forkDelegation = value; }
		}

		public ForkImpl()
		{
		}

		public ForkImpl(IProcessDefinition processDefinition) : base(processDefinition)
		{
		}

		public DelegationImpl CreateForkDelegation()
		{
			_forkDelegation = new DelegationImpl(_processDefinition);
			return _forkDelegation;
		}

		public override void ReadProcessData(XmlElement xmlElement, CreationContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);

			if ((Object) xmlElement.GetAttribute("handler") != null)
			{
				creationContext.DelegatingObject = this;
				this._forkDelegation = new DelegationImpl();
				this._forkDelegation.ReadProcessData(xmlElement, creationContext);
				creationContext.DelegatingObject = null;
			}
		}

		public override void Validate(ValidationContext validationContext)
		{
			base.Validate(validationContext);

			// verify that all transitions leaving a fork have a name
			// this is required because this name is assigned to the flow and
			// it serves as an id for the ForkHandler's
			IEnumerator iter = _leavingTransitions.GetEnumerator();
			while (iter.MoveNext())
			{
				TransitionImpl transition = (TransitionImpl) iter.Current;
				validationContext.Check(((Object) transition.Name != null), "one of the transitions leaving the fork does not have a name");
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?