suppress unresolved xmlId warnings for initial unmarshalling of vamsas document
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 18 Feb 2010 12:05:58 +0000 (12:05 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 18 Feb 2010 12:05:58 +0000 (12:05 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@509 be28352e-c001-0410-b1a7-c7978e42abec

src/uk/ac/vamsas/client/VorbaXmlBinder.java

index b237dcf..016700a 100644 (file)
@@ -262,13 +262,16 @@ public class VorbaXmlBinder implements UnmarshalListener {
   public static Object[] getVamsasObjects(Reader instream,\r
       VorbaIdFactory factory, Vobject root) {\r
     Unmarshaller unmarshaller = new Unmarshaller(root);\r
+    final VorbaIdFactory ourfactory = factory;\r
     unmarshaller.setIDResolver(new IDResolver() {\r
       public Object resolve(String id) {\r
-        // TODO: allow for external ID resolution\r
-        VorbaXmlBinder.log\r
-            .warn("Warning - id "\r
-                + id\r
-                + " is not found in the Vamsas XML! (TODO: Ignore if this is a forward reference!)");\r
+        if (ourfactory.warnUnresolved) {\r
+          // TODO: allow for external ID resolution\r
+          VorbaXmlBinder.log\r
+          .warn("Warning - id "\r
+              + id\r
+              + " is not found in the Vamsas XML! (TODO: Ignore if this is a forward reference!)");\r
+        }\r
         return null;\r
       }\r
     });\r
@@ -287,7 +290,9 @@ public class VorbaXmlBinder implements UnmarshalListener {
         // TODO: mark objects in oobjhash prior to unmarshalling, to detect when\r
         // objects have been lost through an update.\r
         // tohere\r
+        factory.warnUnresolved = false;\r
         Object obj = unmarshaller.unmarshal(instream);\r
+        factory.warnUnresolved = true;\r
         boolean sync = ensure_references(unrefedObj, objrefs);\r
         if (!(obj instanceof Vobject))\r
           return null;\r