todo for importing stored session as a new session
[vamsas.git] / src / uk / ac / vamsas / client / Vobjhash.java
index f2feab9..1b258dc 100644 (file)
@@ -2,24 +2,34 @@ package uk.ac.vamsas.client;
 \r
 /**\r
  * Holds information about Vobj instances that is held over between different writes to the document.\r
+ * Currently records the LhashValue obtained from Vobject\r
  * @author JimP\r
  *\r
  */\r
 public class Vobjhash {\r
-  int hashvalue;\r
+  private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Vobjhash.class); \r
+  long  hashvalue;\r
   /**\r
    * creates a record of the hash value for a vamsas document object\r
    * @param tobemarshalled\r
    */\r
   public Vobjhash(Vobject tobemarshalled) {\r
+    tobemarshalled.doHash();\r
     hashvalue = tobemarshalled.get__last_hash();\r
+    if (log.isDebugEnabled())\r
+      log.debug(tobemarshalled.getVorbaId()+":"+hashvalue);\r
   }\r
   /**\r
-   * compares the old hash value with the unmarshalled object's most recently computed hash value.\r
+   * compares the old hash value with the unmarshalled object's most recently computed hash value and updates internal record.\r
    * @param unmarshalled\r
    * @return true if the hash values differ\r
    */\r
   public boolean isUpdated(Vobject unmarshalled) {\r
-    return hashvalue==unmarshalled.get__last_hash();\r
+    long oldhash = hashvalue;\r
+    unmarshalled.doHash();\r
+    hashvalue=unmarshalled.get__last_hash();\r
+    if (log.isDebugEnabled() && oldhash!=hashvalue)\r
+      log.debug(" has changed."+unmarshalled.getVorbaId());\r
+    return oldhash!=hashvalue;\r
   }\r
 }\r