actionimpl.cs

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

CS
71
字号
using System;
using log4net;
using NetBpm.Util.DB;
using NetBpm.Util.Xml;
using NetBpm.Workflow.Delegation.Impl;

namespace NetBpm.Workflow.Definition.Impl
{
	public class ActionImpl : PersistentObject, IAction
	{
		[NonSerialized()] private DelegationImpl _actionDelegation = null;
		private static readonly ILog log = LogManager.GetLogger(typeof (ActionImpl));

		private Int64 _definitionObjectId;
		private EventType _eventType = 0;

		public Int64 DefinitionObjectId
		{
			get { return this._definitionObjectId; }
			set { this._definitionObjectId = value; }
		}

		public DelegationImpl ActionDelegation
		{
			get { return this._actionDelegation; }
			set { this._actionDelegation = value; }
		}

		public EventType EventType
		{
			set { _eventType = value; }
			get { return _eventType; }
		}

		public ActionImpl()
		{
		}

		public void ReadProcessData(XmlElement xmlElement, CreationContext creationContext)
		{
			DefinitionObjectImpl definitionObject = creationContext.DefinitionObject;

			// first make sure the definitionObject has got an id
			DbSession dbSession = creationContext.DbSession;
			dbSession.SaveOrUpdate(definitionObject);

			// store the reference link to the definitionObject 
			this._definitionObjectId = definitionObject.Id;

			log.Debug("adding action : ");
			log.Debug("  definitionObjectId: " + _definitionObjectId);
			log.Debug("  definitionObject: " + definitionObject);

			this._eventType = EventTypeHelper.fromText(xmlElement.GetAttribute("event"));

			log.Debug("action on eventType '" + _eventType + "' and definitionObject " + creationContext.DefinitionObject);

			// reading the action delegation
			creationContext.DelegatingObject = this;
			this._actionDelegation = new DelegationImpl();
			this._actionDelegation.ReadProcessData(xmlElement, creationContext);
			creationContext.DelegatingObject = null;

			dbSession.SaveOrUpdate(this);
		}

		public void Validate(ValidationContext validationContext)
		{
		}
	}
}

⌨️ 快捷键说明

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