diff --git a/BpmEngine.csproj b/BpmEngine.csproj index 544f0fb..4a8c6e8 100644 --- a/BpmEngine.csproj +++ b/BpmEngine.csproj @@ -129,6 +129,7 @@ + diff --git a/BusinessProcess.cs b/BusinessProcess.cs index 8b25540..c727247 100644 --- a/BusinessProcess.cs +++ b/BusinessProcess.cs @@ -208,7 +208,7 @@ private void _ErrorExternalTask(string taskID, Exception ex) if (elem.id == taskID && elem is ATask) { if (_onTaskError != null) - _onTaskError((ATask)elem); + _onTaskError((ATask)elem, new ReadOnlyProcessVariablesContainer(elem.id, _state)); lock (_state) { _state.Path.FailTask((ATask)elem); @@ -400,7 +400,7 @@ private void _suspendEvent(object parameters) AEvent evnt = (AEvent)ie; lock (_state) { _state.Path.SucceedEvent(evnt); } if (_onEventCompleted != null) - _onEventCompleted(evnt); + _onEventCompleted(evnt,new ReadOnlyProcessVariablesContainer(ie.id,_state)); break; } } @@ -573,15 +573,15 @@ public bool BeginProcess(ProcessVariablesContainer variables) { WriteLogLine(LogLevels.Info, new StackFrame(1, true), DateTime.Now, string.Format("Valid Process Start[{0}] located, beginning process", se.id)); if (_onProcessStarted != null) - _onProcessStarted(p); + _onProcessStarted(p, new ReadOnlyProcessVariablesContainer(variables)); if (_onEventStarted!=null) - _onEventStarted(se); + _onEventStarted(se, new ReadOnlyProcessVariablesContainer(variables)); _state.Path.StartEvent(se, null); foreach (string str in variables.Keys) _state[se.id,str]=variables[str]; _state.Path.SucceedEvent(se); if (_onEventCompleted!=null) - _onEventCompleted(se); + _onEventCompleted(se, new ReadOnlyProcessVariablesContainer(se.id, _state)); ret=true; } } @@ -699,7 +699,7 @@ private void _ProcessElement(string sourceID,IElement elem) _state.Path.ProcessSequenceFlow(sf); } if (_onSequenceFlowCompleted != null) - _onSequenceFlowCompleted(sf); + _onSequenceFlowCompleted(sf,new ReadOnlyProcessVariablesContainer(elem.id,_state)); } else if (elem is MessageFlow) { @@ -709,7 +709,7 @@ private void _ProcessElement(string sourceID,IElement elem) _state.Path.ProcessMessageFlow(mf); } if (_onMessageFlowCompleted != null) - _onMessageFlowCompleted(mf); + _onMessageFlowCompleted(mf, new ReadOnlyProcessVariablesContainer(elem.id, _state)); } else if (elem is AGateway) { @@ -731,7 +731,7 @@ private void _ProcessElement(string sourceID,IElement elem) _state.Path.StartGateway(gw, sourceID); } if (_onGatewayStarted != null) - _onGatewayStarted(gw); + _onGatewayStarted(gw, new ReadOnlyProcessVariablesContainer(elem.id, _state)); string[] outgoings = null; try { @@ -741,7 +741,7 @@ private void _ProcessElement(string sourceID,IElement elem) { WriteLogException(new StackFrame(1, true), DateTime.Now, e); if (_onGatewayError != null) - _onGatewayError(gw); + _onGatewayError(gw, new ReadOnlyProcessVariablesContainer(elem.id, _state)); outgoings = null; } lock (_state) @@ -756,7 +756,7 @@ private void _ProcessElement(string sourceID,IElement elem) { AEvent evnt = (AEvent)elem; if (_onEventStarted != null) - _onEventStarted(evnt); + _onEventStarted(evnt, new ReadOnlyProcessVariablesContainer(elem.id, _state)); lock (_state) { _state.Path.StartEvent(evnt, sourceID); @@ -792,17 +792,17 @@ private void _ProcessElement(string sourceID,IElement elem) { lock (_state) { _state.Path.FailEvent(evnt); } if (_onEventError != null) - _onEventError(evnt); + _onEventError(evnt, new ReadOnlyProcessVariablesContainer(elem.id, _state)); } else { lock (_state) { _state.Path.SucceedEvent(evnt); } if (_onEventCompleted != null) - _onEventCompleted(evnt); + _onEventCompleted(evnt, new ReadOnlyProcessVariablesContainer(elem.id, _state)); if (evnt is EndEvent) { if (_onProcessCompleted != null) - _onProcessCompleted(((EndEvent)evnt).Process); + _onProcessCompleted(((EndEvent)evnt).Process, new ReadOnlyProcessVariablesContainer(elem.id, _state)); _processLock.Set(); } } @@ -811,7 +811,7 @@ private void _ProcessElement(string sourceID,IElement elem) { ATask tsk = (ATask)elem; if (_onTaskStarted != null) - _onTaskStarted(tsk); + _onTaskStarted(tsk, new ReadOnlyProcessVariablesContainer(elem.id, _state)); lock (_state) { _state.Path.StartTask(tsk, sourceID); @@ -869,7 +869,7 @@ private void _ProcessElement(string sourceID,IElement elem) { WriteLogException(new StackFrame(1, true), DateTime.Now, e); if (_onTaskError != null) - _onTaskError(tsk); + _onTaskError(tsk, new ReadOnlyProcessVariablesContainer(elem.id, _state)); lock (_state) { _state.Path.FailTask(tsk); } } } @@ -911,7 +911,7 @@ private void _MergeVariables(ATask task, ProcessVariablesContainer variables,str } } if (_onTaskCompleted != null) - _onTaskCompleted(task); + _onTaskCompleted(task, new ReadOnlyProcessVariablesContainer(task.id, _state)); if (task is UserTask) _state.Path.SucceedTask((UserTask)task,completedByID); else diff --git a/Delegates.cs b/Delegates.cs index 99bbe90..990c479 100644 --- a/Delegates.cs +++ b/Delegates.cs @@ -8,20 +8,20 @@ namespace Org.Reddragonit.BpmEngine { #region Ons - public delegate void OnEventStarted(IElement Event); - public delegate void OnEventCompleted(IElement Event); - public delegate void OnEventError(IElement Event); - public delegate void OnTaskStarted(IElement task); - public delegate void OnTaskCompleted(IElement task); - public delegate void OnTaskError(IElement task); - public delegate void OnProcessStarted(IElement process); - public delegate void OnProcessCompleted(IElement process); - public delegate void OnProcessError(IElement process); - public delegate void OnSequenceFlowCompleted(IElement flow); - public delegate void OnMessageFlowCompleted(IElement flow); - public delegate void OnGatewayStarted(IElement gateway); - public delegate void OnGatewayCompleted(IElement gateway); - public delegate void OnGatewayError(IElement gateway); + public delegate void OnEventStarted(IElement Event, ReadOnlyProcessVariablesContainer variables); + public delegate void OnEventCompleted(IElement Event, ReadOnlyProcessVariablesContainer variables); + public delegate void OnEventError(IElement Event, ReadOnlyProcessVariablesContainer variables); + public delegate void OnTaskStarted(IElement task, ReadOnlyProcessVariablesContainer variables); + public delegate void OnTaskCompleted(IElement task, ReadOnlyProcessVariablesContainer variables); + public delegate void OnTaskError(IElement task, ReadOnlyProcessVariablesContainer variables); + public delegate void OnProcessStarted(IElement process, ReadOnlyProcessVariablesContainer variables); + public delegate void OnProcessCompleted(IElement process, ReadOnlyProcessVariablesContainer variables); + public delegate void OnProcessError(IElement process, ReadOnlyProcessVariablesContainer variables); + public delegate void OnSequenceFlowCompleted(IElement flow, ReadOnlyProcessVariablesContainer variables); + public delegate void OnMessageFlowCompleted(IElement flow, ReadOnlyProcessVariablesContainer variables); + public delegate void OnGatewayStarted(IElement gateway, ReadOnlyProcessVariablesContainer variables); + public delegate void OnGatewayCompleted(IElement gateway, ReadOnlyProcessVariablesContainer variables); + public delegate void OnGatewayError(IElement gateway, ReadOnlyProcessVariablesContainer variables); public delegate void OnStateChange(XmlDocument stateDocument); internal delegate void processStateChanged(); #endregion diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 1467dac..d92e8fb 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/ReadOnlyProcessVariablesContainer.cs b/ReadOnlyProcessVariablesContainer.cs new file mode 100644 index 0000000..baacbe8 --- /dev/null +++ b/ReadOnlyProcessVariablesContainer.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Org.Reddragonit.BpmEngine +{ + public class ReadOnlyProcessVariablesContainer + { + private ProcessVariablesContainer _variables; + + internal ReadOnlyProcessVariablesContainer(string elementID, ProcessState state) + { + _variables = new BpmEngine.ProcessVariablesContainer(elementID,state); + } + + internal ReadOnlyProcessVariablesContainer(ProcessVariablesContainer variables) + { + _variables = variables; + } + + public object this[string name] { get { return _variables[name]; } } + + public string[] Keys { get { return _variables.Keys; } } + } +}