{
Page page = Pages.instance().getPage(viewId);
if(conversationName != null)
{
ConversationIdParameter currentConversationIdParameter = Pages.instance().getConversationIdParameter(conversationName);
if(currentConversationIdParameter == null)
{
throw new IllegalStateException("The conversationName specified: " + conversationName + ", does not exist.");
}
// Try to restore the conversation from parameters (the user has specified the exact conversation to restore using f:param)
conversationId = currentConversationIdParameter.getRequestConversationId(parameters);
if (conversationId == null)
{
// Try to restore the conversation from the EL expression on the conversation definition
conversationId = currentConversationIdParameter.getConversationId();
}
}
else
{
conversationId = page.getConversationIdParameter().getRequestConversationId(parameters);