|
From: Andreas V. <a_...@us...> - 2004-05-14 18:03:53
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26354/src/org/cobricks/item Modified Files: Item.java Log Message: Index: Item.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/Item.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Item.java 7 May 2004 07:33:34 -0000 1.29 +++ Item.java 14 May 2004 18:03:42 -0000 1.30 @@ -10,6 +10,7 @@ import org.cobricks.user.User; +import java.io.IOException; import java.sql.Timestamp; import java.text.DateFormat; @@ -33,7 +34,7 @@ * Copyright (c) 2003 Michael Koch, mic...@ac... */ public class Item extends org.cobricks.core.DataObject - implements java.io.Serializable { + implements java.io.Externalizable { private static final int OBJECT_TYPE = -1; /** @@ -245,6 +246,55 @@ } /** + * This method is used to deserialize this Item. + * + * @param s The serialized Item + * @throws ClassNotFoundException + * @throws IOException + */ + public void readExternal(java.io.ObjectInput s) + throws ClassNotFoundException, IOException { + itemid = s.readInt(); + globalid = s.readUTF(); + itemclass = s.readUTF(); + recursiveLevel = s.readInt(); + defaultLanguage = s.readUTF(); + xmlEncoding = s.readUTF(); + Object temp = s.readObject(); + if (temp != null) { + alreadyInstantiated = (Map) temp; + } + annotations = (Map) s.readObject(); + attachments = (Map) s.readObject(); + usedLanguages = (Set) s.readObject(); + attrs = (Map) s.readObject(); + } + + /** + * This method is used to serialize this Item. + * + * @param s Specifies the location where the Item is written to. + * @throws IOException + */ + public void writeExternal(java.io.ObjectOutput s) throws IOException { + s.writeInt(itemid); + s.writeUTF(globalid); + if ((itemclass != null) && (itemclass.length() > 0)) { + s.writeUTF(itemclass); + } else { + s.writeUTF("item"); + } + s.writeInt(recursiveLevel); + s.writeUTF(defaultLanguage); + s.writeUTF(xmlEncoding); + s.writeObject(alreadyInstantiated); + s.writeObject(annotations); + s.writeObject(attachments); + s.writeObject(usedLanguages); + s.writeObject(attrs); + } + + /** * This method is an auxiliary method for some of the constructors. * It extracts the attributes of an Item from a XML representation by * calling the method extractFromXML(String, Map, Item, ItemManager) of the |