fixed a rather nasty bug in groupby subnode relations, introduced yesterday.

This commit is contained in:
hns 2001-07-26 17:40:25 +00:00
parent d7677773c5
commit dbee94cdd4

View file

@ -250,9 +250,9 @@ public class Relation {
throw new RuntimeException ("getVirtualSubnodeRelation called on non-virtual relation"); throw new RuntimeException ("getVirtualSubnodeRelation called on non-virtual relation");
Relation vr = null; Relation vr = null;
if (subnoderelation != null) if (subnoderelation != null)
vr = subnoderelation; vr = subnoderelation.makeClone ();
else else
vr = new Relation (other, localField, remoteField, direction, subnodesAreProperties); vr = makeClone ();
vr.groupby = groupby; vr.groupby = groupby;
vr.groupbyorder = groupbyorder; vr.groupbyorder = groupbyorder;
vr.groupbyprototype = groupbyprototype; vr.groupbyprototype = groupbyprototype;
@ -267,7 +267,7 @@ public class Relation {
public Relation getVirtualPropertyRelation () { public Relation getVirtualPropertyRelation () {
if (!virtual) if (!virtual)
throw new RuntimeException ("getVirtualPropertyRelation called on non-virtual relation"); 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.groupby = groupby;
vr.groupbyorder = groupbyorder; vr.groupbyorder = groupbyorder;
vr.groupbyprototype = groupbyprototype; vr.groupbyprototype = groupbyprototype;
@ -281,12 +281,12 @@ public class Relation {
*/ */
public Relation getGroupbySubnodeRelation () { public Relation getGroupbySubnodeRelation () {
if (groupby == null) 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; Relation vr = null;
if (subnoderelation != null) if (subnoderelation != null)
vr = subnoderelation; vr = subnoderelation.makeClone ();
else else
vr = new Relation (other, localField, remoteField, direction, subnodesAreProperties); vr = makeClone ();
vr.order = order; vr.order = order;
vr.prototype = groupbyprototype; vr.prototype = groupbyprototype;
return vr; return vr;
@ -298,12 +298,20 @@ public class Relation {
public Relation getGroupbyPropertyRelation () { public Relation getGroupbyPropertyRelation () {
if (groupby == null) if (groupby == null)
throw new RuntimeException ("getGroupbyPropertyRelation called on non-group-by relation"); 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.order = order;
vr.prototype = groupbyprototype; vr.prototype = groupbyprototype;
return vr; return vr;
} }
public Relation makeClone () {
return new Relation (other, localField, remoteField, direction, subnodesAreProperties);
}
public String toString () {
return "Relation["+home+">"+other+"]";
}
} }