-
Notifications
You must be signed in to change notification settings - Fork 4
Data Element
Data Element adds business semantics to data domains. With business semantics, usually we mean label texts, as they are usually the first semantic information to users. Besides, other semantics are long texts, search helps, and context parameters.
Data Element provides a layer of re-usability on business level. Business semantics can be transferred to attributes by assigning data elements when creating relations, entities, or relationships. Together with the technique boundaries derived from data domains, data element gives attributes all the meanings on both storage layer and presentation layer.
In the modeling tool, go to the 'Data Element' tab. The left list shows the 10 latest data elements in the system. You can run a fuzzy search which filters in names and descriptions. Click the '+' button on the top right, you can create a new data element.
You must give a unique name to your data element. Optionally, you may also give some description. You can either create a data element based on a data domain, or based on an elementary data type. Currently, we provide following elementary data types: char, integer, boolean, decimal, string, binary, date, and timestamp. They can be mapped to the MySQL data types(boolean is mapped to tiny int).
You must give a label text and a list head text to a data element. Label text will be displayed when the attributes are shown as fields in a form. List header text will be displayed when the attributes are shown as columns in a table. Usually, list header text is shorter than label text, as we want a short column header in most of the cases.
If you use jor-angular to develop UI, label text and list text can be automatically derived with multi-languages. This can save you a lot of effort in UI development by delegating texts and languages to the backend entity model.
<dk-app-attribute-form2 class="col-md-6 col-lg-4 dk-form-label"
[attributeControl]="getAttrCtrlFromID('COMPANY_ID')"
[formGroup]="userBasicEmployeeForm"
[readonly]="readonly">
</dk-app-attribute-form2>
You can optionally assign a search help and a parameter to a data element.
A search help is a dialog window in which you can search and list the possible values of the current attribute. The list may also contain other attributes, but the returned value should fit the attribute that the data element is assigned to. So you may also give a 'Export Field' to indicate which attribute in the search help list should be returned.
You assign a parameter name so that the value is carried in a whole user context. For example, if you assign 'COMPANY_ID' to a data element, then a value is carried by the parameter when it is first input or changed. Afterwards, wherever you navigate through different UIs, as long as the fields have the data element with the parameter, the value is always entered automatically. This gives the users great convenience. Imagine you enter into a search page, the company search field is already input with the company ID you are working on.
When you change a data element for its technical boundaries, it also triggers changes of the underlying DB tables. However, some changes are incompatible, for example, a char type is changed to integer, or the length is shortened. The DB replies the incompatible errors, and you may have to manually correct them.
The changes on texts, search help, and parameter will effect immediately after you refresh the UI. It doesn't mean each time the UI is asking the DB for the meta. Instead it asks to a cache layer maintained by JOR. And with each such changes, the cache layer is updated accordingly.