Examples of DeepMergeOperation


Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {

                            DeepMergeOperation merger = new DeepMergeOperation(context);

                            // subclass descriptors will be resolved on the fly... here
                            // find objects base descriptor.
                            ListIterator it = objects.listIterator();
                            while (it.hasNext()) {
                                Persistent object = (Persistent) it.next();
                                ObjectId id = object.getObjectId();

                                // sanity check
                                if (id == null) {
                                    throw new CayenneRuntimeException(
                                            "Server returned an object without an id: "
                                                    + object);
                                }

                                // have to resolve descriptor here for every object, as
                                // often a query will not have any info indicating the
                                // entity type
                                ClassDescriptor descriptor = resolver
                                        .getClassDescriptor(id.getEntityName());

                                it.set(merger.merge(object, descriptor));
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {

                            DeepMergeOperation merger = new DeepMergeOperation(context);
                            List<Object> rsMapping = info.getResultSetMapping();
                            if (rsMapping == null) {
                                convertSingleObjects(resolver, objects, merger);
                            }
                            else {
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

        final Artist a = context.newObject(Artist.class);
        a.setArtistName("AAA");
        context.commitChanges();

        final DeepMergeOperation op = new DeepMergeOperation(context1);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                Artist a2 = (Artist) op.merge(a, d);
                assertNotNull(a2);
                assertEquals(PersistenceState.COMMITTED, a2.getPersistenceState());
                assertEquals(a.getArtistName(), a2.getArtistName());
            }
        });
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

        a.setArtistName("AAA");
        context.commitChanges();

        final Artist a1 = (Artist) Cayenne.objectForPK(context1, a.getObjectId());
        a1.setArtistName("BBB");
        final DeepMergeOperation op = new DeepMergeOperation(context1);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                Artist a2 = (Artist) op.merge(a, d);
                assertNotNull(a2);
                assertEquals(PersistenceState.MODIFIED, a2.getPersistenceState());
                assertSame(a1, a2);
                assertEquals("BBB", a2.getArtistName());
            }
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {

                            DeepMergeOperation merger = new DeepMergeOperation(context);

                            // subclass descriptors will be resolved on the fly... here
                            // find objects base descriptor.
                            ListIterator it = objects.listIterator();
                            while (it.hasNext()) {
                                Persistent object = (Persistent) it.next();
                                ObjectId id = object.getObjectId();

                                // sanity check
                                if (id == null) {
                                    throw new CayenneRuntimeException(
                                            "Server returned an object without an id: "
                                                    + object);
                                }

                                // have to resolve descriptor here for every object, as
                                // often a query will not have any info indicating the
                                // entity type
                                ClassDescriptor descriptor = resolver
                                        .getClassDescriptor(id.getEntityName());

                                it.set(merger.merge(object, descriptor));
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {

                            DeepMergeOperation merger = new DeepMergeOperation(context);

                            // subclass descriptors will be resolved on the fly... here
                            // find objects base descriptor.
                            ListIterator it = objects.listIterator();
                            while (it.hasNext()) {
                                Persistent object = (Persistent) it.next();
                                ObjectId id = object.getObjectId();

                                // sanity check
                                if (id == null) {
                                    throw new CayenneRuntimeException(
                                            "Server returned an object without an id: "
                                                    + object);
                                }

                                // have to resolve descriptor here for every object, as
                                // often a query will not have any info indicating the
                                // entity type
                                ClassDescriptor descriptor = resolver
                                        .getClassDescriptor(id.getEntityName());

                                it.set(merger.merge(object, descriptor));
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {
                      
                            DeepMergeOperation merger = new DeepMergeOperation(context);

                            // subclass descriptors will be resolved on the fly... here
                            // find objects base descriptor.
                            ListIterator it = objects.listIterator();
                            while (it.hasNext()) {
                                Persistent object = (Persistent) it.next();
                                ObjectId id = object.getObjectId();

                               
                                // sanity check
                                if (id == null) {
                                    throw new CayenneRuntimeException(
                                            "Server returned an object without an id: "
                                                    + object);
                                }

                                // have to resolve descriptor here for every object, as
                                // often a query will not have any info indicating the
                                // entity type
                                ClassDescriptor descriptor = resolver
                                        .getClassDescriptor(id.getEntityName());

                                it.set(merger.merge(object, descriptor));
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {

                            DeepMergeOperation merger = new DeepMergeOperation(context);

                            // subclass descriptors will be resolved on the fly... here
                            // find objects base descriptor.
                            ListIterator it = objects.listIterator();
                            while (it.hasNext()) {
                                Persistent object = (Persistent) it.next();
                                ObjectId id = object.getObjectId();

                                // sanity check
                                if (id == null) {
                                    throw new CayenneRuntimeException(
                                            "Server returned an object without an id: "
                                                    + object);
                                }

                                // have to resolve descriptor here for every object, as
                                // often a query will not have any info indicating the
                                // entity type
                                ClassDescriptor descriptor = resolver
                                        .getClassDescriptor(id.getEntityName());

                                it.set(merger.merge(object, descriptor));
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

                        List objects = response.currentList();

                        if (!objects.isEmpty()) {

                            DeepMergeOperation merger = new DeepMergeOperation(context);
                            List<Object> rsMapping = info.getResultSetMapping();
                            if (rsMapping == null) {
                                convertSingleObjects(resolver, objects, merger);
                            }
                            else {
View Full Code Here

Examples of org.apache.cayenne.util.DeepMergeOperation

        d1.getEmployees().size();

        // resolve Employees
        context1.performQuery(new SelectQuery(Employee.class));

        DeepMergeOperation op = new DeepMergeOperation(context1);

        blockQueries();
        try {
            Department d2 = (Department) op.merge(d1, d);
            assertNotNull(d2);
            assertEquals(PersistenceState.COMMITTED, d2.getPersistenceState());

            Iterator it = d2.getEmployees().iterator();
            while (it.hasNext()) {
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.