Author: michiel
Date: 2009-05-17 13:00:48 +0200 (Sun, 17 May 2009)
New Revision: 35208

Modified:
   mmbase/trunk/src/org/mmbase/datatypes/processors/RelatedList.java
Log:
sigh

Modified: mmbase/trunk/src/org/mmbase/datatypes/processors/RelatedList.java
===================================================================
--- mmbase/trunk/src/org/mmbase/datatypes/processors/RelatedList.java   
2009-05-17 10:59:41 UTC (rev 35207)
+++ mmbase/trunk/src/org/mmbase/datatypes/processors/RelatedList.java   
2009-05-17 11:00:48 UTC (rev 35208)
@@ -74,12 +74,21 @@
                 }
                 while(relatedNodes.remove(otherNode));
             }
-            RelationManager rel = 
cloud.getRelationManager(node.getNodeManager(),
-                                                           
cloud.getNodeManager(type),
-                                                           role);
+            RelationManager rel = "destination".equals(searchDir) ?
+                cloud.getRelationManager(node.getNodeManager(),
+                                         cloud.getNodeManager(type),
+                                         role) :
+                cloud.getRelationManager(cloud.getNodeManager(type),
+                                         node.getNodeManager(),
+                                         role);
+
             for (Node otherNode : relatedNodes) {
-                if (node.isNew()) node.commit(); // Silly, but you cannot make 
relations to new nodes.
-                Relation newrel = node.createRelation(otherNode, rel);
+                if (node.isNew()) {
+                    node.commit(); // Silly, but you cannot make relations to 
new nodes.
+                }
+                Relation newrel = searchDir.equals("destination") ?
+                    node.createRelation(otherNode, rel) :
+                    otherNode.createRelation(node, rel);
                 newrel.commit();
             }
             return otherNodes;

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

Reply via email to