Absrtact: This paper proposes and realizes a data-driven command interface generation scheme, which generates all the command interface elements in a consistent way, and can flexibly adapt to the change of command.
Keywords: data driven; command; Java
In typical enterprise applications, applications typically provide a set of commands as an interface between users and applications. As business needs change and technology develops, it requires adjustments to the original commands, such as adding commands, modifying command parameters, and so on, which may require modifying the application to generate an adjusted command interface. This paper proposes and implements a data-driven command interface generation scheme, which handles all commands in a consistent manner, maximizing the increase, deletion and modification of commands, and does not require or need to modify applications.
1 data-driven solutions and ideas
Typically, an application is designed to interface with its own business logic, and for a specific command, the developer needs to write an interface to generate code to generate the interface elements of the command, such as menu items, Parameter Input dialog box, and so on. This is a more straightforward approach when the number of commands applied is small. But when the application contains hundreds of commands, it is a tedious task to generate interface elements for each command one at a time. In addition, as the application upgrades, it may require modifications to the original command system, which requires that the code be modified to generate the modified command interface elements. We hope that there is a way to achieve the convenience of flexible generation of command interface elements and to adapt to the requirements of future adjustments, but the impact on our program is minimal.
All the commands in the application can be found, although the functions of the commands are different, but the form of the command is very similar, including the command identity and 0 or more parameters, and for each command to write the interface generated code is very similar. So we can handle all the commands in a uniform way. The main idea of the data-driven command-interface generation scheme is based on this, which is used to describe all the commands in a certain way, and to generate the interface elements to drive all the commands by describing the data. This article uses database tables to complete the original description of all commands.
The nature of the parameter is reflected by its data type, it is necessary to define the various data types of the parameters in this application only according to the actual application. The type of data is always limited, and by giving a solution to each data type, the processing of a large number of parameters can be converted to a finite type of data.
database table Description of the 2 command
Starting with a description of the command in a database table, subsequent orders to add, delete, modify and change the parameters of the command only need to modify the description table related items. Commands typically include command identification and parameters, but for more efficient management of commands and the need to adapt to more complex applications, the description of the command is defined by defining the command type description table, Command description table, command parameter Description table, enumeration Description table level four structure to complete. Command type fields and command fields combine to determine a unique command that provides intuitive name characters and numeric encoding to accommodate different needs. parameter types and value requirements are defined in the parameter table, and the enumeration table is set for a particular parameter type, whose value is selected in some selections. In addition to the basic attributes of the defined object in this table, all levels of the table, if there are subordinate elements, give the number of subordinate elements and their position in the subordinate table, to associate the various components of a command in this way. A simple example of this table structure is given below.
· Command Type Description table: Describes the classification of commands.
Unique flag |
Number |
Name |
Number of commands |
Command Description Location |
ct_00010 |
248 |
System Management Class |
2 |
c_00010 |
Table 1 Command Type description
· Command Description table: describing specific commands
Unique flag |
Number |
Name |
Number of arguments |
Parameter Description Location |
c_00010 |
1 |
System Contact Request |
1 |
p_00010 |
c_00011 |
2 |
System Reset |
0 |
|
Table 2 Command Description table
· Command parameter Description table: Describes the parameters for each command. The value of the parameter is set when the user invokes the command and cannot be determined beforehand. We just make some constraints on the nature of the parameters. Depending on the specific application, the application can specify a numeric number for each type and fill in the table with the number value of the parameter data type. The maximum minimum value of the parameter gives the parameter range or length limit.
unique flag |
name |
data type |
max value |
minimum |
number of enumerations |
enumeration description location |
p_00010 |
|
9 |
  |
  |
2 |
e_00010 |
p_00020< /td> |
source filename |
32 |
0 |
&NBSP; |
Table 3 Command parameter Description table
· Enumeration Description Table: Enumeration Items given enumerated type parameters
Unique flag |
Enumeration name |
enumeration value |
e_00010 |
Request response |
1 |
e_00011 |
No response required |
0 |
Table 4: Enumeration Description Tables
Table 1 of Table 4 above provides a general demonstration of the actual application that defines its own command content according to the needs of the business logic, and the size of the command is unrestricted.