5 Replies Latest reply on Feb 23, 2011 7:51 PM by streejang

    how to get the taskId in "candidate-groups" sicenario?

    streejang

      I made a simple test process, and one task with the [candidate-groups="market"]

      suppose there are two users in this "market" group.: test1, and test2

       

      when this task is executed, the following codes alwasys give the "0" result.

      List<Task> taskList = taskService.findGroupTasks("test1");

      System.out.println(taskList.size());

       

      I wonder how to get the current running taskId in such a situation?

       

      I just start to learn this jBPM...

        • 1. how to get the taskId in "candidate-groups" sicenario?
          jnhelal

          Hi Stree

           

          I don't see what is wrong in there if you have make sure that you created a "market" group with a "test1" user  that belong to it !

           

          Here is something equivalent that work with JBPM4.4 (and i gess worked with 4.3):

           

          TaskList l = ...getTaskService().CreateQuery.candidate("test1").list()

           

          same would work with assignee("test1") instead of candidate("test1") after you explicitely "taken" the task or if you use [assignee ="test1"]  instead of [candidate-groups="marker"]

           

          Regards  

          JNH

          • 2. how to get the taskId in "candidate-groups" sicenario?
            streejang

            Hi Helal,

             

            Before the execution of this sample process, I do have created a "market" group, a user "test1", and created the membership.

            When this process is executed until this task, I wonder the way to acquire the current running task's taskId.

             

            It was mentioned through this way, we can get a taskList, then further to get specific taskId. However this taskList.size() always be 0. I don't understand...

            ----

            List<Task> taskList = taskService.findGroupTasks("test1");

            System.out.println(taskList.size());

            ----

             

            Besides I tried your way, also get the 0 result...

            List<Task> taskList2 = taskService.createTaskQuery().candidate("test1").list();

            System.out.println("taskList2.size(): " + taskList2.size());

            • 3. how to get the taskId in "candidate-groups" sicenario?
              streejang

              By the way

              ----------------

              List<Task> taskList3 = taskService.createTaskQuery().assignee("test1").list();

              ----------------

               

              this is clear to understand, since there is a "jbpm4_task" table, the relationship is obvious. The things which i don't understand is the candidates...

               

              Regards

               

              Stree

              • 4. how to get the taskId in "candidate-groups" sicenario?
                jnhelal

                User candidate to a task is just as you though : if a user "test1" membership to a group "market" and if  candidate-groups="market" is set for the task node into the process declarartion then you shoud be able to query test1 as candidate for that that task !

                 

                Please make sure that you do not use version number into your process declaration (<process name="NAME" version="INTVALUE" xmlns="http://jbpm.org/4.4/jpdl">). And if so try to increase by one the version number. This is because unless you destroy the db on each run, the process with the non increased version number might have been deployed time ago. It would be possible that you did it with different attribute in the task node than candidate-group....  Who knows !

                 

                The only other thing i could recommend would be to go to JBPM4.4 there is no difficulty with the source code. However for the database you will have to check the migration procedure.

                 

                Regards

                jnh

                • 5. how to get the taskId in "candidate-groups" sicenario?
                  streejang

                  I got it....

                   

                  As you mentioned, it's because of the process declaration...

                   

                  Thank you so much for your patience and help

                   

                  regards