/** * Returns <code>true</code> if there are any modified, deleted or new * objects registered with this CayenneContext, <code>false</code> * otherwise. */ public boolean hasChanges() { return graphManager.hasChanges(); }
public void rollbackChangesLocally() { synchronized (graphManager) { if (graphManager.hasChanges()) { graphManager.graphReverted(); } } }
public void rollbackChanges() { synchronized (graphManager) { if (graphManager.hasChanges()) { GraphDiff diff = graphManager.getDiffs(); graphManager.graphReverted(); channel.onSync(this, diff, DataChannel.ROLLBACK_CASCADE_SYNC); } } }
@Override public void rollbackChangesLocally() { synchronized (graphManager) { if (graphManager.hasChanges()) { GraphDiff diff = graphManager.getDiffs(); graphManager.graphReverted(); fireDataChannelRolledback(this, diff); } } }
@Override public void rollbackChanges() { synchronized (graphManager) { if (graphManager.hasChanges()) { GraphDiff diff = graphManager.getDiffs(); graphManager.graphReverted(); channel.onSync(this, diff, DataChannel.ROLLBACK_CASCADE_SYNC); fireDataChannelRolledback(this, diff); } } }
public void graphRolledback(final GraphEvent e) { if (shouldProcessEvent(e)) { // do we need to merge anything? if (context.internalGraphManager().hasChanges()) { runWithEventsDisabled(new Runnable() { public void run() { context.internalGraphManager().graphReverted(); } }); // post event outside of "execute" to make sure it is sent repostAfterMerge(e); } } }
public void graphFlushed(final GraphEvent e) { // TODO (Andrus, 10/17/2005) - there are a few problems with commit processing: // 1. Event mechanism reliability: // - events may come out of order (commit and then preceeding flush) // - events may be missing all together (commit arrived, while prior flush did // not) // Possible solution - an "event_version_id" to be used for optimistic locking // 2. We don't know if our own dirty objects were committed or not... // For now we will simply merge the changes, and keep the context dirty if (shouldProcessEvent(e)) { final boolean hadChanges = context.internalGraphManager().hasChanges(); runWithEventsDisabled(new Runnable() { public void run() { if (e.getDiff() != null) { e.getDiff().apply(CayenneContextMergeHandler.this); } if (!hadChanges) { context.internalGraphManager().stateLog.graphCommitted(); context.internalGraphManager().reset(); } } }); // post event outside of "execute" to make sure it is sent repostAfterMerge(e); } }
GraphDiff doCommitChanges() { GraphDiff commitDiff = null; synchronized (graphManager) { if (graphManager.hasChanges()) { graphManager.graphCommitStarted(); try { commitDiff = channel.onSync(this, graphManager .getDiffsSinceLastFlush(), DataChannel.FLUSH_CASCADE_SYNC); } catch (Throwable th) { graphManager.graphCommitAborted(); if (th instanceof CayenneRuntimeException) { throw (CayenneRuntimeException) th; } else { throw new CayenneRuntimeException("Commit error", th); } } graphManager.graphCommitted(commitDiff); } } return commitDiff; }
if (graphManager.hasChanges()) {