X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fclient%2Fsimpleclient%2FIdFactory.java;h=09a28e4be7eae6518256605a4d051b81c33c0aca;hb=3f33c95af6db013e21c49f50f87d700f3d530bee;hp=a5f3879cfbe2148db07a99202cb634441c7cf195;hpb=ea8b10ee787a2b1e2b35f2acb4dccaf12fd2a6fd;p=vamsas.git diff --git a/src/uk/ac/vamsas/client/simpleclient/IdFactory.java b/src/uk/ac/vamsas/client/simpleclient/IdFactory.java index a5f3879..09a28e4 100644 --- a/src/uk/ac/vamsas/client/simpleclient/IdFactory.java +++ b/src/uk/ac/vamsas/client/simpleclient/IdFactory.java @@ -5,7 +5,6 @@ package uk.ac.vamsas.client.simpleclient; 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; @@ -13,6 +12,7 @@ import uk.ac.vamsas.client.UserHandle; 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; @@ -50,11 +50,22 @@ 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(); } /** + * 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 */ @@ -89,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; }