1 2 Previous Next 19 Replies Latest reply on Jun 28, 2007 5:37 AM by trekker880

    How to extract the page id

    trekker880

      hi how we can extract the view-id that is defined in the pageflow.jpdl.xml ?

        • 1. Re: How to extract the page id
          trekker880

           

          "trekker880" wrote:
          hi how we can extract the view-id that is defined in the pageflow.jpdl.xml ?


          How to read the pageflow.jpdl.xml file in a java class like we do it in the processdefintion.xml in jbpm?

          FileInputStream fis = new FileInputStream("processes/Hello_Core/processdefinition.xml");
          ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(fis);

          • 2. Re: How to extract the page id
            pmuir

            You should start by explaining what you are trying to do. Alternatively look at the code in org.jboss.seam.bpm.Jbpm to see how Seam parses the pageflow (if you *really* want to reparse it yourself)!

            • 3. Re: How to extract the page id
              trekker880

              I had defined a pageflow.xml (Submit2.jpdl.xml)

              And i m trying to find out the view-id in the java class and the corrosponding page name.
              In Short i need the last,Current,and Next page with every page transition.
              Then what is the procedure ?
              Here i am not able to read the xml in the java file.

              <pageflow-definition xmlns="http://jboss.com/products/seam/pageflow"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation=
              "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-1.2.xsd"
              name="submit2">

              <start-page name="page2" view-id="/page2.jspx" >




              </start-page>

              <page name="page3" view-id="/page3.jspx" back="enabled">





              <page name="page4" view-id="/page4.jspx" back="enabled">





              <page view-id="/login.jspx" name="start" >


              </pageflow-definition>

              • 4. Re: How to extract the page id
                trekker880

                 

                "trekker880" wrote:
                I had defined a pageflow.xml (Submit2.jpdl.xml)

                And i m trying to find out the view-id in the java class and the corrosponding page name.
                In Short i need the last,Current,and Next page with every page transition.
                Then what is the procedure ?
                Here i am not able to read the xml in the java file.

                <pageflow-definition xmlns="http://jboss.com/products/seam/pageflow"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation=
                "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-1.2.xsd"
                name="submit2">

                <start-page name="page2" view-id="/page2.jspx" >
                <transition name="yes" to="page3">
                </transition>

                <transition name="back" to="start"></transition>
                </start-page>

                <page name="page3" view-id="/page3.jspx" back="enabled">
                <redirect/>
                <transition name="back" to="page2"></transition>
                <transition name="yes" to="page4"/>
                </page>

                <page name="page4" view-id="/page4.jspx" back="enabled">
                <redirect/>
                <transition to="start" name="yes"></transition>
                <transition name="back" to="page3"></transition>
                </page>

                <page view-id="/login.jspx" name="start" >
                </page>

                </pageflow-definition>


                • 5. Re: How to extract the page id
                  pmuir

                  You can access the ProcessDefintion object using Jbpm.instance().getPageflowProcessDefintion("Submit2");

                  You can then use a method like getNode("page2") or getNodes() to inspect the node. Cast the Node object you want to org.jboss.seam.pageflow.Page.

                  • 6. Re: How to extract the page id
                    trekker880

                    Hi i am using the same thing u told but i am not getting the desired output pls tell me where i am wrong.
                    The output is

                    *******************************
                    ----------pageflowDefinition is null-----------
                    -----instance.getProcessInstance()--------null
                    -----pageflow.getNode()--------null

                    *******************************

                    package com.sample.action;

                    import java.io.FileInputStream;

                    import org.jboss.seam.core.Jbpm;
                    import org.jboss.seam.core.Pageflow;
                    import org.jboss.seam.core.ProcessInstance;

                    import org.jbpm.graph.def.ProcessDefinition;

                    public class UserTest {
                    boolean b= true;
                    public void test() throws Exception{

                    Jbpm jbpm = new Jbpm();


                    ProcessDefinition pageflowDefinition =jbpm.getPageflowProcessDefinition("Webroot/submit2.jpdl.xml");



                    if(pageflowDefinition == null){
                    System.out.println("----------pageflowDefinition is null-----------");
                    }else{
                    System.out.println("----------pageflowDefinition is not null entry-----------");
                    }

                    Pageflow pageflow = new Pageflow();


                    // pageflow.getPage();
                    // System.out.println("---pageflow.getPage()---"+pageflow.getPage());
                    //
                    ProcessInstance instance = new ProcessInstance() ;

                    instance.getProcessInstance();

                    System.out.println("-----instance.getProcessInstance()--------"+instance.getProcessInstance());



                    pageflow.getNode();
                    System.out.println("-----pageflow.getNode()--------"+pageflow.getNode());

                    }
                    public static void main(String[] args) throws Exception{
                    UserTest test1 = new UserTest();
                    test1.test();
                    }
                    }

                    • 7. Re: How to extract the page id
                      pmuir

                      Pageflows are mapped by name not path.

                      • 8. Re: How to extract the page id
                        trekker880

                        Ok.
                        If i am doing this
                        ProcessDefinition pageflowDefinition =jbpm.getPageflowProcessDefinition("submit2");

                        I m still getting the same output.

                        Could you tell how we find out the path for the submit2.jpdl.xml in the java class ?
                        thanx

                        • 9. Re: How to extract the page id
                          trekker880

                          NO Reply ???

                          • 10. Re: How to extract the page id
                            gavin.king

                            I strongly recommend that you install a debugger on your development machine. It will make your life *much* easier :-)

                            • 11. Re: How to extract the page id
                              trekker880

                              Hi this is my simple code -
                              package example;


                              import java.io.FileInputStream;

                              import org.jboss.seam.ScopeType;
                              import org.jboss.seam.annotations.Begin;
                              import org.jboss.seam.annotations.Create;
                              import org.jboss.seam.annotations.Name;
                              import org.jboss.seam.annotations.Scope;
                              import org.jboss.seam.core.Jbpm;
                              import org.jboss.seam.core.Pageflow;

                              import org.jbpm.graph.def.ProcessDefinition;


                              //@Name("submit2")
                              //@Scope(ScopeType.PAGE)
                              public class UserTest {

                              @Create
                              @Begin(pageflow="submit2")

                              public void test() throws Exception{

                              //Jbpm jbpm = new Jbpm();
                              boolean b;
                              System.out.println("--Before the instance---");
                              ProcessDefinition pageflowDefinition =Jbpm.instance().getPageflowProcessDefinition("submit2");

                              if(pageflowDefinition == null){
                              System.out.println("----------pageflowDefinition is null-----------");
                              }else{
                              System.out.println("----------pageflowDefinition is not null entry-----------");
                              }
                              }
                              public static void main(String[] args) throws Exception{
                              UserTest test1 = new UserTest();
                              test1.test();

                              }

                              }

                              Here i am getting the IlligalStateException at the getpageflowProcessDefinition() method. Is there any sample code so that i can have a look and find out the procedure . Its urgent
                              **********
                              Exception in thread "main" java.lang.IllegalStateException: No application context active
                              at org.jboss.seam.core.Jbpm.instance(Jbpm.java:248)
                              at example.UserTest.test(UserTest.java:29)
                              at example.UserTest.main(UserTest.java:39)
                              ****************

                              • 12. Re: How to extract the page id
                                pmuir

                                Please use [ code ] tags when you post. The code you posted above won't work as the call to test1.test() isn't intercepted by the container - hence the IllegalStateException. Try just calling the method from a JSF page.

                                • 13. Re: How to extract the page id
                                  trekker880

                                  From this code i want to pass the current page,Next page as parameters in a method. So i want this functionality in java class.

                                  You are right as this is not interpreted by the container.
                                  But cannot we do something to read the xml first and after that we can use the methods to get the Current page-id etc.

                                  This is the whole purpose i m doing for.

                                  • 14. Re: How to extract the page id
                                    trekker880

                                    Is there any sample code to test the pageflow transitions?

                                    1 2 Previous Next