Search

CN-115983207-B - Extensible markup language (XML) file conversion method, device and medium of flow model

CN115983207BCN 115983207 BCN115983207 BCN 115983207BCN-115983207-B

Abstract

The application discloses a method, a device, equipment and a medium for converting a flow model extensible markup language (XML) file, which are used for realizing the purposes of synchronization, interaction and the like of the flow models of the flow management systems based on different types of flow engines.

Inventors

  • WANG YUKUN
  • REN CAIHONG
  • HUANG QI
  • WANG DADI
  • SUN HUI
  • LV YANAN
  • LIU XIAOCHENG
  • MA JUN
  • ZHANG DEHAI

Assignees

  • 北京中电普华信息技术有限公司

Dates

Publication Date
20260505
Application Date
20230104

Claims (9)

  1. 1. An extensible markup language (XML) file conversion method of a flow model is characterized by comprising the following steps: Obtaining a migration instruction of a source XML file corresponding to a flow model, wherein the migration instruction comprises the type of a source flow engine to which the source XML file belongs and the type of a target flow engine to which the source XML file is to be migrated; analyzing the source XML file to obtain codes corresponding to a first primitive identifier of a first primitive, codes corresponding to first primitive attributes, codes corresponding to source streaming condition codes, codes corresponding to source participants and codes corresponding to association relations, wherein the association relations represent the sequential execution sequence of a plurality of first primitives; acquiring the relative positions of a plurality of first graphic primitives located in a flow chart canvas in the source flow engine from the source XML file; determining that a plurality of second primitives are positioned at the relative positions of the flow diagram canvas in the target flow engine based on the preset size of the flow diagram canvas belonging to the source flow engine, the size of the flow diagram canvas belonging to the target flow engine and the relative positions of the flow diagram canvas in the source flow engine of the plurality of first primitives, wherein each first primitive corresponds to one second primitive belonging to the target flow engine; According to XML file rules defined by the target flow engine, converting codes corresponding to the first primitive identifier into first codes belonging to the target flow engine, converting codes corresponding to the first primitive attribute into second codes belonging to the target flow engine, converting the source flow condition codes into third codes belonging to the target flow engine, converting codes corresponding to the source participant into fourth codes belonging to the target flow engine, and converting the association relation into fifth codes belonging to the target flow engine; And reorganizing the first code, the second code, the third code, the fourth code and the fifth code according to an XML file format defined by the target flow engine to obtain a target XML file belonging to the target flow engine.
  2. 2. The extensible markup language XML file conversion method of a flow model according to claim 1, wherein the step of acquiring said association relationship from said source XML file comprises: Obtaining primitive levels corresponding to the first primitives respectively from the source XML file; For each first primitive belonging to the same primitive level, determining a connection relation between the first primitive and the first primitive located in the previous primitive level based on the gateway type, the egress degree and the ingress degree corresponding to the first primitive and the order located in the ordering result, so as to obtain the connection relation respectively corresponding to a plurality of first primitives, wherein the ordering result is the result that the first primitives belonging to the same primitive level are ordered according to the order located in the source XML file; And obtaining the association relation, wherein the association relation characterizes the primitive levels respectively corresponding to the first primitives and the connection relation respectively corresponding to the first primitives.
  3. 3. The extensible markup language XML file conversion method of a flow model according to claim 2, wherein said step of obtaining said association relation of each of said first primitives comprises: if the connection relation of the first primitive characterizes that the first primitive is not connected with the first primitive positioned at the previous primitive level, taking the layer number of the primitive level where the first primitive is positioned as the primitive level number of the first primitive; taking the sequence of the first primitive in the sequencing result as the sequence number of the first primitive; if the connection relation of the first primitive characterizes that the first primitive is connected with a target first primitive positioned at the previous primitive level, taking the number of the target first primitive as the level number of the first primitive; taking the sequence of the first primitive in the sequencing result as the sequence number of the first primitive; determining that the association relation of the first primitive comprises the number of the first primitive, wherein the number of the first primitive comprises the primitive level number and the sequence number.
  4. 4. The XML file conversion method of a flow model according to claim 1, further comprising: And setting the positions of the flow chart canvas in the target flow engine based on the relative positions of the flow chart canvas in the target flow engine of the plurality of the second graphic elements.
  5. 5. An extensible markup language XML file conversion device of a flow model, comprising: The first acquisition module is used for acquiring migration instructions of a source XML file corresponding to a flow model, wherein the migration instructions comprise the type of a source flow engine to which the source XML file belongs and the type of a target flow engine to which the source XML file is to be migrated; The second acquisition module is used for analyzing the source XML file to acquire codes corresponding to first primitive identifiers of the first primitives, codes corresponding to first primitive attributes, source streaming condition codes, codes corresponding to source participants and codes corresponding to association relations, and the association relations represent the sequential execution sequences of the first primitives; a second obtaining module, configured to obtain, from the source XML file, relative positions of a plurality of flow chart canvas where the first primitives are located in the source flow engine; A first determining module, configured to determine, based on a preset size of a flow chart canvas belonging to the source flow engine, a preset size of a flow chart canvas belonging to the target flow engine, and a relative position of a flow chart canvas in the source flow engine of the plurality of first primitives, a relative position of a flow chart canvas in the target flow engine of a plurality of second primitives, where each first primitive corresponds to a second primitive belonging to the target flow engine; The conversion module is used for converting codes corresponding to the first primitive identifier into first codes belonging to the target flow engine, converting codes corresponding to the first primitive attribute into second codes belonging to the target flow engine, converting the source flow condition codes into third codes belonging to the target flow engine, converting codes corresponding to the source participant into fourth codes belonging to the target flow engine and converting the association relation into fifth codes belonging to the target flow engine according to XML file rules defined by the target flow engine; And the reorganization module is used for reorganizing the first code, the second code, the third code, the fourth code and the fifth code according to an XML file format defined by the target flow engine so as to obtain a target XML file belonging to the target flow engine.
  6. 6. The extensible markup language XML file conversion apparatus of a flow model according to claim 5, wherein said second obtaining module comprises: the first acquisition unit is used for acquiring a plurality of primitive levels corresponding to the first primitives respectively from the source XML file; The first determining unit is used for determining connection relations between the first primitives and the first primitives located in the previous primitive level according to gateway types, output degrees, input degrees and sequences located in sorting results corresponding to the first primitives aiming at each first primitive belonging to the same primitive level, so as to obtain the connection relations respectively corresponding to the first primitives, wherein the sorting results are results of sorting the first primitives belonging to the same primitive level according to sequences located in the source XML file; The second obtaining unit is used for obtaining the association relation, and the association relation characterizes the primitive levels corresponding to the first primitives respectively and the connection relation corresponding to the first primitives respectively.
  7. 7. The extensible markup language XML file conversion apparatus of a flow model according to claim 6, said second acquisition unit, for each of said first primitives, comprising: A first determining subunit, configured to, if the connection relationship of the first primitive characterizes that the first primitive is not connected to a first primitive located at a previous primitive level, take a number of layers of the primitive level where the first primitive is located as a primitive level number of the first primitive; a second determining subunit, configured to take an order in which the first primitives are located in the ordering result as an order number of the first primitives; A third determining subunit, configured to, if the connection relationship of the first primitive characterizes that the first primitive is connected to a target first primitive located at a previous primitive level, take a number of the target first primitive as a level number of the first primitive; a fourth determining subunit, configured to take an order in which the first primitives are located in the ordering result as an order number of the first primitives; And a fifth determining subunit, configured to determine that the association relationship of the first primitive includes a number of the first primitive, where the number of the first primitive includes the primitive level number and the order number.
  8. 8. An electronic device, comprising: A processor; A memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the extensible markup language XML file conversion method of the flow model of any one of claims 1 to 4.
  9. 9. A computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the extensible markup language, XML, file conversion method of the flow model of any one of claims 1 to 4.

Description

Extensible markup language (XML) file conversion method, device and medium of flow model Technical Field The application relates to the field of flow engines, in particular to a method, a device and a medium for converting an extensible markup language (XML) file of a flow model. Background The flow management system is a system for defining, managing and executing a flow model through the execution of software under the drive of the formal representation of the flow model. The flow engine is the core of the flow management system, can analyze the flow model and drive the flow of the flow. There are different types of flow engines, such as a flow engine, activiti flow engines, and the types of flow engines in different flow management systems may be different. The different types of flow engines are mutually incompatible, i.e. the flow engines cannot parse XML (EXtensible Markup Language ) files defined by the flow engines of another type. Therefore, the process management system based on different types of process engines cannot realize synchronization, interaction and the like of the process models. Disclosure of Invention In view of the above, the present application provides a method, an apparatus and a medium for converting XML files of a process model. In order to achieve the above purpose, the present application provides the following technical solutions: according to a first aspect of an embodiment of the present disclosure, there is provided an XML document conversion method of a flow model, including: Obtaining a migration instruction of a source XML file corresponding to a flow model, wherein the migration instruction comprises the type of a source flow engine to which the source XML file belongs and the type of a target flow engine to which the source XML file is to be migrated; analyzing the source XML file to obtain codes corresponding to a first primitive identifier of a first primitive, codes corresponding to first primitive attributes, codes corresponding to source streaming condition codes, codes corresponding to source participants and codes corresponding to association relations, wherein the association relations represent the sequential execution sequence of a plurality of first primitives; According to XML file rules defined for the target flow engine, converting codes corresponding to the first primitive identification into first codes belonging to the target flow engine, converting codes corresponding to the first primitive attributes into second codes belonging to the target flow engine, converting the source flow condition codes into third codes belonging to the target flow engine, converting codes corresponding to the source participants into fourth codes belonging to the target flow engine, and converting the association relation into fifth codes belonging to the target flow engine; and reorganizing the first code, the second code, the third code, the fourth code and the fifth code according to an XML file format defined by the target flow engine to obtain a target XML file belonging to the target flow engine. According to a second aspect of the embodiments of the present disclosure, there is provided an extensible markup language XML file conversion apparatus of a flow model, including: The first acquisition module is used for acquiring migration instructions of a source XML file corresponding to a flow model, wherein the migration instructions comprise the type of a source flow engine to which the source XML file belongs and the type of a target flow engine to which the source XML file is to be migrated; The second acquisition module is used for analyzing the source XML file to acquire codes corresponding to first primitive identifiers of the first primitives, codes corresponding to first primitive attributes, source streaming condition codes, codes corresponding to source participants and codes corresponding to association relations, and the association relations represent the sequential execution sequences of the first primitives; The conversion module is used for converting codes corresponding to the first primitive identifier into first codes belonging to the target flow engine, converting codes corresponding to the first primitive attribute into second codes belonging to the target flow engine, converting the source flow condition codes into third codes belonging to the target flow engine, converting codes corresponding to the source participant into fourth codes belonging to the target flow engine and converting the association relation into fifth codes belonging to the target flow engine according to XML file rules defined by the target flow engine; And the reorganization module is used for reorganizing the first code, the second code, the third code, the fourth code and the fifth code according to an XML file format defined by the target flow engine so as to obtain a target XML file belonging to the target flow engine. According to a third aspect of the embodiments of