How to create a Import/Export Feature without changing my domain model

0
Hello,   I am creating a “Media Orchestration” application which allows users to create Scenarios in which applications on various computers can be coordinated to run. I have got my app working and now want to add Import/Export functionality but I’m coming across problems on how to do that with my current domain model shown below.   I have created my own JSON structure which would fit how I’d imagine the data should look like exported (shown below). Side note – I am surprised Mendix doesnt support an “Auto generated” JSON file based on a selected entities. If that does exist please let me know. The issue is that the Export Mapping generated by the JSON file doesnt match my domain model and creates additional entities which then lead to error CE0001 (“An association between a persistable entity and a non-persistable entity must start in the non-persistable entity and have owner ‘Default’).  The Map automatically gives me problems where it generates a structure which doesnt match my data model. Any idea how to create an import/export model which doesnt require additional entities which doesnt match my model? Or have any ideas on the simplest solution to my issue?  Would also love it if someone can share or point to a Project I can download which shows how one can export/import more complicated data models. The learning path trainings used examples that were to simple to be relevant.      {     "Scenarios": [         {             "Name": "Scenario 1",             "Description": "A",             "Script": "Lot1",             "Content": [                 {                     "Name": "content1",                     "Description": "A",                     "Orientation": "Lot1",                     "Screen": {                         "Name": "ScreenName",                         "IP": "ScreenDescription"                     },                     "Application": {                         "Name": "ApplicationName",                         "Description": "ApplicationDesc",                         "RootAPI": "AppRootAPI",                         "Actions": [                             {                                 "Name": "ActionDescription1",                                 "Description": "ActionsDesc1",                                 "APIcommand": "APIcommand1"                             },                             {                                 "Name": "ActionDescription2",                                 "Description": "ActionsDesc2",                                 "APIcommand": "APIcommand2"                             }                         ]                     },                     "ActionInstances": [                         {                             "Arguement": "Arguement1"                         },                         {                             "Arguement": "Arguement2"                         }                     ]                 }             ]         }     ] }
asked
1 answers
1

Dmitri,

Mendix does support (sort of) auto generation of JSON structures.  This documentation on Message Definitions will get you started with how to do that: https://docs.mendix.com/refguide/message-definitions  It may not work as you are envisioning, but I would give it a try as it will only take a short time and you’ll see how this feature of Mendix works.

Hope that helps,

Mike

answered