Search in sources :

Example 1 with ModelMetaData

use of jetbrains.exodus.query.metadata.ModelMetaData in project xodus by JetBrains.

the class TreeKeepingEntityIterable method instantiateForWholeHierarchy.

private Iterable<Entity> instantiateForWholeHierarchy(final String entityType, final NodeBase ast) {
    final ModelMetaData mmd = queryEngine.getModelMetaData();
    @Nullable final EntityMetaData emd = mmd == null ? null : mmd.getEntityMetaData(entityType);
    Iterable<Entity> result = (emd != null && emd.isAbstract()) ? EntityIterableBase.EMPTY : ast.getClone().instantiate(entityType, queryEngine, mmd, new NodeBase.InstantiateContext());
    if (!(emd == null || ast.polymorphic())) {
        for (String subType : emd.getSubTypes()) {
            if (Utils.getUnionSubtypes()) {
                // union returns sorted by id results provided its operands are sorted by id
                result = queryEngine.unionAdjusted(result, instantiateForWholeHierarchy(subType, ast));
            } else {
                result = queryEngine.concatAdjusted(result, instantiateForWholeHierarchy(subType, ast));
            }
        }
    }
    return queryEngine.adjustEntityIterable(result);
}
Also used : Entity(jetbrains.exodus.entitystore.Entity) EntityMetaData(jetbrains.exodus.query.metadata.EntityMetaData) Nullable(org.jetbrains.annotations.Nullable) ModelMetaData(jetbrains.exodus.query.metadata.ModelMetaData)

Aggregations

Entity (jetbrains.exodus.entitystore.Entity)1 EntityMetaData (jetbrains.exodus.query.metadata.EntityMetaData)1 ModelMetaData (jetbrains.exodus.query.metadata.ModelMetaData)1 Nullable (org.jetbrains.annotations.Nullable)1