Example #1
0
        public TransitionImpl DelegateDecision(DelegationImpl delegation, ExecutionContextImpl executionContext)
        {
            TransitionImpl selectedTransition = null;

            try
            {
                IDecisionHandler decision = (IDecisionHandler)GetDelegate(delegation);
                executionContext.SetConfiguration(ParseConfiguration(delegation));
                String transitionName = decision.Decide(executionContext);

                if ((Object)transitionName == null)
                {
                    throw new SystemException("Decision-delegate for decision '" + executionContext.GetNode() + "' returned null instead of a transition-name : " + decision.GetType().FullName);
                }

                try
                {
                    Object[] args  = new Object[] { executionContext.GetNode().Id, transitionName };
                    IType[]  types = new IType[] { DbType.LONG, DbType.STRING };
                    selectedTransition = (TransitionImpl)executionContext.DbSession.FindOne(queryFindLeavingTransitionByName, args, types);
                }
                catch (Exception t)
                {
                    throw new SystemException("couldn't find transition '" + transitionName + "' that was selected by the decision-delegate of activity '" + executionContext.GetNode().Name + "' : " + t.Message);
                }
            }
            catch (Exception t)
            {
                HandleException(delegation, executionContext, t);
            }

            return(selectedTransition);
        }
Example #2
0
 public void DelegateFork(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     try
     {
         // delegate the fork
         IForkHandler forker = (IForkHandler)delegation.GetDelegate();
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         forker.Fork(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
 }
Example #3
0
 public void DelegateAction(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     try
     {
         executionContext.CreateLog(EventType.ACTION);
         executionContext.AddLogDetail(new DelegateCallImpl(delegation, typeof(IAction)));
         IActionHandler actionHandler = (IActionHandler)GetDelegate(delegation);
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         actionHandler.Run(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
 }
Example #4
0
        public String DelegateAssignment(DelegationImpl delegation, ExecutionContextImpl executionContext)
        {
            String actorId = null;

            try
            {
                IAssignmentHandler assigner = (IAssignmentHandler)delegation.GetDelegate();
                executionContext.SetConfiguration(ParseConfiguration(delegation));
                actorId = assigner.SelectActor(executionContext);
            }
            catch (Exception t)
            {
                HandleException(delegation, executionContext, t);
            }

            return(actorId);
        }
Example #5
0
        public bool DelegateJoin(DelegationImpl delegation, ExecutionContextImpl executionContext)
        {
            bool reactivateParent = false;

            try
            {
                IJoinHandler joiner = (IJoinHandler)delegation.GetDelegate();
                executionContext.SetConfiguration(ParseConfiguration(delegation));
                reactivateParent = joiner.Join(executionContext);
            }
            catch (Exception t)
            {
                HandleException(delegation, executionContext, t);
            }

            return(reactivateParent);
        }
Example #6
0
 public Object[] DelegateProcessTermination(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     Object[] completionData = new Object[2];
     try
     {
         IProcessInvocationHandler processInvoker = (IProcessInvocationHandler)delegation.GetDelegate();
         log.Debug("collecting results from the sub-process...");
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         completionData[0] = processInvoker.CollectResults(executionContext);
         completionData[1] = processInvoker.GetCompletionTransitionName(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
     return(completionData);
 }
Example #7
0
 public Object[] DelegateProcessInvocation(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     Object[] invocationData = new Object[2];
     try
     {
         IProcessInvocationHandler processInvoker = (IProcessInvocationHandler)delegation.GetDelegate();
         log.Debug("requesting the attributeValues from the process invoker...");
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         invocationData[0] = processInvoker.GetStartTransitionName(executionContext);
         invocationData[1] = processInvoker.GetStartAttributeValues(executionContext);
         log.Debug("process invoker specified transition '" + invocationData[0] + "' and supplied attributeValues '" + invocationData[1] + "'");
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
     return(invocationData);
 }
Example #8
0
 public void DelegateScheduledAction(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     try
     {
         /* can't add logs because of a integritiy constraint violation...
          * can you find why ?
          */
         if (executionContext.GetFlow() != null)
         {
             executionContext.CreateLog(EventType.ACTION);
             executionContext.AddLogDetail(new DelegateCallImpl(delegation, typeof(IAction)));
         }
         IActionHandler actionHandler = (IActionHandler)GetDelegate(delegation);
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         actionHandler.Run(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
 }