12 Replies Latest reply on Aug 15, 2006 9:26 AM by cpob

    taken end and task instance end

      Hello

      when a token reaches the "end" state, does it mean the token.hasEnded() return true? At this stage, will taskInstance.hasEnded() return true?

      regards
      yang

        • 1. Re: taken end and task instance end
          kukeltje

          does it? I'm sure you've tried and got some (unexpected?) results

          • 2. Re: taken end and task instance end
            cpob

            Depends on how you're having the token move. Are you doing a token.signal, or a taskInstance.end?

            • 3. Re: taken end and task instance end

               

              "cpob" wrote:
              Depends on how you're having the token move. Are you doing a token.signal, or a taskInstance.end?


              any difference? i am using token.signal

              yang

              • 4. Re: taken end and task instance end
                cpob

                if you want to end the task, you should do a taskInstance.end.

                Or, you could add end-tasks="true" to your task node xml:

                <task-node name="task4" end-tasks="true">


                That will then end all open tasks when the node is left.

                • 5. Re: taken end and task instance end
                  jbpmndc

                  What are situations when you should use token.signal instead of token.end()?

                  It seems to me you should always use token.end. It's more clear and intuitive.

                  • 6. Re: taken end and task instance end
                    cpob

                     

                    "jbpmndc" wrote:
                    What are situations when you should use token.signal instead of token.end()?

                    It seems to me you should always use token.end. It's more clear and intuitive.


                    There's a difference between token.end and token.signal.

                    Token.end will END the token and all of its children. If you token.signal, it will signal to the next node.

                    taskInstance.end ends the task, but SIGNALS the token to the next node.

                    • 7. Re: taken end and task instance end
                      jbpmndc

                       

                      taskInstance.end ends the task, but SIGNALS the token to the next node.


                      I understand this. I'm wondering why anyone would use token.signal in their code. If task.endInstance signals the token to move to the next task, then writing in your code taskInstande.end("foo") is more intuitive-to me anyhow-than signal.token().

                      • 8. Re: taken end and task instance end
                        kukeltje

                        Not every node is a task

                        • 9. Re: taken end and task instance end
                          cpob

                           

                          "jbpmndc" wrote:
                          taskInstance.end ends the task, but SIGNALS the token to the next node.


                          I understand this. I'm wondering why anyone would use token.signal in their code. If task.endInstance signals the token to move to the next task, then writing in your code taskInstande.end("foo") is more intuitive-to me anyhow-than signal.token().


                          I only got throw off, since your last comment before said you should be using token.end()

                          • 10. Re: taken end and task instance end

                             

                            "cpob" wrote:
                            if you want to end the task, you should do a taskInstance.end.

                            Or, you could add end-tasks="true" to your task node xml:
                            <task-node name="task4" end-tasks="true">


                            That will then end all open tasks when the node is left.


                            (1)what do you mean "task end"? I went through the source code and find out that the hibernate queries for findTaskInstance....() related methods only retrieve the "open" tasks.

                            (2)What is the purpose of this "open" flag in jbpm design?

                            (3)Under what situation, will the completion of a task instances trigger a signal on the token? In other words, who will response for the triggering of the token when a task instance is completed?


                            Token.end will END the token and all of its children

                            (4)I know token.signal() move the token to next node. But what is the function of "token.end()"? If a token and all of its children are ended, what does it mean?

                            yang



                            • 11. Re: taken end and task instance end

                              Does "Token end" means that "cannot move" anymore?

                              Because without token moving, the process instance cannot continue.

                              Does it mean that "token end" will end the process instance also?

                              Or more accurately, "token end" will stop one path of the execution of current process instance. If a process instance has multiple execution path(token), if one token ended, other execution path(tokens) still can move. Right?

                              If a token is ended, can it be triggered again?

                              On the whole thing, token ending give me lots of confusion.

                              Please comments.

                              Yang

                              • 12. Re: taken end and task instance end
                                cpob

                                 

                                "yxyang" wrote:
                                (1)what do you mean "task end"? I went through the source code and find out that the hibernate queries for findTaskInstance....() related methods only retrieve the "open" tasks.


                                This is in the user guide. Task end... means the task is ended.

                                "yxyang" wrote:
                                (2)What is the purpose of this "open" flag in jbpm design?


                                I think that flag indicates if it is active/open or ended/closed. Experiment a bit and see what it does

                                "yxyang" wrote:
                                (3)Under what situation, will the completion of a task instances trigger a signal on the token? In other words, who will response for the triggering of the token when a task instance is completed?


                                Like I said before, if there is a single task instance on a task node, and you end that task, it will signal the token. (using default jPDL attributes - if you don't know what these are, you're using the defaults) If you have multiple tasks on a task node, the LAST completed task will signal the token.

                                "yxyang" wrote:
                                (4)I know token.signal() move the token to next node. But what is the function of "token.end()"? If a token and all of its children are ended, what does it mean?


                                I take it as killing the token. It's done, no more, no more signalling, etc. My suggestion is just to experiment and see what happens. Write up a simple test case which ends tasks and tokens and etc and see what happens. Look at the database.