Understanding the Abstract Data Format
The data integration API is built on top of the EntityRecord
Java interface, which is an abstract representation for an instance of an entity regardless of the data source it is coming from. For example, an EntityRecord
can be implemented as a row in an Excel spreadsheet, a row in an SQL result set, a CSV line, a JSON object, etc.
An EntityRecord
describes an instance of an entity as it is modeled in the application JDL file. The instance is described as a collection of key/value entries implementing the Java interface EntityRecordEntry
, where keys are attribute names or attribute paths, and values can be decoded from the five supported base types: Boolean
, Double
, Integer
, String
and Date
.
These entries can cover the proper members of the entity, as well as the nested attributes that are required to identify relationships to other entities. In this last case, the key is an attribute path where the attribute names are separated by dots, as for example in activity.plant.id
.
As an example, let's consider the following JDL description of two entities Activity
and Plant
:
entity Activity { // DOM [primary.keys] : [id] id Integer, startTime Instant, endTime Instant } entity Plant { // DOM [primary.keys] : [id, countryCode] id Integer, countryCode String } relationship ManyToOne { Activity{plant} to Plant{activities} }
Then an instance of Activity
as an EntityRecord
could be described as the following list of entries:
-
id
-12
-
startTime
-2021-02-09T08:00:00Z
-
endTime
-2021-02-09T12:00:00Z
-
plant.id
-5
-
plant.countryCode
-"FR"