4 Replies Latest reply on Mar 7, 2006 10:18 AM by antitrust1982

    decision expression

    antitrust1982

      hello everybody,

      I have an XPDL file where I have a decision to do:

      - if the responde of a test is "yes" i want to go in a task
      - and if not i want to go in an another.

      But when i write my XPDL code and execute the decision is already made in the XPDL code, and I want to make my choice when I execute my file. how can i choose the decision (yesor not) when i execute my file with a java code?

      for example i want to type when i arrived on the decision node "yes" or "no" and this choice permit to choice where i want to go

      thank you for you help

      antitrust1982.

      i put my extract of code:

      </start-state>
       <task-node name="Analyse DA">
       <transition name="" to="fournisseur existe-t-il?"></transition>
       </task-node>
       <decision name="fournisseur existe-t-il?" expression="oui">
       <transition name="oui" to="traitement DA" >
       </transition>
       <transition name="non" to="peut-on réorienter la DA vers fournisseur existant?">
       </transition>
       </decision>


        • 1. Re: decision expression
          antitrust1982

          I have just seen in an another topic the same problem but i don't understand really what i must do. can you help me to understand well please

          thanks for your help

          antitrust1982

          http://jboss.org/index.html?module=bb&op=viewtopic&t=66796

          • 2. Re: decision expression
            aguizar

            Looks like you intend the actor of the Analyse DA task to make the decision. In this case you would have multiple outgoing transitions from the task node, query the available transitions with TaskInstance.getAvailableTransitions() and complete the task and leave over one transition with TaskInstance.end(transition).

            • 3. Re: decision expression
              antitrust1982

              ok thank you for all. I will try your solution on my application.

              Antitrust1982

              • 4. Re: decision expression
                antitrust1982

                hi,

                i had tried your solution but when i put expression in decision node in my xpdl file the workflow already goes in the default branch and if i don't put any expression in decision node the file is block in the node. i join my xpld file and my file of exploration if you see any errors can you help me to understand how works this workflow because i'm a beginner in this domain and it's difficult to understand how works this technologie. thx tou for your help

                the JAVA FILE: (JUnit)

                
                package com.testjbpm;
                
                import org.jbpm.graph.def.*;
                import org.jbpm.graph.exe.*;
                import org.jbpm.jpdl.xml.*;
                import org.jbpm.taskmgmt.exe.TaskInstance;
                import junit.framework.TestCase;
                
                public class testjbpm extends TestCase {
                 public void testProcess() throws Exception{
                 String x1="non";
                
                 System.out.println("enter your value of x1");
                 x1= clavier.lireString();
                
                 java.io.FileReader reader= new java.io.FileReader("eclipse/testjbpm/src/java/testjbpm.par/processdefinition.xml");
                
                 JpdlXmlReader test= new JpdlXmlReader(reader);
                
                 ProcessDefinition definition =
                 test.readProcessDefinition();
                 assertNotNull("Definition should be not null", definition);
                
                 ProcessInstance instance = new ProcessInstance(definition);
                 TaskInstance task =new TaskInstance("Analyse DA","acheteur");
                
                 if (x1=="non"){
                 task.end();
                 System.out.println("la transition est non");
                 }
                 else{
                 if(x1=="oui"){
                 task.end("oui");
                 System.out.println("la transition est oui");
                 }
                 else{
                 System.out.println("problem"); }
                 }
                
                 System.out.println("task Id is +task.getAvailableTransitions());
                 instance.signal();
                
                 }
                }
                
                


                my XPLD FILE:
                <?xml version="1.0" encoding="UTF-8"?>
                
                <process-definition
                 xmlns="urn:jbpm.org:jpdl-3.1" name="testjbpm">
                 <start-state name="start">
                 <transition name="start_to_AnalyseDA" to="Analyse DA">
                 </transition>
                
                 </start-state>
                 <task-node name="Analyse DA">
                 <transition name="" to="fournisseur existe-t-il?"></transition>
                 </task-node>
                 <decision name="fournisseur existe-t-il?" expression="non">
                 <transition name="oui" to="traitement DA" >
                 </transition>
                 <transition name="non" to="peut-on réorienter la DA vers fournisseur existant?">
                 </transition>
                 </decision>
                 <task-node name="traitement DA">
                 <transition name="" to="end1"></transition>
                 </task-node>
                 <decision name="peut-on réorienter la DA vers fournisseur existant?" expression="oui">
                 <transition name="oui" to="traitement DA">
                 </transition>
                 <transition name="non" to="fournisseur existe dans SAP?">
                 </transition>
                 </decision>
                
                ...............
                



                thank you very much for your help

                Antitrust1982