CN109634569B - Method, device and equipment for realizing flow based on annotation and readable storage medium - Google Patents

Method, device and equipment for realizing flow based on annotation and readable storage medium Download PDF

Info

Publication number
CN109634569B
CN109634569B CN201811526367.1A CN201811526367A CN109634569B CN 109634569 B CN109634569 B CN 109634569B CN 201811526367 A CN201811526367 A CN 201811526367A CN 109634569 B CN109634569 B CN 109634569B
Authority
CN
China
Prior art keywords
flow
annotation
node
business process
condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811526367.1A
Other languages
Chinese (zh)
Other versions
CN109634569A (en
Inventor
殷凇
邬秋元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN201811526367.1A priority Critical patent/CN109634569B/en
Publication of CN109634569A publication Critical patent/CN109634569A/en
Application granted granted Critical
Publication of CN109634569B publication Critical patent/CN109634569B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a flow implementation method based on annotation, which comprises the following steps: defining a specific object of a business process; when a preset business process frame is initialized, initializing a specific object of the business process added with the annotation; and constructing the execution sequence of the business process according to the annotation content. The invention also provides a flow implementation device, equipment and a readable storage medium based on the annotation. The invention solves the technical problems that the lightweight framework of the existing business process management does not support the process flow circulation of the state according to the condition and needs to modify a large amount of business system codes.

Description

Method, device and equipment for realizing flow based on annotation and readable storage medium
Technical Field
The invention relates to the technical field of intelligent terminals, in particular to a method, a device, equipment and a readable storage medium for realizing a flow based on annotation.
Background
Currently, the tool advanced in business process management is mainly the JBPM framework. The JBPM (Java Business Process Management) framework is an executable Process language framework with a complex architecture and complete functions; the framework is too complex for a common business system process due to the fact that a large workload needs to be consumed in the using and integrating processes, and the integration difficulty is large.
In addition, there is also a lightweight framework similar to Spring Statemachine. Compared with a JBPM framework, the Spring Statemechine has obvious light weight advantage and adopts a direct event triggering mode to control the state. As shown in fig. 1, fig. 1 is a state machine diagram of a Spring statechip, where the state machine includes two states: state 1, state 2; the switching between the different states is performed by event 1, event 2. Such lightweight frameworks do not support conditional flow streams, and therefore require a large number of modifications to business system codes to adapt to specific business process management.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a method, a device, equipment and a readable storage medium for realizing a flow based on annotation, and aims to solve the technical problems that a lightweight framework of the existing business flow management does not support flow circulation of states according to conditions and needs to modify a large amount of business system codes.
In order to achieve the above object, the present invention provides an annotation-based process implementation method, which is characterized in that the method includes:
defining a specific object of a business process;
when a preset business process frame is initialized, initializing a specific object of the business process added with the annotation;
and constructing the execution sequence of the business process according to the annotation content.
Preferably, the specific objects of the business process include: the service process comprises a process inlet node of the service process, process steps of the service process, circulation conditions among the process steps and execution codes of the process steps.
Preferably, the step of constructing the execution sequence of the business process according to the annotation content specifically includes:
traversing classes in the business process framework, and acquiring a method set of classes to which annotations are added;
traversing the method set of the class and extracting the method containing annotation content;
detecting whether the class contains a process entry node and a process end condition at the same time based on the extracted method;
and if the class simultaneously contains a process entry node and a process end condition, determining the circulation sequence of each process step node of the business process according to the annotation content of the process entry node and the annotation content of each process step.
Preferably, after the step of the method for extracting content containing annotations, the method further comprises: caching the extracted method into a key value container map;
the step of determining the flow sequence of each flow step node of the business flow according to the annotation content of the flow entry node and the annotation content of each flow step specifically includes:
acquiring a process entry node from a key value container map to check whether the process entry node contains a circulation condition annotation attribute;
if the flow entry node contains the flow condition annotation attribute, determining a corresponding next flow transfer node according to the flow condition annotation attribute, and checking whether the next flow transfer node contains the flow condition annotation attribute;
if the next streaming node contains the streaming condition annotation attribute, continuing to determine the streaming node, repeating the checking step of the streaming condition streaming attribute until the last streaming node is determined, and setting the last streaming node as the flow end node;
and if the next streaming node does not contain the streaming condition annotation attribute, setting the next streaming node as the flow end node.
Preferably, the step of constructing the execution sequence of the business process according to the annotation content further includes;
when an execution signal of a preset business process frame is detected, flow control of the business process is carried out according to the specific object and the execution sequence of the business process;
and transmitting parameters among the process steps of the business process in a context mode.
In addition, to achieve the above object, the present invention further provides an annotation-based flow implementation apparatus, including:
the definition module is used for defining a specific object of the business process;
the annotation module is used for initializing the specific object of the business process added with the annotation when the preset business process framework is initialized;
and the execution sequence construction module is used for constructing the execution sequence of the business process according to the annotation content.
Preferably, the specific objects of the business process include: the service process comprises a process inlet node of the service process, process steps of the service process, circulation conditions among the process steps and execution codes of the process steps.
Preferably, the execution sequence building module specifically includes:
the traversing unit is used for traversing the classes in the business process framework and acquiring a method set of the classes to which the annotations are added;
the extraction unit is used for traversing the method set of the class and extracting the method containing the annotation content;
a detection unit for detecting whether the class contains a process entry node and a process end condition based on the extracted method;
and the flow determining unit is used for determining the flow sequence of each flow step node of the business flow according to the annotation content of the flow entry node and the annotation content of each flow step if the class simultaneously contains the flow entry node and the flow end condition.
Preferably, the extracting unit is further configured to cache the extracted method into a key value container map;
a flow determining unit, configured to obtain a flow entry node from the key value container map, and check whether the flow entry node contains a flow condition annotation attribute; if the flow entry node contains the flow condition annotation attribute, determining a corresponding next flow transfer node according to the flow condition annotation attribute, and checking whether the next flow transfer node contains the flow condition annotation attribute; if the next streaming node contains the streaming condition annotation attribute, continuing to determine the streaming node, repeating the checking step of the streaming condition streaming attribute until the last streaming node is determined, and setting the last streaming node as the flow end node; and if the next streaming node does not contain the streaming condition annotation attribute, setting the next streaming node as the flow end node.
Preferably, the device further comprises a circulation control module;
the flow control module is used for controlling the flow of the business flow according to the specific object and the execution sequence of the business flow when detecting an execution signal of a preset business flow frame;
and transmitting parameters among the process steps of the business process in a context mode.
In addition, to achieve the above object, the present invention further provides an annotation based flow implementation device, including: the system comprises a memory, a processor and an annotation based flow implementation program stored on the memory and capable of running on the processor, wherein the annotation based flow implementation program realizes the steps of the annotation based flow implementation method according to any one of the above items when being executed by the processor.
In addition, in order to achieve the above object, the present invention further provides a readable storage medium, where an annotation-based flow implementation program is stored, and when executed by a processor, the annotation-based flow implementation program implements the steps of the annotation-based flow implementation method according to any one of the above items.
The embodiment of the invention provides a method, a device, equipment and a readable storage medium for realizing a flow based on annotation, which are used for establishing an execution sequence of a business flow according to annotation contents by defining a specific object of the business flow, adding the annotation to the specific object of the business flow when a preset business flow frame is initialized. Therefore, the adoption of a complex framework with high integration difficulty is avoided, and the light weight of the business process framework is facilitated; meanwhile, the definition and the added annotation of the specific object of the business process are utilized to construct the execution sequence of the business process, and the flow is supported to flow according to the conditions in the specific process execution process of the business process, so that the code is consistent with the business process, and the code maintenance is convenient; the method has the advantages that a large amount of business system codes are not required to be transformed, the code invasion is small, the method can be used after being slightly transformed on the existing codes, and the method also has the characteristics of simplicity in use and high flexibility.
Drawings
FIG. 1 is a state machine diagram of a Spring Statemmachine;
FIG. 2 is a schematic flowchart of a first embodiment of a method for annotation-based flow implementation according to the present invention;
FIG. 3 is a lifecycle diagram of a business process;
FIG. 4 is a detailed diagram of the step S30 of the annotation-based flow implementation method according to the first embodiment of the present invention;
FIG. 5 is a diagram illustrating a detailed step of step S34 in FIG. 4;
FIG. 6 is a flowchart illustrating a second embodiment of the annotation-based flow implementation method of the present invention;
FIG. 7 is a schematic diagram of a business process of the annotation based process implementation method of the present invention;
FIG. 8 is a functional block diagram of an annotation-based process implementation apparatus according to the present invention;
FIG. 9 is a detailed diagram of the execution sequence constructing module 30 of the annotation-based process implementation apparatus according to the present invention;
FIG. 10 is a schematic diagram of another functional module of the annotation-based process implementation apparatus according to the present invention.
The objects, features and advantages of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a flow implementation method based on annotation.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a first embodiment of an annotation-based flow implementation method according to the present invention. Wherein the method comprises the following steps:
step S10, defining specific objects of the business process;
in the present invention, the complete life cycle of a business process includes the main processes of process design, process definition, process construction, process execution, process termination, etc., as shown in fig. 3. The process design process specifically comprises the steps that a developer splits a preset service process to obtain a plurality of corresponding process steps, and flow conditions for flowing among the steps are designed; presetting a Business Process as a specific established Business Process (Business Process); the business process may be a related process formulated by reading and analyzing a certain business project requirement. Taking a deduction process as an example, the deduction process is refined and split, and the deduction process is split into the following steps: 1. checking the request parameter; 2. if the parameter verification fails, directly ending the flow and returning to the failure of the parameter verification; 3. passing parameter verification and warehousing; 4. deducting money and updating the state; 5. and ending the flow and returning a result.
Specifically, the developer organizes the preset business process according to the process design content to implement the definition of the specific object of the business process, for example, the arrangement of each process step is performed based on the logical relationship, which may specifically include determining the execution content of each process step and the circulation condition for circulating between each step. In this embodiment, programming is used to define specific objects of a business process. The specific object of the preset business process specifically includes: the method comprises the steps of a process Entry node (Entry) of a business process, process steps (Step) of the business process, circulation conditions (Condition) among the process steps and execution codes of the process steps. It should be noted that, the flow steps of the business flow include various types of nodes, for example, step A, B may include N nodes and M nodes, respectively.
Step S20, when the preset business process frame is initialized, initializing the specific object of the business process added with the annotation;
when the system is started, initializing a preset business process frame, wherein the initialization comprises the initialization of various parameters in the frame; at this time, the specific object of the business process to which the annotation is added is initialized.
In embodiments of the present invention, step S20 includes an operation of initializing a specific object of the business process to which an annotation is added, specifically a syntactic metadata technique that may be added to source code of a programming language (e.g., Java). Annotations may be added to classes, methods, parameters of methods, and local variables. After annotations are added to a program, compilers, development tools, and other programs may obtain the added annotation content through a reflection mechanism and perform actions or processes related to the annotation content.
The specific added annotation content is shown below and its corresponding table.
@BusinessProcess
Figure BDA0001904544910000061
@Entry
Figure BDA0001904544910000062
Figure BDA0001904544910000071
@Step
Figure BDA0001904544910000072
@End
Properties Value taking Whether or not to fill Description of the invention
name String Whether or not Slightly less than
@Route
Properties Value taking Whether or not to fill Description of the invention
exp String Is that Conditional expressions
next String Is that Step name
The @ business process is used for identifying one business process and corresponds to a specific business process. The annotation content at least comprises the name of the business process and the thread pool (executor) used.
@ Entry is used to identify a process Entry, corresponding to a process Entry node of a specific business process. The annotation content at least comprises the name of the flow Entry node, the next attribute (for specifying the next node of Entry) and the default exit condition of the error.
@ Step is used to identify the process steps, corresponding to the relevant content of each process Step. The annotation content includes the name of the flow step, the next/next attribute (next flow node for specifying the current node), and the calling mechanism before and after the current flow step is executed.
@ End is used to identify the flow End step.
@ Route is used for identifying a flow branch Route, and annotation contents of the @ Route include conditions for circulation of different flow steps.
And step S30, constructing the execution sequence of the business process according to the annotation content.
In one embodiment, as shown in fig. 4, step S30 includes:
step S31, traversing the classes in the business process framework and acquiring a method set of the classes added with annotations;
if any form of annotation content exists on a certain class, the annotation content can be regarded as existing on the class. When judging whether the annotation content exists on the class, whether the identifier of "@" exists on the class can be searched. When the current class is detected to have annotation content, extracting (or marking) each method packaged by the current class, and further acquiring a method set of the current class.
If the annotation content is not detected to exist on the class, skipping the class, and continuing to judge the next class until the judgment of all classes is completed.
Step S32, traversing the method set of the class and extracting the method containing annotation content;
judging whether a method contains annotation content or not by traversing the method set in the current class; if so, the method is extracted, and so on.
Preferably, after the method including the annotation content is extracted, the method "detecting whether the class includes the process entry node and the process end condition at the same time based on the extracted method, and if the class includes the process entry node and the process end condition at the same time, determining the flow order of the nodes of the process steps of the business process according to the annotation content of the process entry node and the annotation content of the process steps" is directly executed.
Further, in order to improve the flexibility of the implementation of the annotation-based process, after the method containing the annotation content is extracted, the method containing the annotation content is cached in the key value container map. The "key value container Map" may be regarded as a key value container in a data structure, and is a key-value key value pair, and in a specific implementation, Java is taken as an example, and there are Map interfaces inherited by a Map interface, a hashmap, a treemap, and a hashtable. In Linux, a mmap () function is used to replace read, so that the copying times of a CPU (central processing unit) can be reduced, and the context switching times of a system can be reduced to 2 times, thereby greatly improving the performance of buffering and reading speed
Step S33, based on the extracted method, detecting whether the class contains both a process entry node and a process end condition;
the process entry node and the process ending condition respectively correspond to the starting mechanism and the ending mechanism of the business process and are necessary contents. Specifically, whether the annotation content cached to the key value container map contains the @ Entry and the @ End is searched, and whether the class contains a process Entry node and a process End condition at the same time is determined, wherein the process End condition corresponds to a process End step. If the extracted method simultaneously contains the annotation contents of the @ Entry and the @ End, the class is judged to simultaneously contain a flow Entry node and a flow End condition. Otherwise, judging that the class does not contain a process entry node and a process ending condition at the same time, and outputting an alarm to remind a programmer to complement the missing item so as to ensure the subsequent normal execution of the business process.
Step S34, if the class contains both a process entry node and a process end condition, determining a flow order of each process step node of the business process according to the annotation content of the process entry node and the annotation content of each process step.
In one implementation, as shown in fig. 5, step S34 includes: a1. acquiring a process Entry node (Entry) from a key value container map to check whether the process Entry node contains a flow condition annotation attribute;
a2. if the flow entry node contains the flow condition annotation attribute, determining a corresponding next flow transfer node according to the flow condition annotation attribute, and checking whether the next flow transfer node contains the flow condition annotation attribute;
a3. if the next streaming node contains the streaming condition annotation attribute, continuing to determine the streaming node, repeating the checking step of the streaming condition streaming attribute until the last streaming node is determined, and setting the last streaming node as the flow end node;
a4. and if the next streaming node does not contain the streaming condition annotation attribute, setting the next streaming node as the flow end node.
I.e. reads the annotation content @ Entry of the flow Entry node and detects whether it contains a next attribute. If not, directly setting the next node as a process End node (End). If so, the next node specified in the next attribute is determined to be the "next streaming node". Further, the annotation content @ Step of the flow Step where the determined "next streaming node" is located is read and it is detected whether a next/nexts attribute is contained therein. If not, setting the next streaming node as a flow End node (End). If yes, the determination of the transfer node is continued until the last transfer node is determined, and then the last transfer node is set as an End node (End) of the process. It should be noted that conditional flow between different steps also needs to be implemented according to the annotation flow condition in @ Route. Specific examples of the implementation of step S34 can also refer to the following examples.
In this embodiment, a specific object of a business process is defined, and an annotation is added to the specific object of the business process when a preset business process frame is initialized, and an execution sequence of the business process is constructed according to annotation contents. Therefore, the adoption of a complex framework with high integration difficulty is avoided, and the light weight of the business process framework is facilitated; meanwhile, the definition and the added annotation of the specific object of the business process are utilized to construct the execution sequence of the business process, and the flow is supported to flow according to the conditions in the specific process execution process of the business process, so that the code is consistent with the business process, and the code maintenance is convenient; the method has the advantages that a large amount of business system codes are not required to be transformed, the code invasion is small, the method can be used after being slightly transformed on the existing codes, and the method also has the characteristics of simplicity in use and high flexibility.
Further, on the basis of the first embodiment of the annotation-based flow implementation method of the present invention, a second embodiment is proposed. As shown in fig. 6, fig. 6 is a schematic flow chart of the second embodiment. After step S30, the method further includes;
step S40, when detecting the execution signal of the preset business process frame, controlling the flow of the business process according to the specific object and the execution sequence of the business process;
and transmitting parameters among the process steps of the business process in a context mode.
After the above-mentioned process construction is completed, after the system calls the business process Entry node (Entry), the preset business process framework automatically enters the execution process. At this time, an execution signal of the preset business process framework is triggered. And dynamically determining a next flow transfer node and performing node transfer after continuously updated service data is acquired based on each defined specific object and the execution sequence constructed according to the annotation content, thereby realizing the flow control of the service flow.
The following examples are given. As shown in fig. 7, a certain service process specifically includes process steps 1 to 4, and the implementation process is designed as follows: a preset service flow framework enters a Step 1(Step1) of executing a flow from a flow Entry node (Entry), if an actual flow condition meets the condition 1, a Step 2(Step2) of executing the flow is executed, then the flow is transferred to a flow End node (End), and the service flow is ended; if the actual circulation condition satisfies the condition 2, the flow proceeds to Step 3(Step 3).
After the Step3 of the flow is executed (Step3), if the actual flow condition meets the condition 3, the flow is transferred to a flow End node (End), and the service flow is ended; if the actual flow condition satisfies the condition 4, the flow Step4 is executed (Step4), and then the flow is transferred to the flow End node (End), and the service flow is ended.
After defining a process Entry node (Entry) of a business process, flow steps 1 to 4, flow conditions (namely, conditions 1 to 4) among the steps, and specific execution codes of the flow steps, annotations are added to the process Entry node (Entry), the flow steps 1 to 4, and the flow conditions (namely, conditions 1 to 4) among the steps. Wherein, Step 4(Step4) is the End of the flow, and the annotation added to this Step is @ End.
And then, constructing an execution sequence of the business flow according to the annotation content. After judging that the class of the preset business process frame includes a process Entry node (Entry) and a process ending Step (Step4), acquiring the process Entry node (Entry), and determining a next flow node based on the annotation content @ Entry, namely, the next flow node corresponds to the process Step 2(Step 2). Then, based on the next/nexts attribute in the annotation content @ Step2 of flow Step 2(Step2), the next streaming node is determined, and so on. When the flow goes from Step 2(Step2) to the next flow Step, the determination of the next flow node is made by the annotation content @ Route of the Step flow condition, and so on. When the annotation content of a flow step does not contain the next/next attribute corresponding to the current flow node (for example, the next/next attribute is null), modifying the next/next attribute in the annotation content of the flow step into a flow End node (End), thereby determining the current flow node as the flow End node of the business flow.
When entering the process execution stage, after the system calls a business process Entry node (Entry), the preset business process framework automatically enters the execution process. Through the determination of the circulation node determined by the annotation content of the specific object and the dynamic service data acquired in real time, the next circulation node is dynamically determined, node circulation is performed until the circulation reaches the dynamically determined flow End node (End), and then the flow End step (i.e. the flow step4) is executed, and the service flow is ended.
In addition, the invention also provides a flow implementation device based on the annotation. As shown in fig. 8, the apparatus includes:
a definition module 10, configured to define a specific object of a business process;
specifically, the developer organizes the preset business process according to the process design content to implement the definition of the specific object of the business process, for example, the arrangement of each process step is performed based on the logical relationship, which may specifically include determining the execution content of each process step and the circulation condition for circulating between each step. In the present embodiment, programming is used to define specific objects of a business process via definition module 10. The specific object of the preset business process specifically includes: the method comprises the steps of a process Entry node (Entry) of a business process, process steps (Step) of the business process, circulation conditions (Condition) among the process steps and execution codes of the process steps. It should be noted that, the flow steps of the business flow include various types of nodes, for example, step A, B may include N nodes and M nodes, respectively.
The annotation module 20 is configured to initialize the specific object of the service flow to which the annotation is added when the preset service flow framework is initialized;
when the system is started, initializing a preset business process frame, wherein the initialization comprises the initialization of various parameters in the frame; at this point, annotations are added to particular objects of the business process.
In the embodiments of the present invention, an operation of initializing a specific object of a business process to which an annotation is added is performed, and adding the annotation is specifically a syntax metadata technique that can be added to source code of a programming language (such as Java). Annotations may be added to classes, methods, parameters of methods, and local variables. After annotations are added to a program, compilers, development tools, and other programs may obtain the added annotation content through a reflection mechanism and perform actions or processes related to the annotation content.
For additional comments, see above.
The @ business process is used for identifying one business process and corresponds to a specific business process. The annotation content at least comprises the name of the business process and the thread pool (executor) used.
@ Entry is used to identify a process Entry, corresponding to a process Entry node of a specific business process. The annotation content at least comprises the name of the flow Entry node, the next attribute (for specifying the next node of Entry) and the default exit condition of the error.
@ Step is used to identify the process steps, corresponding to the relevant content of each process Step. The annotation content includes the name of the flow step, the next/next attribute (next flow node for specifying the current node), and the calling mechanism before and after the current flow step is executed.
@ End is used to identify the flow End step.
@ Route is used for identifying a flow branch Route, and annotation contents of the @ Route include conditions for circulation of different flow steps.
And the execution sequence construction module 30 is configured to construct an execution sequence of the business process according to the annotation content.
In one implementation, as shown in fig. 9, the execution sequence building module 30 specifically includes:
a traversing unit 310, configured to traverse the classes in the business process framework, and obtain a method set of classes to which annotations have been added;
if any form of annotation content exists on a certain class, the annotation content can be regarded as existing on the class. When judging whether the annotation content exists on the class, whether the identifier of "@" exists on the class can be searched. When the current class is detected to have annotation content, extracting (or marking) each method packaged by the current class, and further acquiring a method set of the current class.
If the annotation content is not detected to exist on the class, skipping the class, and continuing to judge the next class until the judgment of all classes is completed.
An extracting unit 320, configured to traverse the method set of the class and extract methods containing annotation content;
judging whether a method contains annotation content or not by traversing the method set in the current class; if so, the method is extracted, and so on.
Preferably, after extracting the method including the annotation content, the extracting unit 320 directly performs "detecting whether the class includes the flow entry node and the flow end condition at the same time based on the extracted method, and if the class includes the flow entry node and the flow end condition at the same time, determining the flow order of each flow step node of the business flow according to the annotation content of the flow entry node and the annotation content of each flow step".
Further, in order to improve flexibility of implementation of the annotation-based flow, after the extracting unit 320 extracts the method containing the annotation content, the extracting unit 320 is further configured to cache the method containing the annotation content into the key-value container map. The "key value container Map" may be regarded as a key value container in a data structure, and is a key-value key value pair, and in a specific implementation, Java is taken as an example, and there are Map interfaces inherited by a Map interface, a hashmap, a treemap, and a hashtable. In Linux, a mmap () function is used, and reads are replaced by mmap, so that the CPU copy frequency can be reduced, and the system context switching frequency is reduced to 2 times, thereby greatly improving the buffering and reading speed performance.
A detecting unit 330, configured to detect whether the class contains a process entry node and a process end condition at the same time based on the extracted method;
the process entry node and the process ending condition respectively correspond to the starting mechanism and the ending mechanism of the business process and are necessary contents. Specifically, whether the annotation content cached to the key value container map contains the @ Entry and the @ End is searched, and whether the class contains a process Entry node and a process End condition at the same time is determined, wherein the process End condition corresponds to a process End step. If the extracted method simultaneously contains the annotation contents of the @ Entry and the @ End, the class is judged to simultaneously contain a flow Entry node and a flow End condition. Otherwise, judging that the class does not contain a process entry node and a process ending condition at the same time, and outputting an alarm to remind a programmer to complement the missing item so as to ensure the subsequent normal execution of the business process.
A flow determining unit 340, configured to determine, if the class includes both a flow entry node and a flow end condition, a flow sequence of each flow step node of the business flow according to the annotation content of the flow entry node and the annotation content of each flow step.
In one implementation, the flow determination unit 340 is configured to: a1. acquiring a process Entry node (Entry) from a key value container map to check whether the process Entry node contains a flow condition annotation attribute;
a2. if the flow entry node contains the flow condition annotation attribute, determining a corresponding next flow transfer node according to the flow condition annotation attribute, and checking whether the next flow transfer node contains the flow condition annotation attribute;
a3. if the next streaming node contains the streaming condition annotation attribute, continuing to determine the streaming node, repeating the checking step of the streaming condition streaming attribute until the last streaming node is determined, and setting the last streaming node as the flow end node;
a4. and if the next streaming node does not contain the streaming condition annotation attribute, setting the next streaming node as the flow end node.
I.e. reads the annotation content @ Entry of the flow Entry node and detects whether it contains a next attribute. If not, directly setting the next node as a process End node (End). If so, the next node specified in the next attribute is determined to be the "next streaming node". Further, the annotation content @ Step of the flow Step where the determined "next streaming node" is located is read and it is detected whether a next/nexts attribute is contained therein. If not, setting the next streaming node as a flow End node (End). If yes, the determination of the transfer node is continued until the last transfer node is determined, and then the last transfer node is set as an End node (End) of the process. It should be noted that conditional flow between different steps also needs to be implemented according to the annotation flow condition in @ Route.
In the device, a specific object of a business process is defined through a definition module 10, an annotation is added to the specific object of the business process by an annotation module 20 when a preset business process frame is initialized, and an execution sequence of the business process is constructed by an execution sequence construction module 30 according to annotation contents. Therefore, the adoption of a complex framework with high integration difficulty is avoided, and the light weight of the business process framework is facilitated; meanwhile, the definition and the added annotation of the specific object of the business process are utilized to construct the execution sequence of the business process, and the flow is supported to flow according to the conditions in the specific process execution process of the business process, so that the code is consistent with the business process, and the code maintenance is convenient; the method has the advantages that a large amount of business system codes are not required to be transformed, the code invasion is small, the method can be used after being slightly transformed on the existing codes, and the method also has the characteristics of simplicity in use and high flexibility.
Further, as shown in fig. 10, on the basis of the annotation-based flow implementation apparatus of the present invention, the apparatus further includes a flow control module 40.
The flow control module 40 is configured to, when an execution signal of a preset service flow frame is detected, perform flow control of the service flow according to the specific object and the execution sequence of the service flow;
and transmitting parameters among the process steps of the business process in a context mode.
After the above-mentioned process construction is completed, after the system calls the business process Entry node (Entry), the preset business process framework automatically enters the execution process. At this time, an execution signal of the preset business process framework is triggered. And dynamically determining a next flow transfer node and performing node transfer after continuously updated service data is acquired based on each defined specific object and the execution sequence constructed according to the annotation content, thereby realizing the flow control of the service flow.
In addition, the present invention also provides an annotation-based process implementation device, which includes: the system comprises a memory, a processor and an annotation based flow implementation program stored on the memory and capable of running on the processor, wherein the annotation based flow implementation program realizes the steps of the annotation based flow implementation method according to any one of the above items when being executed by the processor.
The annotation-based flow circulation implementation equipment in the embodiment of the invention can be a PC or a server.
The apparatus may include: a processor, e.g. a CPU, a network interface, a user interface, a memory, a communication bus. Wherein the communication bus is used for realizing connection communication among the components. The user interface may comprise a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may also comprise a standard wired interface, a wireless interface. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory may be a high-speed RAM memory or a non-volatile memory, such as a disk memory. The memory may alternatively be a storage device separate from the aforementioned processor.
The memory, which is a type of computer storage medium, may include an operating system, a network communication module, a user interface module, and an annotation based flow stream implementation program.
The network interface is mainly used for connecting the background server and carrying out data communication with the background server; the user interface is mainly used for connecting a client (user side) and carrying out data communication with the client; and the processor may be configured to call the annotation based flow stream implementation program stored in the memory, and perform the operations in the following embodiments of the annotation based flow stream implementation method.
Based on the hardware structure, the embodiment of the annotation-based flow circulation implementation method is provided.
In addition, the invention also provides a readable storage medium.
The readable storage medium stores an annotation-based flow stream implementation program, and the annotation-based flow stream implementation program, when executed by a processor, implements the steps of the annotation-based flow stream implementation method as described in any one of the above items.
The specific embodiment of the readable storage medium of the present invention is substantially the same as the embodiments of the annotation-based process implementation method, and is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (8)

1. An annotation-based flow implementation method, comprising:
defining a specific object of a business process, wherein the specific object of the business process comprises: a process entry node of the business process, process steps of the business process, a flow condition between each process step and an execution code of each process step;
when a preset business process frame is initialized, initializing a specific object of the business process added with the annotation;
constructing an execution sequence of the business process according to annotation contents;
wherein the step of constructing the execution sequence of the business process according to the annotation content comprises:
traversing classes in the business process framework, and acquiring a method set of classes to which annotations are added;
traversing the method set of the class and extracting the method containing annotation content;
detecting whether the class contains a process entry node and a process end condition at the same time based on the extracted method;
and if the class simultaneously contains a process entry node and a process end condition, determining the circulation sequence of each process step node of the business process according to the annotation content of the process entry node and the annotation content of each process step.
2. The method for implementing an annotation-based process of claim 1, wherein the step of extracting the annotation-containing content further comprises: caching the extracted method into a key value container map;
the step of determining the flow sequence of each flow step node of the business flow according to the annotation content of the flow entry node and the annotation content of each flow step specifically includes:
acquiring a process entry node from a key value container map to check whether the process entry node contains a circulation condition annotation attribute;
if the flow entry node contains the flow condition annotation attribute, determining a corresponding next flow transfer node according to the flow condition annotation attribute, and checking whether the next flow transfer node contains the flow condition annotation attribute;
if the next streaming node contains the streaming condition annotation attribute, continuing to determine the streaming node, repeating the checking step of the streaming condition streaming attribute until the last streaming node is determined, and setting the last streaming node as a flow end node;
and if the next streaming node does not contain the streaming condition annotation attribute, setting the next streaming node as a flow end node.
3. The method for implementing an annotation-based process according to claim 1, wherein the step of constructing the execution sequence of the business process according to the annotation content further comprises;
when an execution signal of a preset business process frame is detected, flow control of the business process is carried out according to the specific object and the execution sequence of the business process;
and transmitting parameters among the process steps of the business process in a context mode.
4. An apparatus for implementing an annotation-based process, the apparatus comprising:
the definition module is used for defining a specific object of the business process, wherein the specific object of the business process comprises the following steps: a process entry node of the business process, process steps of the business process, a flow condition between each process step and an execution code of each process step;
the annotation module is used for initializing the specific object of the business process added with the annotation when the preset business process framework is initialized;
the execution sequence construction module is used for constructing the execution sequence of the business process according to the annotation content;
wherein the execution sequence building module comprises:
the traversing unit is used for traversing the classes in the business process framework and acquiring a method set of the classes to which the annotations are added;
the extraction unit is used for traversing the method set of the class and extracting the method containing the annotation content;
a detection unit for detecting whether the class contains a process entry node and a process end condition based on the extracted method;
and the flow determining unit is used for determining the flow sequence of each flow step node of the business flow according to the annotation content of the flow entry node and the annotation content of each flow step if the class simultaneously contains the flow entry node and the flow end condition.
5. The apparatus of claim 4, wherein the extraction unit is further configured to cache the extracted method in a key-value container map;
a flow determining unit, configured to obtain a flow entry node from the key value container map, and check whether the flow entry node contains a flow condition annotation attribute; if the flow entry node contains the flow condition annotation attribute, determining a corresponding next flow transfer node according to the flow condition annotation attribute, and checking whether the next flow transfer node contains the flow condition annotation attribute; if the next streaming node contains the streaming condition annotation attribute, continuing to determine the streaming node, repeating the checking step of the streaming condition streaming attribute until the last streaming node is determined, and setting the last streaming node as a flow end node; and if the next streaming node does not contain the streaming condition annotation attribute, setting the next streaming node as a flow end node.
6. The annotation-based flow implementation apparatus of claim 4, wherein the apparatus further comprises a flow control module;
the flow control module is used for controlling the flow of the business flow according to the specific object and the execution sequence of the business flow when detecting an execution signal of a preset business flow frame;
and transmitting parameters among the process steps of the business process in a context mode.
7. An annotation-based flow implementation device, comprising: a memory, a processor and an annotation based procedure implementation program stored on the memory and executable on the processor, the annotation based procedure implementation program when executed by the processor implementing the steps of the annotation based procedure implementation method according to any one of claims 1 to 3.
8. A readable storage medium, wherein the readable storage medium stores thereon an annotation based flow stream implementation program, and the annotation based flow stream implementation program, when executed by a processor, implements the steps of the annotation based flow stream implementation method according to any one of claims 1 to 3.
CN201811526367.1A 2018-12-13 2018-12-13 Method, device and equipment for realizing flow based on annotation and readable storage medium Active CN109634569B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811526367.1A CN109634569B (en) 2018-12-13 2018-12-13 Method, device and equipment for realizing flow based on annotation and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811526367.1A CN109634569B (en) 2018-12-13 2018-12-13 Method, device and equipment for realizing flow based on annotation and readable storage medium

Publications (2)

Publication Number Publication Date
CN109634569A CN109634569A (en) 2019-04-16
CN109634569B true CN109634569B (en) 2022-01-25

Family

ID=66073644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811526367.1A Active CN109634569B (en) 2018-12-13 2018-12-13 Method, device and equipment for realizing flow based on annotation and readable storage medium

Country Status (1)

Country Link
CN (1) CN109634569B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110650211B (en) * 2019-10-15 2022-04-01 河北幸福消费金融股份有限公司 Agent technology-based process control method, system, device and storage medium
CN110908644B (en) * 2019-10-16 2023-12-12 浙江大搜车软件技术有限公司 Configuration method and device of state node, computer equipment and storage medium
CN113326026B (en) * 2021-05-11 2023-09-08 福建天泉教育科技有限公司 Method and terminal for generating micro-service business process interface

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106059796A (en) * 2016-05-17 2016-10-26 中国建设银行股份有限公司 Business extension system and method
CN107704386A (en) * 2017-09-25 2018-02-16 金蝶软件(中国)有限公司 Unit test method, device, computer equipment and the storage medium of operation flow
CN108053144A (en) * 2017-12-29 2018-05-18 厦门市美亚柏科信息股份有限公司 Open operation flow implementation method and workflow engine
CN108363566A (en) * 2018-01-30 2018-08-03 中国平安人寿保险股份有限公司 File configuration method, intelligent terminal and storage medium in a kind of project development process

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7831453B2 (en) * 2005-05-05 2010-11-09 Siebel Systems, Inc. Modeling of business process data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106059796A (en) * 2016-05-17 2016-10-26 中国建设银行股份有限公司 Business extension system and method
CN107704386A (en) * 2017-09-25 2018-02-16 金蝶软件(中国)有限公司 Unit test method, device, computer equipment and the storage medium of operation flow
CN108053144A (en) * 2017-12-29 2018-05-18 厦门市美亚柏科信息股份有限公司 Open operation flow implementation method and workflow engine
CN108363566A (en) * 2018-01-30 2018-08-03 中国平安人寿保险股份有限公司 File configuration method, intelligent terminal and storage medium in a kind of project development process

Also Published As

Publication number Publication date
CN109634569A (en) 2019-04-16

Similar Documents

Publication Publication Date Title
KR102179149B1 (en) Page component dynamic layout
CN109634569B (en) Method, device and equipment for realizing flow based on annotation and readable storage medium
US20120304153A1 (en) Context-sensitive analysis framework using value flows
US20150142718A1 (en) Ontology-Aided Business Rule Extraction Using Machine Learning
CN109246163B (en) Terminal information identification method and device
CN108536745B (en) Shell-based data table extraction method, terminal, equipment and storage medium
CN107632929B (en) Method and device for detecting memory leakage
US9569183B2 (en) Contract based builder
US20140297679A1 (en) Analytics based on pipes programming model
CN113296786B (en) Data processing method, device, electronic equipment and storage medium
CN115599386A (en) Code generation method, device, equipment and storage medium
WO2020263676A1 (en) Regular expression generation using span highlighting alignment
US9898467B1 (en) System for data normalization
US11500618B2 (en) Software library differential identification and automated uplift
CN112527459A (en) Log analysis method and device based on Kubernetes cluster
CN111352631A (en) Interface compatibility detection method and device
CN111240728A (en) Application program updating method, device, equipment and storage medium
CN115794858A (en) Query statement processing method, device, equipment and storage medium
CN113342553A (en) Data acquisition method and device, electronic equipment and storage medium
KR101684454B1 (en) Hybrid application and event handling method thereof
CN109388400B (en) Automatic page generation method and device
CN113138767A (en) Code language conversion method, device, electronic equipment and storage medium
CN112130860A (en) JSON object analysis method and device, electronic device and storage medium
EP3987409A1 (en) User interface commands for regular expression generation
CN110297639B (en) Method and apparatus for detecting code

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant