10 Replies Latest reply on Dec 28, 2012 6:34 AM by aadav86

    User Task inside Multiple Instances node to do concurrent User Task assignments

    aadav86

      Dear Community,

       

      With the support I've been receiving from the community members & developers, I have involved myself into this wonderful phenomenon of exploring and making the best use of jBPM5 & BPMN2.0

       

      My current experiment is to combine User Task with Multiple Instances construct involving looping mechanism for an iterative execution. I'm good with generation of multiple task items (User task in my case) sequentially and its completion synchrounously and execution out of Multiple Instances construct is also fine.

       

      DynamicWF.png

       

      Objective of my above depicted design is to reduce a lot of manual effort in placing multiple user tasks to achieve a approval workflow of multi levels with more than an user task at every level.

       

      1) To serve the horizontal purpose I'm simply using Multiple Instances node to create concurrent user task assignments.

      2) To carry out the vertical level I have manually introduced the looping mechanism.

       

       

      Concerns & Queries about what I'm trying to achieve is

       

      1) If at all I have placed separate User Tasks across the BPMN, associating the name of the tasks with User Task node would have become simple since I would have given the names separately. But in case of my design the User Task which takes the input with the help of Multiple Instances node's collection expression(list) it gets the User (Approver) name alone. I'm wondering how can I associate the name of the task with the User Task node. For Eg:- HR Approval, Admin Approval etc., If the multiple instances node is capable of taking Map object we could have set the Task Name as key and the User name as value.

       

      2) Is there any tweak available for Multiple Instances node with which we can set its property to "Async" because the construct behaves in a synchronized manner meaning only after all the Task assignments(User task in my case) are completed the construct moves forward its control. But there are situations in which I really need to keep the User Tasks triggered out of Multiple Instances be independent of each other.

       

      3) Is it possible to customize the User Task to associate it with an WorkItemHandler. This question should make sense if my understanding about the Domain specific WorkItemHandlers are not wrong.

       

      Guys, please throw me some light on these things as I'm struct and not able to move forward with the other things..

       

      Thanks in Advance,

      Aadav

        • 1. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
          thomas.setiabudi

          Hi Aadav,

           

          For your question number 3, yes it is possible to customize User Task and associate it with your own custom implementation of WorkItemHandler.

           

          Regards,

          Thomas Setiabudi

          • 2. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
            aadav86

            Hi Thomas,

             

            Thanks a lot for the input.. Any thoughts on the other items..?

             

            Thanks,

            Aadav

            • 3. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
              thomas.setiabudi

              I am not sure why you use multiple instance node there..

               

              If the approval process is sequential, you can just use single human task node and about the name of the task, just use a single process variable and assign it to the task name like this #{taskNameVariable}

               

              have you tried that?

               

              Regards,

              Thomas Setiabudi

              • 4. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                swiderski.maciej

                Firs of all not really sure what you trying to achieve with these two dimensions?

                 

                If I understood your case right, you try to have a dynamic approval workflow that depends on two factors:

                1. list of approvers defined at the process start or during process live time but before it enters the approval flow

                2. some sort of completion condition that will allow to finish looping through approvers if one of the important ones has already approved it

                 

                if above is correct, you should use only the explicit loop construct which is based on exclusive gateways (since the standard loop characteristic is not yet implemented). That way you control how many tasks needs to be created and when you can proceed with the further activities. So in general it would look like following:

                - enter the first task - initial work needs to be done

                - once initial work is completed creates new task for the approver from the list

                - once first approver is completed then you evaluate if another needs to take place or not

                - if another approval is required you loop back to create another approval tasks

                - if not continue with the flow

                 

                the only aspect that is not (directly) covered here is that if you would like to create tasks for several approvers at the same time but you can achieve this by assigning approval tasks to a group instead of individuals (actor). It gives possibility to access it by several approvers but of course only one can claim and work on it.

                 

                HTH

                • 5. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                  aadav86

                  Hi Thomas,

                   

                   

                  My requirement is at every iteration I have to trigger tasks to multiple approvers. That's why I had to go for Multiple Instances node.

                   

                   

                  Thanks,

                  Aadav

                  • 6. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                    aadav86

                    Hi Maciej,

                     

                    Thanks a lot for the quick response.

                     

                    Your observation on my design is 100% perfect. Yes I had to go with this multidimensional approach to trigger multiple task assignment at a time and I want all the users to complete the task. Also I'm looping to achieve dynamic workflow.

                     

                    1) In that case how can I associate the task name to the number of User Tasks triggered? How can I overwrite the implementation of Multiple Instances construct so that I can associate different task names with different user tasks whose information gets stored in I18NText?

                     

                    2) Yes, I'm fine with the explicit loop construct and the "Async" property on Multiple Instances is possible..?

                     

                    Please advise.

                     

                    Thanks in advance,

                     

                    Aadav

                    • 7. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                      swiderski.maciej

                      Aadav N wrote:

                       

                       

                      1) In that case how can I associate the task name to the number of User Tasks triggered? How can I overwrite the implementation of Multiple Instances construct so that I can associate different task names with different user tasks whose information gets stored in I18NText?

                       

                      Not sure why you need to match these two? With multi instance each node instance will be of the same type - will have same task name, what will differ is the data pushed into that node instance - in your case human task. If you have requirement to somehow reset list of approvers after first iteration then you would need to prepare it up front and make sure a ready collection will be available for multi instance.

                       

                       

                      Aadav N wrote:

                       

                      2) Yes, I'm fine with the explicit loop construct and the "Async" property on Multiple Instances is possible..?

                      in general, multi instance (as every other construct) is synchronous and to make it async it's to make the handler that takes care of particular work item async. For human tasks it's already done. So in your case mutli instance will create all tasks and then will wait untill all of them are completed. Completion of the tasks can be done in any order and asynchronously.

                       

                      HTH

                      • 8. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                        aadav86

                        Maciej Swiderski wrote:


                        Not sure why you need to match these two? With multi instance each node instance will be of the same type - will have same task name, what will differ is the data pushed into that node instance - in your case human task. If you have requirement to somehow reset list of approvers after first iteration then you would need to prepare it up front and make sure a ready collection will be available for multi instance.

                         

                                  As per my business requirement, I want to associate different task name with each of the node instances (human task) so that at the front-end (Application) I can distinguish the Approver names and their Designation/Role. This is what I'm trying to achieve.

                         

                                  Yeah, I hope I can try this to achieve this requirement(Task name association) of mine at my App end itself with some sort of work around. But if it is achieved at the jBPM End I think the integrity of data is well maintained.

                        Maciej Swiderski wrote:

                         

                        In general, multi instance (as every other construct) is synchronous and to make it async it's to make the handler that takes care of particular work item async. For human tasks it's already done. So in your case mutli instance will create all tasks and then will wait untill all of them are completed. Completion of the tasks can be done in any order and asynchronously.

                         

                        Yeah, i understand that the human tasks can be completed in any order and asynchronously but I do not want the multiple instances node to wait until all of the tasks are completed. I just want to know if that tweak is possible on Multiple instances construct.

                                 

                         

                        Thanks forever,

                         

                        Aadav

                        • 9. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                          swiderski.maciej

                          Aadav N wrote:

                           

                          Yeah, i understand that the human tasks can be completed in any order and asynchronously but I do not want the multiple instances node to wait until all of the tasks are completed. I just want to know if that tweak is possible on Multiple instances construct.

                          unfortunately, it is not possible with current implemented features. BPMN2 spec defines completionCondition that is evaluated at the end of each instance so that could be something useful for you but it is not yet there (you could open jira issue)

                           

                           

                          Aadav N wrote:

                           

                                    As per my business requirement, I want to associate different task name with each of the node instances (human task) so that at the front-end (Application) I can distinguish the Approver names and their Designation/Role. This is what I'm trying to achieve.

                           

                                    Yeah, I hope I can try this to achieve this requirement(Task name association) of mine at my App end itself with some sort of work around. But if it is achieved at the jBPM End I think the integrity of data is well maintained.

                          does that mean you would like to assign different names to the task instances that are part of multi instance? Where task name is a data input definition and can accept expression same as GroupId. With that said your collection that is an input to the multi instance does not have to be collection of simple types like String, it could be collection of objects that can be then used to resolve the names and actors that you'd like to assign task to

                           

                          if your object would be like this:

                          TaskAssignmentInfo

                               String actorName

                               String taskName

                           

                          then you fill in collection with instances of TaskAssignmentInfo object and pass that collection as intput to multi instance. Then in the task definition you declare that the item that will be put into task instance is taskInfo and you can refer to it for interested fields to set data inputs:

                          taskInfo.getActorName() to assign task to given person

                          taskInfo.getTaskName() to set the task name dynamically

                           

                          HTH

                          • 10. Re: User Task inside Multiple Instances node to do concurrent User Task assignments
                            aadav86

                            Maciej Swiderski wrote:

                            unfortunately, it is not possible with current implemented features. BPMN2 spec defines completionCondition that is evaluated at the end of each instance so that could be something useful for you but it is not yet there (you could open jira issue) 

                             

                            Yeah, I will open a jira issue for this. But do I need to specify this as a feature request?

                            Maciej Swiderski wrote:

                             

                            does that mean you would like to assign different names to the task instances that are part of multi instance? Where task name is a data input definition and can accept expression same as GroupId. With that said your collection that is an input to the multi instance does not have to be collection of simple types like String, it could be collection of objects that can be then used to resolve the names and actors that you'd like to assign task to

                             

                             

                            if your object would be like this:

                                 TaskAssignmentInfo

                                 String actorName

                                 String taskName

                             

                            then you fill in collection with instances of TaskAssignmentInfo object and pass that collection as intput to multi instance. Then in the task definition you declare that the item that will be put into task instance is taskInfo and you can refer to it for interested fields to set data inputs:

                            taskInfo.getActorName() to assign task to given person

                            taskInfo.getTaskName() to set the task name dynamically

                             

                            Great.. This is what I exactly wanted. Any simple sample prog on this?

                             

                            Thanks you very much,

                             

                            Aadav