/** * Adds a flow variable. * @param variable the variable */ public void addVariable(FlowVariable variable) { variables.put(variable.getName(), variable); }
/** * Adds a flow variable. * @param variable the variable */ public void addVariable(FlowVariable variable) { variables.put(variable.getName(), variable); }
/** * Adds a flow variable. * @param variable the variable */ public void addVariable(FlowVariable variable) { variables.put(variable.getName(), variable); }
/** * 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; }
public void testFlowVariable() { model.setVars(asList(new VarModel("flow-foo", "org.springframework.webflow.TestBean"))); model.setStates(asList(new EndStateModel("end"))); Flow flow = getFlow(model); assertEquals("flow-foo", flow.getVariable("flow-foo").getName()); }