示例#1
0
 public bool shouldExit(FlowElement current)
 {
     if (current == null)
     {
         return false;
     }
     if (isExitFlow())
     {
         return true;
     }
     bool loop = current.type.Equals(TYPE_LOOP) || current.type.Equals(TYPE_RETRY);
     if (isExitLoop() )
     {
         if (loop)
         {
             done = true;
         }
     }else if (isExitParent())
     {
         done = true;
     }else if (current.name != null)
     {
         if (from.Equals(current.name))
         {
             done = true;
         }
     }
     return true;
 }
示例#2
0
 public bool shouldExit(FlowElement current)
 {
     if (exit != null)
     {
         return(exit.shouldExit(current));
     }
     return(false);
 }
示例#3
0
        public FlowElement pushNextNode()
        {
            FlowElement parent = current();
            FlowElement child  = pushNode(parent.nodeIndex);

            parent.nextNodeIndex();
            return(child);
        }
示例#4
0
 public FlowElement push(FlowElement node)
 {
     if (node.id == 0)
     {
         node.id = newFlowElementID();
     }
     FlowElement next = node.Clone() as FlowElement;
     state.Push(next);
     return next;
 }
示例#5
0
        public FlowElement push(FlowElement node)
        {
            if (node.id == 0)
            {
                node.id = newFlowElementID();
            }
            FlowElement next = node.Clone() as FlowElement;

            state.Push(next);
            return(next);
        }
示例#6
0
 public static bool isRoot(FlowElement flowElement)
 {
     return(flowElement.type.Equals(FlowElement.TYPE_ROOT));
 }
示例#7
0
 public bool shouldExit(FlowElement current)
 {
     if (exit != null)
     {
         return exit.shouldExit(current);
     }
     return false;
 }
示例#8
0
 public static bool isRoot(FlowElement flowElement)
 {
     return flowElement.type.Equals(FlowElement.TYPE_ROOT);
 }
示例#9
0
        /*protected bool validateMessage(FlowState state, IData pipeline, bool inOpt)
         * {
         *  NSService svc = getService(state.getNamespace(), NSName.create(getNSName()));
         *
         *  int vo = inOpt ? svc.getInputValidatorOptions() : svc.getOutputValidatorOptions();
         *  if (vo == 2)
         *  {
         *      IData val = null;
         *
         *      NSRecord nsr = inOpt ? svc.getSignature().getInput() : svc.getSignature().getOutput();
         *
         *      ValidatorOptions vtorOpts = Validator.getDefaultOptions();
         *
         *      Validator vtor = Validator.create(pipeline, nsr, vtorOpts);
         *      boolean valid = false;
         *      Exception ex = null;
         *      try
         *      {
         *          val = vtor.validate();
         *          IDataCursor ic = val.getCursor();
         *          if (ic.first("isValid"))
         *          {
         *              valid = IDataUtil.getBoolean(ic);
         *          }
         *          ic.destroy();
         *      }
         *      catch (Exception e)
         *      {
         *          ex = e;
         *      }
         *      if ((!valid) || (ex != null))
         *      {
         *          Object[] subs = { svc.getNSName().getFullName(), FlowInvoke.getValidationMsgs(val) };
         *          if (ex == null)
         *          {
         *              ex = new FlowException(FlowExceptionBundle.class, inOpt? FlowExceptionBundle.FAILED_INPUT_VALIDATION : FlowExceptionBundle.FAILED_OUTPUT_VALIDATION, "", subs);
         * }
         * handleError(state, ex);
         * }
         * return valid;
         * }
         * return true;
         * }*/

        public override void invoke(FlowState flowState)
        {
            bool        isRoot   = FlowState.isRoot(this);
            bool        disabled = false;
            FlowElement last     = flowState.last;

            if ((last != null) && (!last.enabled))
            {
                disabled = true;
            }
            if (flowState.shouldExit(this) ||
                (flowState.error == null && exitOn == SUCCESS && !start && !map && !disabled) ||
                (flowState.error != null && exitOn == FAILURE))
            {
                flowState.done = true;
                flowState.willExit();
                return;
            }
            if (flowState.error != null)
            {
                FlowExceptionHandler fex = flowState.flowExHandler;
                if (fex != null)
                {
                    fex.resetException();
                }
                flowState.error = null;
                IData       pipe   = flowState.pipeline;
                IDataCursor cursor = pipe.getCursor();
                while (cursor.first() && cursor.delete())
                {
                }
                cursor.destroy();
                IDataUtil.append(save_pipeline, pipe);
            }
            else
            {
                save_pipeline = IDataUtil.clone(flowState.pipeline);
            }
            if (flowState.pushNextNode() == null)
            {
                flowState.done = true;
                if (isRoot && flowState.incremental)
                {
                    if (flowState.shouldExit(this) ||
                        (flowState.error == null && exitOn == SUCCESS && !start && !map && !disabled) ||
                        (flowState.error != null && exitOn == FAILURE))
                    {
                        flowState.done = true;
                        flowState.willExit();
                    }
                }
            }
            else
            {
                map = flowState.current().type.Equals(TYPE_MAP);
            }
            if (start)
            {
                start = false;
            }
        }