I’m having an issue with nested and embedded classes/data sources at run time. The xml is below which works fine in most cases but at run time a new item in the collection is added and the nested datasource is always null.
<collectionDatasource id="shipmentsDs"
property="shipments">
<datasource id="shipToContactDs"
property="shipToContact">
<datasource id="shipToContactContactDs"
property="cont"/>
<datasource id="shipToContactAddressDs"
property="addr"/>
I found I can programmatically create the nested datasource (shipToContact) but having trouble creating the two under the it. Each is an embedded class. Not sure if these should be embedded or nested, tried both
Here is the code to build the initial datasource under the collection datasource
Datasource ds = new DsBuilder(getDsContext())
.setJavaClass(OrderContact.class)
.setViewName(View.LOCAL)
.setId(“shipToContactDs”)
.buildDatasource();
ds.setItem(newItem);
Datasource dsAddrs = new DsBuilder(getDsContext())
.setJavaClass(AddressEmbedded.class)
.setViewName(View.LOCAL)
.setId(“shipToContactAddressDs”)
.setMaster(shipToContactDs)
.setMetaClass(metaClass)
.setProperty(“addr”)
.buildDatasource();
One of the errors I received is metaProperty required (or something like that) I haven’t been been able to find what either meta property or property actually requires.
Any help would be appreciated. An example would be great!
Thanks