A domain code generation method and device based on conceptual data model
By parsing and processing the version keywords in the conceptual data model, domain codes are generated, which solves the problems in the existing technology that entity classes are not related and cannot reflect multi-language and multi-time zone characteristics, and achieves complete generation of domain codes and R&D efficiency. improvement.
Patent Information
- Application Number
- CN202010886403.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-08-28
AI Technical Summary
When the existing technology generates domain code, there is a lack of correlation between entity classes, and it cannot effectively reflect the multi-language, multi-time zone and other features of domain-driven design.
Through the domain code generation method based on the conceptual data model, the preset parser is used to parse the domains, packages, entities, and attributes in the CDM file, determine the object-oriented information, and process the characteristic information according to the version keyword to generate the domain code , add annotations for features such as multi-language and multi-time zones.
It realizes the establishment of associations between entity classes, can fully reflect the multi-language and multi-time zone features in domain-driven design, saves development time and costs, and improves research and development efficiency.
Smart Images

Figure CN112114790B
Abstract
Description
Technical Field
[0001] The present application relates to the field of domain driven design, and in particular to a domain code generation method and device based on a conceptual data model. Background Art
[0002] In domain-driven design, the conceptual data model (CDM) includes concepts such as components, aggregate roots, and multilingualism. These concepts reflect the internationalization characteristics of domain-driven design.
[0003] At present, in the process of generating domain code, code generation tools can generate corresponding entity class source code according to CDM files, but the entity classes are isolated from each other and have no association relationship. In addition, since there are no components in the code generation tools to express concepts such as multiple languages and multiple time zones, the generated entity class source code cannot reflect the characteristics of aggregate roots, multiple languages, and multiple time zones in domain-driven design. Summary of the invention
[0004] The embodiments of the present application provide a method and device for generating domain codes based on a conceptual data model, so as to solve the problem that the entity classes of the currently generated domain codes are not related, and the generated domain codes cannot reflect the multi-language, multi-time zone and other characteristics in domain-driven design.
[0005] The present application provides a method for generating domain codes based on a conceptual data model, including:
[0006] Determine the conceptual data model CDM file to be generated;
[0007] According to a preset parser, the domains, packages, entities and attributes in the CDM file are parsed respectively to determine the corresponding object-oriented information;
[0008] Processing the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domain, entity, and attribute in the CDM file;
[0009] Generate corresponding domain codes based on the processed object-oriented information.
[0010] In one example, according to a preset parser, the domains, packages, entities, and attributes in the CDM file are respectively parsed to determine corresponding object-oriented information, including: according to a preset domain parser, the domains in the CDM file are parsed to determine object-oriented domain information; according to a preset package parser, the packages in the CDM file are parsed to determine object-oriented component information; according to a preset entity parser, the entities of each package in the CDM file are parsed to determine object-oriented entity information; according to a preset attribute parser, the attributes of each entity in the CDM file are parsed to determine object-oriented attribute information.
[0011] In one example, before processing the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domains, entities, and attributes in the CDM file, the method also includes: determining the template keywords corresponding to each parsing stage according to the preset template parser interface configuration; the parsing stage includes a domain parsing stage, an entity parsing stage, and an attribute parsing stage.
[0012] In one example, according to the template keywords corresponding to the domains, entities, and attributes in the CDM file, the characteristic information in the corresponding object-oriented information is processed, including: according to the preset template parser interface configuration, determining the template keywords and template parser interface implementation classes corresponding to the domains, entities, and attributes in the CDM file respectively; according to the determined template parser interface implementation class, calling the corresponding template parser interface for processing.
[0013] In one example, processing the characteristic information in the corresponding object-oriented information includes: setting the attribute value of the corresponding object-oriented information according to the corresponding template keyword.
[0014] In one example, before generating the corresponding domain code, the method further includes: constructing a source code generation context according to configuration information specified by a user; the configuration information includes a code template path, a namespace, and whether to overwrite existing code.
[0015] In one example, corresponding domain code is generated based on processed object-oriented information, including: determining the corresponding code template based on the code template path in the source code generation context and a preset template processing tool; passing the processed object-oriented information to the code template to form a corresponding namespace, and generating corresponding domain code.
[0016] In one example, the method further includes: adding corresponding annotations in the class of the generated domain code according to the template keywords corresponding to the domains, entities, and attributes in the CDM file.
[0017] In one example, the method further includes: determining a corresponding attribute value according to a domain identifier corresponding to the attribute.
[0018] The embodiment of the present application provides a domain code generation device based on a conceptual data model, comprising:
[0019] Determine the module and the conceptual data model CDM file to be generated;
[0020] A parsing module, which parses the domains, packages, entities and attributes in the CDM file according to a preset parser to determine the corresponding object-oriented information;
[0021] A processing module, which processes the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domain, entity and attribute in the CDM file;
[0022] The generation module generates corresponding domain codes based on the processed object-oriented information.
[0023] The embodiments of the present application provide a method and device for generating domain code based on a conceptual data model, which at least include the following beneficial effects: through template keywords, a correspondence can be established between packages, entities, attributes, domains in a CDM file and corresponding components, entities, attributes in a domain design. In this way, in the process of generating domain code, concepts such as "aggregate root", "multi-language", and "multi-time zone" can be expressed through template keywords, and complete generation of domain code by ordinary code generation tools can be achieved, avoiding spending a lot of time and energy on the development of domain-driven design tools and specific code generation tools, saving R&D costs, and improving R&D efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0025] Figure 1 A flow chart of a method for generating domain codes based on a conceptual data model provided in an embodiment of the present application;
[0026] Figure 2 A schematic diagram of the structure of a domain code generation device based on a conceptual data model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0028] Figure 1 The flowchart of the domain code generation method based on the conceptual data model provided in the embodiment of the present application specifically includes the following steps:
[0029] S101: Determine a conceptual data model CDM file to be generated.
[0030] In the embodiment of the present application, the server can define the interface standards that the code generation process needs to follow in advance according to the needs of generating domain codes from CDM files. The interface standards include parsers, parser interfaces, interface configurations, etc.
[0031] Afterwards, the server may determine the CDM file specified by the user for generating the domain code as the CDM file to be generated, so as to parse the CDM file later and automatically generate the corresponding source code.
[0032] S102: According to a preset parser, the domains, packages, entities and attributes in the CDM file are parsed respectively to determine corresponding object-oriented information.
[0033] In an embodiment of the present application, the server can parse the domains, packages, entities, and attributes in the CDM file according to a preset parser to obtain corresponding object-oriented information, thereby realizing the conversion of the XML format in the CDM file to the object-oriented format.
[0034] In one embodiment, when the server is parsing the CDM file, the corresponding parsing process is different according to the different parsing objects and parsing stages.
[0035] Specifically, when resolving a domain, the server can read the content of the CDM file, search for domain nodes containing "c:Domains / o:Domain", and form a corresponding domain node list. Afterwards, for all domain nodes, the server can call the "resolve domain" method in the preset domain resolver, input the corresponding domain node information, and perform resolution to obtain the domain information shared by multiple object-oriented entities.
[0036] The domain parser is used to define the method of parsing the domain information in XML format in the CDM file into object-oriented domain information. A domain represents a shared attribute with the same name between different entities, which can be referenced by entities to achieve a unified definition of attributes with the same meaning, avoiding different definitions of attributes with the same meaning in different entities.
[0037] A domain may include attributes such as ID, object ID, code, name, data type, length, precision, required, default value, template, multi-language, multi-time zone, and reference field. Among them, "ID" is used to uniquely identify a domain; "object ID" is used to indicate the ID of the domain in the CDM file; "Code" is used to indicate the code of the domain; "Name" is used to indicate the name of the domain; "Data type" is used to indicate the data type of the domain; "Length" is used to indicate the length of the data type of the domain; "Precision" is used to indicate the precision requirement of the data; "Required" is used to indicate whether the current attribute must be filled in; "Default value" is used to indicate the default value of the domain; "Template" is used to indicate the identifier of the template keyword corresponding to the domain; "Multi-language" is used to specify whether the current attribute is a multi-language field; "Multi-time zone" is used to specify whether the current attribute is a multi-time zone field; "Reference field" is used to specify whether the current attribute is a reference field, that is, a foreign key field.
[0038] Specifically, when parsing a package, the server can search for the package node containing "c:Packages / o:Package" according to the content of the CDM file to form a corresponding package node list. Afterwards, for all package nodes, the server can call the "parse package" method in the preset package parser, input the corresponding package node information, and parse to obtain the corresponding object-oriented component information.
[0039] The package parser is used to define a method for parsing the package in the CDM file into component information in an object-oriented form.
[0040] A component represents a container that contains several entities. A component may include attributes such as ID, code, name, entity list, etc. Among them, "ID" is used to uniquely identify a component; "Code" is used to represent the component's code; "Name" is used to represent the name of the component; "Entity list" is used to represent the list of entities in the package.
[0041] Specifically, when parsing the entities in each package node, the server can search for entity nodes containing "c:Entities / o:Entity" according to the content of the corresponding package node in the CDM file to form a corresponding entity node list. Afterwards, for all entities in each package node, the server can call the "parse entity" method according to the preset entity parser, input the corresponding entity node information, and parse to obtain object-oriented entity information.
[0042] The entity resolver is used to define a method for resolving entity information in XML format in a CDM file into domain entity information in an object-oriented format.
[0043] Entity representation contains a container with several field attributes, which may include attributes such as identification, object identification, code, name, template, whether it is an aggregate root, and attribute list. Among them, "identification" is used to uniquely identify an entity; "object identification" is used to indicate the entity's identification in the CDM file; "code" is used to indicate the entity's code; "name" is used to indicate the name of the entity; "template" is used to indicate the template keyword corresponding to the current entity; "aggregate root" is used to indicate whether the current entity is an aggregate root. In a package, there is only one entity that is the main entity and only one entity that is an aggregate root; "attribute list" is used to indicate the attribute list corresponding to the current entity.
[0044] Specifically, when parsing the attributes in each entity, the server can search for the attribute content containing "c:Attributes / o:EntityAttribute" in each entity node to form a corresponding attribute node list in XML format. Afterwards, for each attribute in the attribute node list, the server can call the "parse attribute" method in the preset attribute parser, input the corresponding attribute information in XML format, and parse it to obtain the corresponding object-oriented attribute information in memory.
[0045] The attribute parser is used to define a method for parsing attribute information in XML format in a CDM file into attribute information in object-oriented format.
[0046] The data structure of the attribute is basically the same as that of the above-mentioned domain, including the attributes such as identification, object identification, domain identification, encoding, name, data type, length, precision, whether required, default value, version, whether multi-language, whether multi-time zone, and whether reference field. Among them, "ID" is used to uniquely identify an attribute; "Object ID" is used to indicate the ID of the attribute in the CDM file; "Domain ID" is used to indicate which domain's definition the detailed information of the current attribute refers to. If the attribute value is not empty, the corresponding value in the domain can be copied to the current attribute according to the domain ID; "Encoding" is used to indicate the encoding of the attribute; "Name" is used to indicate the name of the attribute; "Data type" is used to indicate the data type of the attribute; "Length" is used to indicate the length of the data type of the attribute; "Precision" is used to indicate the precision requirement of the data; "Is it required" is used to indicate whether the current attribute must be filled in; "Default value" is used to indicate the default value of the attribute; "Layout" is used to indicate the layout keyword corresponding to the attribute; "Is it multilingual" is used to specify whether the current attribute is a multilingual field; "Is it multi-time zone" is used to specify whether the current attribute is a multi-time zone field; "Is it a reference field" is used to specify whether the current attribute is a reference field, that is, a foreign key field.
[0047] S103: Processing the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domains, entities and attributes in the CDM file.
[0048] In the embodiment of the present application, the server can pre-set the template keywords corresponding to each entity, attribute, and domain according to the relevant characteristics of the entity, attribute, and domain in the CDM file. Among them, the characteristics represent the attributes that cannot be automatically generated by general code generation tools, such as multiple languages, multiple time zones, etc., and the template keywords represent the description of the relevant characteristics of each entity, attribute, and domain.
[0049] After parsing the packages, entities, attributes, and domains in the CDM file and obtaining the converted object-oriented information, the server can determine the template keywords corresponding to each entity, attribute, and domain, and parse the corresponding template keywords according to the preset template parser to add the description of relevant features in the template keywords to the object-oriented information.
[0050] In one embodiment, the predefined interface standard may include a template parser interface configuration. The template parser interface configuration is used to define the corresponding relationship between the parsing stage, the template keyword and the template parser interface implementation class.
[0051] The layout parser interface configuration includes attributes such as identification, parsing stage, layout keyword, layout parser interface implementation class, etc. Among them, "identification" is used to uniquely identify a layout parser interface configuration; "parsing stage" is used to indicate the parsing stage corresponding to the current layout parser interface configuration, including domain parsing stage, entity parsing stage, and attribute parsing stage; "layout keyword" is used to indicate the layout keyword corresponding to the current parsing stage, and different parsing stages often correspond to different layout keywords; "layout parser interface implementation class" is used to indicate the implementation class of the layout parser interface, and different layout keywords correspond to different layout parser interface implementation classes.
[0052] Therefore, the server can determine the layout keywords and layout parser interface implementation classes corresponding to each parsing stage according to the layout parser interface configuration. After that, the server can call the corresponding layout parser interface according to the layout parser interface implementation classes corresponding to the layout keywords of the domain, entity, and attribute in the CDM file, parse the corresponding layout keywords, and add the parsed feature information to the pre-obtained object-oriented information.
[0053] Specifically, the server can assign attribute values of corresponding characteristic parameters according to the template keywords corresponding to the entity, attribute, and domain. For example, if the template keyword corresponding to the entity is aggregate root, the attribute value of "Is it an aggregate root" in the entity can be set to "yes"; if the template keyword corresponding to the attribute is multilingual, the attribute value of "Is it multilingual" in the attribute can be set to "yes".
[0054] S104: Generate corresponding domain code according to the processed object-oriented information.
[0055] In the embodiment of the present application, the server can generate corresponding domain codes according to the processed object-oriented information, wherein the generated domain codes include corresponding characteristic information.
[0056] In one embodiment, the server can construct a source code generation context for generating domain code according to the configuration information specified by the user, wherein the specified configuration information includes the code template path, namespace, whether to overwrite the existing code, etc.
[0057] In one embodiment, after constructing the source code generation context, the server can determine the corresponding code template according to the code template path in the source code generation context and the preset template processing tool. Afterwards, the server can pass the processed object-oriented information to the corresponding code template to form a corresponding namespace and generate a corresponding domain code.
[0058] In one embodiment, the server can add corresponding annotations to the class of the generated domain code according to the template of the domain, entity, and attribute in the CDM file to reflect the multi-language, multi-time zone and other characteristic information of the domain, entity, and attribute in the generated domain code.
[0059] In an embodiment of the present application, through the template keywords, a correspondence can be established between the packages, entities, attributes, domains in the CDM file and the corresponding components, entities, attributes in the domain design. In this way, in the process of generating domain code, concepts such as "aggregate root", "multi-language", and "multi-time zone" can be expressed through template keywords, which can realize the complete generation of domain code by ordinary code generation tools, avoiding spending a lot of time and energy on the development of domain-driven design tools and specific code generation tools, saving R&D costs, and improving R&D efficiency.
[0060] For ease of understanding, this application takes the generation of entity source code in a sales order package in a CDM file as an example for explanation.
[0061] In the CDM file, the content of the sales order package is shown in Table 1. The first column represents the attributes of the sales order package, and the second column represents the corresponding attribute values.
[0062] Table 1
[0063] Property Name value Code SalesOrder Name Sales Order
[0064] Table 2 shows the content of the sales order entity in the sales order package, where the first column represents the attributes of the sales order package, and the second column represents the corresponding attribute values.
[0065] Table 2
[0066] Property Name meaning Logo O1 Object Identification 99710E01-DBC5-4B08-905C-2510208A491F coding SalesOrder name Sales Order Version Aggregate Root
[0067] Table 3 shows the attribute information of the sales order entity. The first row indicates the attribute corresponding to the entity attribute, and the second to fourth rows respectively indicate the three attributes of the sales order entity.
[0068] Table 3
[0069] Logo coding name Data Types length Is this field required? Version 1 ID ID String 36 yes 2 MaterialName Material Name String 100 yes Multilingual 3 DeliveryDate Shipping Date DateTime yes Multiple time zones
[0070] Table 4 shows the interface configuration of the template parser. The 2nd to 4th rows represent three configurations respectively. Since the parsing process of the domain parsing stage and the attribute parsing stage is basically the same, the same interface implementation class can be used.
[0071] Table 4
[0072]
[0073] The code generation process includes the following steps:
[0074] First, the server can determine the corresponding layout keywords and the layout parser interface implementation class according to the layout parser interface configuration and different parsing stages.
[0075] According to Tables 1 to 4 above, the output value of the package parsing stage is empty, the template keyword obtained in the entity parsing stage is aggregate root, and the corresponding template parser interface implementation class is com.inspur.common.AggregateRootInterceptor. The template keywords obtained in the domain (entity) parsing stage are multi-language and multi-time zone, and the corresponding template parser interface implementation classes are com.inspur.common.I18nInterceptor and com.inspur.common.TimeZoneInterceptor respectively.
[0076] Second, the server can construct a source code generation context according to the user-specified configuration information such as the base path / project, namespace com.inspur.scm.sd, code template entity.vm, and whether to overwrite existing code.
[0077] Third, the server reads the content of the CDM file specified by the user, searches for the node containing "c:Domains / o:Domain", obtains a list of domain nodes, iterates these domain nodes, and passes the information of each domain node to the "resolve domain" operation of the "domain resolver" to obtain domain information common to multiple entities, providing a basis for subsequent resolution of attributes.
[0078] Fourth, the server searches for the node containing "c:Packages / o:Package", obtains the package node list, iterates these package nodes, and passes the information of each package node to the "parse package" operation of the "package parser" to obtain the component information SalesOrder corresponding to the current package.
[0079] Fifth, the server searches for the node containing "c:Entities / o:Entity" in the child nodes of the current node, obtains the entity node list information in the current package, iterates each entity node, calls the "parse entity" operation of the "entity resolver", and obtains its corresponding object-oriented entity information.
[0080] In addition, the server can call its "processing" interface based on the entity's layout keywords, layout parser interface and layout parser interface implementation class determined in the first step, parse the entity's layout keywords, and set the current entity's "Is it an aggregate root" data to true based on the layout keyword "aggregate root".
[0081] Sixth, the server searches for the child node of "c:Attributes / o:EntityAttribute" in the current entity node, obtains the attribute node list in XML format, iterates each attribute node, calls the "attribute resolution operation" of the "attribute resolution device", and obtains the entity attribute information corresponding to the current node. Among them, if the "domain identifier" in the attribute has a value, the value in the corresponding domain is copied to the current attribute.
[0082] In addition, the server can also call its "processing" interface according to the layout keyword, layout parser interface and layout parser interface implementation class of the domain (attribute) determined in the first step, parse the layout keyword of the attribute, and set the "Is it multi-language" data of the current attribute (domain) to true according to the layout keyword "multi-language" of the attribute "material name", and set the "Is it multi-time zone" of the current attribute (domain) to true according to the layout keyword "multi-time zone" of the attribute "shipping date".
[0083] At this point, all entities and all entity attributes in a package have completed the conversion from XML format to object format; iterate the next package until all packages, all entities, and all attributes in this CDM file have been converted into object format, and assign the component list in object format to the component list of the source code generation context.
[0084] Seventh, the server can obtain the code template path of the source code generation context, use the template processing tool to read the code template content, and then iterate the component list, iterate the entity list in the current component, and pass the current component and the current entity as parameters to the code template.
[0085] The template processing tool will use component information and base namespace information, that is, base namespace and component encoding, to form the namespace of all entity classes in this component; replace the relevant parameters in the code template with entity information and entity attribute information, and annotate the entity template, such as the "aggregate root" template, on the class in the form of annotation @AggregateRoot, and annotate the attribute template, such as the "multi-language", "multi-time zone" and other templates, on the corresponding attributes in the form of annotations @I18n, @TimeZone; iterate the next entity, iterate the next component, until all components have formed their domain codes.
[0086] The above is a domain code generation method based on a conceptual data model provided in the embodiment of the present application. Based on the same inventive idea, the embodiment of the present application also provides a corresponding domain code generation device based on a conceptual data model, such as Figure 2 shown.
[0087] Figure 2The schematic diagram of the structure of the domain code generation device based on the conceptual data model provided in the embodiment of the present application specifically includes:
[0088] Determining module 201, determining a conceptual data model CDM file to be generated;
[0089] The parsing module 202 parses the domains, packages, entities and attributes in the CDM file according to a preset parser to determine the corresponding object-oriented information;
[0090] Processing module 203, processing characteristic information in corresponding object-oriented information according to the template keywords corresponding to the domain, entity, and attribute in the CDM file;
[0091] The generation module 204 generates corresponding domain codes according to the processed object-oriented information.
[0092] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0093] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0094] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A domain code generation method based on a conceptual data model, characterized in that: include: Determine the conceptual data model CDM file to be generated; According to a preset parser, the domains, packages, entities and attributes in the CDM file are parsed respectively to determine the corresponding object-oriented information; Processing the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domain, entity, and attribute in the CDM file; Template keywords represent descriptions of relevant characteristics of each entity, attribute, and domain; Generate corresponding domain code according to the processed object-oriented information; According to the preset parser, the domains, packages, entities, and attributes in the CDM file are parsed respectively to determine the corresponding object-oriented information, including: According to the preset domain parser, the domain in the CDM file is parsed to determine the object-oriented domain information; According to the preset package parser, the packages in the CDM file are parsed to determine the object-oriented component information; According to the preset entity parser, the entities of each package in the CDM file are parsed to determine the object-oriented entity information; According to the preset attribute parser, the attributes of each entity in the CDM file are parsed to determine the object-oriented attribute information; Process the characteristic information in the corresponding object-oriented information, including: According to the corresponding template keywords, the attribute values of the corresponding object-oriented information are set.
2. The method according to claim 1, characterized in that Before processing the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domain, entity, and attribute in the CDM file, the method further includes: According to the preset layout parser interface configuration, the layout keywords corresponding to each parsing stage are determined; the parsing stages include a domain parsing stage, an entity parsing stage, and an attribute parsing stage.
3. The method according to claim 1, characterized in that Before generating the corresponding domain code, the method further includes: Construct a source code generation context according to the configuration information specified by the user; the configuration information includes the code template path, namespace, and whether to overwrite the existing code.
4. The method according to claim 3, characterized in that Generate corresponding domain codes based on the processed object-oriented information, including: Determine a corresponding code template according to a code template path in the source code generation context and a preset template processing tool; The processed object-oriented information is passed to the code template to form a corresponding namespace and generate a corresponding domain code.
5. The method according to claim 1, characterized in that The method further comprises: According to the template keywords corresponding to the domains, entities and attributes in the CDM file, corresponding annotations are added to the classes of the generated domain code.
6. The method according to claim 1, characterized in that The method further comprises: According to the domain identifier corresponding to the attribute, a corresponding attribute value is determined.
7. A domain code generation device based on a conceptual data model, characterized in that: include: Determine the module and the conceptual data model CDM file to be generated; A parsing module, which parses the domains, packages, entities and attributes in the CDM file according to a preset parser to determine the corresponding object-oriented information; A processing module, which processes the characteristic information in the corresponding object-oriented information according to the template keywords corresponding to the domain, entity and attribute in the CDM file; Template keywords represent descriptions of relevant characteristics of each entity, attribute, and domain; The generation module generates corresponding domain codes according to the processed object-oriented information; According to the preset parser, the domains, packages, entities, and attributes in the CDM file are parsed respectively to determine the corresponding object-oriented information, including: According to the preset domain parser, the domain in the CDM file is parsed to determine the object-oriented domain information; According to the preset package parser, the packages in the CDM file are parsed to determine the object-oriented component information; According to the preset entity parser, the entities of each package in the CDM file are parsed to determine the object-oriented entity information; According to the preset attribute parser, the attributes of each entity in the CDM file are parsed to determine the object-oriented attribute information; Process the characteristic information in the corresponding object-oriented information, including: According to the corresponding template keywords, the attribute values of the corresponding object-oriented information are set.
