/** * Adds flow variables. * @param variables the variables */ public void addVariables(FlowVariable... variables) { if (variables == null) { return; } for (FlowVariable variable : variables) { addVariable(variable); } }
/** * Builds any variables initialized by the flow when it starts. * @throws FlowBuilderException an exception occurred building the flow */ public void buildVariables() throws FlowBuilderException { if (flowModel.getVars() != null) { for (VarModel varModel : flowModel.getVars()) { getFlow().addVariable(parseFlowVariable(varModel)); } } }
/** * Adds flow variables. * @param variables the variables */ public void addVariables(FlowVariable... variables) { if (variables == null) { return; } for (FlowVariable variable : variables) { addVariable(variable); } }
/** * Adds flow variables. * @param variables the variables */ public void addVariables(FlowVariable[] variables) { if (variables == null) { return; } for (int i = 0; i < variables.length; i++) { addVariable(variables[i]); } }
/** * Adds flow variables. * @param variables the variables */ public void addVariables(FlowVariable[] variables) { if (variables == null) { return; } for (int i = 0; i < variables.length; i++) { addVariable(variables[i]); } }
private void parseAndAddFlowVariables(Element flowElement, Flow flow) { List varElements = DomUtils.getChildElementsByTagName(flowElement, VAR_ELEMENT); for (Iterator it = varElements.iterator(); it.hasNext();) { flow.addVariable(parseVariable((Element) it.next())); } }
/** * Builds any variables initialized by the flow when it starts. * @throws FlowBuilderException an exception occurred building the flow */ public void buildVariables() throws FlowBuilderException { if (flowModel.getVars() != null) { for (Iterator it = flowModel.getVars().iterator(); it.hasNext();) { getFlow().addVariable(parseFlowVariable((VarModel) it.next())); } } }
/** * Create flow variable flow variable. * * @param flow the flow * @param id the id * @param type the type * @return the flow variable */ public FlowVariable createFlowVariable(final Flow flow, final String id, final Class type) { val opt = Arrays.stream(flow.getVariables()).filter(v -> v.getName().equalsIgnoreCase(id)).findFirst(); if (opt.isPresent()) { return opt.get(); } val flowVar = new FlowVariable(id, new BeanFactoryVariableValueFactory(type, applicationContext.getAutowireCapableBeanFactory())); flow.addVariable(flowVar); return flowVar; }
/** * Builds any variables initialized by the flow when it starts. * @throws FlowBuilderException an exception occurred building the flow */ public void buildVariables() throws FlowBuilderException { if (flowModel.getVars() != null) { for (VarModel varModel : flowModel.getVars()) { getFlow().addVariable(parseFlowVariable(varModel)); } } }
public void testStartWithVariables() { MockRequestControlContext context = new MockRequestControlContext(flow); flow.addVariable(new FlowVariable("var1", new VariableValueFactory() { public Object createInitialValue(RequestContext context) { return new ArrayList<>(); } public void restoreReferences(Object value, RequestContext context) { } })); flow.start(context, new LocalAttributeMap<>()); context.getFlowScope().getRequired("var1", ArrayList.class); }