private List<FlowLocation> parseLocations(Element element) { List<Element> locationElements = DomUtils.getChildElementsByTagName(element, "flow-location"); if (locationElements.isEmpty()) { return Collections.emptyList(); } List<FlowLocation> locations = new ArrayList<>(locationElements.size()); for (Element locationElement : locationElements) { String id = locationElement.getAttribute("id"); String path = locationElement.getAttribute("path"); locations.add(new FlowLocation(id, path, parseAttributes(locationElement))); } return locations; }
private FlowDefinitionResource createResource(FlowLocation location) { AttributeMap<Object> flowAttributes = getFlowAttributes(location.getAttributes()); return flowResourceFactory.createResource(location.getPath(), flowAttributes, location.getId()); }
private FlowDefinitionResource createResource(FlowLocation location) { AttributeMap<Object> flowAttributes = getFlowAttributes(location.getAttributes()); return flowResourceFactory.createResource(location.getPath(), flowAttributes, location.getId()); }
private List<FlowLocation> parseLocations(Element element) { List<Element> locationElements = DomUtils.getChildElementsByTagName(element, "flow-location"); if (locationElements.isEmpty()) { return Collections.emptyList(); } List<FlowLocation> locations = new ArrayList<>(locationElements.size()); for (Element locationElement : locationElements) { String id = locationElement.getAttribute("id"); String path = locationElement.getAttribute("path"); locations.add(new FlowLocation(id, path, parseAttributes(locationElement))); } return locations; }
private FlowDefinitionResource createResource(FlowLocation location) { AttributeMap flowAttributes = getFlowAttributes(location.getAttributes()); return flowResourceFactory.createResource(location.getPath(), flowAttributes, location.getId()); }
private List parseLocations(Element element) { List locationElements = DomUtils.getChildElementsByTagName(element, "flow-location"); if (locationElements.isEmpty()) { return Collections.EMPTY_LIST; } List locations = new ArrayList(locationElements.size()); for (Iterator it = locationElements.iterator(); it.hasNext();) { Element locationElement = (Element) it.next(); String id = locationElement.getAttribute("id"); String path = locationElement.getAttribute("path"); locations.add(new FlowLocation(id, path, parseAttributes(locationElement))); } return locations; }
public void testGetFlowRegistry() throws Exception { HashSet<FlowElementAttribute> attributes = new HashSet<>(); attributes.add(new FlowElementAttribute("foo", "bar", null)); attributes.add(new FlowElementAttribute("bar", "2", "integer")); FlowLocation location1 = new FlowLocation("flow1", "org/springframework/webflow/config/flow.xml", attributes); FlowLocation location2 = new FlowLocation("flow2", "org/springframework/webflow/config/flow.xml", attributes); FlowLocation[] flowLocations = new FlowLocation[] { location1, location2 }; factoryBean.setFlowBuilderServices(TestFlowBuilderServicesFactory.getServices()); factoryBean.setFlowLocations(flowLocations); factoryBean.afterPropertiesSet(); FlowDefinitionRegistry registry = factoryBean.getObject(); FlowDefinition def = registry.getFlowDefinition("flow1"); assertNotNull(def); assertEquals("flow1", def.getId()); assertEquals("bar", def.getAttributes().get("foo")); assertEquals(new Integer(2), def.getAttributes().getInteger("bar")); def = registry.getFlowDefinition("flow2"); assertNotNull(def); assertEquals("flow2", def.getId()); }
public void testGetFlowRegistryCustomFlowServices() throws Exception { FlowLocation location1 = new FlowLocation(null, "org/springframework/webflow/config/flow.xml", null); FlowLocation[] flowLocations = new FlowLocation[] { location1 }; factoryBean.setFlowLocations(flowLocations); factoryBean.setFlowBuilderServices(TestFlowBuilderServicesFactory.getServices()); factoryBean.afterPropertiesSet(); FlowDefinitionRegistry registry = factoryBean.getObject(); FlowDefinition def = registry.getFlowDefinition("flow"); assertNotNull(def); assertEquals("flow", def.getId()); assertTrue(def.getAttributes().isEmpty()); } }
public void testGetFlowRegistryGeneratedFlowId() throws Exception { FlowLocation location1 = new FlowLocation(null, "org/springframework/webflow/config/flow.xml", null); FlowLocation[] flowLocations = new FlowLocation[] { location1 }; factoryBean.setFlowBuilderServices(TestFlowBuilderServicesFactory.getServices()); factoryBean.setFlowLocations(flowLocations); factoryBean.afterPropertiesSet(); FlowDefinitionRegistry registry = factoryBean.getObject(); FlowDefinition def = registry.getFlowDefinition("flow"); assertNotNull(def); assertEquals("flow", def.getId()); assertTrue(def.getAttributes().isEmpty()); }