org.apache.myfaces.flow.cdi
Class FlowScopeBeanHolder

java.lang.Object
  extended by org.apache.myfaces.flow.cdi.FlowScopeBeanHolder
All Implemented Interfaces:
Serializable

@SessionScoped
public class FlowScopeBeanHolder
extends Object
implements Serializable

This holder will store the flow scope active ids and it's beans for the current HTTP Session. We use standard SessionScoped bean to not need to treat async-supported and similar headache.

Author:
lu4242
See Also:
Serialized Form

Field Summary
static String CURRENT_FLOW_SCOPE_MAP
           
static String FLOW_SCOPE_PREFIX_KEY
           
 
Constructor Summary
FlowScopeBeanHolder()
           
 
Method Summary
 void clearFlowMap(String clientWindowId)
           
 void createCurrentFlowScope(FacesContext facesContext)
           
 void destroyBeans()
          This method properly destroys all current @WindowScoped beans of the active session and also prepares the storage for new beans.
 void destroyBeansOnPreDestroy()
          See description on ViewScopeBeanHolder for details about how this works
 void destroyCurrentFlowScope(FacesContext facesContext)
           
 Map<String,ContextualStorage> forceNewStorage()
          This method will replace the storageMap and with a new empty one.
 List<String> getActiveFlowMapKeys(FacesContext facesContext)
           
 ContextualStorage getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager, String flowClientWindowId)
          This method will return the ContextualStorage or create a new one if no one is yet assigned to the current flowClientWindowId.
 ContextualStorage getContextualStorageNoCreate(javax.enterprise.inject.spi.BeanManager beanManager, String flowClientWindowId)
           
 String getFlowMapKey(FacesContext facesContext, FlowReference flowReference)
           
 Map<Object,Object> getFlowScopeMap(javax.enterprise.inject.spi.BeanManager beanManager, String flowClientWindowId, boolean create)
           
 Map<String,ContextualStorage> getStorageMap()
           
 void init()
           
 void refreshClientWindow(FacesContext facesContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_FLOW_SCOPE_MAP

public static final String CURRENT_FLOW_SCOPE_MAP
See Also:
Constant Field Values

FLOW_SCOPE_PREFIX_KEY

public static final String FLOW_SCOPE_PREFIX_KEY
See Also:
Constant Field Values
Constructor Detail

FlowScopeBeanHolder

public FlowScopeBeanHolder()
Method Detail

init

@PostConstruct
public void init()

getContextualStorage

public ContextualStorage getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager,
                                              String flowClientWindowId)
This method will return the ContextualStorage or create a new one if no one is yet assigned to the current flowClientWindowId.

Parameters:
beanManager - we need the CDI BeanManager for serialisation.
flowClientWindowId - the flowClientWindowId for the current flow.

getContextualStorageNoCreate

public ContextualStorage getContextualStorageNoCreate(javax.enterprise.inject.spi.BeanManager beanManager,
                                                      String flowClientWindowId)

getStorageMap

public Map<String,ContextualStorage> getStorageMap()

getFlowScopeMap

public Map<Object,Object> getFlowScopeMap(javax.enterprise.inject.spi.BeanManager beanManager,
                                          String flowClientWindowId,
                                          boolean create)

forceNewStorage

public Map<String,ContextualStorage> forceNewStorage()
This method will replace the storageMap and with a new empty one. This method can be used to properly destroy the WindowBeanHolder beans without having to sync heavily. Any Contextual.destroy(Object, javax.enterprise.context.spi.CreationalContext) should be performed on the returned old storage map.

Returns:
the old storageMap.

destroyBeans

public void destroyBeans()
This method properly destroys all current @WindowScoped beans of the active session and also prepares the storage for new beans. It will automatically get called when the session context closes but can also get invoked manually, e.g. if a user likes to get rid of all it's @WindowScoped beans.


destroyBeansOnPreDestroy

@PreDestroy
public void destroyBeansOnPreDestroy()
See description on ViewScopeBeanHolder for details about how this works


refreshClientWindow

public void refreshClientWindow(FacesContext facesContext)

clearFlowMap

public void clearFlowMap(String clientWindowId)

getActiveFlowMapKeys

public List<String> getActiveFlowMapKeys(FacesContext facesContext)

getFlowMapKey

public String getFlowMapKey(FacesContext facesContext,
                            FlowReference flowReference)

createCurrentFlowScope

public void createCurrentFlowScope(FacesContext facesContext)

destroyCurrentFlowScope

public void destroyCurrentFlowScope(FacesContext facesContext)


Copyright © 2014 The Apache Software Foundation. All rights reserved.