Summary of the invention
Technical problems to be solved in this application are to provide a kind of operational order disposal route and device, have same section for solving in code corresponding to the operational order of prior art different pieces of information list, cause the problem of code redundancy.
The application provides a kind of operational order disposal route, generates in advance the expandable mark language XML file of every field, and XML file described in each is resolved to respectively to JAVA object; Described method comprises:
Receive operational order request;
Obtain JAVA object corresponding to described operational order request, and obtain the attribute information of described JAVA object;
The attribute information of described JAVA object is loaded in Structured Query Language (SQL) sql command template corresponding to described operational order request, generates SQL statement;
Described SQL statement is carried out in described field, and return to execution result.
Preferably, the attribute information of described JAVA object is loaded in Structured Query Language (SQL) sql command template corresponding to described operational order request, generation SQL statement comprises: the attribute information of described JAVA entity is brought in the JAVA image parameter of sql command template corresponding to described operational order request, generates SQL statement.
Preferably, obtaining JAVA object corresponding to described operational order request comprises:
According to the realm information carrying in described operational order request, obtain the JAVA object that this realm information is corresponding, wherein realm information is corresponding one by one with JAVA object.
Preferably, be that JAVA object comprises by described XML document analysis:
Each the single data form information recording in described XML file is converted to respectively to the data form information of JAVA standard attribute;
The list relation information recording in described XML file is converted to the list relation information of JAVA standard attribute;
All single data form information is being converted to the data form information of JAVA standard attribute, and list relation information is being converted to after the list relation information of JAVA standard attribute, completing the step that described XML is resolved to JAVA object.
Preferably, described single data form information comprises data form title and data form type.
The application also provides a kind of operational order treating apparatus, comprising:
Resolution unit, for generating in advance the expandable mark language XML file of every field, and resolves to respectively JAVA object by XML file described in each;
Receiving element, for receiving operational order request;
Acquiring unit, for obtaining JAVA object corresponding to described operational order request, and obtains the attribute information of described JAVA object;
Loading unit, for the attribute information of described JAVA object being loaded into Structured Query Language (SQL) sql command template corresponding to described operational order request, generates SQL statement;
Performance element, for described SQL statement is carried out in described field, and returns to execution result.
Preferably, described loading unit is further used for the attribute information of described JAVA entity to be brought in the JAVA image parameter of sql command template corresponding to described operational order request, generates SQL statement.
Preferably, described acquiring unit is further used for, according to the realm information carrying in described operational order request, obtaining the JAVA object that this realm information is corresponding, and wherein realm information is corresponding one by one with JAVA object.
Preferably, described resolution unit is further used for each the single data form information recording in described XML file to be converted to respectively the data form information of JAVA standard attribute; And the list relation information recording in described XML file is converted to the list relation information of JAVA standard attribute.
Preferably, described single data form information comprises data form title and data form type.
Compared with prior art, the application comprises following advantage:
In this application, data processing engine can generate the expandable mark language XML file of every field in advance, and XML file described in each is resolved to respectively to JAVA object.When data processing engine receives after operational order request, obtain the attribute information of JAVA object corresponding to operational order request and JAVA object; Again the attribute information of JAVA object is loaded in Structured Query Language (SQL) sql command template corresponding to described operational order request, thereby generate SQL statement.Described SQL statement is carried out in described field, and return to execution result.
To sum up, in the time that different pieces of information list is operated, only need the XML file in the field that generates in advance usage data list, and be JAVA object by XML document analysis.When receiving after operational order request, can obtain the attribute information of corresponding JAVA object, the attribute information of JAVA object is loaded in sql command template corresponding to described operational order request, SQL statement that can generating run order, can carry out operation corresponding to operational order request to data list while carrying out this SQL statement.Therefore, when different pieces of information list is operated, only need the attribute information of corresponding AVA entity to be loaded in sql command template, generate SQL statement.Namely the same operation of different pieces of information list can be used identical sql command template, avoids code redundancy.
Certainly, arbitrary product of enforcement the application might not need to reach above-described all advantages simultaneously.
Embodiment
The understanding of operational order disposal route the application being provided for the ease of those skilled in the art, some terms that paper the application uses.
Data processing: for the mass data occurring in business object, how to be persisted in database, and how to take out the required data of user from database.
Engine: the relatively API(Application Programming Interface of bottom, application programming interface), on API basis, can build complicated application system.
Field: represent concrete business object, be certain concrete class in JAVA, corresponding one or multiple data forms in database.
Entity: in field, attribute and type are composite data type, a data form in an entity correspondence database.
View: be the middle layer that field JAVA class is mapped to data form, the operation of all spectra, is all gone to have shone upon by view.
List: represent concrete tables of data.
Metadata: all entities, view, list is all described by metadata.
Above-mentioned field, entity, view, list and metadata form a class model.The schematic diagram of described class model refers to shown in Fig. 1, and wherein DomainObject is that domain object: metadata is field metadata, and entity is domain entities.DomainMetadata is that field metadata: id is field numbering, and name is domain name, and view is field associated view, title is that field shows title, vesion is field version, and binaries is the binary file that field generates, and entityMetadatas is entity metadata set.
AbsBizEntity is that the foundation class of domain entities: id is entity numbering, and version is entity version, and delFlg is whether this entity is deleted, insertUser is for inserting user, insertTime is the insertion time, and updateUser is for upgrading user, and updateTime is update time.
View is that view: id is view number, name is view name, version is view version, table is the table that view is corresponding, selectColumns is the visible columns of view, and queryClause is query filter condition, and groupBy is a point set condition, orderBy is sort criteria, and tableAssociations is the incidence relation of table.
DomainBinary is the binary file that field generates: id is reference number of a document, and domainId is field numbering, and domainName is domain name, and name is file name, the binary content that content is file.
JavaDomainBinary is that the Java file that field generates: pkgName is bag name.ClassDomainBinary is that the binary file that field generates: pkgName is bag name, and beanType is class file type, and as Entity or Mapper file etc., state is class file status.
XmlDomainBinary is the binary file that field generates: state is the state of xml file.EntityMetadata is that entity metadata: id is entity numbering, and name is entity title, and label is entity display label, and properties is entity attribute set.
PropertyMetadata is that entity attribute metadata: id is attribute number, name is Property Name, label is attribute display label, type is attribute type, as master data, array, object type or object array etc., dataType is data type, as character types, numeric type, date type or logical type etc., mappingRule is the mapping ruler of attribute and Database field, ownEntityName is affiliated entity title, ownDomainName is affiliated domain name, linkedEntityName is associated entity title, linkedDomainName is associated domain name.
MappingRule is that the mapping ruler of attribute and Database field: column is corresponding database column, and rule is mapping ruler.
Table is that data form: id is table numbering, and name is table name, and version is table version, and columns is tabular set.
Column is that tables of data is single-row: id is tabular numbering, name is tabular name, table is table under row, whether ispk for major key, whether isunique for unique key, dataLength is data length, defaultValue is default value, and whether notNull for non-NULL, the data type that sqlType is correspondence database, as varchar, int, date etc., which version firstVersion is at for these row appear in this table first, which version dropVerison is at for these row are deleted, and for sky, to illustrate that these row do not have deleted.
TableAssociation is that multilist incidence relation: leftTable is left contingency table, and leftColumn is left associated column, and op is operation associated, and as right connection of left connection etc., rightTable is right contingency table, and rightColumn is right associated column.
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiment.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtaining under creative work prerequisite, all belong to the scope of the application's protection.
Refer to Fig. 2, it shows the process flow diagram of a kind of operational order disposal route that the embodiment of the present application provides, data processing engine is in the time of the operational order disposal route that uses the embodiment of the present application to provide, first obtain every field, generate the XML(Extensible Markup Language of every field, extend markup language) file, and each XML file is resolved to respectively to JAVA object, so that when follow-up operation command request, can obtain the attribute information of JAVA object.
Operational order disposal route shown in Fig. 2 can comprise the following steps:
Step 201: receive operational order request.
In the present embodiment, field is to there being multiple data forms, and in field, records all single data form information, data form relation information and master meter title.Wherein single data form information refers to the data form information that any one is independent, and described single data form information comprises data form title and data form type.Data form relation information refers to the relation between all data forms that record in field, and as embedded the data that have data form B in data form A, data form B is the sublist of data form A, and data form A is the master meter of data form B.Master meter title refers to the title that is not embedded in the data form in other data forms.
For the ease of operating personnel, different operations is carried out in field, different operating can be embedded in option mode in the actions menu of corresponding each data form in field, or also can in the actions menu of corresponding each data form in field, create a new menu, in this new menu, there is different option of operation.
Option of operation in menu is pre-loaded operational order request, and in the time that operating personnel choose certain option of operation, data processing engine can receive operational order request corresponding to this option of operation.
Step 202: obtain JAVA object corresponding to described operational order request, and obtain the attribute information of described JAVA object.
Because the option of operation of the menu of different pieces of information list is loaded with operational order request, when operating personnel choose after some option of operation, send in the operational order of data processing engine and can carry data form information, and this data form information is corresponding with field, and field is the unique JAVA object of correspondence respectively, data processing engine is receiving after operational order request, can obtain JAVA object corresponding to this operational order request, and obtains the attribute information of this JAVA object.According to the realm information carrying in described operational order request, obtain the JAVA object that this realm information is corresponding, wherein realm information is corresponding one by one with JAVA object.
The attribute information of described JAVA object comprises the data form information of JAVA standard attribute and the list relation information of JAVA standard attribute.Data form information comprises data form title and data form type, and the data form information of JAVA standard attribute comprises the data form title of JAVA standard attribute and the data form type of JAVA standard attribute.
Step 203: the attribute information of described JAVA object is loaded in Structured Query Language (SQL) sql command template corresponding to described operational order request, generates SQL statement.
In the present embodiment the attribute information of described JAVA object is loaded in Structured Query Language (SQL) sql command template corresponding to described operational order request, generation SQL statement comprises: the attribute information of described JAVA entity is brought in the JAVA image parameter of sql command template corresponding to described operational order request, generates SQL statement.
Wherein sql command template is the command template that order generates in advance to different operating, and the JAVA image parameter in this command template is the JAVA attribute information in the corresponding field of JAVA object.After JAVA attribute information being brought into correspondingly in JAVA image parameter, can generate the SQL statement of respective operations command request.This SQL statement is for the operation to data form operation command request corresponding to field.
Step 204: described SQL statement is carried out in described field, and return to execution result.Wherein SQL statement is carried out in field, and the real process of returning to execution result is that data form corresponding to field carried out to SQL statement, and returns data form is carried out to the result after SQL statement.
It should be noted that: be that JAVA object comprises by described XML document analysis in the present embodiment: the data form information that each the single data form information recording in described XML file is converted to respectively to JAVA standard attribute; The list relation information recording in described XML file is converted to the list relation information of JAVA standard attribute; All single data form information is being converted to the data form information of JAVA standard attribute, and list relation information is being converted to after the list relation information of JAVA standard attribute, completing the step that described XML is resolved to JAVA object.Wherein XML document analysis is being specifically implemented as follows of JAVA object:
Application technique scheme, data processing engine can generate the expandable mark language XML file of every field in advance, and XML file described in each is resolved to respectively to JAVA object.When data processing engine receives after operational order request, obtain the attribute information of JAVA object corresponding to operational order request and JAVA object; Again the attribute information of JAVA object is loaded in Structured Query Language (SQL) sql command template corresponding to described operational order request, thereby generate SQL statement.Described SQL statement is carried out in described field, and return to execution result.
To sum up, in the time that different pieces of information list is operated, only need the XML file in the field that generates in advance usage data list, and be JAVA object by XML document analysis.When receiving after operational order request, can obtain the attribute information of corresponding JAVA object, the attribute information of JAVA object is loaded in sql command template corresponding to described operational order request, SQL statement that can generating run order, can carry out operation corresponding to operational order request to data list while carrying out this SQL statement.Therefore, when different pieces of information list is operated, only need the attribute information of corresponding AVA entity to be loaded in sql command template, generate SQL statement.Namely the same operation of different pieces of information list can be used identical sql command template, avoids code redundancy.
The schematic diagram of the overall architecture of the data processing engine of the operational order disposal route providing in enforcement the application refers to shown in Fig. 3.The overall architecture of data processing engine is divided into three layers: Resource(resource layer), Service(service layer) and Dao(data Layer).
Wherein resource layer is mutual for communication, mainly contains four resource component: ViewResource, MetadataResource, DomainResource and FormResource.Carry out input and output by resource.Be that resource is to call the interface of engine.ViewResource is view resource, and the additions and deletions of respective view change looks into.Resource when MetadataResource is domain design, the definition in corresponding field.Resource when DomainResource is field operation, the additions and deletions of corresponding domain entities change looks into.FormResource is list resource, and the additions and deletions of corresponding list change looks into.
Service layer is responsible for processing concrete service logic.FormParamInterceptor is list parameter blocker, JSON or the XML parameter transmitted for resolving foreground.CodeGeneratorInterceptor is that code generates blocker, for generate corresponding domain entities class and field mapping class according to domain design.ViewProcessorInterceptor is that view related service is processed blocker.MetadataProcessorInterceptor is that domain design related service is processed blocker.When DomainProcessorInterceptor is field operation, related service is processed blocker.FormProcessorInterceptor is that form design related service is processed blocker.CryptInterceptor is for encrypting blocker.ZipInterceptor is Compress softwares blocker.
Database layer is mainly responsible for data to carry out persistence and inquiry, or deposits data in database, or deposits file system in, or deposits other system in.ViewXXX is the data manipulation to view.MetadataXXX is the operation to field definition.DomainXXX is the operation to field operation.FormXXX is the operation to list.DataFacade is the distributor of data manipulation, and all data manipulations are specifically all carried out by this distributor.DataWorkerFactory is the factory of data run device, according to various data storage medium, and generated data performer.DbWorker is the performer of relevant database, and all operations to relevant database, by this performer.FileWorker is the performer of file system, and all operations to file system, by this performer.
The overall architecture of the data processing engine based on shown in Fig. 3, data processing engine corresponding process flow diagram in the time that different operating is carried out in field is please consulted respectively Fig. 4 and Fig. 5, wherein Fig. 4 is the process flow diagram to domain design operation, wherein domain design refers to as any one field, determine the process of all data forms corresponding to this field, Fig. 4 comprises insertion, inquiry, renewal and deletion action to the operation of domain design.Fig. 5 is the process flow diagram to field operation, and wherein field operation comprises the operation to the corresponding data form in field, and the operation of data form is comprised to insertion, inquiry, renewal and deletion action.Fig. 4 and Fig. 5 are please consulted respectively in the concrete operation that how to realize the operation to domain design and field is moved, and this present embodiment is no longer set forth.
Embodiment is corresponding with said method, and the embodiment of the present application also provides a kind of operational order treating apparatus, and its structural representation refers to shown in Fig. 6, comprising: resolution unit 11, receiving element 12, acquiring unit 13, loading unit 14 and performance element 15.
Resolution unit 11, for generating in advance the expandable mark language XML file of every field, and resolves to respectively JAVA object by XML file described in each.Wherein, resolution unit 11 is further used for each the single data form information recording in described XML file to be converted to respectively the data form information of JAVA standard attribute; And the list relation information recording in described XML file is converted to the list relation information of JAVA standard attribute.Described single data form information comprises data form title and data form type.
Receiving element 12, for receiving operational order request.
Acquiring unit 13, for obtaining JAVA object corresponding to described operational order request, and obtains the attribute information of described JAVA object.Acquiring unit 13 can, according to the realm information carrying in described operational order request, obtain the JAVA object that this realm information is corresponding, and wherein realm information is corresponding one by one with JAVA object.
Loading unit 14, for the attribute information of described JAVA object being loaded into Structured Query Language (SQL) sql command template corresponding to described operational order request, generates SQL statement.Loading unit 14 can be brought into the attribute information of described JAVA entity in the JAVA image parameter of sql command template corresponding to described operational order request particularly, generates SQL statement.
Performance element 15, for described SQL statement is carried out in described field, and returns to execution result.
It should be noted that, each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment, between each embodiment identical similar part mutually referring to.For device class embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part is referring to the part explanation of embodiment of the method.
Finally, also it should be noted that, in this article, such as term " comprise ", " comprising " or its any other variant be intended to contain comprising of nonexcludability, thereby the process, method, article or the equipment that make to comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or be also included as the intrinsic key element of this process, method, article or equipment.The in the situation that of more restrictions not, the key element being limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
For convenience of description, while describing above device, being divided into various unit with function describes respectively.Certainly, in the time implementing the application, the function of each unit can be realized in same or multiple software and/or hardware.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the mode that the application can add essential general hardware platform by software and realizes.Based on such understanding, the part that the application's technical scheme contributes to prior art in essence in other words can embody with the form of software product, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions (can be personal computers in order to make a computer equipment, server, or the network equipment etc.) carry out the method described in some part of each embodiment of the application or embodiment.
A kind of operational order disposal route and the device that above the application are provided are described in detail, applied principle and the embodiment of specific case to the application herein and set forth, the explanation of above embodiment is just for helping to understand the application's method and core concept thereof; , for one of ordinary skill in the art, according to the application's thought, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application meanwhile.