increased node serialization version, check for order in getGroupbySubnode
This commit is contained in:
parent
433fb5d580
commit
30f539b396
1 changed files with 14 additions and 6 deletions
|
@ -46,6 +46,9 @@ public class Node implements INode, Serializable {
|
||||||
|
|
||||||
private void readObject (ObjectInputStream in) throws IOException {
|
private void readObject (ObjectInputStream in) throws IOException {
|
||||||
try {
|
try {
|
||||||
|
// as a general rule of thumb, if a string can bu null use read/writeObject,
|
||||||
|
// if not it's save to use read/writeUTF.
|
||||||
|
// version indicates the serialization version
|
||||||
int version = in.readShort ();
|
int version = in.readShort ();
|
||||||
id = in.readUTF ();
|
id = in.readUTF ();
|
||||||
name = in.readUTF ();
|
name = in.readUTF ();
|
||||||
|
@ -59,15 +62,17 @@ public class Node implements INode, Serializable {
|
||||||
proplinks = (Vector) in.readObject ();
|
proplinks = (Vector) in.readObject ();
|
||||||
propMap = (Hashtable) in.readObject ();
|
propMap = (Hashtable) in.readObject ();
|
||||||
anonymous = in.readBoolean ();
|
anonymous = in.readBoolean ();
|
||||||
if (version > 1)
|
if (version == 2)
|
||||||
prototype = in.readUTF ();
|
prototype = in.readUTF ();
|
||||||
|
else if (version == 3)
|
||||||
|
prototype = (String) in.readObject ();
|
||||||
} catch (ClassNotFoundException x) {
|
} catch (ClassNotFoundException x) {
|
||||||
throw new IOException (x.toString ());
|
throw new IOException (x.toString ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeObject (ObjectOutputStream out) throws IOException {
|
private void writeObject (ObjectOutputStream out) throws IOException {
|
||||||
out.writeShort (2); // serialization version
|
out.writeShort (3); // serialization version
|
||||||
out.writeUTF (id);
|
out.writeUTF (id);
|
||||||
out.writeUTF (name);
|
out.writeUTF (name);
|
||||||
out.writeObject (parentID);
|
out.writeObject (parentID);
|
||||||
|
@ -84,7 +89,7 @@ public class Node implements INode, Serializable {
|
||||||
out.writeObject (proplinks);
|
out.writeObject (proplinks);
|
||||||
out.writeObject (propMap);
|
out.writeObject (propMap);
|
||||||
out.writeBoolean (anonymous);
|
out.writeBoolean (anonymous);
|
||||||
out.writeUTF (prototype);
|
out.writeObject (prototype);
|
||||||
}
|
}
|
||||||
|
|
||||||
transient String prototype;
|
transient String prototype;
|
||||||
|
@ -795,14 +800,17 @@ public class Node implements INode, Serializable {
|
||||||
Relation srel = dbmap.getSubnodeRelation ();
|
Relation srel = dbmap.getSubnodeRelation ();
|
||||||
Relation prel = dbmap.getPropertyRelation ();
|
Relation prel = dbmap.getPropertyRelation ();
|
||||||
DbMapping dbm = new DbMapping ();
|
DbMapping dbm = new DbMapping ();
|
||||||
|
Relation gsrel = srel.getGroupbySubnodeRelation();
|
||||||
dbm.setSubnodeMapping (srel.other);
|
dbm.setSubnodeMapping (srel.other);
|
||||||
dbm.setSubnodeRelation (srel.getGroupbySubnodeRelation());
|
dbm.setSubnodeRelation (gsrel);
|
||||||
dbm.setPropertyMapping (prel.other);
|
dbm.setPropertyMapping (prel.other);
|
||||||
dbm.setPropertyRelation (prel.getGroupbyPropertyRelation());
|
dbm.setPropertyRelation (prel.getGroupbyPropertyRelation());
|
||||||
node.setDbMapping (dbm);
|
node.setDbMapping (dbm);
|
||||||
String snrel = "WHERE "+srel.groupby +"='"+sid+"'";
|
String snrel = "WHERE "+srel.groupby +"='"+sid+"'";
|
||||||
if (dbm.getSubnodeRelation().direction == Relation.BACKWARD)
|
if (gsrel.direction == Relation.BACKWARD)
|
||||||
snrel += " AND "+dbm.getSubnodeRelation().remoteField+"='"+getNonVirtualHomeID()+"'";
|
snrel += " AND "+gsrel.remoteField+"='"+getNonVirtualHomeID()+"'";
|
||||||
|
if (gsrel.order != null)
|
||||||
|
snrel += " ORDER BY "+gsrel.order;
|
||||||
node.setSubnodeRelation (snrel);
|
node.setSubnodeRelation (snrel);
|
||||||
return node;
|
return node;
|
||||||
} catch (Exception noluck) {}
|
} catch (Exception noluck) {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue