Upgraded serialization methods to new version to include prototype info

This commit is contained in:
hns 2001-01-05 19:26:55 +00:00
parent dd750e0a06
commit 4cd70f3648

View file

@ -59,13 +59,15 @@ 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)
prototype = in.readUTF ();
} 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 (1); // serialization version out.writeShort (2); // serialization version
out.writeUTF (id); out.writeUTF (id);
out.writeUTF (name); out.writeUTF (name);
out.writeObject (parentID); out.writeObject (parentID);
@ -82,6 +84,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);
} }
transient String prototype; transient String prototype;
@ -261,6 +264,7 @@ public class Node implements INode, Serializable {
this.id = nmgr.generateID (dbmap); this.id = nmgr.generateID (dbmap);
checkWriteLock (); checkWriteLock ();
this.name = node.getName (); this.name = node.getName ();
this.prototype = node.getPrototype ();
created = lastmodified = System.currentTimeMillis (); created = lastmodified = System.currentTimeMillis ();
setContent (node.getContent (), node.getContentType ()); setContent (node.getContent (), node.getContentType ());
created = lastmodified = System.currentTimeMillis (); created = lastmodified = System.currentTimeMillis ();