At 23:44 +0200 23-05-2005, Michiel Meeuwissen wrote:
+ // I think we should not use core-functionality in taglib implemenation
I agree but i could not find another way to check whether a relation is allowed honnering the source -> destination direction.
org.mmbase.module.core.MMBase mmb = org.mmbase.module.core.MMBase.getMMBase();int snumber = sourceNode.getNodeManager().getNumber(); int dnumber = destinationNode.getNodeManager().getNumber(); int rnumber = rm.getNumber();if (log.isDebugEnabled()) log.debug("snumber: " + snumber + " dnumber: " + dnumber + " rnumber: " + rnumber);- if (rm.mayCreateRelation(sourceNode, destinationNode) != getInverse() - && mmb.getTypeRel().contains(snumber, dnumber, rnumber) ) {+ if ((rm.mayCreateRelation(sourceNode, destinationNode) && mmb.getTypeRel().contains(snumber, dnumber, rnumber)) != getInverse()) { + // perhaps this mmb.getTypeRel must simply be moved to implementation of mayCreateRelation?
The implementation in org.mmbase.bridge.BasicRelationManager#mayCreateRelation only checks against security. 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.
---Andr� -- Andr� van Toly http://www.toly.nl mobile +31(0)627233562 ------------------------------------------------------------------>><<-- _______________________________________________ Developers mailing list [email protected] http://lists.mmbase.org/mailman/listinfo/developers
