Search in sources :

Example 1 with SnapshotEventDecorator

use of org.apache.cayenne.access.ObjectStore.SnapshotEventDecorator in project cayenne by apache.

the class DataContextMergeHandler method graphChanged.

// *** GraphEventListener methods
@Override
public void graphChanged(GraphEvent event) {
    // parent received external change
    if (shouldProcessEvent(event)) {
        // temp kludge - see TODO in ObjectStore.snapshotsChanged(..)
        GraphDiff diff = event.getDiff();
        if (diff instanceof SnapshotEventDecorator) {
            SnapshotEvent decoratedEvent = ((SnapshotEventDecorator) diff).getEvent();
            context.getObjectStore().processSnapshotEvent(decoratedEvent);
        } else {
            synchronized (context.getObjectStore()) {
                diff.apply(this);
            }
        }
        // repost channel change event for our own children
        context.fireDataChannelChanged(event.getPostedBy(), event.getDiff());
    }
}
Also used : GraphDiff(org.apache.cayenne.graph.GraphDiff) SnapshotEventDecorator(org.apache.cayenne.access.ObjectStore.SnapshotEventDecorator) SnapshotEvent(org.apache.cayenne.access.event.SnapshotEvent)

Aggregations

SnapshotEventDecorator (org.apache.cayenne.access.ObjectStore.SnapshotEventDecorator)1 SnapshotEvent (org.apache.cayenne.access.event.SnapshotEvent)1 GraphDiff (org.apache.cayenne.graph.GraphDiff)1