EIS-Metadata


To be able to utilize the framework in appropriate way, you will need some configuration files that includes the metadata, these are System, tables, reports, menus and localization.

System

In the framework bootstrap using ApplicationManager.getInstance().init(), the framework will look for the application configuration in specific file.the file is should be named system.xml , and should be places in the root of the classpath. This file that contains the first level metadata of the application, in case the developer didn’t provide this file, below are snippet example for system.xml from UMS university management system:

<application>
<id>1</id>
<name>Demo</name>
<splash-img>/resources/images/splash.png</splash-img>
<home-img>/resources/images/home.png</home-img>
<background-img>/resources/images/background.jpg</background-img>
<config-file>system.config</config-file>
<locale>en</locale>
<module id="1" name="SYSTEM" config-path="com.jk.framework.apps.system.meta"  />
<module id="2" name="SECURITY_SYSTEM" class="com.jk.security.SecurityModule"  />
<module id="3" name="Demo" config-path="/com/jk/example/module1/meta" default="true"/>
<module id="4" name="Demo2" config-path="/com/jk/example/module2/meta" />
<listener class="com.jk.examople.listener.DemoApplictionListener1" />
<listener class="com.jk.examople.listener.DemoApplictionListener2" />
</application>

In case the developer did not provide one, the framework will use the default system.xml which contains the below:

<application>
       <id>786</id>
       <name>Smart-Desktop Application</name>
       <splash-img>/resources/images/splash.jpg</splash-img>
       <background-img>/resources/images/background.jpg</background-img>
       <config-file>system.config</config-file>
       <locale>en</locale>
       <module id="1" name="System" config-path="com.jk.framework.apps.system.meta"  default="true"/>
       <module id="2" name="Security" class="com.jk.security.SecurityModule"  />
       <module id="3" name="Application" config-path="/meta" />
</application>

And in this case, the framework will look for the other metadata in the /meta folder in the class path.

 

Meta

meta.xml is the file that contains the database metadata for a module set in the syste.xml , for example, if the developer configured system.xml to include module HR as follows:

       <module id=“3” name=“HR” config-path=“/com/jk/example/hr/meta” />

A file named meta.xml exists in the com/jk/example/hr/meta folder, and this file should contains the metadata for the database for that module. If no file was set, the framework will use the dynamically generated metadata, however this is not recommended for production environment due to performance and reliability issues.

This metadata can be generated using Database Metadata-Console, or manually, please show a snippet for security meta.xml

<tables>
<!-- ///////////////////////////////////////////////////////////////////////////// -->
<!-- Table Meta for : -sec_audit_type-with id : -sec_audit_type- -->
<!-- ///////////////////////////////////////////////////////////////////////////// -->
<table name='sec_audit_type'  allow-manage='true'  caption='sec_audit_type'>
<id-field  name='audit_type_id'  type='2'  max-length='50' />
<field  name='audit_type_name'  max-length='50'  default-value='null'/>
</table>
<!-- ///////////////////////////////////////////////////////////////////////////// -->
<!-- Table Meta for : -sec_audits-with id : -sec_audits- -->
<!-- ///////////////////////////////////////////////////////////////////////////// -->
<table name='sec_audits'  allow-manage='true'  caption='sec_audits' allow-delete="false">
<id-field  name='audit_id'  type='2'  max-length='50' />
<field  name='audit_date'  type='91'  max-length='50'  required='false'  default-value='null'/>
<field  name='audit_type_id'  type='4'  max-length='50'  default-value='null' reference_table='sec_audit_type'  reference_field='audit_type_id' />
<field  name='user_id'  max-length='50'  default-value='null' reference_table='sec_users'  reference_field='user_id' />
</table>

Reports

In the meta folder of the folder, another file should exist, reports.xml, this file contains the metadata for the reports to be used by the internal reporting API.

Example of reports.xml:

<reports>
       <source-path>/resources/reports</source-path>
       <out-path>reports-out</out-path>
       <report name="sec_privilege"/>
       <report name="sec_user_role_privilege"/>
</reports>


Menu

This file contains the menu metadata for the module, the file should be names menu.xml and should be placed in the module meta folder, and example for the menu.xml:

<main-menu>
       <menu name="SECURITY_CONFIG" icon-name="lock.png">
              <menu-item name="PRIVILIGES" icon-name="roles.png">
                     <properties>
                      <property name="table-meta" value="sec_privileges" />
                     </properties>
              </menu-item>

              <menu-item name=" ROLES" icon-name="roles.png">
                     <properties>
                     <property name="table-meta" value="sec_roles" />
                     <property name="detail-tables" value="sec_role_privileges" />
                     <property name="detail_fields" value="role_id" />
                     <property name="cross-table" value="true" />
                     </properties>
              </menu-item>

…..

Localization

For the localization of the framework, every module should contain the translation for every labels in localization files, where every file contains the translation for special language, the file name should be name XX_lbl.properties  where XX is the short language code, for example, for Arabic translations , the file should be name, ar_lbl.properties. the format of this file is standard properties file formatting with UTF-8 encoding, where the key is the key of the label, and the value is the localized value, example:

AUTHENTICATE=تسجيل الدخول
SECURITY=الامن
ROLES=الأدوار