use of org.apache.cayenne.commitlog.model.MutableChangeMap in project cayenne by apache.
the class CommitLogFilter method onSync.
@Override
public GraphDiff onSync(ObjectContext originatingContext, GraphDiff beforeDiff, int syncType, DataChannelFilterChain filterChain) {
// process commits only; skip rollback
if (syncType != DataChannel.FLUSH_CASCADE_SYNC && syncType != DataChannel.FLUSH_NOCASCADE_SYNC) {
return filterChain.onSync(originatingContext, beforeDiff, syncType);
}
// don't collect changes if there are no listeners
if (listeners.isEmpty()) {
return filterChain.onSync(originatingContext, beforeDiff, syncType);
}
MutableChangeMap changes = new MutableChangeMap();
// passing DataDomain, not ObjectContext to speed things up
// and avoid capturing changed state when fetching snapshots
DataChannel channel = originatingContext.getChannel();
beforeCommit(changes, channel, beforeDiff);
GraphDiff afterDiff = filterChain.onSync(originatingContext, beforeDiff, syncType);
afterCommit(changes, channel, beforeDiff, afterDiff);
notifyListeners(originatingContext, changes);
return afterDiff;
}
use of org.apache.cayenne.commitlog.model.MutableChangeMap in project cayenne by apache.
the class CommitLogFilter method onSync.
@Override
public GraphDiff onSync(ObjectContext originatingContext, GraphDiff beforeDiff, int syncType, DataChannelSyncFilterChain filterChain) {
// process commits only; skip rollback
if (syncType != DataChannel.FLUSH_CASCADE_SYNC && syncType != DataChannel.FLUSH_NOCASCADE_SYNC) {
return filterChain.onSync(originatingContext, beforeDiff, syncType);
}
// don't collect changes if there are no listeners
if (listeners.isEmpty()) {
return filterChain.onSync(originatingContext, beforeDiff, syncType);
}
MutableChangeMap changes = new MutableChangeMap();
// passing DataDomain, not ObjectContext to speed things up
// and avoid capturing changed state when fetching snapshots
DataChannel channel = originatingContext.getChannel();
beforeCommit(changes, channel, beforeDiff);
GraphDiff afterDiff = filterChain.onSync(originatingContext, beforeDiff, syncType);
afterCommit(changes, channel, beforeDiff, afterDiff);
notifyListeners(originatingContext, changes);
return afterDiff;
}
Aggregations