- if (changeTracking && !db)
- mapping.rangeModified(node);
- //updated.add(new Pair<E, String>(node, id));
- updated.add(node, id);
- rangeModified = true;
- }
- repaint();
- }
-
- private boolean graphUpdates = false;
- private Set<E> graphModified = new HashSet<E>();
-
- private boolean requestCommit = false;
- private String commitMessage = null;
-
- @Override
- public void commit(String message) {
- requestCommit = true;
- commitMessage = message;
- }
-
- protected void doCommit() throws DatabaseException {
- session.syncRequest(new WriteRequest() {
-
- @Override
- public void perform(WriteGraph graph) throws DatabaseException {
- if (DEBUG) System.out.println("Commit " + commitMessage);
- if (commitMessage != null) {
- Layer0Utils.addCommentMetadata(graph, commitMessage);
- graph.markUndoPoint();
- commitMessage = null;
- }
- commit(graph);
- }
-
- });
- }
-
- protected void commit(WriteGraph graph) throws DatabaseException {
- synchronized(syncMutex) {
- if (DEBUG) System.out.println("Commit");
- graphUpdates = true;
- mapping.updateDomain(graph);
- graphUpdates = false;
- clearDeletes();
- if (DEBUG) System.out.println("Commit done");
- }
- }
-
-
-
- @Override
- public void domainModified() {
- if (graphUpdates)
- return;
- if (DEBUG)System.out.println("domainModified");
- // FIXME : this is called by IMapping id DB thread
- session.asyncRequest(new ReadRequest() {
-
- @SuppressWarnings("unchecked")
- @Override
- public void run(ReadGraph graph) throws DatabaseException {
- update(graph);
- }
- });
-
- }
-
- protected void reset(ReadGraph graph) throws MappingException {
- if (DEBUG) System.out.println("Reset");
- synchronized (syncMutex) {
- graphUpdates = true;
- mapping.getRangeModified().clear();
- for (Object o : mapping.getDomain())
- mapping.domainModified(o);
- mapping.updateRange(graph);
- graphModified.clear();
- graphUpdates = false;
- }
- }
-
-
- protected void update(ReadGraph graph) throws DatabaseException {
- if (DEBUG) System.out.println("Graph update start");
- synchronized (syncMutex) {
- graphUpdates = true;
- for (Object domainObject : mapping.getDomainModified()) {
- E rangeObject = mapping.get(domainObject);
- if (rangeObject != null)
- graphModified.add(rangeObject);
- }
- mapping.updateRange(graph);
- graphModified.clear();
- syncDeletes();
- clearDeletes();
- graphUpdates = false;
- }
-
-
- //if (mapping.isRangeModified() && !runUndo) // FIXME : redo?
- if (mapping.isRangeModified())
- commit((String)null);
- if (DEBUG) System.out.println("Graph update done");
- }
-
- @Override
- public void rangeModified() {
- //System.out.println("rangeModified");
+ if (changeTracking && !db)
+ mapping.rangeModified(node);
+ //updated.add(new Pair<E, String>(node, id));
+ updated.add(node, id);
+ rangeModified = true;
+ }
+ repaint();
+ }
+
+ private boolean graphUpdates = false;
+ private Set<E> graphModified = new HashSet<E>();
+
+ private boolean requestCommit = false;
+ private String commitMessage = null;
+
+ @Override
+ public void commit(String message) {
+ requestCommit = true;
+ commitMessage = message;
+ }
+
+ protected void doCommit() throws DatabaseException {
+ session.syncRequest(new WriteRequest() {
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ if (DEBUG) System.out.println("Commit " + commitMessage);
+ if (commitMessage != null) {
+ Layer0Utils.addCommentMetadata(graph, commitMessage);
+ graph.markUndoPoint();
+ commitMessage = null;
+ }
+ commit(graph);
+ }
+
+ });
+ }
+
+ protected void commit(WriteGraph graph) throws DatabaseException {
+ synchronized(syncMutex) {
+ if (DEBUG) System.out.println("Commit");
+ graphUpdates = true;
+ mapping.updateDomain(graph);
+ graphUpdates = false;
+ clearDeletes();
+ if (DEBUG) System.out.println("Commit done");
+ }
+ }
+
+
+
+ @Override
+ public void domainModified() {
+ if (graphUpdates)
+ return;
+ if (DEBUG)System.out.println("domainModified");
+ // FIXME : this is called by IMapping id DB thread
+ dirty = true;
+// session.asyncRequest(new ReadRequest() {
+//
+// @SuppressWarnings("unchecked")
+// @Override
+// public void run(ReadGraph graph) throws DatabaseException {
+// update(graph);
+// }
+// });
+
+ }
+
+ protected void reset(ReadGraph graph) throws MappingException {
+ if (DEBUG) System.out.println("Reset");
+ synchronized (syncMutex) {
+ graphUpdates = true;
+ mapping.getRangeModified().clear();
+ for (DBObject o : mapping.getDomain())
+ mapping.domainModified(o);
+ mapping.updateRange(graph);
+ graphModified.clear();
+ graphUpdates = false;
+ }
+ }
+
+ protected void update(ReadGraph graph) throws DatabaseException {
+ if (DEBUG) System.out.println("Graph update start");
+ synchronized (syncMutex) {
+ graphUpdates = true;
+ for (DBObject domainObject : mapping.getDomainModified()) {
+ E rangeObject = mapping.get(domainObject);
+ if (rangeObject != null)
+ graphModified.add(rangeObject);
+ }
+ mapping.updateRange(graph);
+ graphModified.clear();
+ syncDeletes();
+ clearDeletes();
+ graphUpdates = false;
+ }
+
+
+ //if (mapping.isRangeModified() && !runUndo) // FIXME : redo?
+ if (mapping.isRangeModified())
+ commit((String)null);
+ if (DEBUG) System.out.println("Graph update done");
+ }
+
+ @Override
+ public void rangeModified() {
+ //System.out.println("rangeModified");