use of org.apache.olingo.commons.api.edm.EdmNavigationProperty in project teiid by teiid.
the class TeiidServiceHandler method insertDepth.
private int insertDepth(EdmEntityType entityType, Entity entity) throws SQLException, TeiidException {
int depth = 1;
int childDepth = 0;
for (String navigationName : entityType.getNavigationPropertyNames()) {
EdmNavigationProperty navProperty = entityType.getNavigationProperty(navigationName);
Link navLink = entity.getNavigationLink(navigationName);
if (navLink != null && navLink.getInlineEntity() != null) {
childDepth = Math.max(childDepth, insertDepth(navProperty.getType(), navLink.getInlineEntity()));
} else if (navLink != null && navLink.getInlineEntitySet() != null && !navLink.getInlineEntitySet().getEntities().isEmpty()) {
for (Entity inlineEntity : navLink.getInlineEntitySet().getEntities()) {
childDepth = Math.max(childDepth, insertDepth(navProperty.getType(), inlineEntity));
}
}
}
return depth + childDepth;
}
Aggregations