/** * Create the flow execution state restorer to be used by the executor produced by this factory bean. Configure the * state restorer appropriately. Subclasses may override if they which to use a custom state restorer * implementation. * @param definitionLocator the definition locator to use * @param executionAttributes execution attributes to apply to restored executions * @param executionListenerLoader decides which listeners should apply to restored flow executions * @return a new state restorer instance */ protected FlowExecutionStateRestorer createFlowExecutionStateRestorer(FlowDefinitionLocator definitionLocator, AttributeMap executionAttributes, FlowExecutionListenerLoader executionListenerLoader) { FlowExecutionImplStateRestorer executionStateRestorer = new FlowExecutionImplStateRestorer(definitionLocator); executionStateRestorer.setExecutionAttributes(executionAttributes); if (executionListenerLoader != null) { executionStateRestorer.setExecutionListenerLoader(executionListenerLoader); } return executionStateRestorer; }
/** * Returns the flow execution repository to use in a JSF environment. Searches for a bean in the root web * application context named {@link #FLOW_EXECUTION_REPOSITORY_BEAN_NAME}. If no such bean exists with this name, * falls back on the repository configured by a bean with name {@link #FLOW_EXECUTOR_BEAN_NAME}. If no bean exists * with that name, uses the default 'simple' repository implementation. * @param context the faces context * @return the flow execution repository */ public synchronized static FlowExecutionRepository getExecutionRepository(FacesContext context) { // note: synchronized because this sets the defaultExecutionRepository static member ApplicationContext ac = FacesContextUtils.getRequiredWebApplicationContext(context); if (ac.containsBean(FLOW_EXECUTION_REPOSITORY_BEAN_NAME)) { return (FlowExecutionRepository) ac.getBean(FLOW_EXECUTION_REPOSITORY_BEAN_NAME, FlowExecutionRepository.class); } else { if (defaultExecutionRepository == null) { FlowExecutorImpl flowExecutor = getFlowExecutor(context); if (flowExecutor != null) { defaultExecutionRepository = flowExecutor.getExecutionRepository(); } else { defaultExecutionRepository = new SimpleFlowExecutionRepository(new FlowExecutionImplStateRestorer( getDefinitionLocator(context)), new SessionBindingConversationManager()); } } return defaultExecutionRepository; } }