Package org.apache.myfaces.flow.cdi
Class FlowScopeBeanHolder
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description static String
CREATED
static String
CURRENT_FLOW_SCOPE_MAP
-
Constructor Summary
Constructors Constructor Description FlowScopeBeanHolder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 worksvoid
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)
Map<Object,Object>
getFlowScopeMap(javax.enterprise.inject.spi.BeanManager beanManager, String flowClientWindowId, boolean create)
Map<String,ContextualStorage>
getStorageMap()
void
init()
void
refreshClientWindow(FacesContext facesContext)
-
-
-
Field Detail
-
CURRENT_FLOW_SCOPE_MAP
public static final String CURRENT_FLOW_SCOPE_MAP
- See Also:
- Constant Field Values
-
CREATED
public static final String CREATED
-
-
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 CDIBeanManager
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 BeanHolder beans without having to sync heavily. AnyContextual.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)
-
createCurrentFlowScope
public void createCurrentFlowScope(FacesContext facesContext)
-
destroyCurrentFlowScope
public void destroyCurrentFlowScope(FacesContext facesContext)
-
-