fixed the User element and the form of the ApplicationData dataType.xsd definition.
[vamsas.git] / src / org / vamsas / client / simpleclient / IdFactory.java
index c046af5..79ec47c 100644 (file)
@@ -26,7 +26,7 @@ public class IdFactory extends VorbaIdFactory {
   private UserHandle user;
   private CRC32 unique=new CRC32(); // used to attempt a unique but predictable stream for IDs
   private String idstring;
-  int sequence=0; // incrementing value for next new ID
+  int sequence=1; // incrementing value for next new ID
   /**
    * 
    */
@@ -47,8 +47,8 @@ public class IdFactory extends VorbaIdFactory {
     this.user = user;
     unique.reset();
     unique.update(new Object[] { session, client, user}.toString().getBytes());
-    idstring = "vamsas:"+session.getSessionUrn()+":"+unique.getValue()+":"+client.getClientUrn()+"/";
-    sequence=0;
+    // TODO: Ensure format of URNs and use standard composition methods.
+    idstring = client.getClientUrn()+":"+unique.getValue()+"/";
     extantids=new Hashtable();
   }
 
@@ -60,10 +60,11 @@ public class IdFactory extends VorbaIdFactory {
       throw new Error("makeVorbaId called on improperly initialised IdFactory object!");
     String newidstring;
     do {
-      if (sequence!=0) {
+      if (sequence>0) {
         sequence++;
       } else {
         idstring+="1/";
+        sequence=1;
       }
       newidstring=idstring+Integer.toString(sequence);
     } while (extantids.containsKey(newidstring));