From dbee94cdd405f32c07a1f6a36b6b206fe50bf279 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 26 Jul 2001 17:40:25 +0000 Subject: [PATCH] fixed a rather nasty bug in groupby subnode relations, introduced yesterday. --- src/helma/objectmodel/Relation.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/helma/objectmodel/Relation.java b/src/helma/objectmodel/Relation.java index 16c29f51..b53690db 100644 --- a/src/helma/objectmodel/Relation.java +++ b/src/helma/objectmodel/Relation.java @@ -250,9 +250,9 @@ public class Relation { throw new RuntimeException ("getVirtualSubnodeRelation called on non-virtual relation"); Relation vr = null; if (subnoderelation != null) - vr = subnoderelation; + vr = subnoderelation.makeClone (); else - vr = new Relation (other, localField, remoteField, direction, subnodesAreProperties); + vr = makeClone (); vr.groupby = groupby; vr.groupbyorder = groupbyorder; vr.groupbyprototype = groupbyprototype; @@ -267,7 +267,7 @@ public class Relation { public Relation getVirtualPropertyRelation () { if (!virtual) throw new RuntimeException ("getVirtualPropertyRelation called on non-virtual relation"); - Relation vr = new Relation (other, localField, remoteField, direction, subnodesAreProperties); + Relation vr = makeClone (); vr.groupby = groupby; vr.groupbyorder = groupbyorder; vr.groupbyprototype = groupbyprototype; @@ -281,12 +281,12 @@ public class Relation { */ public Relation getGroupbySubnodeRelation () { if (groupby == null) - throw new RuntimeException ("getGroupbyPropertyRelation called on non-group-by relation"); + throw new RuntimeException ("getGroupbySubnodeRelation called on non-group-by relation"); Relation vr = null; if (subnoderelation != null) - vr = subnoderelation; + vr = subnoderelation.makeClone (); else - vr = new Relation (other, localField, remoteField, direction, subnodesAreProperties); + vr = makeClone (); vr.order = order; vr.prototype = groupbyprototype; return vr; @@ -298,12 +298,20 @@ public class Relation { public Relation getGroupbyPropertyRelation () { if (groupby == null) throw new RuntimeException ("getGroupbyPropertyRelation called on non-group-by relation"); - Relation vr = new Relation (other, localField, remoteField, direction, subnodesAreProperties); + Relation vr = makeClone (); vr.order = order; vr.prototype = groupbyprototype; return vr; } + public Relation makeClone () { + return new Relation (other, localField, remoteField, direction, subnodesAreProperties); + } + + + public String toString () { + return "Relation["+home+">"+other+"]"; + } }