RE: Data Engine

thumbnail
Andre Kreienbring, modified 6 Years ago. Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
Using the new Liferay Data Engine like described here
https://portal.liferay.dev/docs/7-2/frameworks/-/knowledge_base/f/data-engine
I have two questions and one issue:
1. Creating a DataRecordCollection in a DataDefinition seems to create 2 different collections.  Inspected with a GraphQL Query:
{
  "data": {
    "dataRecordCollections": {
      "items": [
        {
          "id": 37043,
          "dataDefinitionId": 37037,
          "dataRecordCollectionKey": "37042"
        },
        {
          "id": 37039,
          "dataDefinitionId": 37037,
          "dataRecordCollectionKey": "FIELDDEFINITION"
     }  
 }
}
The dataRecordCollectionKey "FieldDefinition" is the DataDefinitionKey of the corresponding DataDefinition.  BTW the request that creates the collection(s) returns the id of the first one. (In this example 37043)
Why are there two and which one must I use to finally store my records in?
2. Does anybody know an example that uses the property 
nestedDataDefinitionFields
?
What is it good for? Is it possible to store some kind of relation to other DataDefinitions?
3. After playing around with the Data Engine for a while ... (creation and deletion of dfinitions and collections) It seems that I can't delete DataDefinitions and DataRecordCollections anymore. The server responds with 500 (internal error).
Using Postman like this:
DELETE  http://localhost:8080/o/data-engine/v1.0/data-definitions/37028

reveals
com.liferay.dynamic.data.mapping.exception.NoSuchStorageLinkException: No DDMStorageLink exists with the key {classPK=37132}
in the response. Nothing in the Logs and restarting the server does not help.
Any advice?
thumbnail
Bijan Vakili, modified 6 Years ago. Expert Posts: 375 Join Date: 3/10/09 Recent Posts
I'm not sure how to recreate the exception to help you to help you troubleshoot this emoticon just thought to ask what version of liferay are you using? 7.3 GA1?
I see some issues reported and fixed in 7.3 GA1, but not sure. https://issues.liferay.com/browse/LPS-105942 
thumbnail
Andre Kreienbring, modified 6 Years ago. Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
Thanks! I'm on 7.2.1 and will update to 7.3 now. I don't belive that the issue you posted has something to do with mine, but I can see that the Data Engine and also the App Builder is under constant development.
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Yes, they still development and as issues are reported on issues.liferay.com, those issues will be addressed, resolved and eventually released into a future GA release.

I'd recommend that anything you hit, report it so you might get a fix in the next GA...
thumbnail
Andre Kreienbring, modified 6 Years ago. Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
Ok, now I applied for a JIRA Account. But in the meantime:
Having updated to 7.3 GA the REST API obviously has changed.
For example: looking up existing DataDefinitions was previously done with a
GET .../o/data-engine/v1.0/sites/{sideId}/data-definitions

Now, looking into the source code here:
https://github.com/liferay/liferay-portal/blob/master/modules/apps/data-engine/data-engine-rest-client/src/main/java/com/liferay/data/engine/rest/client/resource/v2_0/DataDefinitionResource.java
I guess it must be something like:
GET .../o/data-engine/v2.0/data-definitions/by-content-type/{contentType}

This is a guess because I could not find a documentation of the new API. (Nothing in the Knowledge base or swagger hub...)
AND calling the endpoint like described above only raises an "500 Internal Server Error" (NPE in the logs) because (another guess) apperantly the sideId/groupId/sideKey is missing :-(
It seems like I'm an early bird playing around with the Data Engine, but I hope that somebody has more detailed information how to use the new REST API. If this is of any importance: Unlike the new "App Builder" I'm using the API from outside Liferay and with Basic Authentication.
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
FYI, the APIs for data engine and app builder have been uploaded to swaggerhub.
thumbnail
Andre Kreienbring, modified 6 Years ago. Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
Great news! Thank you!
For others beeing interested:
For 7.3 GA it's here:
https://app.swaggerhub.com/apis/liferayinc/data-engine/2.0
thumbnail
Andre Kreienbring, modified 6 Years ago. Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
After a hard time figuring out WTF {contentType} may be I found out (by inspecting the browsers console) when using "App Builder" that
GET http://[myHost:myPort]/o/data-engine/v2.0/sites/[mySiteId]/data-definitions/by-content-type/app-builder
is returning a valid JSON Response with an Items Array with the existing DataDefinitions. 
Maybe this saves others people time while waiting for the documantation of 7.3
BTW: App Builder is currently only working when using an english locale. There are issues reported that adress this situation...