vorbaId generator constructs valid ID strings (NCNames)
[vamsas.git] / src / uk / ac / vamsas / client / simpleclient / IdFactory.java
index 35795cb..09a28e4 100644 (file)
@@ -50,7 +50,7 @@ public class IdFactory extends VorbaIdFactory {
     unique.reset();
     unique.update(new Object[] { session, client, user}.toString().getBytes());
     // TODO: Ensure format of URNs and use standard composition methods.
-    idstring = client.getClientName()+":"+unique.getValue()+".";
+    idstring = client.getClientNCname()+"_"+unique.getValue()+".";
     extantids=new Hashtable();
     this.extanthashv=new Hashtable();
   }
@@ -100,8 +100,8 @@ 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.hash()==newidstring.hash() so we can still recover vobject
+    extantids.put(id, vobject); // hash the Vobject by its new Id
     return id;
   }