From bd765cc78e296c52f7a34f2b1915d3bee5810dc7 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 12 Jun 2009 15:55:32 +0000 Subject: [PATCH] datastore registration and class cast exception fix --- src/jalview/io/vamsas/DatastoreItem.java | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/vamsas/DatastoreItem.java b/src/jalview/io/vamsas/DatastoreItem.java index 0815055..489f56f 100644 --- a/src/jalview/io/vamsas/DatastoreItem.java +++ b/src/jalview/io/vamsas/DatastoreItem.java @@ -126,7 +126,7 @@ public abstract class DatastoreItem } if (vobj2jv.containsKey(vobj.getVorbaId()) - && !((VorbaId) vobj2jv.get(vobj.getVorbaId())).equals(jvobj)) + && !(vobj2jv.get(vobj.getVorbaId())).equals(jvobj)) { Cache.log.debug( "Warning? Overwriting existing vamsas id binding for " @@ -204,6 +204,7 @@ public abstract class DatastoreItem { throw new Error("Implementation Error: Vamsas Document Class "+vobj.getClass()+" should bind to a "+boundType+" (found a "+jvobj.getClass()+")"); } + dsReg.registerDsObj(this); } /** * construct and initialise datastore object and retrieve document object bound to Jalview object jvobj2 and validate it against boundType @@ -221,6 +222,7 @@ public abstract class DatastoreItem { throw new Error("Implementation Error: Jalview Class "+jvobj2.getClass()+" should bind to a "+boundToType+" (found a "+vobj.getClass()+")"); } + dsReg.registerDsObj(this); } /** * create a new vobj to be added to the document @@ -262,7 +264,7 @@ public abstract class DatastoreItem */ protected void doSync() { - + dsReg.registerDsObj(this); if (vobj == null) { log.debug("adding new vobject to document."); @@ -293,6 +295,7 @@ public abstract class DatastoreItem */ protected void doJvUpdate() { + dsReg.registerDsObj(this); if (jvobj == null) { log.debug("adding new vobject to Jalview from Document"); @@ -320,14 +323,17 @@ public abstract class DatastoreItem */ protected Object jvobj = null; + protected DatastoreRegistry dsReg; + public void initDatastoreItem(VamsasAppDatastore ds) { datastore = ds; + dsReg = ds.getDatastoreRegisty(); initDatastoreItem(ds.getProvEntry(), ds.getClientDocument(), ds .getVamsasObjectBinding(), ds.getJvObjectBinding()); } - public void initDatastoreItem(Entry provEntry, IClientDocument cdoc, + private void initDatastoreItem(Entry provEntry, IClientDocument cdoc, Hashtable vobj2jv, IdentityHashMap jv2vobj) { this.provEntry = provEntry; @@ -511,4 +517,14 @@ public abstract class DatastoreItem return jvobj; } + public boolean docWasUpdated() + { + return (this.addtodoc || this.updated) && this.success; + } + + public boolean jvWasUpdated() + { + return (success); // TODO : Implement this properly! + } + } -- 1.7.10.2