/** * Get the state model for an identifier * @param id the state identifier to find * @return the state or null if the identifier was not found */ public AbstractStateModel getStateById(String id) { if (states != null) { for (AbstractStateModel state : states) { if (id.equals(state.getId())) { return state; } } } return null; }
/** * Get the state model for an identifier * @param id the state identifier to find * @return the state or null if the identifier was not found */ public AbstractStateModel getStateById(String id) { if (states != null) { for (AbstractStateModel state : states) { if (id.equals(state.getId())) { return state; } } } return null; }
/** * Get the state model for an identifier * @param id the state identifier to find * @return the state or null if the identifier was not found */ public AbstractStateModel getStateById(String id) { if (states != null) { for (Iterator it = states.iterator(); it.hasNext();) { AbstractStateModel state = (AbstractStateModel) it.next(); if (id.equals(state.getId())) { return state; } } } return null; }
public void testBuildFlowWithEndState() { ClassPathResource resource = new ClassPathResource("flow-endstate.xml", getClass()); FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry); builder.init(); builder.build(); FlowModel flow = builder.getFlowModel(); assertNull(flow.getStartStateId()); assertEquals("end", flow.getStates().get(0).getId()); }
public void testGetFlowDefinition() { FlowModel flow = holder.getFlowModel(); assertNull(flow.getStartStateId()); assertEquals("end", flow.getStates().get(0).getId()); }
public void testBuildFlowWithDefaultStartState() { ClassPathResource resource = new ClassPathResource("flow-startstate-default.xml", getClass()); FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry); builder.init(); builder.build(); FlowModel flow = builder.getFlowModel(); assertNull(flow.getStartStateId()); assertEquals("end", flow.getStates().get(0).getId()); }
public void testMerge() { ClassPathResource resourceChild = new ClassPathResource("flow-inheritance-child.xml", getClass()); ClassPathResource resourceParent = new ClassPathResource("flow-inheritance-parent.xml", getClass()); registry.registerFlowModel("child", new DefaultFlowModelHolder(new XmlFlowModelBuilder(resourceChild, registry))); registry.registerFlowModel("parent", new DefaultFlowModelHolder(new XmlFlowModelBuilder(resourceParent, registry))); FlowModel flow = registry.getFlowModel("child"); assertEquals(1, flow.getGlobalTransitions().size()); assertEquals(2, flow.getStates().size()); assertEquals("view", flow.getStates().get(0).getId()); }
public void testGetFlowDefinitionWithChangesRefreshed() { FlowModel flow = holder.getFlowModel(); holder.refresh(); flow = holder.getFlowModel(); assertNull(flow.getStartStateId()); assertEquals("end", flow.getStates().get(0).getId()); }