Search in sources :

Example 1 with HasEntityPointer

use of com.haulmont.cuba.core.sys.jpql.pointer.HasEntityPointer in project cuba by cuba-platform.

the class EntitiesFinder method resolveEntityNames.

protected void resolveEntityNames(Set<String> entityNames, PathNode node, DomainModel model, QueryVariableContext queryVariableContext) {
    List<Pointer> pointers = node.resolveTransitionalPointers(model, queryVariableContext);
    pointers.stream().filter(pointer -> pointer instanceof HasEntityPointer).forEach(pointer -> {
        JpqlEntityModel entityModel = ((HasEntityPointer) pointer).getEntity();
        if (entityModel != null) {
            entityNames.add(entityModel.getName());
        }
    });
}
Also used : HashSet(java.util.HashSet) JpqlEntityModel(com.haulmont.cuba.core.sys.jpql.model.JpqlEntityModel) Pointer(com.haulmont.cuba.core.sys.jpql.pointer.Pointer) CommonTree(org.antlr.runtime.tree.CommonTree) List(java.util.List) IdentificationVariableNode(com.haulmont.cuba.core.sys.jpql.tree.IdentificationVariableNode) Set(java.util.Set) HasEntityPointer(com.haulmont.cuba.core.sys.jpql.pointer.HasEntityPointer) TreeVisitorAction(org.antlr.runtime.tree.TreeVisitorAction) PathNode(com.haulmont.cuba.core.sys.jpql.tree.PathNode) JoinVariableNode(com.haulmont.cuba.core.sys.jpql.tree.JoinVariableNode) ArrayList(java.util.ArrayList) HasEntityPointer(com.haulmont.cuba.core.sys.jpql.pointer.HasEntityPointer) Pointer(com.haulmont.cuba.core.sys.jpql.pointer.Pointer) HasEntityPointer(com.haulmont.cuba.core.sys.jpql.pointer.HasEntityPointer) JpqlEntityModel(com.haulmont.cuba.core.sys.jpql.model.JpqlEntityModel)

Aggregations

JpqlEntityModel (com.haulmont.cuba.core.sys.jpql.model.JpqlEntityModel)1 HasEntityPointer (com.haulmont.cuba.core.sys.jpql.pointer.HasEntityPointer)1 Pointer (com.haulmont.cuba.core.sys.jpql.pointer.Pointer)1 IdentificationVariableNode (com.haulmont.cuba.core.sys.jpql.tree.IdentificationVariableNode)1 JoinVariableNode (com.haulmont.cuba.core.sys.jpql.tree.JoinVariableNode)1 PathNode (com.haulmont.cuba.core.sys.jpql.tree.PathNode)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 CommonTree (org.antlr.runtime.tree.CommonTree)1 TreeVisitorAction (org.antlr.runtime.tree.TreeVisitorAction)1