3 Replies Latest reply on Apr 16, 2010 9:28 PM by sai burgula

    how to go back to parent conversation

    sai burgula Novice
      Hi

      I have a bean wherein I start a conversation on a search page, where you can search for a course,and it presents you a list. 

      Now when you select a course by clicking on a row in that dataTable, another conversation(nested) starts.  This conversation is active till the person searches, edit, delete or does any operation on that course.  When the person again clicks on a link on the page to go back to the search results, the nested conversation is ended and parent conversation is made active.

      The method I call when a person clicks on that link(named Search) from any page(edit, delete, view) is the clearSearchParams() method.

      This method has the following code:

      String oldConversationId = Conversation.instance().getId();

      // this will end the nested conversation.
      Conversation.instance().end();
      // Conversation.instance().leave();

      ConversationEntries.instance().removeConversationEntry(
                          oldConversationId);

      // this will redirect conversation to the parent
      Conversation.instance().redirectToParent();


      As you can notice it gets the current conversation Id, ends the conversation, removes the conversation Id from the entries list and redirects to the parent Conversation.

      Now what I notice is that as I am clicking through the different links on the left hand menu from any page, I am able to go through all the pages, but when I click on the Search page, it blanks out.  I believe that the conversation is ended, but it does not somehow redirect to the parent, and I dont get the search page back.


      Can anyone suggest what is the best remedy for this situation.


      In my bean, I have the following code right at the beginning even before the search method is called:

      protected void beginConversation(boolean join, boolean nested) {
                Conversation.instance().begin(join, nested);
           }

      protected void endConversation(boolean beforeRedirect) {
                Conversation.instance().end(beforeRedirect);
           }

      And when a course is selected I have a method called loadCourseOffering() being called.

      That method has the following line in it

           Conversation.instance().begin(false, true);
      which starts a nested conversation.

      This conversation is active when you edit that course, delete, view the course details, etc.

      It should ideally end and the parent conversation should be called when I click on the "Search" link from any page, since it calls the above listed method "clearSearchParams()".


      Please let me know if anyone has a idea for this.

      thanks
      Sai

      P.S:   I hope I have not confused anyone with so much information.  My apologies if so.