Workflow node jumping method and device, processor and electronic device
By combining recursive queries and stack data structures, flexible multi-level jumps between nodes in the workflow engine are realized, solving the problem of insufficient flexibility in node jump methods in existing technologies. It is suitable for multi-node and multi-level jumps in complex business processes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 中国邮政储蓄银行股份有限公司
- Filing Date
- 2022-12-27
- Publication Date
- 2026-06-23
AI Technical Summary
The node jump methods of existing workflow engines are not flexible enough to handle the jump requirements between nodes of the main process node and nodes of multi-level nested sub-processes.
By obtaining the location of the current node, the identification information of the destination node, and the process definition data, the location of the destination node is determined by recursive query. The jump task is executed according to the node cluster and workflow instance, supporting jumps at the same level, upward level, and downward level. The stack data structure is used to store the hierarchical data to realize multi-level node jumps.
It enables flexible jumps from the current node to any node, solving the problem that nodes can only jump at a single level in existing technologies, and adapting to the multi-node and multi-level jump requirements of complex process business scenarios.
Smart Images

Figure CN116071012B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of workflow engine technology, and more specifically, to a workflow node switching method, apparatus, computer-readable storage medium, processor, and electronic device. Background Technology
[0002] In business process processing scenarios using workflow engines, some complex business processes have multiple nodes, multiple sub-processes, or multi-level nested sub-processes. Certain business processes require jumps from a main process node to a node in a multi-level nested sub-process, or vice versa. For example, some complex transaction processes in the banking industry require a return from a processing node in a multi-level nested sub-process to a processing node in the main process.
[0003] like Figure 1 As shown, current workflow engines mostly handle node transitions between nodes at the same level or between a single-level sub-process node and the main process node. This approach cannot flexibly handle the transition requirements from the main process node to nodes in multi-level nested sub-processes, as described earlier. Summary of the Invention
[0004] The main objective of this application is to provide a workflow node switching method, apparatus, computer-readable storage medium, processor, and electronic device to solve the problem of poor flexibility in the node switching methods of existing workflow engines.
[0005] According to one aspect of the present invention, a node jump method for a workflow is provided, comprising: obtaining a first position, first identification information, and process definition data, wherein the process definition data is used to characterize the business process to which the current node belongs, the current node is a node to which a jump is required, the first position is the position information of the current node in the business process, the first identification information is the identification information of the destination node, and the destination node is a node located at any position in the business process other than the first position; querying a second position recursively from the first position according to the first identification information and the process definition data, wherein the second position is the position information of the destination node in the business process; and executing a jump task from the current node to the destination node according to the first position, the second position, and the process definition data.
[0006] Optionally, obtaining process definition data includes: obtaining second identification information, where the second identification information is the identification information of the current node; and determining the process definition data corresponding to the second identification information based on the second identification information.
[0007] Optionally, based on the first identification information and the process definition data, querying the second position recursively from the first position includes: determining the jump direction of the current node based on the first identification information and the process definition data, wherein the jump direction includes jump to the same level, jump to the upper level, and jump to the lower level; and recursively querying the second position along the jump direction, starting from the first position.
[0008] Optionally, executing a jump task from the current node to the destination node based on the first position, the second position, and the process definition data includes: determining process nodes based on the first position, the second position, and the process definition data, wherein the process nodes are nodes along the process path from the current node to the destination node, and the process nodes and the destination node arranged in jump order constitute a node cluster; obtaining workflow instances of each node in the node cluster; and executing the jump task based on the node cluster and each workflow instance.
[0009] Optionally, the jump task is executed according to the node cluster and each workflow instance, including: a first determination step, in the case that the jump direction is an upward hierarchical jump, determining a target node and deleting all child nodes in the hierarchy where the target node is located, the target node being the node in the node cluster that is closest to the current node according to the jump order; a first modification step, modifying the running node in the first target instance as the jump node, and setting the flow parameters between the current node and the target node so that the current node jumps to the target node, the first target instance being the workflow instance corresponding to the target node; a first deletion step, deleting the jump task of the current node, and determining whether the target node reached by the jump is the destination node, if the target node reached by the jump is not the destination node, determining the target node reached by the jump as the new current node; a first loop step, repeatedly executing the first determination step, the first modification step, and the first deletion step at least once, until the target node reached by the jump is the destination node, and determining that the jump task is completed.
[0010] Optionally, based on the first position, the second position, and the process definition data, executing a jump task from the current node to the destination node includes: a storage step, where, if the jump direction is a downward hierarchical jump, data of each level is stored in a stack according to the jump order based on the first position, the second position, and the process definition data, wherein each level of data is instance data of the level where the process node and the destination node are located, and the process node is a node in the process path from the current node to the destination node; and a reading step, where the level data is read from the stack, and a workflow instance is generated based on the read level data to obtain a second target instance. For example; the second modification step involves modifying the parent-child relationship in the second target instance according to the jump order, changing the running node in the second target instance to a jump node, and setting the flow parameters between the current node and the target node so that the current node jumps to the target node, where the target node is the process node or the destination node corresponding to the second target instance; the second deletion step involves deleting the jump task of the current node and determining the target node reached by the jump as the new current node; the second loop step involves repeatedly executing the reading step, the second modification step, and the second deletion step until all the hierarchical data has been read from the stack.
[0011] Optionally, based on the first position, the second position, and the process definition data, a jump task from the current node to the destination node is executed, including: a second determination step, in the case that the jump direction is a same-level jump, determining a target node, the target node being the node in the node cluster that is closest to the current node according to the jump order; a third modification step, modifying the running node in the first target instance to a jump node, and setting the process flow parameters between the current node and the target node so that the current node jumps to the target node, the first target instance being the workflow instance corresponding to the target node; a third deletion step, deleting the jump task of the current node, and determining whether the target node reached by the jump is the destination node, if the target node reached by the jump is not the destination node, determining the target node reached by the jump as the new current node; a third loop step, repeatedly executing the second determination step, the third modification step, and the third deletion step at least once, until the target node reached by the jump is the destination node, and determining that the jump task is completed.
[0012] According to another aspect of the present invention, a workflow node jump device is also provided, comprising: an acquisition unit, configured to acquire a first position, first identification information, and process definition data, wherein the process definition data is used to characterize the business process to which the current node belongs, the current node is a node to which a jump is required, the first position is the position information of the current node in the business process, the first identification information is the identification information of the destination node, and the destination node is a node located at any position in the business process other than the first position; a query unit, configured to query a second position recursively from the first position according to the first identification information and the process definition data, wherein the second position is the position information of the destination node in the business process; and an execution unit, configured to execute a jump task from the current node to the destination node according to the first position, the second position, and the process definition data.
[0013] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein the program executes any one of the methods described.
[0014] According to another aspect of the present invention, a processor is also provided, the processor being configured to run a program, wherein the program, when running, executes any one of the methods described.
[0015] According to another aspect of the present invention, an electronic device is also provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for performing any one of the methods described.
[0016] In this embodiment of the invention, the first position of the current node in the business process, the first identification information of the destination node, and the process definition data representing the business process to which the current node belongs are first obtained. Then, based on the first identification information and the process definition data, the second position of the destination node in the business process is recursively queried, starting from the first position. Finally, based on the first position, the second position, and the process definition data, a jump task from the current node to the destination node is executed, wherein the destination node is any node located in the business process except for the first position. This application determines the position of the destination node through a recursive query method based on the position of the current node, the identification information of the destination node, and the business process, ensuring that the position of the destination node can be found relatively easily and quickly. Then, based on the positions of the two nodes and the business process, a node jump task is executed, achieving the effect of jumping from the current node to any node. This solves the problem in the prior art where workflow engines can only jump to a single level, resulting in poor flexibility in the jump method. Attached Figure Description
[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 A schematic diagram illustrating the node transition method of a workflow engine in the prior art is shown;
[0019] Figure 2 A flowchart illustrating a node jump method for a workflow according to an embodiment of this application is shown.
[0020] Figure 3 A schematic diagram illustrating the node navigation method of a workflow engine according to an embodiment of this application is shown;
[0021] Figure 4 A schematic diagram of the node jump process of a workflow according to an embodiment of this application is shown;
[0022] Figure 5 A schematic diagram of a workflow node switching device according to an embodiment of this application is shown. Detailed Implementation
[0023] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] It should be understood that when an element (such as a layer, film, region, or substrate) is described as being "on" another element, the element may be directly on the other element, or there may be an intermediate element present. Furthermore, in the specification and claims, when an element is described as being "connected" to another element, the element may be "directly connected" to the other element, or "connected" to the other element via a third element.
[0027] As mentioned in the background section, the node switching methods of existing workflow engines are not very flexible. In order to solve the above problems, in a typical embodiment of this application, a workflow node switching method, apparatus, computer-readable storage medium, processor, and electronic device are provided.
[0028] According to an embodiment of this application, a workflow node switching method is provided.
[0029] Figure 2 This is a flowchart of a node navigation method in a workflow according to an embodiment of this application. For example... Figure 2 As shown, the method includes the following steps:
[0030] Step S101: Obtain the first location, the first identification information, and the process definition data. The process definition data is used to characterize the business process to which the current node belongs. The current node is the node that needs to jump to the destination node. The first location is the location information of the current node in the business process. The first identification information is the identification information of the destination node. The destination node is a node located at any position in the business process other than the first location.
[0031] The above identification information is a unique identifier for each node, meaning that different nodes have different identification information.
[0032] To ensure a relatively simple and quick way to obtain the business process of the current node and the destination node, in practical applications, obtaining process definition data includes: obtaining second identification information, where the second identification information is the identification information of the current node; and determining the process definition data corresponding to the second identification information based on the second identification information.
[0033] Of course, the methods for obtaining process definition data are not limited to those described above, and may also include: determining the process definition data corresponding to the first identifier information based on the first identifier information described above.
[0034] Step S102: Based on the first identification information and the process definition data, query the second position recursively starting from the first position. The second position is the location information of the destination node in the business process.
[0035] Using recursive queries to locate the destination node can efficiently and quickly determine its position.
[0036] In addition, when querying recursively starting from the first position mentioned above, if the query time exceeds the predetermined time, it is determined that there is no destination node and the result is returned.
[0037] To further ensure a faster, more efficient, and more accurate retrieval of the second location, specifically, based on the aforementioned first identifier information and the aforementioned process definition data, the second location is queried recursively starting from the aforementioned first location. This includes: determining the jump direction of the current node based on the aforementioned first identifier information and the aforementioned process definition data, whereby the jump direction includes jumps at the same level, jumps to the next higher level, and jumps to the next lower level; and recursively querying the second location along the aforementioned jump direction, starting from the aforementioned first location.
[0038] Step S103: Based on the first position, the second position, and the process definition data, execute the jump task from the current node to the destination node.
[0039] Based on the first position, the second position, and the process definition data, the task of jumping from the current node to any node is executed, further realizing the effect of jumping from the current node to any node and ensuring high flexibility of the challenge.
[0040] To further address the issue that existing workflow engines only allow single-level node jumps, this embodiment of the application executes a jump task from the current node to the destination node based on the first position, the second position, and the process definition data. This includes: determining process nodes based on the first position, the second position, and the process definition data; these process nodes are the nodes along the process path from the current node to the destination node; the process nodes and the destination node, arranged in jump order, constitute a node cluster; obtaining workflow instances for each node in the node cluster; and executing the jump task based on the node cluster and each workflow instance. By obtaining the process nodes along the path from the current node to the destination node in the current business process, arranging the process nodes and the destination node in jump order to obtain a node cluster, and then executing the jump task based on the node cluster and the workflow instances of the process nodes and the destination node, it is further ensured that the current node can reach the destination node through each process node, thereby further realizing the multi-node, multi-level jump effect of workflow nodes.
[0041] Specifically, the workflow instances mentioned above include process instances and execution instances.
[0042] In practical applications, node jump directions are divided into same-level jumps, upward level jumps, and downward level jumps. To further ensure that the current node can jump in all of the above jump directions, thereby further guaranteeing the flexibility and practicality of node jumps, according to an embodiment of this application, the above jump task is executed based on the above node cluster and each of the above workflow instances, including: a first determination step, in the case that the jump direction is the upward level jump, determining the target node and deleting all child nodes in the level where the target node is located, the target node is the node in the above node cluster that is closest to the current node according to the above jump order; a first modification step, modifying the running node in the first target instance. The process is defined as follows: A jump node is defined, and flow parameters between the current node and the target node are set to allow the current node to jump to the target node. The first target instance is the workflow instance corresponding to the target node. A first deletion step involves deleting the jump task of the current node and determining whether the target node reached by the jump is the destination node. If the target node reached by the jump is not the destination node, the target node reached by the jump is determined to be the new current node. A first loop step involves repeatedly executing the first determination step, the first modification step, and the first deletion step at least once until the target node reached by the jump is the destination node, at which point the jump task is determined to be complete.
[0043] Through the above embodiments, when the jump direction is the upward hierarchical jump, the current node can jump to the destination node in a simple and fast manner, ensuring flexible jump from multi-level nested sub-process nodes to the main process node, and also ensuring flexible jump from multi-level nested sub-process nodes to any outer node. This makes the node jump method adaptable to workflow engines with complex process business scenarios with multi-level nested sub-processes.
[0044] Specifically, the aforementioned process flow parameters are the process parameters for workflow node jumps.
[0045] In addition to upward hierarchical jumps, there are also downward hierarchical jumps. To further ensure that workflow nodes can flexibly jump in different scenarios, specifically, based on the aforementioned first position, second position, and process definition data, a jump task from the current node to the destination node is executed, including: a storage step, in the case of a downward hierarchical jump, storing the data of each level into a stack according to the jump order based on the aforementioned first position, second position, and process definition data, where each level of data is an instance data of the level where the process node and the destination node are located, and the process node is the node in the process path from the current node to the destination node; and a reading step, reading the hierarchical data from the stack and, according to the read... The above-mentioned hierarchical data is used to generate a workflow instance, resulting in a second target instance. The second modification step involves modifying the parent-child relationship in the second target instance according to the jump order, changing the running node in the second target instance to a jump node, and setting the flow parameters between the current node and the target node so that the current node jumps to the target node, which is either the process node or the destination node corresponding to the second target instance. The second deletion step involves deleting the jump task of the current node and determining the target node reached by the jump as the new current node. The second loop step involves repeatedly executing the above-mentioned reading step, the second modification step, and the second deletion step until all the above-mentioned hierarchical data has been read from the stack.
[0046] Through the above embodiments, when the jump direction is the downward level jump, the current node can jump to the destination node in a simple and fast way. This ensures flexible jumps from the main process node to multi-level nested sub-process nodes, as well as flexible jumps from any outer node to multi-level nested sub-process nodes. This makes the node jump method adaptable to workflow engines with complex process business scenarios with multi-level nested sub-processes.
[0047] In addition, in the above embodiments, when the jump direction is the downward level jump, that is, during the jump from the outer node to the nested sub-process node, the stack data structure is used to store the hierarchical data, so that the jump process does not need to consider the nesting level of the sub-process, further ensuring that the nodes can jump to each other in a simple, formulaic and fast and accurate manner.
[0048] In addition to upward and downward hierarchical jumps, there are also intra-hierarchical jumps. In this case, to further ensure that workflow nodes can flexibly jump in different scenarios, in another embodiment of this application, a jump task from the current node to the destination node is executed according to the first position, the second position, and the process definition data, including: a second determination step, in the case that the jump direction is the intra-hierarchical jump, determining the target node, wherein the target node is the node in the node cluster that is closest to the current node according to the jump order; and a third modification step, modifying the running node in the first target instance to the jump node, and setting the current node... The process flow parameters between the current node and the target node are configured to allow the current node to jump to the target node. The first target instance is the workflow instance corresponding to the target node. The third deletion step involves deleting the jump task of the current node and determining whether the target node reached by the jump is the destination node. If the target node reached by the jump is not the destination node, the target node reached by the jump is determined to be the new current node. The third loop step involves repeatedly executing the second determination step, the third modification step, and the third deletion step at least once until the target node reached by the jump is the destination node, thus confirming the completion of the jump task.
[0049] The node jump method of the workflow described in this application is applicable to workflow engines such as Activiti and Flowable.
[0050] Specifically, such as Figure 3 As shown, the destination node can be a node at the same level as the current node, or a node at a lower level than the current node, such as the next level or the two levels below it, or a node at a higher level than the current node, such as the previous level or the two levels above it.
[0051] In the above-described workflow node jump method, the first step is to obtain the first position of the current node in the business process, the first identifier information of the destination node, and the process definition data representing the business process to which the current node belongs. Then, based on the first identifier information and the process definition data, the second position of the destination node in the business process is recursively queried, starting from the first position. Finally, based on the first position, the second position, and the process definition data, the jump task from the current node to the destination node is executed. The destination node can be any node in the business process except for the first position. This application determines the position of the destination node through a recursive query based on the position of the current node, the identifier information of the destination node, and the business process, ensuring that the position of the destination node can be found relatively easily and quickly. Then, based on the positions of the two nodes and the business process, the node jump task is executed, achieving the effect of jumping from the current node to any node. This solves the problem in existing technologies where workflow engines can only jump to a single level, resulting in poor flexibility in the jump method.
[0052] According to another specific embodiment of this application, such as Figure 4 As shown, the workflow node transition process is as follows:
[0053] Step 1): Obtain the process definition data based on the unique identifier of the current node.
[0054] Step 2): Determine whether the jump is at the same level based on the unique identifier of the jump node.
[0055] Step 3): If it is a jump to the same level, perform the following steps.
[0056] Retrieve execution instance data at the current level;
[0057] Change the execution node of the instance to the destination node;
[0058] Set process flow parameters;
[0059] Delete the currently running task, that is, the hierarchical task of the current node's layer;
[0060] Execute a jump to the same level of the node.
[0061] Step 4): If it is not a jump to the same level, determine whether the destination node is in the parent level. If not, recursively call to determine whether it is in a parent level of the parent level. If the destination node is found, execute the following steps.
[0062] Delete all child instance nodes at the target level;
[0063] Modify the running node of this execution instance to the jump node;
[0064] Set process flow parameters;
[0065] Delete the currently running task;
[0066] Execute the upper-level jump of the node.
[0067] Step 5): If the node is not found in a parent level of the current node, a recursive search is performed at the next lower level. If the node is not found, a jump to the next level is returned (including multiple levels below the current node), and the following steps are executed:
[0068] Push the found destination node data onto the bottom of the stack;
[0069] Push the hierarchical data from the destination node to the current node onto the stack in sequence;
[0070] Loop through the stack to retrieve the hierarchy of data;
[0071] Generate execution instances and process instances based on hierarchical data;
[0072] Modify the parent-child relationships of execution instances and process instances at each level;
[0073] Set the running node of the last executed instance as the jump node;
[0074] Set process flow parameters;
[0075] Delete the current task;
[0076] Execute the next level jump of the node.
[0077] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0078] This application also provides a workflow node switching device. It should be noted that the workflow node switching device of this application can be used to execute the workflow node switching method provided in this application. The workflow node switching device provided in this application will be described below.
[0079] Figure 5 This is a schematic diagram of a workflow node switching device according to an embodiment of this application. Figure 5 As shown, the device includes:
[0080] The acquisition unit 10 is used to acquire a first position, a first identification information and process definition data. The process definition data is used to characterize the business process to which the current node belongs. The current node is the node that needs to jump to the destination node. The first position is the position information of the current node in the business process. The first identification information is the identification information of the destination node. The destination node is a node located at any position in the business process other than the first position.
[0081] The above identification information is a unique identifier for each node, meaning that different nodes have different identification information.
[0082] To ensure a relatively simple and quick way to obtain the business process of the current node and the destination node, in practical applications, the above-mentioned acquisition unit includes: a first acquisition module, used to acquire second identification information, wherein the second identification information is the identification information of the current node; and a first determination module, used to determine the process definition data corresponding to the second identification information based on the second identification information.
[0083] Of course, the method of obtaining process definition data is not limited to the above method. The above-mentioned obtaining unit may also include: a second determining module, used to determine the above-mentioned process definition data corresponding to the above-mentioned first identification information based on the above-mentioned first identification information.
[0084] The query unit 20 is used to query the second position recursively from the first position based on the first identification information and the process definition data, where the second position is the location information of the destination node in the business process.
[0085] Using recursive queries to locate the destination node can efficiently and quickly determine its position.
[0086] In addition, when querying recursively starting from the first position mentioned above, if the query time exceeds the predetermined time, it is determined that there is no destination node and the result is returned.
[0087] To further ensure that the second position can be found quickly, efficiently and accurately, the query unit specifically includes: a third determining module, used to determine the jump direction of the current node based on the first identification information and the process definition data, wherein the jump direction includes jump to the same level, jump to the upper level, and jump to the lower level; and a query module, used to recursively query the second position along the jump direction, starting from the first position.
[0088] The execution unit 30 is used to execute a jump task from the current node to the destination node based on the first position, the second position and the process definition data.
[0089] Based on the first position, the second position, and the process definition data, the task of jumping from the current node to any node is executed, further realizing the effect of jumping from the current node to any node and ensuring high flexibility of the challenge.
[0090] To further address the issue that workflow engines in the prior art can only perform single-level jumps, in this embodiment, the execution unit includes: a fourth determining module, used to determine process nodes based on the first position, the second position, and the process definition data, wherein the process nodes are the nodes along the process path from the current node to the destination node, and the process nodes and the destination node arranged in jump order constitute a node cluster; a second obtaining module, used to obtain workflow instances of each node in the node cluster; and an execution module, used to execute the jump task based on the node cluster and each workflow instance. By obtaining the process nodes along the path from the current node to the destination node in the current business process, arranging the process nodes and the destination node in jump order to obtain a node cluster, and then executing the jump task based on the node cluster and the workflow instances of the process nodes and the destination node, it is further ensured that the current node can reach the destination node through each process node, thereby further realizing the multi-node, multi-level jump effect of workflow nodes.
[0091] Specifically, the workflow instances mentioned above include process instances and execution instances.
[0092] In practical applications, node jump directions are divided into same-level jumps, upward level jumps, and downward level jumps. To further ensure that the current node can jump in all of the above jump directions, thereby further guaranteeing the flexibility and practicality of node jumps, according to an embodiment of this application, the execution module includes: a determination submodule, used in the first determination step, in the case that the jump direction is the upward level jump, determining the target node and deleting all child nodes in the level where the target node is located, wherein the target node is the node in the node cluster that is closest to the current node according to the jump order; and a modification submodule, used in the first modification step, modifying the running node in the first target instance to the jump node, and setting the above... The flow parameters between the current node and the target node are configured to allow the current node to jump to the target node, where the first target instance is the workflow instance corresponding to the target node; a deletion submodule is used in the first deletion step to delete the jump task of the current node and determine whether the target node reached by the jump is the destination node. If the target node reached by the jump is not the destination node, the target node reached by the jump is determined to be the new current node; a loop submodule is used in the first loop step to repeatedly execute the first determination step, the first modification step, and the first deletion step at least once until the target node reached by the jump is the destination node, and the jump task is determined to be completed.
[0093] Through the above embodiments, when the jump direction is the upward hierarchical jump, the current node can jump to the destination node in a simple and fast manner, ensuring flexible jump from multi-level nested sub-process nodes to the main process node, and also ensuring flexible jump from multi-level nested sub-process nodes to any outer node. This makes the node jump method adaptable to workflow engines with complex process business scenarios with multi-level nested sub-processes.
[0094] Specifically, the aforementioned process flow parameters are the process parameters for workflow node jumps.
[0095] In addition to upward hierarchical jumps, there are also downward hierarchical jumps. To further ensure that workflow nodes can flexibly jump in different scenarios, the execution unit specifically includes: a storage module for storing steps; in the case of downward hierarchical jumps, it stores the data of each level into a stack according to the first position, the second position, and the process definition data, in the order of jumps. Each level of data is the instance data of the level where the process node and the destination node are located. The process node is the node in the process path from the current node to the destination node; a reading module for reading steps; reading the hierarchical data from the stack; and generating a workflow instance based on the read hierarchical data to obtain a second target instance; and a first modification module. The first module, used in the second modification step, modifies the parent-child relationship in the second target instance according to the above jump order, changes the running node in the second target instance to a jump node, and sets the flow parameters between the current node and the target node so that the current node jumps to the target node, where the target node is the process node or the destination node corresponding to the second target instance; the first deletion module, used in the second deletion step, deletes the jump task of the current node and determines the target node reached by the jump as the new current node; the first loop module, used in the second loop step, repeatedly executes the above reading step, the above second modification step, and the above second deletion step until all the above-mentioned hierarchical data are read from the above stack.
[0096] Through the above embodiments, when the jump direction is the downward level jump, the current node can jump to the destination node in a simple and fast way. This ensures flexible jumps from the main process node to multi-level nested sub-process nodes, as well as flexible jumps from any outer node to multi-level nested sub-process nodes. This makes the node jump method adaptable to workflow engines with complex process business scenarios with multi-level nested sub-processes.
[0097] In addition, in the above embodiments, when the jump direction is the downward level jump, that is, during the jump from the outer node to the nested sub-process node, the stack data structure is used to store the hierarchical data, so that the jump process does not need to consider the nesting level of the sub-process, further ensuring that the nodes can jump to each other in a simple, formulaic and fast and accurate manner.
[0098] In addition to upward and downward hierarchical jumps, there are also intra-hierarchical jumps. In this case, to further ensure that workflow nodes can flexibly jump in different scenarios, in another embodiment of this application, the execution unit includes: a fifth determining module, used in the second determining step, in the case that the jump direction is the intra-hierarchical jump, determining a target node, wherein the target node is the node in the node cluster that is closest to the current node according to the jump order; and a second modifying module, used in the third modifying step, modifying the running node in the first target instance to a jump node, and setting the flow parameters between the current node and the target node, so that... The current node jumps to the target node, and the first target instance is the workflow instance corresponding to the target node; the second deletion module is used in the third deletion step to delete the jump task of the current node and determine whether the target node reached by the jump is the destination node. If the target node reached by the jump is not the destination node, the target node reached by the jump is determined to be the new current node; the second loop module is used in the third loop step to repeatedly execute the second determination step, the third modification step, and the third deletion step at least once until the target node reached by the jump is the destination node, and the jump task is determined to be completed.
[0099] The node jump method of the workflow described in this application is applicable to workflow engines such as Activiti and Flowable.
[0100] Specifically, such as Figure 3 As shown, the destination node can be a node at the same level as the current node, or a node at a lower level than the current node, such as the next level or the two levels below it, or a node at a higher level than the current node, such as the previous level or the two levels above it.
[0101] In the aforementioned workflow node jump device, the acquisition unit acquires the first position of the current node in the business process, the first identification information of the destination node, and the process definition data representing the business process to which the current node belongs. The query unit, based on the first identification information and the process definition data, recursively queries the second position of the destination node in the business process, starting from the first position. The execution unit, based on the first position, the second position, and the process definition data, executes the jump task from the current node to the destination node. The destination node can be any node in the business process except for the first position. This application determines the position of the destination node through a recursive query based on the position of the current node, the identification information of the destination node, and the business process, ensuring that the position of the destination node can be found relatively easily and quickly. Then, based on the positions of the two nodes and the business process, the node jump task is executed, achieving the effect of jumping from the current node to any node. This solves the problem in the prior art where workflow engines can only jump to a single level, resulting in poor flexibility in the jump method.
[0102] The node switching device of the above workflow includes a processor and a memory. The above acquisition unit, the above query unit and the above execution unit are all stored in the memory as program units. The processor executes the above program units stored in the memory to realize the corresponding functions.
[0103] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can address the issue of poor flexibility in node switching methods in existing workflow engines.
[0104] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0105] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the node jump method of the above-described workflow.
[0106] This invention provides a processor for running a program, wherein the program executes the node jump method of the workflow.
[0107] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps:
[0108] Step S101: Obtain the first location, the first identification information, and the process definition data. The process definition data is used to characterize the business process to which the current node belongs. The current node is the node that needs to jump to the destination node. The first location is the location information of the current node in the business process. The first identification information is the identification information of the destination node. The destination node is a node located at any position in the business process other than the first location.
[0109] Step S102: Based on the first identification information and the process definition data, query the second position recursively starting from the first position. The second position is the location information of the destination node in the business process.
[0110] Step S103: Based on the first position, the second position, and the process definition data, execute the jump task from the current node to the destination node.
[0111] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0112] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:
[0113] Step S101: Obtain the first location, the first identification information, and the process definition data. The process definition data is used to characterize the business process to which the current node belongs. The current node is the node that needs to jump to the destination node. The first location is the location information of the current node in the business process. The first identification information is the identification information of the destination node. The destination node is a node located at any position in the business process other than the first location.
[0114] Step S102: Based on the first identification information and the process definition data, query the second position recursively starting from the first position. The second position is the location information of the destination node in the business process.
[0115] Step S103: Based on the first position, the second position, and the process definition data, execute the jump task from the current node to the destination node.
[0116] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0117] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0118] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0119] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0120] If the aforementioned integrated units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0121] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0122] 1) In the node jump method of the workflow described in this application, the first step is to obtain the first position of the current node in the business process, the first identifier information of the destination node, and the process definition data representing the business process to which the current node belongs. Then, based on the first identifier information and the process definition data, the second position of the destination node in the business process is recursively queried from the first position. Finally, based on the first position, the second position, and the process definition data, a jump task from the current node to the destination node is executed. The destination node is any node located in the business process other than the first position. This application determines the position of the destination node through a recursive query based on the position of the current node, the identifier information of the destination node, and the business process, ensuring that the position of the destination node can be found relatively easily and quickly. Then, based on the positions of the two nodes and the business process, a node jump task is executed, achieving the effect of jumping from the current node to any node. This solves the problem in the prior art where workflow engines can only jump to a single level, resulting in poor flexibility in the jump method.
[0123] 2) In the node jump device of the workflow described above in this application, the acquisition unit acquires the first position of the current node in the business process, the first identification information of the destination node, and the process definition data representing the business process to which the current node belongs; the query unit, based on the first identification information and the process definition data, recursively queries the second position of the destination node in the business process, starting from the first position; and the execution unit, based on the first position, the second position, and the process definition data, executes the jump task from the current node to the destination node, wherein the destination node is any node located in the business process other than the first position. This application determines the position of the destination node through a recursive query method based on the position of the current node, the identification information of the destination node, and the business process, ensuring that the position of the destination node can be found relatively easily and quickly. Then, based on the positions of the two nodes and the business process, the node jump task is executed, achieving the effect of jumping from the current node to any node. This solves the problem in the prior art where workflow engines can only jump to a single level, resulting in poor flexibility in the jump method.
[0124] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A workflow node jump method, characterized in that, include: Obtain a first location, a first identification information, and process definition data. The process definition data is used to characterize the business process to which the current node belongs. The current node is the node that needs to jump to the destination node. The first location is the location information of the current node in the business process. The first identification information is the identification information of the destination node. The destination node is a node located at any position in the business process other than the first location. Based on the first identification information and the process definition data, the jump direction of the current node is determined, and the jump direction includes jump to the same level, jump to the upper level, and jump to the lower level. Based on the jump direction, starting from the first location information, the second location is recursively queried along the jump direction, where the second location is the location information of the destination node in the business process; Based on the first position, the second position, and the process definition data, process nodes are determined. The process nodes are the nodes in the process path from the current node to the destination node. The process nodes and the destination node arranged in the jump order constitute a node cluster. Obtain workflow instances for each node in the node cluster; The first determination step involves determining the target node and deleting all child nodes in the level where the target node is located, in the case that the jump direction is the upward level jump. The target node is the node in the node cluster that is closest to the current node according to the jump order. The first modification step is to modify the running node in the first target instance to a jump node, and set the flow parameters between the current node and the target node so that the current node jumps to the target node. The first target instance is the workflow instance corresponding to the target node. The first deletion step involves deleting the jump task of the current node and determining whether the target node reached by the jump is the destination node. If the target node reached by the jump is not the destination node, the target node reached by the jump is determined to be the new current node. The first loop step involves repeatedly executing the first determination step, the first modification step, and the first deletion step at least once, until the target node reached by the jump is the destination node, thus determining that the jump task is completed. The method further includes: In the storage step, when the jump direction is the downward level jump, the data of each level is stored in the stack according to the jump order based on the first position, the second position and the process definition data. Each level data is the instance data of the level where the process node and the destination node are located. The process node is the node of the process path from the current node to the destination node. The reading step involves reading the hierarchical data from the stack and generating a workflow instance based on the read hierarchical data to obtain a second target instance. The second modification step involves modifying the parent-child relationship in the second target instance according to the jump order, changing the running node in the second target instance to a jump node, and setting the flow parameters between the current node and the target node so that the current node jumps to the target node, where the target node is the process node or the destination node corresponding to the second target instance. The second deletion step involves deleting the jump task of the current node and determining the target node reached by the jump as the new current node. The second loop step involves repeatedly executing the read step, the second modification step, and the second deletion step until all the hierarchical data has been read from the stack.
2. The method according to claim 1, characterized in that, Obtain process definition data, including: Obtain the second identification information, which is the identification information of the current node; Based on the second identification information, determine the process definition data corresponding to the second identification information.
3. The method according to claim 1, characterized in that, The method further includes: The second determination step involves determining a target node when the jump direction is a same-level jump. The target node is the node in the node cluster that is closest to the current node according to the jump order. The third modification step is to modify the running node in the first target instance to a jump node, and set the flow parameters between the current node and the target node so that the current node jumps to the target node. The first target instance is the workflow instance corresponding to the target node. The third deletion step involves deleting the jump task of the current node and determining whether the target node reached by the jump is the destination node. If the target node reached by the jump is not the destination node, the target node reached by the jump is determined to be the new current node. The third loop step involves repeatedly executing the second determination step, the third modification step, and the third deletion step at least once, until the target node reached by the jump is the destination node, thus determining that the jump task is complete.
4. A workflow node switching device, applied to the method according to any one of claims 1 to 3, characterized in that, The workflow node transition mechanism includes: The acquisition unit is used to acquire a first position, a first identification information, and process definition data. The process definition data is used to characterize the business process to which the current node belongs. The current node is a node that needs to jump to a destination node. The first position is the position information of the current node in the business process. The first identification information is the identification information of the destination node. The destination node is a node located at any position in the business process other than the first position. The query unit is used to query the second location in a recursive manner, starting from the first location information, based on the first identification information and the process definition data. The second location is the location information of the destination node in the business process. An execution unit is configured to execute a jump task from the current node to the destination node based on the first position, the second position, and the process definition data.
5. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program performs the method according to any one of claims 1 to 3.
6. A processor, characterized in that, The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 3 when it runs.
7. An electronic device, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being used to perform the method of any one of claims 1 to 3.