Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.EntityInheritanceTree


        // append Entity qualifiers, taking inheritance into account
        ObjEntity entity = getObjEntity();

        if (entity != null) {
            EntityInheritanceTree tree = queryAssembler
                    .getEntityResolver()
                    .lookupInheritanceTree(entity);
            Expression entityQualifier = (tree != null) ? tree
                    .qualifierForEntityAndSubclasses() : entity.getDeclaredQualifier();
            if (entityQualifier != null) {
                qualifier = (qualifier != null)
                        ? qualifier.andExp(entityQualifier)
                        : entityQualifier;
View Full Code Here


        this.context = context;
        this.cache = context.getObjectStore().getDataRowCache();
        this.refreshObjects = refresh;
        this.descriptor = descriptor;

        EntityInheritanceTree inheritanceTree = context
                .getEntityResolver()
                .lookupInheritanceTree(descriptor.getEntity());
        this.descriptorResolutionStrategy = inheritanceTree != null
                ? new InheritanceStrategy()
                : new NoInheritanceStrategy();
View Full Code Here

            else {
                createToOneProperty(descriptor, objRelationship);
            }
        }

        EntityInheritanceTree inheritanceTree = descriptorMap
                .getResolver()
                .lookupInheritanceTree(descriptor.getEntity());
        indexSubclassDescriptors(descriptor, inheritanceTree);
        indexQualifiers(descriptor, inheritanceTree);
View Full Code Here

        // append Entity qualifiers, taking inheritance into account
        ObjEntity entity = getObjEntity();

        if (entity != null) {
            EntityInheritanceTree tree = queryAssembler
                    .getEntityResolver()
                    .lookupInheritanceTree(entity);
            Expression entityQualifier = (tree != null) ? tree
                    .qualifierForEntityAndSubclasses() : entity.getDeclaredQualifier();
            if (entityQualifier != null) {
                qualifier = (qualifier != null)
                        ? qualifier.andExp(entityQualifier)
                        : entityQualifier;
View Full Code Here

        // append Entity qualifiers, taking inheritance into account
        ObjEntity entity = getObjEntity();

        if (entity != null) {
            EntityInheritanceTree tree = queryAssembler
                    .getEntityResolver()
                    .lookupInheritanceTree(entity);
            Expression entityQualifier = (tree != null) ? tree
                    .qualifierForEntityAndSubclasses() : entity.getDeclaredQualifier();
            if (entityQualifier != null) {
                qualifier = (qualifier != null)
                        ? qualifier.andExp(entityQualifier)
                        : entityQualifier;
View Full Code Here

        this.context = context;
        this.cache = context.getObjectStore().getDataRowCache();
        this.refreshObjects = refresh;
        this.descriptor = descriptor;

        EntityInheritanceTree inheritanceTree = context
                .getEntityResolver()
                .lookupInheritanceTree(descriptor.getEntity());
        this.descriptorResolutionStrategy = inheritanceTree != null
                ? new InheritanceStrategy()
                : new NoInheritanceStrategy();
View Full Code Here

        // * joined prefetch PK

        ObjEntity oe = getRootEntity();

        // null tree will indicate that we don't take inheritance into account
        EntityInheritanceTree tree = null;

        if (query.isResolvingInherited()) {
            tree = getRootInheritanceTree();
        }

        // ObjEntity attrs
        Iterator attrs = (tree != null) ? tree.allAttributes().iterator() : oe
                .getAttributes()
                .iterator();
        while (attrs.hasNext()) {
            ObjAttribute oa = (ObjAttribute) attrs.next();
            Iterator dbPathIterator = oa.getDbPathIterator();
            while (dbPathIterator.hasNext()) {
                Object pathPart = dbPathIterator.next();
                if (pathPart instanceof DbRelationship) {
                    DbRelationship rel = (DbRelationship) pathPart;
                    dbRelationshipAdded(rel);
                }
                else if (pathPart instanceof DbAttribute) {
                    DbAttribute dbAttr = (DbAttribute) pathPart;
                    if (dbAttr == null) {
                        throw new CayenneRuntimeException(
                                "ObjAttribute has no DbAttribute: " + oa.getName());
                    }

                    appendColumn(columns, oa, dbAttr, attributes, null);
                }
            }
        }

        // relationship keys
        Iterator rels = (tree != null) ? tree.allRelationships().iterator() : oe
                .getRelationships()
                .iterator();
        while (rels.hasNext()) {
            ObjRelationship rel = (ObjRelationship) rels.next();
            DbRelationship dbRel = (DbRelationship) rel.getDbRelationships().get(0);
View Full Code Here

        // append Entity qualifiers, taking inheritance into account
        ObjEntity entity = getObjEntity();

        if (entity != null) {
            EntityInheritanceTree tree =
                queryAssembler.getEntityResolver().lookupInheritanceTree(
                    entity);
            Expression entityQualifier =
                (tree != null)
                    ? tree.qualifierForEntityAndSubclasses()
                    : entity.getDeclaredQualifier();
            if (entityQualifier != null) {
                qualifier =
                    (qualifier != null)
                        ? qualifier.andExp(entityQualifier)
View Full Code Here

        setParentQuery(parentQuery);
        setPrefetchPath(prefetch);

        ObjEntity entity = parentQuery.getMetaData(resolver).getObjEntity();
        EntityInheritanceTree inheritanceTree = resolver.lookupInheritanceTree(entity);

        Iterator it = entity.resolvePathComponents(prefetch);

        // find root entity

        ObjRelationship r = null;
        while (it.hasNext()) {
            r = (ObjRelationship) it.next();
        }

        if (r == null) {
            throw new CayenneRuntimeException("Invalid prefetch '"
                    + prefetch
                    + "' for entity: "
                    + entity.getName());
        }

        setRoot(r.getTargetEntity());

        // chain query and entity qualifiers
        Expression queryQualifier = parentQuery.getQualifier();

        Expression entityQualifier = (inheritanceTree != null) ? inheritanceTree
                .qualifierForEntityAndSubclasses() : entity.getDeclaredQualifier();

        if (entityQualifier != null) {
            queryQualifier = (queryQualifier != null) ? queryQualifier
                    .andExp(entityQualifier) : entityQualifier;
View Full Code Here

        // append Entity qualifiers, taking inheritance into account
        ObjEntity entity = getObjEntity();

        if (entity != null) {
            EntityInheritanceTree tree =
                queryAssembler.getEntityResolver().lookupInheritanceTree(
                    entity);
            Expression entityQualifier =
                (tree != null)
                    ? tree.qualifierForEntityAndSubclasses()
                    : entity.getDeclaredQualifier();
            if (entityQualifier != null) {
                qualifier =
                    (qualifier != null)
                        ? qualifier.andExp(entityQualifier)
View Full Code Here

TOP

Related Classes of org.apache.cayenne.map.EntityInheritanceTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.