5 Replies Latest reply on Apr 17, 2014 1:20 AM by Maciej Swiderski

    How to implement task self-termination within "on entry actions"?

    charles chen Newbie

      Dear Maven,

       

      I want to implement a special function which can extend the user task in following detail:

      If the user task received a special flag from other branch process, it can be terminated itself before its real beginning.

      I investigated the jbpm6-console with KIE workbench, and found a property of user-task: "on entry actions". It seemed

      that the "on entry actions" property can set a sample script line before the task starting.

       

      So, I judge that the special task might be self-terminated by using the "on entry actions", but I cannot find the concrete

      "self-termination" way.

       

      Previously, I have considered the implementation by using embedded sub-process. However, after I investigate the KIE

      workbench, I found that this kind of sub-process cannot be collapsed-extended by mouse operation within jbpm6-console,

      which can be operated with jbpm6 plugin within eclipse IDE.

       

      Could any maven give me a few pointers or suggestions? I'm looking forward to your reply.

       

      Thanks in advance!

       

      Yours sincerely,

       

      Charles

        • 1. Re: How to implement task self-termination within "on entry actions"?
          Sergey Kornilov Newbie

          Hi, .

          I think what you can't do it in "on entry actions", because UserTask is only asynchronous workItem with special WorkItemHandler.

          jBPM execute UserTask in sequence

          1 on entry Action

          2 create WorkItem

          3 create UserTask On Task Server

          4 complete User Task On Task Server

          5 complete workItem

          6 on exit Action

           

          So, nothing terminate when you catch "On Entry Action"

           

          But you can add TaskEventListener and try skip UsetTask in TaskCreateEvent.

           

          Sorry, for my poor english.

          • 2. Re: How to implement task self-termination within "on entry actions"?
            charles chen Newbie

            Dear Sergey Kornilov,

             

            Many thanks to your enthusiastic reply.

             

            I could not find a way to "add TaskEventListener and try skip UsetTask in TaskCreateEvent" to User Task in jbpm6-console

            with KIE workbench for my B/S architecture after my investigation yesterday evening.

             

            So, I am puzzled again.

             

            Otherwise, would I have to make 2nd-development to jbpm6-console?

             

            Thanks in advance!

             

            Yours sincerely,

            Charles

            • 3. Re: How to implement task self-termination within "on entry actions"?
              Maciej Swiderski Master

              why not make use of gateway that decides if the task should be created or not? If a flag is set then you won't even go to the user task so no need for any special and what's worse hidden decision points. Simply use process variable to keep the flag value and the define conditions on the outgoing sequence flows of the gateway depending on the flag value.

               

              HTH

              • 4. Re: How to implement task self-termination within "on entry actions"?
                charles chen Newbie

                Dear Maciej Swiderski,

                 

                Sorry for my reply so late!!!

                 

                Could you please give me an opportunity to explain the reason why I have not use the gateway?

                 

                In the beginning, I used gateway in embedded sub-process in JBPM6 console.

                But after a while, I found that the embedded sub-process cannot been collapsed

                due to it was not same as operation hint as it in eclipse with JBPM6 designer plugin

                (I mentioned in the first post).

                 

                So, I have to think another way to replace the sub-process, and then I investigated

                the User Task.

                 

                I think that the key point of this issue is not the usage of gateway, do you think so?

                 

                I hope you have understood my explanation above.

                 

                Does any other valuable clue exist?

                 

                Thanks in advance!

                 

                Yours sincerely,

                Charles

                • 5. Re: How to implement task self-termination within "on entry actions"?
                  Maciej Swiderski Master

                  Charles, don't really understand what subprocess has to do with the actual process design? Regardless if you use gateway or just user task subprocess is not required. Moreover the subprocess collapse feature is "just" visualization feature and does not have any impact on the execution. If you need collapsed version you can always mode that as two processes and then use call activity to use the subprocess as reusable from within the top level process.

                   

                  Relying on on entry action makes your process definition dependent to jbpm specific constructs and hides the business knowledge. So I still would model it with explicit decision point meaning gateway.

                   

                  HTH