public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException { Assert.hasText(id, "An id is required to lookup a FlowDefinition"); try { if (logger.isDebugEnabled()) { logger.debug("Getting FlowDefinition with id '" + id + "'"); } return getFlowDefinitionHolder(id).getFlowDefinition(); } catch (NoSuchFlowDefinitionException e) { if (parent != null) { // try parent return parent.getFlowDefinition(id); } throw e; } }
@Override public Flow getLoginFlow() { if (this.loginFlowDefinitionRegistry == null) { LOGGER.error("Login flow registry is not configured and/or initialized correctly."); return null; } val found = Arrays.asList(this.loginFlowDefinitionRegistry.getFlowDefinitionIds()).contains(FLOW_ID_LOGIN); if (found) { return (Flow) this.loginFlowDefinitionRegistry.getFlowDefinition(FLOW_ID_LOGIN); } LOGGER.error("Could not find flow definition [{}]. Available flow definition ids are [{}]", FLOW_ID_LOGIN, this.loginFlowDefinitionRegistry.getFlowDefinitionIds()); return null; }
/** * Gets login flow. * * @return the login flow */ protected Flow getLoginFlow() { final Flow flow = (Flow) this.loginFlowDefinitionRegistry.getFlowDefinition(FLOW_ID_LOGIN); return flow; }
/** * Register flow definition into login flow registry. * * @param sourceRegistry the source registry */ protected void registerMultifactorFlowDefinitionIntoLoginFlowRegistry(final FlowDefinitionRegistry sourceRegistry) { val flowIds = sourceRegistry.getFlowDefinitionIds(); for (val flowId : flowIds) { val definition = sourceRegistry.getFlowDefinition(flowId); LOGGER.trace("Registering flow definition [{}]", flowId); this.loginFlowDefinitionRegistry.registerFlowDefinition(definition); } }
@Override public Object getValue(final Object context) throws EvaluationException { return this.flowDefinitionRegistry.getFlowDefinition(this.subflowId); } }
@Override public Object getValue(final Object context) throws EvaluationException { return CasMultiFactorWebflowConfigurer.this.flowDefinitionRegistry.getFlowDefinition(this.subflowId); } }
@Override public Object getValue(final Object context) throws EvaluationException { return this.flowDefinitionRegistry.getFlowDefinition(this.subflowId); } }
@Override public Flow getLogoutFlow() { if (this.logoutFlowDefinitionRegistry == null) { LOGGER.warn("Logout flow registry is not configured correctly."); return null; } if (logoutFlowDefinitionRegistry.containsFlowDefinition(FLOW_ID_LOGOUT)) { return (Flow) this.logoutFlowDefinitionRegistry.getFlowDefinition(FLOW_ID_LOGOUT); } LOGGER.warn("Logout flow registry does not contain a logout flow definition."); return null; }
public void testNoSuchFlow() { try { registry.getFlowDefinition("not there"); } catch (NoSuchFlowDefinitionException e) { } }
public Flow getSubflow(String id) throws FlowArtifactLookupException { try { return (Flow) subflowRegistry.getFlowDefinition(id); } catch (NoSuchFlowDefinitionException e) { throw new FlowArtifactLookupException(id, Flow.class, "Could not locate subflow definition with id '" + id + "'", e); } }
public void testBogusPath() { try { registry.getFlowDefinition("bogus"); fail("Should have failed"); } catch (FlowDefinitionConstructionException e) { } }
@Override public Flow buildFlow(final String location, final String id) { val builder = new FlowDefinitionRegistryBuilder(this.applicationContext, this.flowBuilderServices); builder.setParent(this.loginFlowDefinitionRegistry); builder.addFlowLocation(location, id); val registry = builder.build(); return (Flow) registry.getFlowDefinition(id); }
public void testRegistryFlowLocationPatternsPopulated() { FlowDefinition flow1 = registry.getFlowDefinition("flow1"); assertEquals("flow1", flow1.getId()); FlowDefinition flow2 = registry.getFlowDefinition("flow2"); assertEquals("flow2", flow2.getId()); }
public void testRegistryFlowBuildersPopulatedWithId() { FlowDefinition foo = registry.getFlowDefinition("foo2"); assertEquals("foo2", foo.getId()); }
public void testRegistryFlowBuildersPopulated() { FlowDefinition foo = registry.getFlowDefinition("foo"); assertEquals("foo", foo.getId()); }
public void testParent() { assertNotNull(registry.getParent()); assertEquals("parentFlow", registry.getParent().getFlowDefinition("parentFlow").getId()); }
public void testRegistryFlowLocationsPopulated() { FlowDefinition flow = registry.getFlowDefinition("flow"); assertEquals("flow", flow.getId()); assertEquals("bar", flow.getAttributes().get("foo")); assertEquals(2, flow.getAttributes().get("bar")); }
public void testRegistryFlowBuildersPopulatedWithAttributes() { FlowDefinition foo3 = registry.getFlowDefinition("foo3"); assertEquals("foo3", foo3.getId()); assertEquals("bar", foo3.getAttributes().get("foo")); assertEquals(2, foo3.getAttributes().get("bar")); }
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()); }
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()); } }