Package org.apache.cayenne.map

Examples of org.apache.cayenne.map.EntitySorter


            }
        }

        // sort table list
        if (tables.size() > 1) {
            EntitySorter sorter = new AshwoodEntitySorter();
            sorter.setEntityResolver(new EntityResolver(Collections.singleton(map)));
            sorter.sortDbEntities(tables, false);
        }

        this.dbEntitiesInInsertOrder = tables;
        this.dbEntitiesRequiringAutoPK = tablesWithAutoPk;
    }
View Full Code Here


            return;
        }

        // sort entities for insertion
        List sorted = new ArrayList(entities);
        EntitySorter sorter = new AshwoodEntitySorter();
        sorter.setEntityResolver(new EntityResolver(destinationNode.getDataMaps()));
        sorter.sortDbEntities(sorted, false);

        if (cleaningDestination) {
            // reverse insertion order for deletion
            List entitiesInDeleteOrder = new ArrayList(sorted.size());
            entitiesInDeleteOrder.addAll(sorted);
View Full Code Here

    @Override
    void appendQueriesInternal(Collection<Query> queries) {

        DataDomainDBDiffBuilder diffBuilder = new DataDomainDBDiffBuilder();

        EntitySorter sorter = parent.getDomain().getEntitySorter();
        sorter.sortDbEntities(dbEntities, false);

        for (DbEntity dbEntity : dbEntities) {

            Collection<DbEntityClassDescriptor> descriptors = descriptorsByDbEntity
                    .get(dbEntity);

            InsertBatchQuery batch = new InsertBatchQuery(dbEntity, 27);
            for (DbEntityClassDescriptor descriptor : descriptors) {

                diffBuilder.reset(descriptor);

                List<Persistent> objects = objectsByDescriptor.get(descriptor
                        .getClassDescriptor());
                if (objects.isEmpty()) {
                    continue;
                }

                checkReadOnly(descriptor.getEntity());
                createPermIds(descriptor, objects);
                sorter.sortObjectsForEntity(descriptor.getEntity(), objects, false);

                for (Persistent o : objects) {
                    Map<Object, Object> snapshot = diffBuilder.buildDBDiff(parent
                            .objectDiff(o.getObjectId()));
View Full Code Here

    assertNotNull(domain1);

    EventManager eventManager1 = domain1.getEventManager();
    assertNotNull(eventManager1);

    EntitySorter sorter1 = domain1.getEntitySorter();
    assertNotNull(sorter1);

    DataDomain domain2 = runtime.getDataDomain();
    assertNotNull(domain2);

    EventManager eventManager2 = domain2.getEventManager();
    assertNotNull(eventManager2);

    EntitySorter sorter2 = domain2.getEntitySorter();
    assertNotNull(sorter2);

    assertSame(domain1, domain2);
    assertSame(eventManager1, eventManager2);
    assertSame(sorter1, sorter2);
View Full Code Here

    assertNotNull(context1);
    assertTrue(context1 instanceof DataContext);

    DataDomain domain1 = (DataDomain) context1.getChannel();
    EventManager eventManager1 = domain1.getEventManager();
    EntitySorter sorter1 = domain1.getEntitySorter();

    ObjectContext context2 = runtime.getContext();
    assertNotNull(context2);
    assertTrue(context2 instanceof DataContext);
    DataDomain domain2 = (DataDomain) context2.getChannel();
    EventManager eventManager2 = domain2.getEventManager();
    EntitySorter sorter2 = domain2.getEntitySorter();

    assertNotSame(context1, context2);

    assertSame(domain1, domain2);
    assertSame(eventManager1, eventManager2);
View Full Code Here

    @Override
    void appendQueriesInternal(Collection<Query> queries) {

        DataNodeSyncQualifierDescriptor qualifierBuilder = new DataNodeSyncQualifierDescriptor();

        EntitySorter sorter = parent.getDomain().getEntitySorter();
        sorter.sortDbEntities(dbEntities, true);

        for (DbEntity dbEntity : dbEntities) {
            Collection<DbEntityClassDescriptor> descriptors = descriptorsByDbEntity
                    .get(dbEntity);
            Map<Object, Query> batches = new LinkedHashMap<Object, Query>();

            for (DbEntityClassDescriptor descriptor : descriptors) {

                qualifierBuilder.reset(descriptor);

                boolean isRootDbEntity = descriptor.isMaster();

                // remove object set for dependent entity, so that it does not show up
                // on post processing
                List<Persistent> objects = objectsByDescriptor.get(descriptor
                        .getClassDescriptor());
                if (objects.isEmpty()) {
                    continue;
                }

                checkReadOnly(descriptor.getEntity());

                if (isRootDbEntity) {
                    sorter.sortObjectsForEntity(descriptor.getEntity(), objects, true);
                }

                for (Persistent o : objects) {
                    ObjectDiff diff = parent.objectDiff(o.getObjectId());
View Full Code Here

TOP

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

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.