private static Map<Contextual<?>, CreationalContext<?>> getFlowScopedCreationalMapForCurrentFlow() {
Map<Contextual<?>, CreationalContext<?>> result;
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext extContext = context.getExternalContext();
Map<String, Object> sessionMap = extContext.getSessionMap();
Flow currentFlow = getCurrentFlow(context);
ClientWindow curWindow = context.getExternalContext().getClientWindow();
if (null == curWindow) {
throw new IllegalStateException("Unable to obtain current ClientWindow. Is the ClientWindow feature enabled?");
}
String creationalForClientWindow = currentFlow.getClientWindowFlowId(curWindow) + "_creational";
result = (Map<Contextual<?>, CreationalContext<?>>) sessionMap.get(creationalForClientWindow);
if (null == result) {
result = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
sessionMap.put(creationalForClientWindow, result);
ensureCreationalCleanupOnSessionDestroyed(sessionMap, creationalForClientWindow);