/** * Is there a long running conversation associated with the current request? */ protected boolean isLongRunningConversation() { return Manager.instance().isLongRunningConversation(); }
public boolean isLongRunningOrNestedConversation() { return isLongRunningConversation() || isNestedConversation(); }
protected void flushConversationMetadata() { if ( isLongRunningConversation() ) { //important: only do this stuff when a long-running // conversation exists, otherwise we would // force creation of a conversation entry Conversation.instance().flush(); } }
/** * Start a nested conversation. * * @throws IllegalStateException if no long-running conversation was active */ public void beginNested() { if ( Manager.instance().isLongRunningConversation() ) { Manager.instance().beginNestedConversation( ); } else { throw new IllegalStateException("beginNested() called with no long-running conversation"); } }
public boolean isCurrent() { Manager manager = Manager.instance(); if ( manager.isLongRunningConversation() ) { return id.equals( manager.getCurrentConversationId() ); } else if ( manager.isNestedConversation() ) { return id.equals( manager.getParentConversationId() ); } else { return false; } }
private void updateConversationId() { Manager manager = Manager.instance(); conversationId = manager.isLongRunningConversation() ? manager.getCurrentConversationId() : manager.getParentConversationId(); }
private void promoteConversation() { try { if (!Manager.instance().isLongRunningConversation()) { Manager.instance().setLongRunningConversation(true); this.iPromotedTheConversation = true; } } catch (IllegalStateException e) { // ignore } }
private void promoteConversation() { try { if (!Manager.instance().isLongRunningConversation()) { Manager.instance().setLongRunningConversation(true); this.iPromotedTheConversation = true; } } catch (IllegalStateException e) { // ignore } }
public boolean isReallyLongRunningConversation() { return isLongRunningConversation() && !getCurrentConversationEntry().isRemoveAfterRedirect() && !Session.instance().isInvalid(); }
private String getLongRunningConversationId() { Manager manager = Manager.instance(); if ( manager.isLongRunningConversation() ) { return manager.getCurrentConversationId(); } else if ( manager.isNestedConversation() ) { return manager.getParentConversationId(); } else { //TODO: is there any way to set it to the current outcome, instead of null? return null; } }
public static void endCall() { try { Contexts.destroy( Contexts.getSessionContext() ); Contexts.flushAndDestroyContexts(); if ( Manager.instance().isLongRunningConversation() ) { throw new IllegalStateException("Do not start long-running conversations in direct calls to EJBs"); } } finally { clearThreadlocals(); log.debug( "<<< End call" ); } }
if ( !manager.isLongRunningConversation() )
/** * Temporarily promote a temporary conversation to * a long running conversation for the duration of * a browser redirect. After the redirect, the * conversation will be demoted back to a temporary * conversation. */ public void beforeRedirect() { //DONT BREAK, icefaces uses this if (!destroyBeforeRedirect) { ConversationEntry ce = getCurrentConversationEntry(); if (ce==null) { ce = createConversationEntry(); } //ups, we don't really want to destroy it on this request after all! ce.setRemoveAfterRedirect( !isLongRunningConversation() ); setLongRunningConversation(true); } }
@SuppressWarnings("deprecation") public boolean redirectToExistingConversation(Method method) if ( !Manager.instance().isLongRunningConversation() )
/** * Promote a temporary conversation and make it long-running */ public void beginConversation() { if ( !isLongRunningConversation() ) { log.debug("Beginning long-running conversation"); setLongRunningConversation(true); createConversationEntry(); Conversation.instance(); //force instantiation of the Conversation in the outer (non-nested) conversation storeConversationToViewRootIfNecessary(); if ( Events.exists() ) Events.instance().raiseEvent(EVENT_CONVERSATION_BEGIN); } }
/** * Make a long-running conversation temporary. */ public void endConversation(boolean beforeRedirect) { if ( isLongRunningConversation() ) { log.debug("Ending long-running conversation"); if ( Events.exists() ) Events.instance().raiseEvent(EVENT_CONVERSATION_END); setLongRunningConversation(false); destroyBeforeRedirect = beforeRedirect; endNestedConversations( getCurrentConversationId() ); storeConversationToViewRootIfNecessary(); } unlockConversation(); }
public void storeConversation() { Manager manager = Manager.instance(); //we only need to execute this code when we are in the //RENDER_RESPONSE phase, ie. not before redirects Session session = Session.getInstance(); boolean sessionInvalid = session!=null && session.isInvalid(); if ( !sessionInvalid && manager.isLongRunningConversation() ) { storeConversation( manager.getCurrentConversationId() ); } else if ( !sessionInvalid && manager.isNestedConversation() ) { discardNestedConversation( manager.getParentConversationId() ); } else { discardTemporaryConversation(); } /*if ( !sessionInvalid && Init.instance().isClientSideConversations() ) { // if we are using client-side conversations, put the // map containing the conversation context variables // into the view root (or remove it for a temp // conversation context) Contexts.getConversationContext().flush(); }*/ }
public void storePageflow() { if ( Init.instance().isJbpmInstalled() ) { Pageflow pageflow = Pageflow.instance(); if ( pageflow.isInProcess() /*&& !pageflow.getProcessInstance().hasEnded()*/ && Manager.instance().isLongRunningConversation() ) { pageflowName = pageflow.getSubProcessInstance().getProcessDefinition().getName(); pageflowNodeName = pageflow.getNode().getName(); pageflowCounter = pageflow.getPageflowCounter(); } else { pageflowName = null; pageflowNodeName = null; pageflowCounter = null; } } }
if ( Manager.instance().isLongRunningConversation() )