A method and apparatus for decoupling service logic and flow transfer logic

By decoupling business logic and workflow logic in the workflow engine, and by using a decoupled middleware layer and standard interfaces, the problem of high coupling in existing technologies is solved, enabling more efficient product design and development.

CN115080257BActive Publication Date: 2026-03-31CHINA NAT SOFTWARE & SERVICE
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-10
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing workflow engine products suffer from high coupling between business logic and workflow logic, resulting in low product reusability, low fault tolerance, high difficulty in secondary development, and a lack of reasonable layered design.

Method used

By decoupling business logic and workflow logic, the business logic layer and workflow logic layer are separated, and standard data interaction is achieved through the decoupling of the middle layer. API interfaces and standard interaction interfaces are provided to reduce coupling.

Benefits of technology

The workflow engine features a well-designed layered structure, which improves product readability and maintainability, simplifies technical framework upgrades and application system integration, and reduces the difficulty of secondary development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080257B_ABST
    Figure CN115080257B_ABST
Patent Text Reader

Abstract

The application relates to a method and device for decoupling business logic and flow transfer logic. The steps of the method comprise: dividing a business logic layer and a flow transfer logic layer in a business process engine, and setting a decoupling intermediate layer between the business logic layer and the flow transfer logic layer; the business logic layer receives business and form data input by an application system, parses the business and form data to obtain process data, and transmits the process data to the flow transfer logic layer through the decoupling intermediate layer; the flow transfer logic layer executes specific process tasks according to the process data and obtains execution results, and transmits the execution results to the business logic layer through the decoupling intermediate layer; and the business logic layer performs business semanticization and encapsulation on the execution results, and feeds back processing results to the application system. Through decoupling of the business logic and the flow transfer logic, the application greatly improves the readability and maintainability of a product, the technical framework is simple to upgrade, secondary development does not easily affect the overall function and stability of the product, and the application is convenient to interface with the application system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology and relates to a layered design method for a workflow engine, particularly a method and apparatus for decoupling business logic and workflow logic. Background Technology

[0002] As a crucial component of application systems, workflow engines provide core solutions that significantly impact various application systems, determining information delivery routes and content levels based on roles, responsibilities, and conditions. Workflow engines include essential functions such as node management, flow management, and process example management.

[0003] Currently, mainstream workflow engine products on the market fall into two main design categories: lightweight workflow engine frameworks (such as the open-source workflow engine Activiti) and heavyweight workflow engine products (such as various commercial workflow engine products) that are centered around a workflow engine and include a large number of business extension functions. The former lacks business layer components and functions, requiring the application side to develop numerous business functions based on the workflow logic when integrating with applications, resulting in low product reusability and fault tolerance. The latter focuses more on providing commonly used business functions, with high internal functional coupling and blurred hierarchical boundaries, making secondary development more difficult when existing functions cannot meet business needs.

[0004] Most workflow engine products on the market currently suffer from the aforementioned defects and problems. There is very little publicly available research on workflow engines, especially regarding the layered design of workflow engines, which focuses more on how to integrate and interface with open-source workflow engine frameworks.

[0005] In summary, a method and device for decoupling business logic and workflow logic is imperative and of paramount importance. Summary of the Invention

[0006] To address the issue of reasonable layered design in current workflow engine products (i.e., business process engines), this invention adopts a method of decoupling business logic and flow logic. This is achieved by dividing the business process engine into independent business logic and flow logic layers. The business logic layer provides methods for embedded use in business application systems and APIs for external calls by distributed applications or microservice components. The flow logic layer is decoupled from the business logic layer, and standard interaction interfaces are established between the layers to achieve data transmission and logical interaction. This decoupling also facilitates secondary development of both the business logic and flow logic layers. This approach ensures a reasonable and optimized layered design for the workflow engine product, significantly reducing the difficulty of application integration and secondary development.

[0007] The technical solution adopted in this invention is:

[0008] A method for decoupling business logic and workflow logic includes the following steps:

[0009] In the business process engine, a business logic layer and a flow logic layer are divided, and a decoupling intermediate layer is set between the business logic layer and the flow logic layer.

[0010] The business logic layer receives business and form data input from the application system, parses it to obtain process data, and transmits the process data to the flow logic layer through the decoupling middle layer.

[0011] The workflow logic layer executes specific workflow tasks based on workflow data and obtains execution results. The execution results are then transmitted to the business logic layer through the decoupling middle layer.

[0012] The business logic layer performs business semantics and encapsulation on the execution results, and then feeds the processing results back to the application system.

[0013] Furthermore, the business logic layer includes a user center module, an application configuration module, an API interface platform, and a business logic processing module.

[0014] The user center module is responsible for interfacing with application systems or a unified user center to ensure consistent maintenance of information such as organizations, users, and roles.

[0015] The application configuration module is responsible for configuring application system information, managing application system authorization, and defining the relationship between application systems and process definitions.

[0016] The API interface platform is responsible for providing calling interfaces for application systems, mainly including Restful API interfaces, WebServices API interfaces, Web Socket API interfaces, and Http Servlet API interfaces.

[0017] The business logic processing module is responsible for processing business logic.

[0018] Furthermore, the workflow logic layer includes a process scheduling module and a workflow engine:

[0019] The process scheduling module is responsible for receiving process entities from the flow logic layer, searching, matching and executing specific process tasks based on process configuration information, and feeding back the execution results to the decoupled middleware layer.

[0020] The workflow engine is responsible for decoupling business logic and workflow logic, and implements data transmission through interfaces.

[0021] Furthermore, the decoupling intermediate layer includes a standard data interface module, which is responsible for defining standard data interaction interfaces for the business logic layer and the flow logic layer.

[0022] Furthermore, the decoupling method for the business logic and the flow logic specifically includes the following steps:

[0023] The workflow definition is drawn and saved using the workflow engine;

[0024] The workflow engine product can be associated with application systems or organizational structures in a unified user center through the user center module.

[0025] The application configuration module registers the application system's identifier, name, IP address, and other information with the workflow engine product.

[0026] Authorize the application system through the application configuration module and establish its association with the process definition;

[0027] The application system inputs business and form data to the business logic layer through the interfaces provided by the API interface platform;

[0028] The business logic layer parses the input data, analyzes the business language, extracts business data such as titles and process data such as recipients and process identifiers, and calls the process scheduling module of the flow logic layer by decoupling the middle layer.

[0029] The workflow logic layer calls the workflow scheduling module to find and match the workflow definition based on the workflow configuration information, execute the specific workflow task, and obtain the execution result;

[0030] The flow logic layer inputs the execution results into the business logic layer by decoupling the intermediate layer;

[0031] The business logic processing module in the business logic layer performs business semantics and encapsulation on the execution results, and then feeds them back to the application system for processing through the API interface platform.

[0032] Corresponding to the above method, the present invention also provides a device for decoupling business logic and flow logic, comprising a business logic layer, a flow logic layer, and a decoupling intermediate layer located between the business logic layer and the flow logic layer; the business logic layer receives business and form data input from the application system, parses it to obtain flow data, and transmits the flow data to the flow logic layer through the decoupling intermediate layer; the flow logic layer executes specific flow tasks according to the flow data and obtains the execution results, and transmits the execution results to the business logic layer through the decoupling intermediate layer; the business logic layer performs business semanticization and encapsulation on the execution results, and feeds back the processing results to the application system.

[0033] The present invention also provides an application system comprising a form and business data. The form provides visual information for user interaction, and the business data is used for storage and processing by the application system. The application system interacts with the business logic layer of the workflow engine product and executes instructions for each step of the method described above.

[0034] The beneficial effects of this invention are as follows: First, the product is rationally layered. By decoupling business logic and workflow logic, the readability and maintainability of the product are greatly improved. Second, the technical framework is easy to upgrade. The decoupled intermediate layer modules have established standard data interaction interfaces, so upgrading the business logic layer or workflow logic layer does not affect the overall product functionality. Third, application system integration is easy. The decoupled business logic layer only contains business processing and external interfaces, so secondary development is less likely to affect the overall functionality and stability of the product. The interfaces based on the business logic layer are all described in business language, which facilitates integration with application systems. Attached Figure Description

[0035] Figure 1 A schematic diagram of a device for decoupling business logic and workflow logic.

[0036] Figure 2 A flowchart illustrating the interaction between the application system and the business logic layer and the workflow logic layer. Detailed Implementation

[0037] To facilitate understanding and implementation of the present invention by those skilled in the art, the specific implementation methods and apparatus for decoupling business logic and flow logic of the present invention will be described in detail below with reference to the accompanying drawings.

[0038] An embodiment of the present invention provides a device for decoupling business logic and flow logic, such as... Figure 1 As shown, the device mainly includes a business logic layer, a decoupling intermediate layer, and a flow logic layer.

[0039] 1. Business Logic Layer

[0040] The business logic layer mainly includes the API interface platform, user center module, application configuration module, and business logic processing module.

[0041] The user center module is responsible for interfacing with application systems or a unified user center to ensure consistent maintenance of information such as organizations, users, and roles.

[0042] The application configuration module is responsible for configuring application system information, managing application system authorization, and defining the relationship between application systems and process definitions.

[0043] The API interface platform is responsible for providing calling interfaces for application systems, mainly including RESTful API interfaces, WebServices API interfaces, Web Socket API interfaces, and Http Servlet API interfaces.

[0044] The business logic processing module is responsible for processing business logic.

[0045] 2. Decoupling the intermediate layer

[0046] The decoupling middleware layer mainly includes a standard data interface module, which is responsible for defining standard data interaction interfaces for the business logic layer and the flow logic layer.

[0047] 3. Flow logic layer

[0048] The workflow logic layer mainly includes the process scheduling module and the workflow engine.

[0049] The process scheduling module is responsible for receiving process entities from the flow logic layer, searching, matching and executing specific process tasks based on process configuration information, and feeding back the execution results to the flow logic layer.

[0050] The workflow engine is responsible for decoupling business logic and workflow logic, and implements data transmission through interfaces.

[0051] The interaction process between the application system and the business logic layer and the flow logic layer in this embodiment is as follows: Figure 2 As shown, the main steps include the following:

[0052] Step S1: The application system inputs business and form data to the business logic layer through the API interface platform. The specific process is as follows:

[0053] 1) If the application system has an embedded business logic layer, it should be called via Java method.

[0054] 2) The application system can also interface with the business logic layer through RESTful API interfaces, Web Services API interfaces, Web Socket API interfaces, or Http Servlet API interfaces;

[0055] 3) The application system inputs business and form data through the API interface.

[0056] Step S2: The business logic layer parses the input data, analyzes the business language, extracts business data such as the title and process data such as the recipient and stage identifier, and calls the process scheduling module of the flow logic layer by decoupling the middle layer. The specific process is as follows:

[0057] 1) The API interface calls the application configuration module to verify whether the application system has been registered;

[0058] 2) If the application system is not registered, an error message will be returned to the application system through the API interface;

[0059] 3) The business logic processing module analyzes the input business language and extracts business data and process data;

[0060] 4) The business logic processing module calls the user center module to match and search for recipient information using business data;

[0061] 5) If no recipient information is found, an error message will be returned to the application system via the API interface;

[0062] 6) The business logic processing module calls the flow logic layer and inputs process data and recipient information by decoupling the middle layer;

[0063] Step S3: The workflow logic layer calls the workflow scheduling module, searches for and matches the workflow definition based on the workflow configuration information, executes the specific workflow task, and obtains the execution result. The specific process is as follows:

[0064] 1) The flow logic layer matches and searches for the flow definition based on the input flow data;

[0065] 2) If no process definition is matched, the business logic layer is called by decoupling the middle layer, and an error message is returned to the application system through the API interface;

[0066] 3) The flow logic layer calls the process scheduling module to execute specific process tasks and obtain the execution results.

[0067] Step S4: The flow logic layer inputs the execution result into the business logic layer by decoupling the intermediate layer;

[0068] Step S5: The execution result is semantically encoded and encapsulated by the business logic layer, and then fed back to the application system for processing through the API interface.

[0069] Another embodiment of the present invention provides an application system including a form and business data. The form provides visual information for user interaction, and the business data is used for storage and processing by the application system. The application system interacts with the business logic layer of the workflow engine product and executes the instructions for each step in the method described above.

[0070] Another embodiment of the present invention provides an electronic device (computer, server, smartphone, etc.) including a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the steps of the method of the present invention.

[0071] Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, disk, optical disk) storing a computer program that, when executed by a computer, implements the various steps of the method of the present invention.

[0072] It should be understood that the above description of the embodiments is quite specific and detailed, but it should not be construed as limiting the scope of this invention. It should be pointed out that those skilled in the art can make various modifications and improvements without departing from the concept of this invention, and these all fall within the scope of protection of this invention. Therefore, the scope of protection of this invention should be determined by the appended claims.

Claims

1. A method of decoupling service logic and flow transfer logic, characterized in that, The method comprises the following steps: dividing a business logic layer and a flow logic layer in a business process engine, and setting a decoupling intermediate layer between the business logic layer and the flow logic layer; the business logic layer receives business and form data input by an application system, parses the business and form data to obtain process data, and transmits the process data to the flow logic layer through the decoupling intermediate layer; the flow logic layer executes specific process tasks according to the process data and obtains execution results, and transmits the execution results to the business logic layer through the decoupling intermediate layer; the business logic layer performs business semanticization and encapsulation on the execution results, and feeds back processing results to the application system; the business logic layer comprises: a user center module, which is responsible for interfacing with the application system or a unified user center, and realizing consistent maintenance of institution, user and role information; an application configuration module, which is responsible for configuring application system information, application system authorization management and the association between the application system and process definition; an API interface platform, which is responsible for providing calling interfaces for the application system, mainly including Restful API interfaces, WebServices API interfaces, Web Socket API interfaces and Http Servlet API interfaces; a business logic processing module, which is responsible for related processing of business logic; the flow logic layer comprises: a process scheduling module, which is responsible for receiving process entities of the flow logic layer, and finding, matching and executing specific process tasks according to process configuration information, and feeding back execution results to the decoupling intermediate layer; a workflow engine, which is responsible for decoupling business logic and flow logic, and realizing data transmission in an interface manner; the business logic layer receiving business and form data input by an application system, parsing the business and form data to obtain process data, and transmitting the process data to the flow logic layer through the decoupling intermediate layer comprises: 1) the API interface platform calls the application configuration module to check whether the application system has been registered; 2) if the application system has not been registered, the API interface platform returns error information to the application system; 3) the business logic processing module analyzes input business language, and extracts business data and process data; 4) the business logic processing module calls the user center module to match and find recipient information through the business data; 5) if the recipient information is not matched, the API interface platform returns error information to the application system; 6) the business logic processing module calls the flow logic layer through the decoupling intermediate layer and inputs process data and recipient information; the flow logic layer executing specific process tasks according to the process data and obtaining execution results comprises: 1) the flow logic layer matches and finds process definition according to input process data; 2) if the process definition is not matched, the business logic layer is called through the decoupling intermediate layer, and error information is returned to the application system through the API interface platform; 3) the flow logic layer calls the process scheduling module to execute specific process tasks, and obtains execution results.

2. The method of claim 1, wherein, the decoupling intermediate layer comprises: a standard data interface module, which is responsible for formulating standard data interaction interfaces for the business logic layer and the flow logic layer.

3. A decoupling device of service logic and flow transfer logic employing the method of claim 1 or 2, characterized by The application comprises a business logic layer, a flow logic layer, and a decoupling intermediate layer between the business logic layer and the flow logic layer; the business logic layer receives business and form data input by an application system, analyzes the data to obtain process data, and transmits the process data to the flow logic layer through the decoupling intermediate layer; The flow logic layer executes specific process tasks according to the process data and obtains execution results, and transmits the execution results to the business logic layer through the decoupling intermediate layer; the business logic layer performs business semanticization and encapsulation on the execution results, and feeds back the processing results to the application system.

4. An application system characterized by comprising: The application comprises form and business data, the form provides visual information for user interaction, and the business data is used for storage and processing within the application system, the application system interacts with the business logic layer of the workflow engine product and executes instructions of each step in the method of claim 1 or 2.

5. An electronic device, comprising: The application comprises a memory and a processor, the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method of claim 1 or 2.

6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a computer to implement the method of claim 1 or 2.

Citation Information

Patent Citations

  • Information system based on Ajax (Asynchronous JavaScript and XML) technology

    CN102117294A

  • A method and apparatus for executing a business process

    CN109144618A