]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5728: First successful top-to-bottom run of the single CSID batch job to updat...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 9 Jan 2013 20:20:03 +0000 (12:20 -0800)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 9 Jan 2013 20:20:03 +0000 (12:20 -0800)
services/IntegrationTests/src/test/resources/test-data/xmlreplay/batch/batch-update-object-loc.xml
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java

index 3b1fb8eaff16ea5272fa47b3ebae143da10c08a5..84088950eeb2c162c3b19310445bca09c41cec3f 100644 (file)
@@ -37,7 +37,7 @@
         </test>\r
         \r
         <!-- The currentLocation value of this Movement record, which -->\r
-        <!-- has the most recent locationDate value, should thus be -->\r
+        <!-- has the most recent locationDate value, should also be -->\r
         <!-- reflected in the computedCurrentLocation value in the -->\r
         <!-- CollectionObject record after invoking the batch job. -->\r
         <test ID="createMovement2">\r
             <uri>/cspace-services/collectionobjects/${createCollectionObject.CSID}</uri>\r
             <filename>batch/updateobjloc.xml</filename>\r
             <response>\r
-                <expected level="TEXT" />\r
+                <expected level="ADDOK" />\r
                 <filename>batch/res/collectionobject.res.xml</filename>\r
                 <vars>\r
                     <var ID="computedCurrentLocationValue">${createMovement2.currentLocation}</var>\r
         <!-- Tests with Movement->CollectionObject relations -->\r
         \r
         <!-- The currentLocation value of this new Movement record, which now -->\r
-        <!-- has the most recent locationDate value, should thus be -->\r
+        <!-- has the most recent locationDate value, should also be -->\r
         <!-- reflected in the computedCurrentLocation value in the -->\r
         <!-- CollectionObject record after invoking the batch job a second time. -->\r
         <test ID="createMovement4">\r
             <uri>/cspace-services/collectionobjects/${createCollectionObject.CSID}</uri>\r
             <filename>batch/updateobjloc.xml</filename>\r
             <response>\r
-                <expected level="TEXT" />\r
+                <expected level="ADDOK" />\r
                 <filename>batch/res/collectionobject.res.xml</filename>\r
                 <vars>\r
                     <var ID="computedCurrentLocationValue">${createMovement4.currentLocation}</var>\r
index a61f30f63f6c45938d02563deb9e5d794bb42853..eed4391350070c90054fefe93622e99bfc5ea440 100644 (file)
@@ -156,9 +156,19 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
         try {
             Document document = builder.build(new StringReader(payload.toXML()));
             Element root = document.getRootElement();
+            // The part element is always expected to have an explicit namespace.
             Element part = root.getChild(partLabel, partNamespace);
+            // Try getting the field element both with and without a namespace.
+            // Even though a field element that lacks a namespace prefix
+            // may yet inherit its namespace from a parent, JDOM may require that
+            // the getChild() call be made without a namespace.
             Element field = part.getChild(fieldPath, partNamespace);
-            value = field.getText();
+            if (field == null) {
+                field = part.getChild(fieldPath);
+            }
+            if (field != null) {
+                value = field.getText();
+            }
         } catch (Exception e) {
             logger.error("Error getting value from field path " + fieldPath
                     + " in schema part " + partLabel);