예제 #1
0
        public virtual void Execute(PvmExecutionImpl execution)
        {
            execution.ActivityInstanceDone();

            IActivityBehavior activityBehavior = ActivityBehaviorUtil.GetActivityBehavior(execution);

            if (activityBehavior is FlowNodeActivityBehavior)
            {
                FlowNodeActivityBehavior behavior = (FlowNodeActivityBehavior)activityBehavior;

                var activity           = execution.Activity;
                var activityInstanceId = execution.ActivityInstanceId;
                if (!ReferenceEquals(activityInstanceId, null))
                {
                    Log.DebugLeavesActivityInstance(execution, activityInstanceId);
                }

                try
                {
                    behavior.DoLeave(execution);
                }
                //catch (RuntimeException e)
                //{
                //    throw e;
                //}
                catch (System.Exception e)
                {
                    throw new PvmException(
                              "couldn't leave activity <" + activity.GetProperty("type") + " id=\"" + activity.Id +
                              "\" ...>: " + e.Message, e);
                }
            }
            else
            {
                throw new PvmException("Behavior of current activity is not an instance of " +
                                       typeof(FlowNodeActivityBehavior).Name + ". Execution " + execution);
            }
        }
예제 #2
0
        public virtual void Execute(PvmExecutionImpl execution)
        {
            execution.ActivityInstanceStarted();
            execution.ContinueIfExecutionDoesNotAffectNextOperation((e) => {
                if (execution.Activity.IsScope)
                {
                    execution.DispatchEvent(null);
                }
            }, (e) =>
            {
                var activityBehavior = ActivityBehaviorUtil.GetActivityBehavior(e);

                var activity = (ActivityImpl)e.Activity;
                Log.DebugExecutesActivity(e, activity, activityBehavior.GetType().FullName);
                //try
                //{
                Log.LogDebug("activityBehavior类型:", activityBehavior.GetType().Name);
                if (activity.IsTransaction)
                {
                    Log.LogDebug("进入SubProcess,并新建事务", activity.ActivityId);
                    context.Impl.Context.CommandContext.AddTransaction();
                }
                if (activity.IsInTransaction)
                {
                    Log.LogDebug("进入SubProcess子Activity:", activity.ActivityId);
                }
                activityBehavior.Execute(e);
                //}
                //catch (Exception e)
                //{
                //    throw new PvmException(
                //        "couldn't execute activity <" + activity.GetProperty("type") + " id=\"" + activity.Id +
                //        "\" ...>: " + e.Message, e);
                //}
            }, execution);
        }