import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.vamsas.objects.utils.document.VersionEntries;
import uk.ac.vamsas.client.ClientHandle;
import uk.ac.vamsas.client.SessionHandle;
import uk.ac.vamsas.client.Vobject;
import uk.ac.vamsas.client.VorbaId;
import uk.ac.vamsas.client.VorbaIdFactory;
+import uk.ac.vamsas.objects.utils.document.VersionEntries;
import java.util.Hashtable;
import java.util.zip.CRC32;
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();
}
/**
+ * Create IdFactory with existing object hashes and id set
+ * @param session
+ * @param client
+ * @param user
+ * @param extanthashv hash of existing VorbaIds from a previous read of same document
+ */
+ protected IdFactory(SessionHandle session, ClientHandle client, UserHandle user, Hashtable extanthashv) {
+ this(session, client, user);
+ this.extanthashv = extanthashv;
+ }
+ /**
* values for keys in this hash can be used to reference the uk.ac.vamsas.client.Vobject instance for the VorbaId string.
* @return the hash of all VorbaIds
*/
}
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;
}