亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? hibernateworkflowstore.cs

?? 基于DotNet的工作流引擎實(shí)現(xiàn)
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Collections;
using DotNetTools.PropertySet;
using DotNetTools.Util;
using DotNetTools.Workflow.Query;
using log4net;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Expression;
using Iesi.Collections;
using Expression = NHibernate.Expression.Expression;
/*
* Copyright (c) 2002-2003 by OpenSymphony
* All rights reserved.
*/
namespace DotNetTools.Workflow.Spi.Hibernate
{
	/// <summary> A workflow store backed by Hibernate for persistence.  To use this with the standard
	/// persistence factory, pass to the DefaultConfiguration.persistenceArgs the SessionFactory to
	/// use:
	/// <code>DefaultConfiguration.persistenceArgs.put("sessionFactory", DatabaseHelper.getSessionFactory());</code>
	/// See the HibernateFunctionalWorkflowTestCase for more help.
	/// *
	/// </summary>
	/// <author>jjx (.net)</author>
	public class HibernateWorkflowStore : IWorkflowStore
	{
		//~ Static fields/initializers /////////////////////////////////////////////
		
		private static readonly ILog log;
		
		//~ Instance fields ////////////////////////////////////////////////////////
		
		internal ISession session;
		internal ISessionFactory sessionFactory;
		
		//~ Constructors ///////////////////////////////////////////////////////////
		
		public HibernateWorkflowStore()
		{
		}
		public HibernateWorkflowStore(IDictionary props)
		{
			Init(props);
		}
		
		public HibernateWorkflowStore(ISessionFactory sessionFactory)
		{
			this.sessionFactory = sessionFactory;
			
			try
			{
				this.session = sessionFactory.OpenSession();
			}
			catch (HibernateException he)
			{
				log.Error("constructor", he);
				throw new StoreException("constructor", he);
			}
		}
		
		//~ Methods ////////////////////////////////////////////////////////////////
		
		public virtual void  SetEntryState(long entryId, int state)
		{
			try
			{
				HibernateWorkflowEntry entry = (HibernateWorkflowEntry) session.Find("FROM  " + typeof(HibernateWorkflowEntry).FullName + " as entry WHERE entry.Id = ?", entryId, NHibernateUtil.Int64)[0];
				entry.State = state;
				session.Save(entry);
			}
			catch (HibernateException e)
			{
				log.Error("An exception occured", e);
				
				return ;
			}
		}
		//todo: 使用ado代替
		public virtual IPropertySet GetPropertySet(long entryId)
		{

			IDictionary args = new Hashtable(1);
			args.Add("globalKey", "osff_" + entryId);

			return PropertySetManager.GetInstance("ado", args);
//			IDictionary args = new Hashtable();
//			args.Add("entityName", "OSWorkflowEntry");
//			args.Add("entityId", entryId);
//			
//			DefaultHibernateConfigurationProvider configurationProvider = new DefaultHibernateConfigurationProvider();
//			configurationProvider.setSessionFactory(sessionFactory);
//			
//			args.put("configurationProvider", configurationProvider);
			
//			return PropertySetManager.GetInstance("hibernate", args);
		}
		
		public virtual IStep CreateCurrentStep(long entryId, int stepId, String owner, DateTime startDate, DateTime dueDate, String status, long[] previousIds)
		{
			HibernateCurrentStep step = new HibernateCurrentStep();
			HibernateWorkflowEntry entry;
			
			ITransaction tx;
			
			try
			{
				tx = session.BeginTransaction();
				entry = (HibernateWorkflowEntry) session.Find("FROM  " + typeof(HibernateWorkflowEntry).FullName + " as entry WHERE entry.Id = ?", entryId, NHibernateUtil.Int64)[0];
			}
			catch (HibernateException he)
			{
				log.Error("Looking for workflow entry " + entryId, he);
				throw new StoreException("Looking for workflow entry " + entryId, he);
			}
			
			step.Entry = entry;
			step.StepId = stepId;
			step.Owner = owner;
			step.StartDate = startDate;
			
			step.DueDate = dueDate;
			step.Status = status;
			step.FinishDate=DateTime.MaxValue;
			
			IList stepIdList = new ArrayList(previousIds.Length);
			
			for (int i = 0; i < previousIds.Length; i++)
			{
				long previousId = previousIds[i];
				stepIdList.Add(previousId);
			}
			
			if (stepIdList.Count!=0)
			{
				String stepIds = TextUtils.Join(", ", stepIdList);
				
				try
				{
					step.PreviousSteps=session.Find("FROM  " + typeof(HibernateCurrentStep).FullName + "  as step WHERE step.Id IN (" + stepIds + ")");
				}
				catch (HibernateException he)
				{
					log.Error("Looking for step in " + stepIds, he);
					throw new StoreException("Looking for step in " + stepIds, he);
				}
			}
			else
			{
				step.PreviousSteps=Collections.EMPTY_LIST;
			}
			
			if (entry.CurrentSteps == null)
			{
				ArrayList cSteps = new ArrayList(1);
				cSteps.Add(step);
				entry.CurrentSteps=(cSteps);
			}
			else
			{
				entry.CurrentSteps.Add(step);
			}
			
			try
			{
				session.Save(entry);
				tx.Commit();
				
				//session.save(step);
				return step;
			}
			catch (HibernateException he)
			{
				log.Error("Saving new workflow entry", he);
				throw new StoreException("Saving new workflow entry", he);
			}
		}
		
		public virtual IWorkflowEntry CreateEntry(String workflowName)
		{
			HibernateWorkflowEntry entry = new HibernateWorkflowEntry();
			entry.State = SimpleWorkflowEntry.CREATED;
			entry.WorkflowName = workflowName;
			
			ITransaction tx;
			
			try
			{
				tx = session.BeginTransaction();
				session.Save(entry);
				tx.Commit();
			}
			catch (HibernateException he)
			{
				log.Error("Saving new workflow entry", he);
				throw new StoreException("Saving new workflow entry", he);
			}
			
			return entry;
		}
		
		public virtual IList FindCurrentSteps(long entryId)
		{
			HibernateWorkflowEntry entry;
			
			try
			{
				entry = (HibernateWorkflowEntry) session.Find("FROM  " + typeof(HibernateWorkflowEntry).FullName + " as entry WHERE entry.Id = ?", entryId, NHibernateUtil.Int64)[0];
			}
			catch (HibernateException he)
			{
				log.Error("Looking for entryId " + entryId, he);
				throw new StoreException("Looking for entryId " + entryId, he);
			}
			
			try
			{
				return session.Find("FROM  " + typeof(HibernateCurrentStep).FullName + " as step WHERE step.Entry = ?", entry, NHibernateUtil.Entity(entry.GetType()));
			}
			catch (HibernateException he)
			{
				log.Error("Looking for step id" + entry, he);
				throw new StoreException("Looking for step id" + entry, he);
			}
		}
		
		public virtual IWorkflowEntry FindEntry(long entryId)
		{
			try
			{
				IList result = session.Find("FROM  " + typeof(HibernateWorkflowEntry).FullName + "  as entry WHERE entry.Id = ?", entryId, NHibernateUtil.Int64);
				
				return (IWorkflowEntry) result[0];
			}
			catch (HibernateException he)
			{
				log.Error("Looking for entry " + entryId, he);
				throw new StoreException("Loooking for entry " + entryId, he);
			}
		}
		
		public virtual IList FindHistorySteps(long entryId)
		{
			HibernateWorkflowEntry entry;
			
			try
			{
				entry = (HibernateWorkflowEntry) session.Find("FROM  " + typeof(HibernateWorkflowEntry).FullName + " as entry WHERE entry.Id = ?", entryId, NHibernateUtil.Int64)[0];
			}
			catch (HibernateException he)
			{
				log.Error("Finding entry " + entryId, he);
				throw new StoreException("Finding entry " + entryId, he);
			}
			
			try
			{
				return session.Find("FROM  " + typeof(HibernateHistoryStep).FullName + " as step WHERE step.Entry = ? order by step.StepId desc", entry, NHibernateUtil.Entity(entry.GetType()));
			}
			catch (HibernateException he)
			{
				log.Error("Looking for step with entry " + entry, he);
				throw new StoreException("Looking for step with entry " + entry, he);
			}
		}
		protected ISessionFactory buildSessionFactory(IDictionary hibernateProperties)
		{
			Configuration configuration=new Configuration();
			
			configuration.AddProperties(hibernateProperties);

			//configuration.AddAssembly("DotNetTools.Workflow");
			configuration.AddAssembly(GetType().Assembly);

			
			return configuration.BuildSessionFactory();
		}
	
		public virtual void  Init(IDictionary props)
		{
			try
			{
				//if(1==2){
				//sessionFactory = (ISessionFactory) props["sessionFactory"];
				sessionFactory=buildSessionFactory(props);
				session = sessionFactory.OpenSession();
				
				//}
			}
			catch (HibernateException he)
			{
				log.Error("Setting sessionFactory", he);
				throw new StoreException("Setting sessionFactory", he);
			}
		}
		
		public virtual IStep MarkFinished(IStep step, int actionId, DateTime finishDate, String status, String caller)
		{
			HibernateCurrentStep currentStep = (HibernateCurrentStep) step;
			
			currentStep.ActionId = actionId;
			currentStep.FinishDate = finishDate;
			currentStep.Status = status;
			currentStep.Caller = caller;
			
			try
			{
				ITransaction tx = session.BeginTransaction();
				session.Save(currentStep);
				tx.Commit();
				
				return currentStep;
			}
			catch (HibernateException he)
			{
				log.Error("Saving current step with action " + actionId, he);
				throw new StoreException("Saving current step with action " + actionId, he);
			}
		}
		
		public virtual void  MoveToHistory(IStep step)
		{
			HibernateWorkflowEntry entry;
			
			ITransaction tx;
			
			try
			{
				tx = session.BeginTransaction();
				entry = (HibernateWorkflowEntry) session.Find("FROM " + typeof(HibernateWorkflowEntry).FullName + " as entry WHERE entry.Id = ?", step.EntryId, NHibernateUtil.Int64)[0];
			}
			catch (HibernateException he)
			{
				log.Error("Looking for workflow entry " + step.EntryId, he);
				throw new StoreException("Looking for workflow entry " + step.EntryId, he);
			}
			
			HibernateHistoryStep hStep = new HibernateHistoryStep((HibernateStep) step);
			
			entry.CurrentSteps.Remove(step);
			
			if (entry.HistorySteps == null)
			{
				ArrayList hSteps = new ArrayList(1);
				hSteps.Add(hStep);
				entry.HistorySteps=(hSteps);
			}
			else
			{
				entry.HistorySteps.Add(hStep);
			}
			
			try
			{
				session.Save(hStep);
				session.Save(entry);
				tx.Commit();
				
				//session.delete(step);
				//session.save(hStep, new Long(hStep.getId()));
			}
			catch (HibernateException he)
			{
				log.Error("Saving workflow entry " + entry.Id, he);
				throw new StoreException("Saving workflow entry " + entry.Id, he);
			}
		}
		
		public virtual IList Query(WorkflowExpressionQuery query)
		{
			Query.Expression expression = query.Expression;
			
			ICriterion expr;
			
			Type entityClass = getQueryClass(expression, null);
			

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91丨porny丨户外露出| 中文字幕成人网| 欧美绝品在线观看成人午夜影视| 精品中文字幕一区二区小辣椒| 蜜桃视频在线一区| 国产高清精品在线| 97精品国产露脸对白| 欧美体内she精高潮| 欧美三片在线视频观看| 欧美日韩精品一区二区天天拍小说 | 国产成人在线网站| 99精品1区2区| 欧美精品久久99| 精品国产乱码久久久久久久久| 国产精品久久久久久久午夜片| 亚洲美女免费在线| 国产99一区视频免费| 在线观看日韩av先锋影音电影院| 91精品国产乱| 亚洲gay无套男同| av在线免费不卡| 国产欧美综合色| 国内精品嫩模私拍在线| 欧美精品粉嫩高潮一区二区| 欧美极品美女视频| 国产成人一区二区精品非洲| 欧美网站一区二区| 亚洲欧美一区二区三区久本道91 | 欧美中文一区二区三区| 久久一留热品黄| 九一久久久久久| 日韩欧美高清一区| 青青草原综合久久大伊人精品| 欧美午夜理伦三级在线观看| 亚洲国产电影在线观看| 国产最新精品精品你懂的| 久久综合久色欧美综合狠狠| 欧美a级理论片| 精品国产伦一区二区三区观看方式| 日本中文字幕不卡| 精品国精品国产| 丁香激情综合国产| 自拍偷拍亚洲欧美日韩| 欧美亚洲图片小说| 免费精品视频在线| 国产欧美日韩精品在线| 亚洲成人动漫一区| 亚洲精品一区二区三区香蕉| 久久国产精品99久久久久久老狼| 欧美视频一区在线| 国产精品免费丝袜| 狠狠久久亚洲欧美| 宅男噜噜噜66一区二区66| 久久综合久久久久88| 奇米精品一区二区三区在线观看一 | 亚洲女同ⅹxx女同tv| 亚洲一区视频在线| 国产高清精品久久久久| 欧美撒尿777hd撒尿| 91精品国产综合久久精品| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 26uuu亚洲| 国产99久久久久久免费看农村| 国产午夜久久久久| 91蜜桃免费观看视频| 久久精品人人做人人综合| 裸体一区二区三区| 欧美一区二区三区视频在线| 成人国产精品免费观看| 美女视频黄频大全不卡视频在线播放| 精品剧情在线观看| 一本在线高清不卡dvd| 麻豆精品久久久| 亚洲va欧美va天堂v国产综合| 日本一区二区免费在线| 欧美三级日韩在线| 91国产成人在线| 色久综合一二码| 91免费版在线| 高清日韩电视剧大全免费| 国产一区二区三区综合 | 日韩国产高清影视| 亚洲一区二区三区三| 视频一区免费在线观看| 天堂精品中文字幕在线| 午夜精品国产更新| 狠狠狠色丁香婷婷综合久久五月| 自拍偷拍欧美激情| 午夜精品久久久久久久99樱桃| 国产在线播放一区| 欧美一区二区视频在线观看| 欧美国产精品专区| 天天免费综合色| 亚洲精品中文字幕乱码三区| 一区二区三区精品视频| 日韩av网站在线观看| 国模冰冰炮一区二区| 91丨九色porny丨蝌蚪| 欧美午夜一区二区三区免费大片| 91精品在线麻豆| 欧美国产日韩亚洲一区| 丝袜美腿亚洲一区| 国产成人自拍高清视频在线免费播放| 99国产麻豆精品| 欧美本精品男人aⅴ天堂| 国产精品福利一区二区| 蜜臀av性久久久久av蜜臀妖精| youjizz国产精品| 欧美大片一区二区| 有码一区二区三区| 成人永久免费视频| 亚洲精品在线一区二区| 亚洲国产精品久久久久秋霞影院| 国产999精品久久| 欧美一级黄色片| 日韩av一区二区在线影视| 91亚洲精品乱码久久久久久蜜桃 | 国产精品久久久一区麻豆最新章节| 亚洲国产精品久久久久秋霞影院 | 亚洲少妇屁股交4| 粉嫩av亚洲一区二区图片| 久久久久久久性| 国产成人精品亚洲午夜麻豆| 欧美一区在线视频| 免费不卡在线观看| 日韩欧美一区中文| 精品夜夜嗨av一区二区三区| 欧美成人女星排名| 极品美女销魂一区二区三区 | 国产一区二三区| 久久综合久久鬼色中文字| 国产一区二区三区四| 久久精品亚洲精品国产欧美kt∨| 国产乱码一区二区三区| 国产日韩av一区| 在线观看一区日韩| 香蕉成人伊视频在线观看| 欧美一个色资源| 国产精品一区二区久久精品爱涩| 亚洲国产成人在线| 色欧美片视频在线观看在线视频| 亚洲国产精品久久久久婷婷884 | 五月激情丁香一区二区三区| 欧美裸体一区二区三区| 国内精品久久久久影院色| 一区二区中文视频| 欧美一区二区三区不卡| 成人午夜av电影| 日本aⅴ精品一区二区三区| 中文字幕国产一区| 欧美一级国产精品| 色综合久久久久综合体桃花网| 午夜精品久久久久久久久久久| 久久久精品人体av艺术| 欧美猛男男办公室激情| 国产电影精品久久禁18| 蜜桃一区二区三区在线观看| 国产精品久久久久婷婷| 久久婷婷国产综合国色天香| 欧美亚洲一区三区| 色菇凉天天综合网| 国产成人午夜电影网| 久久av老司机精品网站导航| 亚洲人精品一区| 亚洲你懂的在线视频| 亚洲欧美日韩在线播放| 国产精品久久综合| 中文字幕日韩一区| 亚洲欧洲99久久| 一区二区三区资源| 有码一区二区三区| 亚洲一区在线观看免费 | 7777精品伊人久久久大香线蕉完整版| 91麻豆产精品久久久久久 | 一区二区视频在线| 玉足女爽爽91| 天天av天天翘天天综合网色鬼国产| 一区二区三区在线免费视频 | 欧美一区二区三区成人| 日韩欧美一区在线观看| 久久综合成人精品亚洲另类欧美 | 亚洲一区二区三区激情| 天堂影院一区二区| 国产精品乡下勾搭老头1| 色网站国产精品| 91麻豆精品国产无毒不卡在线观看| 日韩欧美亚洲国产另类| 国产日产欧产精品推荐色 | 欧美日韩高清一区二区三区| 日韩三级在线观看| 国产精品久久免费看| 午夜电影久久久| 国产成人精品三级| 欧美日韩你懂得| 日韩码欧中文字| 黑人精品欧美一区二区蜜桃| 在线观看亚洲专区| 国产亚洲欧美日韩日本| 肉色丝袜一区二区| 色婷婷综合视频在线观看|