DataDomainIndirectDiffBuilder(DataDomainFlushAction parent) { this.parent = parent; this.indirectModifications = parent.getResultIndirectlyModifiedIds(); this.resolver = parent.getDomain().getEntityResolver(); this.flattenedInserts = new HashSet<FlattenedArcKey>(); this.flattenedDeletes = new HashSet<FlattenedArcKey>(); }
GraphDiff onSyncFlush(ObjectContext originatingContext, GraphDiff childChanges) { if (!(originatingContext instanceof DataContext)) { throw new CayenneRuntimeException( "No support for committing ObjectContexts that are not DataContexts yet. " + "Unsupported context: " + originatingContext); } DataDomainFlushAction action = new DataDomainFlushAction(this); action.setJdbcEventLogger(jdbcEventLogger); return action.flush((DataContext) originatingContext, childChanges); }
void processIndirectChanges(GraphDiff allChanges) { // extract flattened and indirect changes and remove duplicate changes... allChanges.apply(this); if (!flattenedInserts.isEmpty()) { for (final FlattenedArcKey key : flattenedInserts) { DbEntity entity = key.getJoinEntity(); parent.addFlattenedInsert(entity, key); } } if (!flattenedDeletes.isEmpty()) { for (final FlattenedArcKey key : flattenedDeletes) { DbEntity entity = key.getJoinEntity(); parent.addFlattenedDelete(entity, key); } } }