@Override public void setParentDs(Datasource parentDs) { Datasource ds = getDatasourceInternal(); ((DatasourceImplementation) ds).setParent(parentDs); }
protected void addParentsToNested() { if (parentDs == null || getDsContext() == parentDs.getDsContext()) { return; } // Iterate through all datasources in the same DsContext for (Datasource sibling : getDsContext().getAll()) { // If the datasource is a property datasource of the Child if (sibling instanceof NestedDatasource && ((NestedDatasource) sibling).getMaster().equals(this) && !metadata.getTools().isEmbeddable(sibling.getMetaClass())) { // Look for corresponding property datasource in the Parent's DsContext for (Datasource siblingOfParent : parentDs.getDsContext().getAll()) { if (siblingOfParent instanceof NestedDatasource && ((NestedDatasource) siblingOfParent).getProperty().equals(((NestedDatasource) sibling).getProperty()) && ((NestedDatasource) siblingOfParent).getMaster() == parentDs) { // If such corresponding datasource found, set it as a parent for our property datasource ((DatasourceImplementation) sibling).setParent(siblingOfParent); } } } } }