/** * Destroy the given ConversationContext and fire the proper * @Destroyed event with the correct payload. */ public void destroyConversationContext(ConversationContext ctx) { webBeansContext.getBeanManagerImpl().fireEvent( getLifecycleEventPayload(ctx), BeforeDestroyedLiteral.INSTANCE_CONVERSATION_SCOPED); ctx.destroy(); webBeansContext.getBeanManagerImpl().fireEvent( getLifecycleEventPayload(ctx), DestroyedLiteral.INSTANCE_CONVERSATION_SCOPED); }
private void startConversationContext() { ConversationManager conversationManager = webBeansContext.getConversationManager(); ConversationContext ctx = conversationManager.getConversationContext(getCurrentSessionContext()); ctx.setActive(true); conversationContext.set(ctx); if (ctx.getConversation().isTransient()) { webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent( conversationManager.getLifecycleEventPayload(ctx), InitializedLiteral.INSTANCE_CONVERSATION_SCOPED); } }
/** * Get current conversation ctx. * @return conversation context */ public ConversationContext getConversationContext(boolean create, boolean ignoreProblems) { ConversationContext conversationContext = conversationContexts.get(); if (conversationContext == null) { SessionContext sessionContext = getSessionContext(create); if (sessionContext != null) { conversationContext = conversationManager.getConversationContext(sessionContext); conversationContexts.set(conversationContext); if (conversationContext.getConversation().isTransient()) { webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent( conversationManager.getLifecycleEventPayload(conversationContext), InitializedLiteral.INSTANCE_CONVERSATION_SCOPED); } if (!ignoreProblems && conversationContext.getConversation().getProblemDuringCreation() != null) { throw conversationContext.getConversation().getProblemDuringCreation(); } } } return conversationContext; }