use of org.apache.cayenne.map.EntityInheritanceTree in project cayenne by apache.
the class ObjectContextQueryAction method polymorphicObjectFromCache.
private Object polymorphicObjectFromCache(EntityInheritanceTree superNode, Map<String, ?> idSnapshot) {
for (EntityInheritanceTree child : superNode.getChildren()) {
ObjectId id = new ObjectId(child.getEntity().getName(), idSnapshot);
Object object = actingContext.getGraphManager().getNode(id);
if (object != null) {
return object;
}
object = polymorphicObjectFromCache(child, idSnapshot);
if (object != null) {
return object;
}
}
return null;
}
use of org.apache.cayenne.map.EntityInheritanceTree in project cayenne by apache.
the class DataDomainQueryAction method polymorphicRowFromCache.
private DataRow polymorphicRowFromCache(ObjectId superOid) {
DataRow row = cache.getCachedSnapshot(superOid);
if (row != null) {
return row;
}
EntityInheritanceTree inheritanceTree = domain.getEntityResolver().getInheritanceTree(superOid.getEntityName());
if (!inheritanceTree.getChildren().isEmpty()) {
row = polymorphicRowFromCache(inheritanceTree, superOid.getIdSnapshot());
}
return row;
}
use of org.apache.cayenne.map.EntityInheritanceTree in project cayenne by apache.
the class ObjGraphBuilder method isIsolated.
@Override
protected boolean isIsolated(DataChannelDescriptor domain, Entity entity) {
if (!super.isIsolated(domain, entity)) {
return false;
}
if (((ObjEntity) entity).getSuperEntity() != null) {
return false;
}
// TODO: andrus 05/30/2010 - reindexing all DataMaps every time may be VERY slow on large projects
EntityResolver resolver = new EntityResolver(domain.getDataMaps());
EntityInheritanceTree inheritanceTree = resolver.getInheritanceTree(entity.getName());
return inheritanceTree == null || inheritanceTree.getChildren().isEmpty();
}
Aggregations