1 Reply Latest reply on Aug 25, 2014 2:34 AM by Andreas G.

    Dynamically assigning users to tasks in a web application

    Meenakshi KK Newbie

      I have created a standalone jbpm web application. It is something like this,

      a. Screen 1 - Displays two links
      Assign Anomaly
      Verify Anomaly

       

      The assign Anomaly link should enable us to assign task to a user. This list of users comes from the DB.


      When the Verify Anomaly link is clicked, a custom login page is displayed. When the user, who had been assigned an anomaly (via first link) logs in,
      he should be able to see the tasks assigned to him.

      b. I have followed this in the lines of rewards_basic application example. My workflow has only one User defined task.

       

      c. The problem that I am facing is in assigning the tasks to the user when I click on the Assign Anomal link
      a. I am using the userGroup call back function to register all the users.
      b. Tried hardcoding the users in userinfo.propertis in resources folder of web application
      c. Tried hardcoding in the user.properties in jboss config directory.

      None seem to be working, unless I explicitely give the user name in the actor fied of the user task in bpmn file.

       

      Is  there any specific way that we can configure jbpm to validate users against the mysql custom users table?

      How do we link the user who has logged in to the process. service. When creating processService, am giving the user name as the input parameter.?

       

      None seem to be working.



      d. Please let me know how to dynamically assign tasks to the user in this standalone web application.

       

      Thanks in advance for all your help.

      Regards

        • 1. Re: Dynamically assigning users to tasks in a web application
          Andreas G. Novice

          You can create your own UserGroupCallback like in this example. Then you have to create your environment with you usergroupcallback implementation like this:

           

          UserGroupCallback userGroupCallback = new MyUserGroupCallback();

          RuntimeEnvironment environment = runtimeEnvironmentBuilder

            .userGroupCallback(userGroupCallback)

            ...

            .get();

           

          If the actor field in the bpmn2-file is empty, you can use getTasksAssignedAsBusinessAdministrator("Administrator", "en-UK") of TaskService to get this task.

          After you get this task you can use the delegate methode of TaskService to assign this task to a user:

           

          taskService.activate(taskId, "Administrator");

          taskService.claim(taskId, "Administrator");

          taskService.delegate(taskId, "Administrator", "username");

           

          Have also a look at this examples.