5 Replies Latest reply on Jun 29, 2014 2:11 PM by dinusha ambagahawita

    Started new processes cannot retriview as task

    dinusha ambagahawita Newbie

      Hi,

       

      I am using a simple process which runs on JBPM6. I was able to start the process by calling ProcessInstance processInstance = ksession.startProcess("myprocessname") and its correcting returning new processinstanceid.

       

      jbpm_issue.PNG

       

      But when I try to retrieve the tasks by giving the user as "user1" then its not returning any results set.

       

      List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("user1", "en-UK");

       

      My "user1" is given to this "Approved by PM" human task an Actor.

       

      Any reason that i was not getting the assigned tasks back? How JBPM maps the newly created processors for actors.

        • 1. Re: Started new processes cannot retriview as task
          dinusha ambagahawita Newbie

          Just figured out its not having these columns updated corrected in the H2 JBPM table TASK

          ACTUALOWNER_ID  CREATEDBY_ID 

           

          Where we are giving these when starting the process?

          • 2. Re: Started new processes cannot retriview as task
            Maciej Swiderski Master

            it depends on user task assignment - is it assigned to individuals (ActorId) or to groups (GroupId). If it is to ActorId and there is only one then these two columns will be filled in otherwise they will stay empty until task is claimed. Another reason why it is not possible to retrieve tasks is because your user is not known to the UserGroupCallback used for the engine so it simple removes unknown users while creating a task.

             

            HTH

            • 3. Re: Started new processes cannot retriview as task
              dinusha ambagahawita Newbie

              Hi Maciej,

               

              Thanks for the reply. I am using a simple one actor. So i assume nothing wrong in assignment.

               

              How do i make sure the 2nd point you mentioned. "user is not known to the UserGroupCallback". I have implemented UserGroupCallback and its having below method too.

               

              public boolean existsUser(String userId) {

                      return userId.equals("newuser") || userId.equals("mary") || userId.equals("Administrator");

                  }

               

              What i basically did was took this example, run the "rewards-basic" project by changing the start user from "john" to "newuser" (which is the assigned user for the 1st state this simple workflow)

              https://github.com/jsvitak/jbpm-6-examples

               

              i searched for name "john" -> change all the places to from "john" -> "newuser"

               

              But when i run it its not working for "newuser". but only working for user "john".

               

              Appreciate your view!

               

              Tx

              • 4. Re: Started new processes cannot retriview as task
                Mauricio Salatino Master

                Hi Dinusha,

                Did you debug your process to check that your UserGroupCallback is being called? I will guess that it is not being called.

                HTH

                • 5. Re: Started new processes cannot retriview as task
                  dinusha ambagahawita Newbie

                  Hi Maciej,

                   

                  Thanks for the reply. I just debug that and below are the findings.

                   

                  If I use existing users in this examples (john or mary) then its working correctly. But if i assign a new user in the diagram then it will not work. I have defined my UserGroupCallback implementations correctly in the beans.xml but cannot see its getting called in either of occasions(with existing users and new user).

                  But both the occasions i can see these warnings are printed in the console.

                   

                  WARN  [org.jbpm.kie.services.cdi.producer.HumanTaskServiceProducer] (http-localhost/127.0.0.1:8080-1) Cannot get value of of instance @Default Instance<UserGroupCallback> due to WELD-001308 Unable to resolve any beans for Types: [interface org.kie.api.task.UserGroupCallback]; Bindings: [QualifierInstance{annotationClass=interface javax.enterprise.inject.Default, values={}, hashCode=-483412954}]

                   

                  WARN  [org.jbpm.kie.services.cdi.producer.HumanTaskServiceProducer] (http-localhost/127.0.0.1:8080-1) Cannot get value of of instance @Default Instance<UserInfo> due to WELD-001308 Unable to resolve any beans for Types: [interface org.kie.internal.task.api.UserInfo]; Bindings: [QualifierInstance{annotationClass=interface javax.enterprise.inject.Default, values={}, hashCode=-483412954}]

                   

                  How its working with existing users - john OR mary? Why its not working with newly added users?

                   

                  Appreciate your advice!

                   

                  Tx