Examples of PrefetchTreeNode


Examples of org.apache.cayenne.query.PrefetchTreeNode

        ObjEntity e5 = getObjEntity("ArtistExhibit");

        List mainRows = new ArrayList();
        Map extraRows = new HashMap();

        PrefetchTreeNode tree = new PrefetchTreeNode();
        tree.addPath(Artist.PAINTING_ARRAY_PROPERTY).setPhantom(false);
        tree.addPath(
                Artist.PAINTING_ARRAY_PROPERTY
                        + "."
                        + Painting.TO_GALLERY_PROPERTY
                        + "."
                        + Gallery.EXHIBIT_ARRAY_PROPERTY).setPhantom(false);
        tree.addPath(Artist.ARTIST_EXHIBIT_ARRAY_PROPERTY).setPhantom(false);

        QueryMetadata metadata = new MockQueryMetadata() {

            @Override
            public ClassDescriptor getClassDescriptor() {
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

            List mainRows = response.firstList();
            if (mainRows != null && !mainRows.isEmpty()) {

                List objects;
                ObjEntity entity = metadata.getObjEntity();
                PrefetchTreeNode prefetchTree = metadata.getPrefetchTree();

                // take a shortcut when no prefetches exist...
                if (prefetchTree == null) {
                    objects = new ObjectResolver(context, entity, metadata
                            .isRefreshingObjects(), metadata.isResolvingInherited())
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

        }

        ObjEntity entity = metadata.getObjEntity();
        Iterator prefetchesIt = prefetches.iterator();
        while (prefetchesIt.hasNext()) {
            PrefetchTreeNode prefetch = (PrefetchTreeNode) prefetchesIt.next();
            String path = prefetch.getPath();
            if (path.indexOf('.') >= 0) {
                throw new CayenneRuntimeException("Only one-step relationships are "
                        + "supported at the moment, this will be fixed soon. "
                        + "Unsupported path : "
                        + path);
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

                    .getPrefetchTree()
                    .adjacentJointNodes()
                    .iterator();

            while (jointPrefetches.hasNext()) {
                PrefetchTreeNode prefetch = (PrefetchTreeNode) jointPrefetches.next();

                // for each prefetch add all joins plus columns from the target entity
                Expression prefetchExp = Expression.fromString(prefetch.getPath());
                Expression dbPrefetch = oe.translateToDbPath(prefetchExp);

                Iterator it = table.resolvePathComponents(dbPrefetch);

                DbRelationship r = null;
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

     */
    private void buildRowMapping() {
        Map targetSource = new TreeMap();

        // build a DB path .. find parent node that terminates the joint group...
        PrefetchTreeNode jointRoot = this;
        while (jointRoot.getParent() != null && !jointRoot.isDisjointPrefetch()) {
            jointRoot = jointRoot.getParent();
        }

        String prefix;
        if (jointRoot != this) {
            Expression objectPath = Expression.fromString(getPath(jointRoot));
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

     */
    private void buildRowMapping() {
        Map targetSource = new TreeMap();

        // build a DB path .. find parent node that terminates the joint group...
        PrefetchTreeNode jointRoot = this;
        while (jointRoot.getParent() != null && !jointRoot.isDisjointPrefetch()) {
            jointRoot = jointRoot.getParent();
        }

        String prefix;
        if (jointRoot != this) {
            Expression objectPath = Expression.fromString(getPath(jointRoot));
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

                    .getPrefetchTree()
                    .adjacentJointNodes()
                    .iterator();

            while (jointPrefetches.hasNext()) {
                PrefetchTreeNode prefetch = (PrefetchTreeNode) jointPrefetches.next();

                // for each prefetch add all joins plus columns from the target entity
                Expression prefetchExp = Expression.fromString(prefetch.getPath());
                Expression dbPrefetch = oe.translateToDbPath(prefetchExp);

                Iterator it = table.resolvePathComponents(dbPrefetch);

                DbRelationship r = null;
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

            List mainRows = response.firstList();
            if (mainRows != null && !mainRows.isEmpty()) {

                List objects;
                ClassDescriptor descriptor = metadata.getClassDescriptor();
                PrefetchTreeNode prefetchTree = metadata.getPrefetchTree();

                // take a shortcut when no prefetches exist...
                if (prefetchTree == null) {
                    objects = new ObjectResolver(context, descriptor, metadata
                            .isRefreshingObjects(), metadata.isResolvingInherited())
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

        descriptor.visitProperties(new PropertyVisitor() {

            public boolean visitSingleObjectArc(SingleObjectArcProperty property) {
                if (prefetchTree != null) {

                    PrefetchTreeNode child = prefetchTree.getNode(property.getName());

                    if (child != null) {
                        Object destinationSource = property.readProperty(source);

                        Object destinationTarget = destinationSource != null ? detach(
                                destinationSource,
                                property.getTargetDescriptor(),
                                child) : null;

                        SingleObjectArcProperty targetProperty = (SingleObjectArcProperty) targetDescriptor
                                .getProperty(property.getName());
                        Object oldTarget = targetProperty.isFault(target)
                                ? null
                                : targetProperty.readProperty(target);
                        targetProperty
                                .writeProperty(target, oldTarget, destinationTarget);
                    }
                }

                return true;
            }

            public boolean visitCollectionArc(CollectionProperty property) {
                if (prefetchTree != null) {
                    PrefetchTreeNode child = prefetchTree.getNode(property.getName());

                    if (child != null) {
                        Collection collection = (Collection) property
                                .readProperty(source);
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

        if (!serverObjects.isEmpty()) {
            ObjectDetachOperation op = new ObjectDetachOperation(serverResolver
                    .getClientEntityResolver());
            Iterator it = serverObjects.iterator();
            PrefetchTreeNode prefetchTree = serverMetadata.getPrefetchTree();

            while (it.hasNext()) {
                Persistent object = (Persistent) it.next();
                ObjectId id = object.getObjectId();
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.