use of com.haulmont.cuba.gui.data.impl.EmbeddedDatasourceImpl in project cuba by cuba-platform.
the class BulkEditorWindow method createNestedEmbeddedDatasources.
protected void createNestedEmbeddedDatasources(Datasource masterDs, MetaClass metaClass, String fqnPrefix) {
for (MetaProperty metaProperty : metaClass.getProperties()) {
if (MetaProperty.Type.ASSOCIATION == metaProperty.getType() || MetaProperty.Type.COMPOSITION == metaProperty.getType()) {
String fqn = metaProperty.getName();
if (StringUtils.isNotEmpty(fqnPrefix)) {
fqn = fqnPrefix + "." + fqn;
}
if (managedEmbeddedProperties.contains(fqn) && metadataTools.isEmbedded(metaProperty)) {
MetaClass propertyMetaClass = metaProperty.getRange().asClass();
@SuppressWarnings("unchecked") NestedDatasource<Entity> propertyDs = new EmbeddedDatasourceImpl();
propertyDs.setup(fqn + "Ds", masterDs, metaProperty.getName());
propertyDs.setAllowCommit(false);
createNestedEmbeddedDatasources(propertyDs, propertyMetaClass, fqn);
datasources.put(fqn, propertyDs);
dsContext.register(propertyDs);
}
}
}
}
Aggregations