]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Necessary changes for UC change management support 60/3760/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 7 Jan 2020 13:42:43 +0000 (15:42 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 7 Jan 2020 13:42:43 +0000 (15:42 +0200)
UpdateTree changes are applied before property changes, so that possible
UC additions/deletions are processed first. (This may require additional
changes).

Use possible custom property relation when applying PropertyChange.

Do not report added/removed asserted properties with GraphComparator.

gitlab #21

Change-Id: Ida163051fd27db06ab504ec86dc86d2d8887bfa0

org.simantics.interop.update/src/org/simantics/interop/update/model/ModelUpdate.java
org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java
org.simantics.interop/src/org/simantics/interop/test/GraphComparator.java

index 2cb2883ce4f0773e6fd9e5f37dabd0bfa81b0f1b..ff56d43ea6f6bd3ac1430dc3ee959b5eb4428ef4 100644 (file)
@@ -348,12 +348,13 @@ public abstract class ModelUpdate {
        public void applySelected(WriteGraph graph) throws DatabaseException {
                Layer0Utils.addCommentMetadata(graph, "Apply selected model updates");
                graph.markUndoPoint();
+               
+               updateTree.getUpdateOps().applySelected(graph);
+               
                for (PropertyChange mod : updateList.getChanges()) {
                        if (mod.selected())
                                mod.apply(graph);
                }
-               
-               updateTree.getUpdateOps().applySelected(graph);
        }
        
        
index 9a95984ed76986707b4991d18f2301d451c7f647..5220736d4259f803da5ed032273c8e6f20d46a56 100644 (file)
@@ -101,6 +101,9 @@ public class PropertyChange {
                                value = graph.getValue(pair.second.getObject());
                        }
                        Resource pred = pair.second.getPredicate();
+                       if (getChanges().getComparable().containsRight(pred))
+                               pred = getChanges().getComparable().getLeft(pred);
+                       
                        if (value != null) {
                                graph.deny(s, pred);
                                graph.claimLiteral(s, pred, value);
index 052a9a9ee19ad7bce23cba188e2bc923fbd76a2d..ac39e2f4f8f5d3b92c2176500c8751e31f8775d7 100644 (file)
@@ -850,8 +850,6 @@ public class GraphComparator {
                if (!changes1Set.contains(s)) {
                        changes1Set.add(s);
                        changes1.add(s);
-                       if (s.getObject().getResourceId() == 532631L)
-                               System.out.println();
                }
        }
        
@@ -1185,16 +1183,20 @@ public class GraphComparator {
                                        break;
                                else {
                                        while (i2 < ss2.size()) {
-                                               if (DEBUG) System.out.println("Compare Prop diff2 " + printStatement(g,ss2.get(i2)));
-                                               addAddition(ss2.get(i2));
+                                               Statement s = ss2.get(i2);
+                                               if (DEBUG) System.out.println("Compare Prop diff2 " + printStatement(g,s));
+                                               if (!s.isAsserted(r2))
+                                                       addAddition(s);
                                                i2++;
                                        }
                                        break;
                                }
                        } else if (i2 >= ss2.size()) {
                                while (i1 < ss1.size()) {
-                                       if (DEBUG) System.out.println("Compare Prop diff1 " + printStatement(g,ss1.get(i1)));
-                                       addDeletion(ss1.get(i1));
+                                       Statement s = ss1.get(i1);
+                                       if (DEBUG) System.out.println("Compare Prop diff1 " + printStatement(g,s));
+                                       if (!s.isAsserted(r1))
+                                               addDeletion(s);
                                        i1++;
                                }
                                break;