* Called just before the render phase.
*/
public void prepareBackswitch(FacesContext facesContext)
{
Conversation conversation = Conversation.instance();
//stuff from jPDL takes precedence
org.jboss.seam.pageflow.Page page =
Manager.instance().isLongRunningConversation() &&
Init.instance().isJbpmInstalled() &&
Pageflow.instance().isInProcess() && Pageflow.instance().isStarted() ?
Pageflow.instance().getPage() : null;
if (page==null)
{
//handle stuff defined in pages.xml
Pages pages = Pages.instance();
if (pages!=null) //for tests
{
String viewId = Pages.getViewId(facesContext);
org.jboss.seam.navigation.Page pageEntry = pages.getPage(viewId);
if ( pageEntry.isSwitchEnabled() )
{
conversation.setViewId(viewId);
}
if ( pageEntry.hasDescription() )
{
conversation.setDescription( pageEntry.renderDescription() );
}
else if(pages.hasDescription(viewId))
{
conversation.setDescription( pages.renderDescription(viewId) );
}
conversation.setTimeout( pages.getTimeout(viewId) );
conversation.setConcurrentRequestTimeout( pages.getConcurrentRequestTimeout(viewId) );
}
}
else
{
//use stuff from the pageflow definition
if ( page.isSwitchEnabled() )
{
conversation.setViewId( Pageflow.instance().getPageViewId() );
}
if ( page.hasDescription() )
{
conversation.setDescription( page.getDescription() );
}
conversation.setTimeout( page.getTimeout() );
}
flushConversationMetadata();
}