Examples of CayenneMapEntry


Examples of org.apache.cayenne.util.CayenneMapEntry

            return items;
        }

        Iterator<?> it = items.iterator();
        while (it.hasNext()) {
            CayenneMapEntry entity = (CayenneMapEntry) it.next();

            if (!passedIncludeFilter(entity)) {
                it.remove();
                continue;
            }
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

    /**
     * Helper method to evaluate path expression with Cayenne Entity.
     */
    protected CayenneMapEntry evaluateEntityNode(Entity entity) {
        Iterator<CayenneMapEntry> path = entity.resolvePathComponents(this);
        CayenneMapEntry next = null;
        while (path.hasNext()) {
            next = path.next();
        }

        return next;
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

    /**
     * Returns a DbAttribute mapped by this ObjAttribute.
     */
    public DbAttribute getDbAttribute() {
        Iterator<CayenneMapEntry> pathIterator = getDbPathIterator((ObjEntity) getEntity());
        CayenneMapEntry o = null;
        while (pathIterator.hasNext()) {
            o = pathIterator.next();
        }
        if (o == null) {
            return getParentDbAttribute((ObjEntity) getEntity());
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

    private DbAttribute getParentDbAttribute(ObjEntity entity) {
        if (entity != null) {
            ObjEntity parent = entity.getSuperEntity();
            if (parent != null) {
                Iterator<CayenneMapEntry> pathIterator = getDbPathIterator(parent);
                CayenneMapEntry o = null;
                while (pathIterator.hasNext()) {
                    o = pathIterator.next();
                }
                if (o == null) {
                    return getParentDbAttribute(parent);
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

        }
       
        private void appendPath(
                LinkedList<String> finalPath,
                PathComponent<Attribute, Relationship> pathComponent) {
            CayenneMapEntry mapEntry = pathComponent.getAttribute() != null ?
                pathComponent.getAttribute() :
                pathComponent.getRelationship();
            String name = mapEntry.getName();
            if (pathComponent.getJoinType() == JoinType.LEFT_OUTER) {
                name += OUTER_JOIN_INDICATOR;
            }
           
            finalPath.addLast(name);
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

                            + component);
                }

                boolean firstComponent = true;
                while (dbSubpath.hasNext()) {
                    CayenneMapEntry subComponent = (CayenneMapEntry) dbSubpath.next();
                    if (buf.length() > 0) {
                        buf.append(Entity.PATH_SEPARATOR);
                    }

                    buf.append(subComponent.getName());
                    if (firstComponent && component.getJoinType() == JoinType.LEFT_OUTER) {
                        buf.append(OUTER_JOIN_INDICATOR);
                    }
                    firstComponent = false;
                }
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

                    throw new CayenneRuntimeException("Unknown path component: "
                            + component);
                }

                while (dbSubpath.hasNext()) {
                    CayenneMapEntry subComponent = (CayenneMapEntry) dbSubpath.next();
                    if (buf.length() > 0) {
                        buf.append(Entity.PATH_SEPARATOR);
                    }

                    buf.append(subComponent.getName());
                }
            }

            return buf.toString();
        }
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

                    prependReversedPath(finalPath, nextDBR);
                }

                while (pathIt.hasNext()) {
                    // components may be attributes or relationships
                    CayenneMapEntry next = pathIt.next();
                    appendPath(finalPath, next);
                }

                return convertToPath(finalPath);
            }
            // case (1)
            if (path.equals(relationshipPath)) {

                LinkedList<String> finalPath = new LinkedList<String>();
                Iterator<CayenneMapEntry> it = resolvePathComponents(path);

                // just do one step back and one step forward to create correct joins...
                // find last rel...
                DbRelationship lastDBR = null;

                while (it.hasNext()) {
                    // relationship path components must be DbRelationships
                    lastDBR = (DbRelationship) it.next();
                }

                if (lastDBR != null) {
                    prependReversedPath(finalPath, lastDBR);
                    appendPath(finalPath, lastDBR);
                }

                return convertToPath(finalPath);
            }

            // case (2)
            String relationshipPathWithDot = relationshipPath + Entity.PATH_SEPARATOR;
            if (path.startsWith(relationshipPathWithDot)) {
                return path.substring(relationshipPathWithDot.length());
            }

            // case (3)
            Iterator<CayenneMapEntry> pathIt = resolvePathComponents(path);
            Iterator<CayenneMapEntry> relationshipIt = resolvePathComponents(relationshipPath);

            // for inserts from the both ends use LinkedList
            LinkedList<String> finalPath = new LinkedList<String>();

            while (relationshipIt.hasNext() && pathIt.hasNext()) {
                // relationship path components must be DbRelationships
                DbRelationship nextDBR = (DbRelationship) relationshipIt.next();

                // expression components may be attributes or relationships
                CayenneMapEntry next = pathIt.next();

                if (nextDBR != next) {
                    // found split point
                    // consume the last iteration components,
                    // then break out to finish the iterators independently
                    prependReversedPath(finalPath, nextDBR);
                    appendPath(finalPath, next);
                    break;
                }

                break;
            }

            // append remainder of the relationship, reversing it
            while (relationshipIt.hasNext()) {
                DbRelationship nextDBR = (DbRelationship) relationshipIt.next();
                prependReversedPath(finalPath, nextDBR);
            }

            while (pathIt.hasNext()) {
                // components may be attributes or relationships
                CayenneMapEntry next = pathIt.next();
                appendPath(finalPath, next);
            }

            return convertToPath(finalPath);
        }
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

    /**
     * Returns a DbAttribute mapped by this ObjAttribute.
     */
    public DbAttribute getDbAttribute() {
        Iterator<CayenneMapEntry> pathIterator = getDbPathIterator();
        CayenneMapEntry o = null;
        while (pathIterator.hasNext()) {
            o = pathIterator.next();
        }
        return (DbAttribute) o;
    }
View Full Code Here

Examples of org.apache.cayenne.util.CayenneMapEntry

                    throw new CayenneRuntimeException("Unknown path component: "
                            + component);
                }

                while (dbSubpath.hasNext()) {
                    CayenneMapEntry subComponent = (CayenneMapEntry) dbSubpath.next();
                    if (buf.length() > 0) {
                        buf.append(Entity.PATH_SEPARATOR);
                    }

                    buf.append(subComponent.getName());
                }
            }

            return buf.toString();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.