public override void invoke(FlowState flowState) { if (msgSubList != null) { clonedMessage = MapSet.substituteVars(msgSubList, flowState.pipeline); } flowState.exit = this; flowState.done = true; }
/*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; } }
public new void init(FlowState flowState) { save_pipeline = IDataUtil.clone(flowState.pipeline); start = true; }
public abstract void invoke(FlowState flowState);
public void init(FlowState state) { }
/*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; } }