At 10:37 +0200 24-05-2005, Michiel Meeuwissen wrote:
 > The implementation in
 org.mmbase.bridge.BasicRelationManager#mayCreateRelation
 only checks against security.

So why not change that? You showed how to do it!

I'm afraid it will break functionality in other uses of the bridge, for example the EditWizards. In the EditWizards it is possible to create a relation without explicitly specifying whether it is from source to destination or from destination to source iirc.

 > Next when a
 relation is created in
 BasicRelationManager#createRelation it checks if
 the relation is valid in
 > BasicRelation#checkValid() which 'looks' at both
 sides of the relation: it first checks whether
 source -> destination is present in TypeRel and
 then reverses it and checks destination -> source
 ;-) IIRC a relation with either direction is
 valid on the bridge.

 In taglib the createrelation tag throws an
 exception when you try to create a relation with
 the wrong directionality. So in a way this code
 is now in the right spot.

I think it is weird that the tag throws an exception and the bridge does
not, while the tag does nothing more than calling a bridge function:
 RelationManager rm = getCloudVar().getRelationManager(role.getString(this));
 Node sourceNode      = getNode(source.getString(this));
 Node destinationNode = getNode(destination.getString(this));

 Relation r = rm.createRelation(sourceNode, destinationNode);
 r.commit();

So, that means that RelationManager#createRelation throws an excpetion
when you turn source and destination around.

True.

That would make perfect sense to me, though the 'turn-around'
functionality about which you speaks sounds familiar too.

I think there must be symmetry in the bridge in the first place. You
cannot have checked 'mayCreateRelation' and then to find that the relation
you make with excactly the same arguments in 'createRelation' gives an
excpetion informing that you are not allowed.

That ambiguity lives in org.mmbase.corebuilders.InsRel#alignRelNode() i found out. It reverses the direction when it encounters a relation that it does not recognize. Then InsRel tries to swap them to produce a correct relation node.

Allthough I would not be be against working around such issues in the
taglib if necessary, I don't quite understand yet what is going on in
bridge here, and I have the feeling that the problem which you try to
solve here, would occur in bridge-only code too, because the
tag-implementations were so very straight-forward.

I agree. And in this i believe the bridge to be correct.

---Andr�
--
Andr� van Toly
http://www.toly.nl                                mobile +31(0)627233562
------------------------------------------------------------------>><<--
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers

Reply via email to