]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5887: Update event listener with updated logic also used in PAHMA-734.
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 15 Feb 2013 00:30:59 +0000 (16:30 -0800)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 15 Feb 2013 00:30:59 +0000 (16:30 -0800)
3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java
services/IntegrationTests/src/test/resources/test-data/xmlreplay/listener/listener-update-object-loc.xml

index 3436d3c1992a1277147b3502d7e02e6c1c3ec097..c7ff0a336221850683a2788400ebf85114239265 100644 (file)
@@ -64,10 +64,12 @@ public class UpdateObjectLocationOnMove extends AbstractUpdateObjectLocationValu
         if (Tools.isBlank(currentLocationRefName) && Tools.notBlank(existingComputedCurrentLocationRefName)) {
             collectionObjectDocModel.setProperty(COLLECTIONOBJECTS_COMMON_SCHEMA,
                     COMPUTED_CURRENT_LOCATION_PROPERTY, (Serializable) null);
-            // Otherwise, if the existing value is blank, or if the new value
-            // is different than the existing value ...
-        } else if (Tools.isBlank(existingComputedCurrentLocationRefName)
-                || (!currentLocationRefName.equals(existingComputedCurrentLocationRefName))) {
+            // Otherwise, if the new value is not blank, and
+            // * the existing value is blank, or
+            // * the new value is different than the existing value ...
+        } else if (Tools.notBlank(currentLocationRefName) &&
+                    (Tools.isBlank(existingComputedCurrentLocationRefName)
+                    || !currentLocationRefName.equals(existingComputedCurrentLocationRefName))) {
             if (logger.isTraceEnabled()) {
                 logger.trace("computedCurrentLocation refName requires updating.");
             }
index c45d2138e1569de8b1312e42be801f0080c12088..6a1faeebd8691b3fa0621f7a83b8a8306ff68272 100644 (file)
         </test>
         -->
         
+        <test ID="updateMovement3WithBlankCurrentLocationSecondTime">
+            <method>PUT</method>
+            <uri>/cspace-services/movements/${createMovement2.CSID}</uri>
+            <filename>listener/movement.xml</filename>
+            <vars>
+                <var ID="currentLocation"></var>
+                <var ID="locationDate">1800-02-01</var>
+            </vars>
+            <expectedCodes>200</expectedCodes>
+        </test>
+        
+        <!--        
+            Uncomment only when working on the computed current location
+            event listener / handler. - ADR - 2013-02-14
+            
+            (See comments above for more details.)
+        -->
+        <!--
+        <test ID="readCollectionObject1AfterMovement3BlankCurrentLocationUpdateSecondTime">
+            <method>GET</method>
+            <uri>/cspace-services/collectionobjects/${createCollectionObject1.CSID}</uri>
+            <response>
+                <filename>listener/res/collectionobject-without-current-location.res.xml</filename>
+                <expected level="TREE" />
+                <parts>
+                    <part>
+                        <label>collectionobjects_common</label>
+                    </part>
+                </parts>
+            </response>
+            <expectedCodes>200</expectedCodes>
+        </test>
+        -->
+        
         <test ID="updateMovement3WithNonBlankCurrentLocation">
             <method>PUT</method>
             <uri>/cspace-services/movements/${createMovement2.CSID}</uri>