use of jetbrains.exodus.query.metadata.AssociationEndMetaData in project xodus by JetBrains.
the class QueryEngine method selectManyDistinct.
public Iterable<Entity> selectManyDistinct(Iterable<Entity> it, final String linkName) {
if (it == null) {
return EntityIterableBase.EMPTY;
}
if (mmd != null) {
if (it instanceof StaticTypedEntityIterable) {
final StaticTypedEntityIterable tree = (StaticTypedEntityIterable) it;
it = toEntityIterable(it);
if (isPersistentIterable(it)) {
final String entityType = tree.getEntityType();
final EntityMetaData emd = mmd.getEntityMetaData(entityType);
if (emd != null) {
final AssociationEndMetaData aemd = emd.getAssociationEndMetaData(linkName);
if (aemd != null) {
final String resultType = aemd.getOppositeEntityMetaData().getType();
return new StaticTypedIterableDecorator(resultType, selectManyDistinctImpl((EntityIterableBase) it, linkName), this);
}
}
}
} else if (isPersistentIterable(it)) {
return selectManyDistinctImpl((EntityIterableBase) it, linkName);
}
}
return inMemorySelectManyDistinct(it, linkName);
}
use of jetbrains.exodus.query.metadata.AssociationEndMetaData in project xodus by JetBrains.
the class QueryEngine method selectDistinct.
public Iterable<Entity> selectDistinct(Iterable<Entity> it, final String linkName) {
if (it == null) {
return EntityIterableBase.EMPTY;
}
if (mmd != null) {
if (it instanceof StaticTypedEntityIterable) {
final StaticTypedEntityIterable ktei = (StaticTypedEntityIterable) it;
it = toEntityIterable(it);
if (isPersistentIterable(it)) {
final String entityType = ktei.getEntityType();
final EntityMetaData emd = mmd.getEntityMetaData(entityType);
if (emd != null) {
final AssociationEndMetaData aemd = emd.getAssociationEndMetaData(linkName);
if (aemd != null) {
final String resultType = aemd.getOppositeEntityMetaData().getType();
return new StaticTypedIterableDecorator(resultType, selectDistinctImpl((EntityIterableBase) it, linkName), this);
}
}
}
} else if (isPersistentIterable(it)) {
return selectDistinctImpl((EntityIterableBase) it, linkName);
}
}
return inMemorySelectDistinct(it, linkName);
}
Aggregations