CN114625353A - Model framework code generation system and method - Google Patents

Model framework code generation system and method Download PDF

Info

Publication number
CN114625353A
CN114625353A CN202011464734.7A CN202011464734A CN114625353A CN 114625353 A CN114625353 A CN 114625353A CN 202011464734 A CN202011464734 A CN 202011464734A CN 114625353 A CN114625353 A CN 114625353A
Authority
CN
China
Prior art keywords
model
service
new
data
service description
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.)
Pending
Application number
CN202011464734.7A
Other languages
Chinese (zh)
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.)
Diankeyun Beijing Technology Co ltd
Original Assignee
Diankeyun Beijing Technology 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 Diankeyun Beijing Technology Co ltd filed Critical Diankeyun Beijing Technology Co ltd
Priority to CN202011464734.7A priority Critical patent/CN114625353A/en
Publication of CN114625353A publication Critical patent/CN114625353A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a model framework code generation system and a method, wherein the system comprises: the model database module is used for storing data elements, data object models and service description models which are constructed in advance according to a set service system and aiming at service description languages defined by the service field; the visual interface module is used for displaying the visual identification of the stored content, receiving the arrangement operation instruction and selecting the visual identification of the required content according to the arrangement operation instruction; the model construction layer module is used for acquiring the stored data elements, the data object model and the service description model according to the selected visual identification, and constructing to obtain a new data object model or a new service description model; and the model issuing layer module is used for issuing the new model and generating a frame code and a corresponding environment library file which are used for operating the new model in the set service system. The data quality of the model can be improved through the scheme.

Description

Model framework code generation system and method
Technical Field
The invention relates to the technical field of cloud services, in particular to a model framework code generation system and method.
Background
The data model refers to the abstraction of real-world data features to describe the concept and definition of a set of data, which is the basis for data asset management and data governance. The high-quality data model is beneficial to improving the quality of business system data.
The existing data model is defined and developed manually. However, in the stage of information system construction and development, the problem that the manual code writing cannot be fundamentally solved exists: firstly, the workload of manually writing codes is large, the period is long, and the cost is high; secondly, the requirement on the developers is high, some errors repeatedly appear in codes of different persons and different positions of the same person, and the improvement of personal ability only can reduce the error occurrence rate, but cannot fundamentally avoid the errors; thirdly, although the common coding standard exists, different people have different learning degrees and understanding directions of the code standard, more or less personal bad habits are carried out in the coding process, and the code handover difficulty is increased when people flow; fourthly, the code written manually has low reuse rate and high reuse difficulty, and a large number of codes with similar logic are easy to miss when being transplanted and modified, thereby easily causing a series of serious errors.
Disclosure of Invention
In view of this, embodiments of the present invention provide a system and a method for generating a framework code to improve data quality of a model.
In order to achieve the purpose, the invention is realized by adopting the following scheme:
according to an aspect of an embodiment of the present invention, there is provided a model framework code generation system including:
the model database module is used for storing at least one of a data element, a data object model and a service description model which are constructed in advance according to a set service system and a service description language defined aiming at the service field where the set service system is located;
the visual interface module is used for displaying visual identifications of the stored data elements, the stored data object models and the stored service description models, receiving an arrangement operation instruction, and selecting at least one of the visual identifications of the data elements, the data object models and the service description models according to the arrangement operation instruction;
the model building layer module is used for obtaining at least one of the corresponding stored data elements, the data object model and the service description model according to the selected visual identification so as to build a new model; wherein the new model is a new data object model or a new service description model;
and the model issuing layer module is used for issuing the new model according to the stored service description language and generating a frame code and a corresponding environment library file for operating the new model in the set service system.
In some embodiments, the model framework code generation system further comprises:
and the model test layer module is used for verifying and analyzing the frame code of the new model and the corresponding environment library file so as to test the client and the server contract.
In some embodiments, the model publishing layer module is further configured to record the information related to the new model; the relevant information of the new model comprises at least one of release time information, release description information, release version information, release field information and release mechanism information;
and the model database module is also used for importing and storing the frame code of the new model and a corresponding environment library file, and the related information of the new model.
In some embodiments, the storage structure of at least one of the stored data elements, the data object model, and the service description model is a tree structure.
In some embodiments, the orchestration operation instruction comprises a drag operation instruction and/or an association operation instruction.
In some embodiments, the service description language includes the structure of the data object model and its meaning, the data elements and their meaning, the function interface model and its meaning, the function types, and the containers, and the required inheritance relationships, combination relationships, and aggregation associations between them.
In some embodiments, a model publishing layer module, comprising:
the lexical analysis and verification module is used for scanning a description file of the new model by taking characters as units, returning attribute codes corresponding to the words when the scanned words in the new model are keywords in the service description language, skipping the invalid characters when the scanned words in the new model are invalid characters, and reserving character string information of the corresponding words when the scanned words in the new model are not the keywords in the service description language and are not the invalid characters so as to obtain lexical analysis and verification results of the new model after the description file of the new model is scanned;
the frame code generation module is used for analyzing the description file of the new model according to the lexical analysis and verification results of the new model so as to execute corresponding functions, initialize global variables, call set code generation functions, analyze language types and generate corresponding frame codes according to the language types;
and the packaging module is used for copying the frame code to a source code path of the programming language engineering, copying the service frame environment library file dependent on the programming language engineering to an environment library path, and packaging and compressing the frame code, the environment library path and the service frame environment library file under the source code path to obtain a frame code of the new model and a compressed package of the corresponding environment library file.
In some embodiments, a model test layer module, comprising:
the server side service instance MockServer generating module is used for simulating a function interface to return a parameter value according to the frame code of the new model and by using a description file of the service description model for testing, and generating a server side service instance MockServer;
the client capability test MockClient generation module is used for loading an interface by using a Java parent class loader according to a frame code of a service instance of a server so as to acquire a class object instance by using a reflection mechanism, collecting interface method array information of a service description model for testing by using the reflection mechanism, acquiring an instance class required by a client through the reflection mechanism according to the acquired class object instance and interface method data information, creating a client object by using the instance class and acquiring member variables and corresponding calling methods to form a client capability test MockClient;
the xml template generation module is used for testing the MockClient by utilizing the client capability, obtaining the parameter entry type, the parameter exit type and the method name of the interface function according to the acquired member variables, and generating an xml template according to the parameter entry type, the parameter exit type and the method name;
and the contract testing module is used for filling the parameter values of the types corresponding to the input testing parameters by using the generated xml template, and transmitting the input parameter values into an invoke method of the client object through a reflection mechanism so as to remotely invoke the server service instance MockServer by using the invoking method.
According to another aspect of the embodiments of the present invention, there is also provided a model framework code generation method, including:
acquiring at least one of a stored data element, a data object model and a service description model which are constructed in advance according to a set service system, and a service description language defined aiming at the service field where the set service system is located;
displaying the stored visual identifications of the data elements, the data object model and the service description model, receiving an arrangement operation instruction, and selecting at least one of the visual identifications of the data elements, the data object model and the service description model according to the arrangement operation instruction;
acquiring at least one of the corresponding stored data element, the data object model and the service description model according to the selected visual identification so as to construct and obtain a new model; wherein the new model is a new data object model or a new service description model;
and issuing the new model according to the stored service description language, and generating a frame code and a corresponding environment library file for operating the new model in the set business system.
According to yet another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method of the above-described embodiments.
The model frame code generation system, the model frame code generation method and the computer readable storage medium provided by the embodiment of the invention can assist a user in arranging the model, reduce the manpower workload, the repetitive work, the human errors and the like, and improve the data quality of the model.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a schematic diagram of a model framework code generation system according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the structure of a model framework code generation system according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for generating model framework code according to an embodiment of the invention;
FIG. 4 is a schematic diagram of a data object model application mode in accordance with an embodiment of the present invention;
FIG. 5 is a diagram illustrating an application mode of the switching pattern according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
It should be noted in advance that the features described in the following embodiments or examples or mentioned therein can be combined with or replace the features in other embodiments or examples in the same or similar manner to form a possible implementation. In addition, the term "comprises/comprising" as used herein refers to the presence of a feature, element, step or component, but does not preclude the presence or addition of one or more other features, elements, steps or components.
In order to reduce various problems existing in manual code writing, the embodiment of the invention provides a model code auxiliary generation tool, so that a visual interface is used for automatically generating a source code, and the generation speed, the specification and the stability of the code are improved.
Fig. 1 is a schematic structural diagram of a model framework code generation system according to an embodiment of the present invention, and as shown in fig. 1, the model framework code generation system according to the embodiment may include: a model database module 110, a visualization interface module 120, a model building layer module 130, and a model distribution layer module 140.
The model database module 110 is configured to store at least one of a data element, a data object model, and a service description model that are constructed in advance according to a set business system, and a service description language defined for a business field where the set business system is located. The data element is a standard data element and can be obtained by importing or manual adding. The data elements and data object models may be used to build new data object models. The data elements, data object models, and service description models can be used to build new service description models. The service description model is, for example, a business system service provided for a user by using a cloud service platform.
Wherein, the storage structure of at least one of the stored data element, the data object model and the service description model may be a tree structure. Therefore, data elements, data object models and service description models can be conveniently searched.
The service description language may include a structure body of the data object model and its meaning, a data element and its meaning, a function interface model and its meaning, a function type, and a container, and an inheritance relationship, a combination relationship, and an aggregation association required therebetween. The service description language can be obtained by induction and specification according to the service system.
The visualization interface module 120 is configured to display the stored visualization identifiers of the data elements, the data object model, and the service description model, receive the layout operation instruction, and select at least one of the visualization identifiers of the data elements, the data object model, and the service description model according to the layout operation instruction. The arranging operation instruction can comprise a dragging operation instruction and/or an associated operation instruction.
A model building layer module 130, configured to obtain at least one of a corresponding stored data element, a data object model, and a service description model according to the selected visual identifier, so as to build a new model; wherein the new model is a new data object model or a new service description model. The visualization interface module 120 may be part of the model build layer module 130. Data elements, data object models, service description models, etc. may be represented on the visualization interface by different identifiers, which may be associated with the background model library, e.g., a corresponding portion of the model library may be selected when an identifier is dragged.
And the model publishing module 140 is configured to publish the new model according to the stored service description language, and generate a framework code and a corresponding environment library file for running the new model in the set service system.
In specific implementation, the model distribution module 140 may include: the system comprises a lexical analysis and verification module, a frame code generation module and a packaging module.
And the lexical analysis and verification module is used for scanning the description file of the new model by taking the character as a unit, returning the attribute code corresponding to the word when the scanned word in the new model is a keyword in the service description language, skipping the invalid character when the scanned word in the new model is the invalid character, and reserving the character string information of the corresponding word when the scanned word in the new model is not the keyword in the service description language and is not the invalid character so as to obtain the lexical analysis and verification result of the new model after the description file of the new model is scanned. The description file is, for example, an IDL (interactive data language) description file.
And the frame code generation module is used for analyzing the description file of the new model according to the lexical analysis and verification result of the new model so as to execute corresponding functions, initialize global variables, call a set code generation function, analyze the language type and generate corresponding frame codes according to the language type. The corresponding relationship between the lexical method and the attribute codes in the compiler can be pre-constructed, so that the compiler can be used for executing the analyzed file to generate codes, and the compiler can be an improved compiler.
And the packaging module is used for copying the frame code to a source code path of the programming language engineering, copying the service frame environment library file dependent on the programming language engineering to an environment library path, and packaging and compressing the frame code, the environment library path and the service frame environment library file under the source code path to obtain a frame code of the new model and a compressed package of the corresponding environment library file.
In a further embodiment, the model distribution module 140 may be further configured to record information related to the new model; the information related to the new model comprises at least one of release time information, release description information, release version information, release field information and release mechanism information. The model database module 110 may also be used to import and store the framework code and corresponding environment library files of the new model, as well as information related to the new model. In this embodiment, the generated new model may be stored in the model library for use in the next arrangement of models.
Fig. 2 is a schematic structural diagram of a model framework code generation system according to another embodiment of the present invention, and as shown in fig. 2, the model framework code generation system shown in fig. 1 may further include a model test layer module 150. And the model test layer module 150 is used for verifying and analyzing the frame code of the new model and the corresponding environment library file so as to perform client and server contract test. The generated new model can be ensured to be used through testing.
Specifically, the model test layer module 150 may include: the system comprises a server service instance MockServer generating module, a client capability test Mockclient generating module, an xml template generating module and a contract testing module.
And the server side service instance MockServer generating module is used for simulating a function interface to return parameter values by using a description file of the service description model for testing according to the frame code of the new model to generate the server side service instance MockServer. If the service description model is tested, the description file (such as an IDL file) of the service description model to be tested can be used as the description file of the service description model for testing; if the data object model is tested, the description file of the service description model used for testing may be a description file of any given one of the service description models, and the data object model may be described.
The client capability test MockClient generation module is used for loading an interface by using a Java parent class loader according to a frame code of a service instance of a server so as to acquire a class object instance by using a reflection mechanism, collecting interface method array information of a service description model for testing by using the reflection mechanism, acquiring an instance class required by a client through the reflection mechanism according to the acquired class object instance and interface method data information, creating a client object by using the instance class and acquiring member variables and corresponding calling methods to form the client capability test MockClient.
And the xml template generation module is used for testing the MockClient by utilizing the client capability, obtaining the parameter entry type, the parameter exit type and the method name of the interface function according to the acquired member variables, and generating an xml template (extensible markup language template) according to the parameter entry type, the parameter exit type and the method name.
And the contract testing module is used for filling the parameter values of the types corresponding to the input testing parameters by using the generated xml template, and transmitting the input parameter values into an invoke method of the client object through a reflection mechanism so as to remotely invoke the server service instance MockServer by using the invoking method.
In this embodiment, by performing the model test using the Java language, the test result of each function interface and the like can be obtained in the test process. Furthermore, since the starting description file is independent of the programming language, model testing can be performed using the Java language, whether it is intended for the Java language or the C/C + + language.
Based on the same inventive concept as the model framework code generation system shown in fig. 1, the embodiment of the present application further provides a model framework code generation method, as described in the following embodiments. Because the principle of solving the problem of the model frame code generation method is similar to that of the model frame code generation system, the implementation of the model frame code generation method can be referred to that of the model frame code generation system, and repeated parts are not repeated.
Fig. 3 is a flowchart illustrating a method for generating a model framework code according to an embodiment of the present invention, and as shown in fig. 3, the method for generating a model framework code according to the embodiment may include:
step S210: acquiring at least one of a stored data element, a data object model and a service description model which are constructed in advance according to a set service system, and a service description language defined aiming at the service field where the set service system is located;
step S220: displaying the stored visual identifications of the data elements, the data object model and the service description model, receiving an arrangement operation instruction, and selecting at least one of the visual identifications of the data elements, the data object model and the service description model according to the arrangement operation instruction;
step S230: acquiring at least one of the corresponding stored data element, the data object model and the service description model according to the selected visual identification so as to construct and obtain a new model; wherein the new model is a new data object model or a new service description model;
step S240: and issuing the new model according to the stored service description language, and generating a frame code and a corresponding environment library file for operating the new model in the set business system.
In some embodiments, the method shown in fig. 3 may further include the steps of: and S250, verifying and analyzing the frame code of the new model and the corresponding environment library file to test the client and the server contract.
In some embodiments, the method shown in fig. 3 may further include the steps of: s260, recording the relevant information of the new model; the relevant information of the new model comprises at least one of release time information, release description information, release version information, release field information and release mechanism information; s270, importing and storing the frame code and the corresponding environment library file of the new model, and the related information of the new model.
In some embodiments, the storage structure of at least one of the stored data elements, the data object model, and the service description model is a tree structure.
In some embodiments, the orchestration operation instruction comprises a drag operation instruction and/or an association operation instruction.
In some embodiments, the service description language includes the structure of the data object model and its meaning, the data elements and their meaning, the function interface model and its meaning, the function types, and the containers, and the required inheritance relationships, combination relationships, and aggregation associations between them.
In specific implementation, step S240, namely, issuing the new model according to the stored service description language, and generating a frame code and a corresponding environment library file for running the new model in the set business system, may specifically include the steps of: s241, scanning a description file of the new model by taking characters as a unit, returning attribute codes corresponding to the words when the words in the scanned new model are keywords in the service description language, skipping the invalid characters when the words in the scanned new model are invalid characters, and reserving character string information of the corresponding words when the words in the scanned new model are not the keywords in the service description language and are not the invalid characters so as to obtain a lexical analysis and verification result of the new model after the description file of the new model is scanned; s242, analyzing the description file of the new model according to the lexical analysis and verification result of the new model to execute corresponding functions, initializing global variables, calling a set code generating function, analyzing a language type, and generating corresponding framework codes according to the language type; s243, copying the frame code to a source code path of the programming language engineering, copying the service frame environment library file depended by the programming language engineering to an environment library path, and packaging and compressing the frame code, the environment library path and the service frame environment library file under the source code path to obtain a frame code of the new model and a compression package of the corresponding environment library file.
In specific implementation, the step S250, namely, performing verification analysis on the frame code of the new model and the corresponding environment library file to perform client and server contract testing, may specifically include the steps of: s251, according to the frame code of the new model, simulating a function interface to return a parameter value by using a description file of the service description model for testing, and generating a server service instance MockServer; s252, according to a frame code of a service instance of a server, loading an interface by using a Java parent loader to acquire a class object instance by using a reflection mechanism, collecting interface method array information of a service description model for testing by using the reflection mechanism, obtaining an instance class required by a client through the reflection mechanism according to the acquired class object instance and interface method data information, creating a client object by using the instance class, and acquiring a member variable and a corresponding calling method to form a client capability test MockClient; s253, testing the MockClient by using the client capability, obtaining the parameter entering type, parameter exiting type and method name of the interface function according to the obtained member variable, and generating an xml template according to the parameter entering type, parameter exiting type and method name; and S254, filling the input parameter values of the types corresponding to the test parameters by using the generated xml template, and transmitting the input parameter values into an invoke method of the client object through a reflection mechanism so as to remotely invoke the server service instance MockServer by using the invoking method.
In addition, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program implements the steps of the method described in the above embodiment when executed by a processor.
The above method is described below with reference to a specific example, however, it should be noted that the specific example is only for better describing the present application and is not to be construed as limiting the present application.
Fig. 4 is a schematic diagram of an application mode of a data object model according to an embodiment of the present invention, and referring to fig. 4, a model management service to which a framework code generation tool based on model orchestration belongs may include: the system comprises five functional modules, namely a model database, a model construction layer, a model test layer and a model release layer.
The model database can be used for storing defined models, including standard data element storage, entity data model storage and service description model storage. The standard data element store may be a common attribute of a set of data objects in a particular business domain. The standard data elements, the entity data model and the service description model can be in tree structures, can be uniformly stored in a database with field attributes and precision, can provide the standard and definition of basic data elements of a consistent service system, and is the basis for establishing all models. The entity data topic model (data object model) is stored as a wide table (the wide table is a database table with more fields in a literal sense) of a data object oriented to a specific business system, generally refers to a database table with related indexes, dimensions and attributes of business topics associated together, and refers to a model which is packaged in a structure called an object class in a mode of the attributes and the operation attributes of data resources, and is essentially abstract description of the business data resources; the service description model is stored as an interface description file of interface interaction between various service systems defined by a system in a specific service field, and the input and output parameter sources of the interface are standard data elements or complex entity data models.
The model building layer can be responsible for building standard data elements (obtained by importing or manually adding), a solid data model (related to an interaction mode) and a service description model, provides a visual interface, builds a new data model or a service description model by adopting a dragging and associating mode, and supports two modes of building a data object and building a new data model based on the existing model aggregation. Selection, such as checking selection, can be made on the interface for the function interface model, basic type of function, container, etc.
The model test layer can be responsible for customizing (can be business system induction or language specification) verification rules aiming at specific fields in the data model or specific interfaces of the service description model, and two test piles of a producer service contract test and a consumer contract test are formed;
the model issuing layer can include data model issuing and service description model issuing, the data model issuing is based on a ProtoBuf binary serialization protocol (data description language, which can serialize structured data), generates entity classes (mainly as categories existing on a data management and business logic processing level) corresponding to java and C + + languages from the data model passing the construction test, the main responsibility of the entity classes is to store and manage information in a system, the entity classes can also have behaviors and even complex behaviors, but the behaviors are closely related to entity objects represented by the entity classes), and issues and registers proto files (files and codes) constructed based on model arrangement, the service model issuing is used for issuing the service description model interface description to generate java (packaged) or framework codes corresponding to the C language and dependent environment library file resources in a packaging manner and registering in a data directory, service developers can download the published and registered data object model and the service description model as required, the model publishing layer records published historical time information, published description information, published version information, published field information and published mechanism information, and the model is published as a service to a data directory, so that a cloud service mode is realized; the model distribution layer supports the proto file to be imported to form a data object model and the service description file to be imported to form a service description model and to be stored in a model database in a persistent mode. The publication generation result may be a compressed package of both code (framework code) and files (environment library files).
In the model publishing layer, the data model can be published specifically by the following steps:
(S11) defining a description language of a service description model aiming at a specific business field, wherein the service description language comprises a data entity object model structure body provided by a model database, Chinese meanings, standard elements and Chinese meanings, a function interface model, the Chinese meanings, basic types (such as int) of functions, containers and inheritance, combination and aggregation relations among the functions; the data entity object model (data object model) is a complex data type, describes an object model of a specific business field and comprises members and methods (such as nesting and affix formats); the function interface model describes a function interface called by the system, and comprises an input parameter, an output parameter and an interface name definition;
(S12) lexical analysis and verification are carried out on the text file generated by using the data entity object model and the function interface model described in the language in the step (S11), the constructed description file is scanned by taking characters as units, blank symbols, line feed symbols and annotation parts are skipped, if the scanned words are keywords of the description language, attribute codes (such as types, structures, functions, parameter numbers, data objects and the like, such as int types, are changed into i32) corresponding to the reserved words are returned, otherwise, character string information of the words is directly returned until the end of the description file is scanned, and the lexical analysis and verification on the description file are completed;
(S13) parsing the description file (i.e., IDL description file) (to obtain a file recognizable by the compiler) according to the result of the lexical analysis of the step (S12), initializing a global variable to call and generate a code function generating code according to execution of a corresponding function, parsing a language type, generating a corresponding class object according to the language type, and then calling the generating program function to generate a corresponding program code; there may be a corresponding table of attribute codes and corresponding contents, and the obtained attribute codes may be parsed into files that a compiler can recognize, and the compiler is also a compiler through proper adjustment;
(S14) copying the framework code to the source code path (path corresponding to the model) of the template C + + VS2010 project and the template java project (Jar package) according to the framework code (generated program code) generated in the step (S13), copying the service framework environment library file dependent on the project to the environment library path, performing compression packaging with the model name as the name, and downloading and publishing the resources (the compressed package of the code and the environment library file) to the data directory;
and (S15) according to the model resource issued in the step (S14), the data directory manager verifies the issued model resource, the model resource which meets the rule is approved, and the user can access the data directory through the browser to download and use the model resource.
In the model test layer, the test can be specifically performed through the following steps:
(S21) according to the frame code generated by the model distribution layer, according to the IDL description file (the description file does not relate to the language type, no matter which language the data model is, the data model can be tested by using the Java mode, so that the test can be carried out on the client by using the Java method) of the defined service description model in the model management background, the simulation function interface returns the parameter value, and a service instance MockServer (server program) of the test server is generated; when the normal function returns the parameter, a lot of processing (such as operation, conversion and call) needs to be performed, but the embodiment performs simple function return here;
(S22) according to the frame code generated in the step (S21), Class object instances (files, objects and interfaces of what is running) obtained by the Class by using a reflection mechanism are realized by using a java parent Class loader loading interface, all interface method array information (interfaces in a service description file) defined by a service description model is collected through the reflection mechanism, a client factory instance and a client create instance, after all instance classes required by the creation of the client are obtained through the reflection mechanism (according to the obtained Class object instances and the obtained interface method array information), the client object is created through the instance classes, and member variables and calling methods (contents corresponding to the interfaces) are obtained to form a capability test MockClient (client program).
(S23) acquiring the join and leave types and the method name (e.g., calculation method) of the defined interface function according to the member variables acquired by the reflection mechanism in the step (S22), and generating an xml template according to the method name and the parameter type.
(S24) filling value values of types corresponding to the test parameters according to the xml template generated in the step (S23), and transferring the entered value of the input (intrusion) into the invoke method held by the instance object generated in the reflection mechanism through the reflection mechanism to remotely call the method for the service instance generated in the step (S21).
The model database can be specifically constructed through the following steps:
first, a database template of the data object model is created
Reasonably classifying and layering the name space of the entity class in the existing service system according to the package path name, and gradually constructing a data object tree list structure according to the classification layered structure, so that a new data object model can be conveniently and quickly constructed by using the existing model base template, and the public attribute of a certain basic data object can be conveniently and uniformly modified in the later period;
second, create data objects and Standard elements
A standard element tree list is formed by summarizing and summarizing the existing database table and a service system, and standard elements are classified and layered according to service field categories, so that a data model can be created for repeated reference conveniently; providing a basic data object model, facilitating aggregation and re-referencing of complex data object models;
thirdly, establishing the association relation of the data objects
When a complex data model is created, selecting data objects with association relation from a data model tree list, and setting the association relation between each data object and each data object; after the setting is finished, forming an incidence relation network containing all data objects, and providing an interface for checking incidence relations globally and locally; powerful support is provided for maintaining the business integrity of the data model in the later period.
The embodiment can provide a visual arrangement model generation tool and a frame code generation method from the perspective of integration of design, development, operation and maintenance aiming at the problems of non-uniform data description, non-standard manual coding and complex secondary development process of the current specific field service information system. The model database is used for storing a data object model and a service description model which are constructed on line and supporting the import and export of a service main body service data object, an operator and a service description file based on a standard format; the model building layer provides a visual interface, a new data object model and a new service description model are built by adopting a dragging and associating mode, and two methods of building and building a new model based on the existing model are supported. Meanwhile, a standard data element and a general data object model which are used for describing an entity and are general in the field of business systems are built in the model building layer, aggregation building can be carried out on the basis of the standard data element and the general data object model, a plurality of data models are supported to be selected to generate data objects according to incidence relations, further integration of data is achieved, and the data object models which are subjected to aggregation association can be directly used and stored; in the model test layer, a user can customize a check rule for a specific field of a data model, an online test interface is provided to test whether the data model meets the specification, an online test report is supported to be generated, and two test piles of a producer service contract test and a consumer contract test are formed; the model distribution layer comprises a data model distribution business developer and a service description model distribution business developer, the data model distribution business developer can download a distributed and registered data object model and a service description model as required, the model distribution layer records the historical time information, the distribution description information, the distribution version information, the distribution field information and the distribution mechanism information of distribution, and distributes the model into a service to a data directory, so that a cloud service mode is realized; the model distribution layer supports the proto file to be imported to form a data object model and the service description file to be imported to form a service description model and to be stored in a model database in a persistent mode. The data capability model generates entity classes corresponding to java and C + + languages and proto files constructed based on model arrangement from the data model passing the construction test based on the ProtoBuf binary serialization protocol. And the service capability model packages, releases and registers framework codes corresponding to java and C + + languages generated by the description and release of the interface of the service description model and the dependent environment library file resources into a data directory.
The model generation tool service refers to the business model, designs and restricts data and the service model in the business system by using data such as standardized expressions, words and the like, and checks and manages the newly added data model according to the standard and contract terms formulated by model management strictly in the process of construction, operation and maintenance of the business system. The standardized management and unified management and control of the data model are beneficial to the integration of data assets and the data quality of a service system is improved.
Fig. 5 is a schematic diagram of exchanging model application patterns according to an embodiment of the present invention, and as shown in fig. 5, the method for generating framework code based on model orchestration includes the following steps:
s1, standardizing and defining naming, identification and type information of database fields according to basic data, a service database, synthesis and aggregation classification in standard data elements, wherein the standard data elements constructed in the first step are the basis of data model construction and exchange models;
and S2, constructing a data model of the service field based on the data standard elements constructed in the S1 and the existing data model in the model database, wherein the standard data elements are used as fields of the complex data model, and a dragging and editing means is provided on the model construction page to edit and construct the complex data object model.
S3, based on the complex data model constructed by S2 as the input and output of the system exchange data interface in the exchange model, naming and identifying the method of exchanging data of the exchange model on the model construction page, improving the designed exchange data interface list, and the exchange model definition can support the use of the existing exchange model interface in the model interface database table;
s4, resource publishing is carried out on the constructed data model and the exchange model of S2 and S3, a model publishing tool calls a built-in model framework code generator to generate proto source files, Java source files and Cpp source files for the data model, a built-in service code compiler of the exchange model call model of S3 generates JAVA and Cpp framework codes, an operating environment library which the exchange model depends on is packaged and compressed, and resource downloading addresses are published to a data directory in a unified mode;
and S5, logging the data directory portal by using the model, and downloading the resources of the data model and the service model.
The visual layout model generation tool and the frame code generation method belong to the model generation tool, wherein the model generation tool comprises a model database module, a model construction layer module, a model test layer module, a model distribution layer module, a data capability model and a service capability model; the model generation tool refers to a business model, designs and restricts data and a service model in a business system by using data such as standardized users, words and the like, reviews and manages a newly added data capability model and a newly added service capability model according to standards and contract terms formulated by model management strictly in the process of construction, operation and maintenance of the business system, completes the conversion and automatic generation of frame codes of a data object model from graphical construction to description language text file generation to standard C + + grammar format and frame codes of java and grammar formats, and the standardized management and unified control of the data model are favorable for the integration of data assets and the improvement of the data quality of the business system.
In the embodiment, a model management tool is provided to construct a standard element, a data model and an exchange model, a whole set of standardized process is constructed to describe the abstract real world data characteristics, a data model is constructed through a model publishing tool, a check rule of a specific field in the data model is customized, a data subject service client test code is generated to perform real-world test on an adding interface, a deleting interface and an modifying interface provided by a data object, the passed data model is registered to a data directory after the test is successful, the exchange model is constructed through the model publishing tool, a function name and function description information are set, and a function object interface is created by setting the type of a parameter and a return value of the function interface through a data object model in a data object model pool. The method comprises the steps of generating a capability model by combining existing function models and providing detailed information of services, generating an rtp description file of the services by a background according to a model interface, generating an exchange model after the format of the rtp file is verified by a compiler, storing the exchange model in an exchange model pool, providing an exchange model capability verification function, creating an exchange model service end online program and a client end online program based on codes generated by the rtp file, successfully calling and testing the services, passing the service capability verification, and releasing exchange model resources to a data directory. In the prior art, the data model and the exchange model definition do not form a specific standardized process, and the manual offline definition development has higher communication cost and longer test troubleshooting cost. Therefore, compared with the prior art, the invention designs the model arranging and publishing tool, and transfers the prior process of manually designing the data object model and exchanging the service file to the resource pool guidance of the on-line design tool and the reference model and the design and development of the auxiliary data theme and service design developer. The development efficiency of the data service and the exchange service is improved, the model resource pool is provided, and new data models and exchange models can be developed rapidly.
The model frame code generation system, the model frame code generation method and the computer readable storage medium provided by the embodiment of the invention can assist a user in arranging the model, reduce the manpower workload, the repetitive work, the human errors and the like, and improve the data quality of the model.
In the description herein, reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," "an example," "a particular example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the various embodiments is provided to schematically illustrate the practice of the invention, and the sequence of steps is not limited and can be suitably adjusted as desired.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A model framework code generation system, comprising:
the model database module is used for storing at least one of a data element, a data object model and a service description model which are constructed in advance according to a set service system and a service description language defined aiming at the service field where the set service system is located;
the visual interface module is used for displaying visual identifications of the stored data elements, the stored data object models and the stored service description models, receiving an arrangement operation instruction, and selecting at least one of the visual identifications of the data elements, the data object models and the service description models according to the arrangement operation instruction;
the model building layer module is used for obtaining at least one of the corresponding stored data elements, the data object model and the service description model according to the selected visual identification so as to build a new model; wherein the new model is a new data object model or a new service description model;
and the model issuing layer module is used for issuing the new model according to the stored service description language and generating a frame code and a corresponding environment library file for operating the new model in the set service system.
2. The model framework code generation system of claim 1, further comprising:
and the model testing layer module is used for verifying and analyzing the frame code of the new model and the corresponding environment library file so as to test the client side contract and the server side contract.
3. The model framework code generation system of claim 1,
the model release layer module is also used for recording the relevant information of the new model; the relevant information of the new model comprises at least one of release time information, release description information, release version information, release field information and release mechanism information;
and the model database module is also used for importing and storing the frame code of the new model and a corresponding environment library file, and the related information of the new model.
4. The model framework code generation system of claim 1, wherein the storage structure of at least one of the stored data elements, the data object model, and the service description model is a tree structure.
5. The model framework code generation system of claim 1, wherein the orchestration operation instruction comprises a drag operation instruction and/or an association operation instruction.
6. The model framework code generation system of claim 1, wherein the service description language includes constructs of data object models and their meanings, data elements and their meanings, function interface models and their meanings, function types, and containers, and required inheritance relationships, composition relationships, and aggregation associations therebetween.
7. The model framework code generation system of claim 1, the model distribution module comprising:
the lexical analysis and verification module is used for scanning a description file of the new model by taking characters as units, returning attribute codes corresponding to the words when the words in the scanned new model are keywords in the service description language, skipping the invalid characters when the words in the scanned new model are invalid characters, and reserving character string information of the corresponding words when the words in the scanned new model are not the keywords in the service description language and are not the invalid characters so as to obtain lexical analysis and verification results of the new model after the description file of the new model is scanned;
the framework code generation module is used for analyzing the description file of the new model according to the lexical analysis and verification result of the new model so as to execute corresponding functions, initialize global variables, call a set code generation function, analyze language types and generate corresponding framework codes according to the language types;
and the packaging module is used for copying the frame code to a source code path of the programming language engineering, copying the service frame environment library file dependent on the programming language engineering to an environment library path, and packaging and compressing the frame code, the environment library path and the service frame environment library file under the source code path to obtain a frame code of the new model and a compressed package of the corresponding environment library file.
8. The model framework code generation system of claim 2, wherein the model test layer module comprises:
the server side service instance MockServer generating module is used for simulating a function interface to return a parameter value according to the frame code of the new model and by using a description file of the service description model for testing, and generating a server side service instance MockServer;
the client capability test MockClient generation module is used for loading an interface by using a Java parent class loader according to a frame code of a service instance of a server so as to acquire a class object instance by using a reflection mechanism, collecting interface method array information of a service description model for testing by using the reflection mechanism, acquiring an instance class required by a client through the reflection mechanism according to the acquired class object instance and interface method data information, creating a client object by using the instance class and acquiring member variables and corresponding calling methods to form a client capability test MockClient;
the xml template generation module is used for testing the MockClient by utilizing the client capability, obtaining the parameter entry type, the parameter exit type and the method name of the interface function according to the acquired member variables, and generating an xml template according to the parameter entry type, the parameter exit type and the method name;
and the contract testing module is used for filling the parameter values of the types corresponding to the input testing parameters by using the generated xml template, and transmitting the input parameter values into an invoke method of the client object through a reflection mechanism so as to remotely invoke the server service instance MockServer by using the invoking method.
9. A model framework code generation method, comprising:
acquiring at least one of a stored data element, a data object model and a service description model which are constructed in advance according to a set service system, and a service description language defined aiming at the service field where the set service system is located;
displaying the stored visual identifications of the data elements, the data object model and the service description model, receiving an arrangement operation instruction, and selecting at least one of the visual identifications of the data elements, the data object model and the service description model according to the arrangement operation instruction;
acquiring at least one of the corresponding stored data element, the data object model and the service description model according to the selected visual identification so as to construct and obtain a new model; wherein the new model is a new data object model or a new service description model;
and issuing the new model according to the stored service description language, and generating a frame code and a corresponding environment library file for operating the new model in the set business system.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method as claimed in claim 9.
CN202011464734.7A 2020-12-14 2020-12-14 Model framework code generation system and method Pending CN114625353A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011464734.7A CN114625353A (en) 2020-12-14 2020-12-14 Model framework code generation system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011464734.7A CN114625353A (en) 2020-12-14 2020-12-14 Model framework code generation system and method

Publications (1)

Publication Number Publication Date
CN114625353A true CN114625353A (en) 2022-06-14

Family

ID=81896598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011464734.7A Pending CN114625353A (en) 2020-12-14 2020-12-14 Model framework code generation system and method

Country Status (1)

Country Link
CN (1) CN114625353A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080015A (en) * 2022-08-23 2022-09-20 珠海正和微芯科技有限公司 Method, system, electronic device and storage medium for automatically generating UPF code
CN115292279A (en) * 2022-07-27 2022-11-04 深圳安巽科技有限公司 Model processing method, system and storage medium for data
CN115314536A (en) * 2022-08-03 2022-11-08 平安付科技服务有限公司 Method and device for remotely executing command, storage medium and computer equipment
CN115857898A (en) * 2023-02-25 2023-03-28 武汉万云网络科技有限公司 Application system construction and operation method and device
CN116339737A (en) * 2023-05-26 2023-06-27 阿里巴巴(中国)有限公司 XR application editing method, device and storage medium
CN116777297A (en) * 2023-07-10 2023-09-19 三峡科技有限责任公司 Machine room evaluation index configuration method and system based on IDC equipment monitoring data
CN116931889A (en) * 2023-09-18 2023-10-24 浙江工企信息技术股份有限公司 Software modeling method and system based on object tree
CN117240928A (en) * 2023-11-10 2023-12-15 浪潮通用软件有限公司 Dynamic publishing method and device for website service, medium and equipment
CN117234525A (en) * 2023-11-15 2023-12-15 北京轻松怡康信息技术有限公司 Robot building method and device, electronic equipment and storage medium
CN117251144A (en) * 2023-11-20 2023-12-19 北京友友天宇系统技术有限公司 Theme-based data object access and release method and related equipment
CN117492721A (en) * 2023-12-29 2024-02-02 中建三局信息科技有限公司 General rapid development method applied to building digital information system

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292279A (en) * 2022-07-27 2022-11-04 深圳安巽科技有限公司 Model processing method, system and storage medium for data
CN115314536B (en) * 2022-08-03 2024-02-02 平安付科技服务有限公司 Remote command execution method and device, storage medium and computer equipment
CN115314536A (en) * 2022-08-03 2022-11-08 平安付科技服务有限公司 Method and device for remotely executing command, storage medium and computer equipment
CN115080015A (en) * 2022-08-23 2022-09-20 珠海正和微芯科技有限公司 Method, system, electronic device and storage medium for automatically generating UPF code
CN115857898A (en) * 2023-02-25 2023-03-28 武汉万云网络科技有限公司 Application system construction and operation method and device
CN116339737A (en) * 2023-05-26 2023-06-27 阿里巴巴(中国)有限公司 XR application editing method, device and storage medium
CN116339737B (en) * 2023-05-26 2023-10-20 阿里巴巴(中国)有限公司 XR application editing method, device and storage medium
CN116777297A (en) * 2023-07-10 2023-09-19 三峡科技有限责任公司 Machine room evaluation index configuration method and system based on IDC equipment monitoring data
CN116777297B (en) * 2023-07-10 2024-03-05 三峡科技有限责任公司 Machine room evaluation index configuration method and system based on IDC equipment monitoring data
CN116931889B (en) * 2023-09-18 2023-12-12 浙江工企信息技术股份有限公司 Software modeling method and system based on object tree
CN116931889A (en) * 2023-09-18 2023-10-24 浙江工企信息技术股份有限公司 Software modeling method and system based on object tree
CN117240928A (en) * 2023-11-10 2023-12-15 浪潮通用软件有限公司 Dynamic publishing method and device for website service, medium and equipment
CN117234525A (en) * 2023-11-15 2023-12-15 北京轻松怡康信息技术有限公司 Robot building method and device, electronic equipment and storage medium
CN117234525B (en) * 2023-11-15 2024-01-30 北京轻松怡康信息技术有限公司 Robot building method and device, electronic equipment and storage medium
CN117251144A (en) * 2023-11-20 2023-12-19 北京友友天宇系统技术有限公司 Theme-based data object access and release method and related equipment
CN117251144B (en) * 2023-11-20 2024-03-29 北京友友天宇系统技术有限公司 Theme-based data object access and release method and related equipment
CN117492721A (en) * 2023-12-29 2024-02-02 中建三局信息科技有限公司 General rapid development method applied to building digital information system
CN117492721B (en) * 2023-12-29 2024-04-16 中建三局信息科技有限公司 General rapid development method applied to building digital information system

Similar Documents

Publication Publication Date Title
CN114625353A (en) Model framework code generation system and method
CN107273117B (en) Programming-friendly agile code automatic generation system
CN107291450B (en) Programming-friendly agile code automatic generation method
Clements A survey of architecture description languages
US11392393B2 (en) Application runtime configuration using design time artifacts
Bennett et al. Aspect-oriented model-driven skeleton code generation: A graph-based transformation approach
Pérez‐Castillo et al. ArchiRev—Reverse engineering of information systems toward ArchiMate models. An industrial case study
Bucaioni et al. Reference architectures modelling and compliance checking
Bush et al. The Styx agent methodology
Lochmann et al. An integrated view on modeling with multiple domain-specific languages
CN116755669A (en) Low code development method and tool based on DSL language operation model
Laouadi et al. A formal framework for organization-centered multi-agent system specification: A rewriting logic based approach
Amar Bensaber et al. Development of semantic web services: model driven approach
McIlvenna Synthesis of orchestrators from service choreographies
Brambilla et al. Model-driven design of service-enabled web applications
Devedzic Software Patterns
Roldán et al. Operation‐based approach for documenting software architecture knowledge
Glässner et al. Experiences from the Implementation of a Structured-Entity-Relationship Modeling Method in a Student Project.
Kubczak et al. Service-oriented mediation with jABC/jETI
Stanev et al. Why the standard methods, 5GL, common platforms and reusable components are the four pillars of the new computational paradigm Programming without programmers
Wang et al. An aspect-oriented UML tool for software development with early aspects
Amissah A framework for executable systems modeling
Efendioglu et al. Modelling method design: An adoxx realisation
Malavolta Software Architecture Modeling by Reuse, Composition and Customization
Brumbulli et al. Verification of bpmn models

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