Author: michiel
Date: 2009-05-14 17:50:02 +0200 (Thu, 14 May 2009)
New Revision: 35174

Modified:
   mmbase/trunk/src/org/mmbase/datatypes/processors/Related.java
Log:
hmm, if node is new, query resulted _all_ relations (perhaps a bug?). But 
anyhow, it doesn't matter. We know that a new node has no relations yet.

Modified: mmbase/trunk/src/org/mmbase/datatypes/processors/Related.java
===================================================================
--- mmbase/trunk/src/org/mmbase/datatypes/processors/Related.java       
2009-05-14 15:46:35 UTC (rev 35173)
+++ mmbase/trunk/src/org/mmbase/datatypes/processors/Related.java       
2009-05-14 15:50:02 UTC (rev 35174)
@@ -103,12 +103,15 @@
                     log.debug("" + dest + " already correctly related");
                     // nothing changed
                 } else {
-                    for (Node r : rl) {
-                        log.debug("Deleting " + r);
-                        r.delete();
+                    RelationManager rel = getRelationManager(node);
+                    if (node.isNew()) {
+                        node.commit(); // Silly, but you cannot make relations 
to new nodes.
+                    } else {
+                        for (Node r : rl) {
+                            log.debug("Deleting " + r);
+                            r.delete();
+                        }
                     }
-                    RelationManager rel = getRelationManager(node);
-                    if (node.isNew()) node.commit(); // Silly, but you cannot 
make relations to new nodes.
                     Relation newrel = node.createRelation(dest, rel);
                     for (Map.Entry<String, String> entry : 
relationConstraints.entrySet()) {
                         newrel.setStringValue(entry.getKey(), 
entry.getValue());

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to