use of config class
[vamsas.git] / src / uk / ac / vamsas / client / simpleclient / ClientDocument.java
index db3d51a..ef0a7d5 100644 (file)
@@ -159,6 +159,7 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement
         return i;
     return -1;
   }
+  
 /**
  * verify that newr version is really an intact version of the 
  * @param newVersion (may be modified)
@@ -173,15 +174,29 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement
         _registerObject(newVersion); // TODO: check - this call hasn't been tested.
       // Should retrieve original version and compare - unless local hashes can be used to determine if resultSet has been truncated.
       // just do internal validation for moment.
-      if (newVersion.isValid())
+      try {
+        if (SimpleClientConfig.validateUpdatedRoots())
+          newVersion.validate();
         return true;
+      }
+      catch (Exception e)
+      {
+        log.error("Validation Exception for new vamsas root :"+newVersion.getVorbaId(),e);
+      }
       return false;
     } else {
       // redundant ? if (oldVersion.is__stored_in_document())
       if (!newVersion.isRegistered())
         _registerObject(newVersion);
-      if (newVersion.isValid())
+      try {
+        if (SimpleClientConfig.validateMergedRoots())
+          newVersion.validate();
         return true;
+      }
+      catch (Exception e)
+      {
+        log.error("Validation Exception for new vamsas root :"+newVersion.getVorbaId(),e);
+      }
     }
     return false;
     /**