ensured that hash binding vorbaIds is passed to client document object for vorba...
[vamsas.git] / src / org / vamsas / client / simpleclient / IdFactory.java
index 80f8f28..dafd08e 100644 (file)
@@ -66,6 +66,10 @@ public class IdFactory extends VorbaIdFactory {
   public VorbaId makeVorbaId(Vobject vobject) {
     if (session==null)
       throw new Error("makeVorbaId called on improperly initialised IdFactory Vobject!");
+    if (!vobject.isRegisterable())
+      throw new Error("makeVorbaId called on unregisterable object.");
+    if (vobject.isRegistered())
+      throw new Error("makeVorbaId called on already registered object.");
     String newidstring;
     do {
       if (sequence>0) {
@@ -77,7 +81,7 @@ public class IdFactory extends VorbaIdFactory {
       newidstring=idstring+Integer.toString(sequence);
     } while (extantids.containsKey(newidstring));
     extantids.put(newidstring, vobject); // hash the Vobject by its new Id
-    VorbaId id = newId(newidstring);
+    VorbaId id = newId(newidstring); // VorbaId.hash()==newidstring.hash() so we can still recover vobject
     return id;
   }