/** * Remove the given ConversationContext from the SessionContext storage. * This method usually will get called at {@link Conversation#end()} or during cleanup. * Not that this does <b>not</b> destroy the ConversationContext! * @return {@code true} if the conversationContext got removed */ public boolean removeConversationFromStorage(ConversationContext conversationContext) { Context sessionContext = webBeansContext.getContextsService().getCurrentContext(SessionScoped.class); Set<ConversationContext> sessionConversations = getSessionConversations(sessionContext, true); return sessionConversations.remove(conversationContext); }
/** * Add the given ConversationContext to the SessionContext. * This method usually will get called at {@link Conversation#begin()}. */ public void addToConversationStorage(ConversationContext conversationContext, String conversationId) { Asserts.assertNotNull(conversationId, "conversationId"); Context sessionContext = webBeansContext.getContextsService().getCurrentContext(SessionScoped.class); Set<ConversationContext> sessionConversations = getSessionConversations(sessionContext, true); // check whether this conversation already exists for (ConversationContext sessionConversation : sessionConversations) { if (conversationId.equals(sessionConversation.getConversation().getId())) { throw new IllegalArgumentException("Conversation with id=" + conversationId + " already exists!"); } } // if not, then simply add this conversation sessionConversations.add(conversationContext); }
Set<ConversationContext> conversationContexts = conversationManager.getSessionConversations(sessionContext, false); if (conversationContexts != null)
Set<ConversationContext> conversationContexts = getSessionConversations(sessionContext, false);