Example #1
0
        protected internal virtual TransitionInstanceImpl createTransitionInstance(PvmExecutionImpl execution)
        {
            TransitionInstanceImpl transitionInstance = new TransitionInstanceImpl();

            // can use execution id as persistent ID for transition as an execution
            // can execute as most one transition at a time.
            transitionInstance.Id = execution.Id;
            transitionInstance.ParentActivityInstanceId = execution.ParentActivityInstanceId;
            transitionInstance.ProcessInstanceId        = execution.ProcessInstanceId;
            transitionInstance.ProcessDefinitionId      = execution.ProcessDefinitionId;
            transitionInstance.ExecutionId = execution.Id;
            transitionInstance.ActivityId  = execution.ActivityId;

            ActivityImpl activity = execution.getActivity();

            if (activity != null)
            {
                string name = activity.Name;
                if (string.ReferenceEquals(name, null))
                {
                    name = (string)activity.getProperty("name");
                }
                transitionInstance.ActivityName = name;
                transitionInstance.ActivityType = (string)activity.getProperty("type");
            }

            return(transitionInstance);
        }
Example #2
0
        public virtual void execute(PvmExecutionImpl execution)
        {
            execution.activityInstanceDone();

            ActivityBehavior activityBehavior = getActivityBehavior(execution);

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

                ActivityImpl activity           = execution.getActivity();
                string       activityInstanceId = execution.ActivityInstanceId;
                if (!string.ReferenceEquals(activityInstanceId, null))
                {
                    LOG.debugLeavesActivityInstance(execution, activityInstanceId);
                }

                try
                {
                    behavior.doLeave(execution);
                }
                catch (Exception e)
                {
                    throw e;
                }
                catch (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);
            }
        }
Example #3
0
 public virtual void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity)
 {
     // do not write history for link events
     if (!activity.getProperty("type").Equals("intermediateLinkCatch"))
     {
         addActivityHandlers(activity);
     }
 }
Example #4
0
        public static bool isCompensationThrowing(PvmExecutionImpl execution)
        {
            ActivityImpl currentActivity = execution.getActivity();

            if (currentActivity != null)
            {
                bool?isCompensationThrowing = (bool?)currentActivity.getProperty(BpmnParse.PROPERTYNAME_THROWS_COMPENSATION);
                if (isCompensationThrowing != null && isCompensationThrowing)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
            public Void callback(PvmExecutionImpl execution)
            {
                ActivityBehavior activityBehavior = getActivityBehavior(execution);

                ActivityImpl activity = execution.getActivity();

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                LOG.debugExecutesActivity(execution, activity, activityBehavior.GetType().FullName);

                try
                {
                    activityBehavior.execute(execution);
                }
                catch (Exception e)
                {
                    throw e;
                }
                catch (Exception e)
                {
                    throw new PvmException("couldn't execute activity <" + activity.getProperty("type") + " id=\"" + activity.Id + "\" ...>: " + e.Message, e);
                }
                return(null);
            }