JBPM source analysis (2) --- acceptToken function

xiaoxiao2021-03-06  70

AcceptToken is the core function in the JBPM Workflow Engine, which has specific implementations in each node. This function mainly determines how the node handles the token arriving to the node. Understand the operation of AcceptToken and JBPM workflows. The features of the specific implementation of AcctPtoken in each node class are as follows:

First, TransitionImpl

1) Trigger Transition event;

2) The arrival node is the current execution context node;

3) Reach the node accepts the token (ACCEPTTOKEN that performs nodes).

Second, DecisionImpl

1) Trigger Decision_Enter event;

2) Call DecisionHandler to get the conversion to be executed;

3) Trigger the Decision_leave event;

4) Convert Accepting tokens (ACCEPTTOKEN that performs nodes).

Third, Fork

1) Trigger the Fork_Enter event;

2) State and ActorID of the token will be run in the context;

3) call forkhander;

Default forkHander, perform the following in order for each of its conversions:

l Trigger the fork_every_leave event;

l Create a token, the token in the context and the new token are the father and child relationship;

l sub-token database holdings;

l Place the token in the context as a sub-token, the context's current node backup;

l Current conversion accepts the token;

l Place the order in the context as a parent, node restore;

The L sub-token reactiveJoin property is set to the CorrespondingJoin in the parent card.

Four, Join

1) If the token in the current context is not end, end the token (including all sub-tokens of the token);

2) Trigger JOIN_EVERY_ENTER event;

3) Clear temporary variables in context;

4) Set the token, the current Join node is set to the toxies and nodes currently running in the context;

5) Execute Joinhander.

The default JoinHander reaches the Join node after all brother tokens, activates the parent card, perform Join's conversion. Join_leave events are triggered when the parent is activated.

Five, StateImpl, StartStateImpl

1) Set the status of the token in the context to the current state;

2) Trigger the state_enter event;

3) If the status is set to the Swimlane property, remove the actorID value from the Swimlane to the ActorID value of the token in the context;

4) If State requires Assignment but actorid is NULL, an error is reported;

5) Record STATELOG in the token;

6) Trigger the state_after_assignment event.

Sixth, endStateImpl

1) Set the LastLog;

2) The token in the context is set to the current token;

3) End the token (will trigger the Process_end event).

7. MilestoneImpl1) Set the status of the token in the context to the current state;

2) Trigger the Milestone_Enter event;

3) Take a variable named Milestone name from the context;

4) If the variable exists (not null), trigger the milestone_leave event, execute the Milestone conversion (enter the next state); otherwise, set the actorID value in the token, record the log (wait) in the token.

Eight, ProcessStateImpl

1) Record the status log in the context token;

2) Get processinvocationhandler, promoter workflow;

3) After the workflow starts successfully, put the context token ActorID, the current state is set to the current state, the log card process instance is set to the sub-workflow that has started successfully; otherwise an error.

转载请注明原文地址:https://www.9cbs.com/read-89826.html

New Post(0)