private void setDestructionQueue(Map<String, ManagedConversation> conversations, S session) { Map<String, List<ContextualInstance<?>>> contexts = new HashMap<>(); for (Entry<String, ManagedConversation> entry : conversations.entrySet()) { ManagedConversation conversation = entry.getValue(); // First make all conversations transient if (!conversation.isTransient()) { conversation.end(); } // Extract contextual instances List<ContextualInstance<?>> contextualInstances = new ArrayList<>(); for (String id : new ConversationNamingScheme(getNamingSchemePrefix(), entry.getKey(), beanIdentifierIndex) .filterIds(getSessionAttributeNames(session))) { contextualInstances.add((ContextualInstance<?>) getSessionAttributeFromSession(session, id)); } contexts.put(entry.getKey(), contextualInstances); } // Store remaining conversation contexts for later destruction setRequestAttribute(getRequest(), DESTRUCTION_QUEUE_ATTRIBUTE_NAME, Collections.synchronizedMap(contexts)); }
private void setDestructionQueue(Map<String, ManagedConversation> conversations, S session) { Map<String, List<ContextualInstance<?>>> contexts = new HashMap<>(); for (Entry<String, ManagedConversation> entry : conversations.entrySet()) { ManagedConversation conversation = entry.getValue(); // First make all conversations transient if (!conversation.isTransient()) { conversation.end(); } // Extract contextual instances List<ContextualInstance<?>> contextualInstances = new ArrayList<>(); for (String id : new ConversationNamingScheme(getNamingSchemePrefix(), entry.getKey(), beanIdentifierIndex) .filterIds(getSessionAttributeNames(session))) { contextualInstances.add((ContextualInstance<?>) getSessionAttributeFromSession(session, id)); } contexts.put(entry.getKey(), contextualInstances); } // Store remaining conversation contexts for later destruction setRequestAttribute(getRequest(), DESTRUCTION_QUEUE_ATTRIBUTE_NAME, Collections.synchronizedMap(contexts)); }
private void setDestructionQueue(Map<String, ManagedConversation> conversations, S session) { Map<String, List<ContextualInstance<?>>> contexts = new HashMap<>(); for (Entry<String, ManagedConversation> entry : conversations.entrySet()) { ManagedConversation conversation = entry.getValue(); // First make all conversations transient if (!conversation.isTransient()) { conversation.end(); } // Extract contextual instances List<ContextualInstance<?>> contextualInstances = new ArrayList<>(); for (String id : new ConversationNamingScheme(getNamingSchemePrefix(), entry.getKey(), beanIdentifierIndex) .filterIds(getSessionAttributeNames(session))) { contextualInstances.add((ContextualInstance<?>) getSessionAttributeFromSession(session, id)); } contexts.put(entry.getKey(), contextualInstances); } // Store remaining conversation contexts for later destruction setRequestAttribute(getRequest(), DESTRUCTION_QUEUE_ATTRIBUTE_NAME, Collections.synchronizedMap(contexts)); }
private void setDestructionQueue(Map<String, ManagedConversation> conversations, S session) { Map<String, List<ContextualInstance<?>>> contexts = new HashMap<>(); for (Entry<String, ManagedConversation> entry : conversations.entrySet()) { ManagedConversation conversation = entry.getValue(); // First make all conversations transient if (!conversation.isTransient()) { conversation.end(); } // Extract contextual instances List<ContextualInstance<?>> contextualInstances = new ArrayList<>(); for (String id : new ConversationNamingScheme(getNamingSchemePrefix(), entry.getKey(), beanIdentifierIndex) .filterIds(getSessionAttributeNames(session))) { contextualInstances.add((ContextualInstance<?>) getSessionAttributeFromSession(session, id)); } contexts.put(entry.getKey(), contextualInstances); } // Store remaining conversation contexts for later destruction setRequestAttribute(getRequest(), DESTRUCTION_QUEUE_ATTRIBUTE_NAME, Collections.synchronizedMap(contexts)); }
private void setDestructionQueue(Map<String, ManagedConversation> conversations, S session) { Map<String, List<ContextualInstance<?>>> contexts = new HashMap<>(); for (Entry<String, ManagedConversation> entry : conversations.entrySet()) { ManagedConversation conversation = entry.getValue(); // First make all conversations transient if (!conversation.isTransient()) { conversation.end(); } // Extract contextual instances List<ContextualInstance<?>> contextualInstances = new ArrayList<>(); for (String id : new ConversationNamingScheme(getNamingSchemePrefix(), entry.getKey(), beanIdentifierIndex) .filterIds(getSessionAttributeNames(session))) { contextualInstances.add((ContextualInstance<?>) getSessionAttributeFromSession(session, id)); } contexts.put(entry.getKey(), contextualInstances); } // Store remaining conversation contexts for later destruction setRequestAttribute(getRequest(), DESTRUCTION_QUEUE_ATTRIBUTE_NAME, Collections.synchronizedMap(contexts)); }
protected ConversationIdGenerator getConversationIdGenerator() { final R request = associated.get(); if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeGeneratingId(); } Object conversationIdGenerator = getRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME); if (conversationIdGenerator == null) { conversationIdGenerator = getSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, false); if (conversationIdGenerator == null) { conversationIdGenerator = new ConversationIdGenerator(); setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); setSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator, false); } else { setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); } } if (!(conversationIdGenerator instanceof ConversationIdGenerator)) { throw ConversationLogger.LOG.conversationIdGeneratorNotFound(); } return (ConversationIdGenerator) conversationIdGenerator; }
protected ConversationIdGenerator getConversationIdGenerator() { final R request = associated.get(); if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeGeneratingId(); } Object conversationIdGenerator = getRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME); if (conversationIdGenerator == null) { conversationIdGenerator = getSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, false); if (conversationIdGenerator == null) { conversationIdGenerator = new ConversationIdGenerator(); setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); setSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator, false); } else { setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); } } if (!(conversationIdGenerator instanceof ConversationIdGenerator)) { throw ConversationLogger.LOG.conversationIdGeneratorNotFound(); } return (ConversationIdGenerator) conversationIdGenerator; }
private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); final R request = getRequest(); Object conversationMap = getRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME); if (conversationMap == null) { conversationMap = getSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, false); if (conversationMap == null) { conversationMap = Collections.synchronizedMap(new HashMap<String, ManagedConversation>()); setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap); setSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, false); } else { setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap); } } if (conversationMap == null || !(conversationMap instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, request); } return cast(conversationMap); }
private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); final R request = getRequest(); Object conversationMap = getRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME); if (conversationMap == null) { conversationMap = getSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, false); if (conversationMap == null) { conversationMap = Collections.synchronizedMap(new HashMap<String, ManagedConversation>()); setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap); setSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, false); } else { setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap); } } if (conversationMap == null || !(conversationMap instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, request); } return cast(conversationMap); }
private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); final R request = getRequest(); Object conversationMap = getRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME); if (conversationMap == null) { conversationMap = getSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, false); if (conversationMap == null) { conversationMap = Collections.synchronizedMap(new HashMap<String, ManagedConversation>()); setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap); setSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, false); } else { setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap); } } if (conversationMap == null || !(conversationMap instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, request); } return cast(conversationMap); }
protected void associateRequestWithNewConversation() { ManagedConversation conversation = new ConversationImpl(manager); lock(conversation); setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); // Set a temporary bean store, this will be attached at the end of the request if needed NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), "transient", beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); setRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME, namingScheme); }
protected void associateRequestWithNewConversation() { ManagedConversation conversation = new ConversationImpl(manager); lock(conversation); setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); // Set a temporary bean store, this will be attached at the end of the request if needed NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), "transient", beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); setRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME, namingScheme); }
protected void associateRequestWithNewConversation() { ManagedConversation conversation = new ConversationImpl(manager); lock(conversation); setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); // Set a temporary bean store, this will be attached at the end of the request if needed NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), "transient", beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); setRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME, namingScheme); }
protected void associateRequestWithNewConversation() { ManagedConversation conversation = new ConversationImpl(manager); lock(conversation); setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); // Set a temporary bean store, this will be attached at the end of the request if needed NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), "transient", beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); setRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME, namingScheme); }
protected void associateRequestWithNewConversation() { ManagedConversation conversation = new ConversationImpl(manager); lock(conversation); setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); // Set a temporary bean store, this will be attached at the end of the request if needed NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), "transient", beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); setRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME, namingScheme); }
protected void associateRequest(ManagedConversation conversation) { setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), conversation.getId(), beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); getBeanStore().attach(); }
protected void associateRequest(ManagedConversation conversation) { setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), conversation.getId(), beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); getBeanStore().attach(); }
protected void associateRequest(ManagedConversation conversation) { setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), conversation.getId(), beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); getBeanStore().attach(); }
protected void associateRequest(ManagedConversation conversation) { setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), conversation.getId(), beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); getBeanStore().attach(); }
protected void associateRequest(ManagedConversation conversation) { setRequestAttribute(getRequest(), CURRENT_CONVERSATION_ATTRIBUTE_NAME, conversation); NamingScheme namingScheme = new ConversationNamingScheme(getNamingSchemePrefix(), conversation.getId(), beanIdentifierIndex); setBeanStore(createRequestBeanStore(namingScheme, getRequest())); getBeanStore().attach(); }