]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5728: Computed current location value now successfully updated for a single...
authorAron Roberts <aron@socrates.berkeley.edu>
Tue, 8 Jan 2013 22:15:24 +0000 (14:15 -0800)
committerAron Roberts <aron@socrates.berkeley.edu>
Tue, 8 Jan 2013 22:15:24 +0000 (14:15 -0800)
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java

index b1fb0ad5ce1707fbfd4cb7c306645d1ab943b6fa..f454ef9e2505c0b7eb61718335a691e93e5e3df6 100644 (file)
@@ -44,6 +44,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
     private final static String COLLECTIONOBJECTS_COMMON_SCHEMA = "collectionobjects_common";
     private final static String MOVEMENTS_COMMON_SCHEMA = MovementConstants.NUXEO_SCHEMA_NAME;
     private final static String COMPUTED_CURRENT_LOCATION_ELEMENT_NAME = "computedCurrentLocation";
+    private final static String CURRENT_LOCATION_ELEMENT_NAME = "currentLocation";
     private final static String LOCATION_DATE_ELEMENT_NAME = "locationDate";
     private final static String OBJECT_NUMBER_ELEMENT_NAME = "objectNumber";
     private InvocationResults results = new InvocationResults();
@@ -245,17 +246,16 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
                             logger.info("Location date value = " + locationDate);
                         }
                     }
-                    currentLocation = AbstractCommonListUtils.ListItemGetElementValue(movementRecord, COMPUTED_CURRENT_LOCATION_ELEMENT_NAME);
+                    currentLocation = AbstractCommonListUtils.ListItemGetElementValue(movementRecord, CURRENT_LOCATION_ELEMENT_NAME);
                     if (Tools.notBlank(currentLocation)) {
                         if (logger.isInfoEnabled()) {
                             logger.info("Current location value = " + currentLocation);
                         }
                     }
                     if (Tools.notBlank(locationDate) && Tools.notBlank(currentLocation)) {
-                        // Assumes for  that all values for this element/field will be
-                        // ISO 8601 date values that can be ordered via string comparison.
-                        // We might consider whether to first convert to date values instead.
-                        if (locationDate.compareTo(mostRecentLocationDate) > 1) {
+                        // Assumes that all values for this element/field will be ISO 8601
+                        // date representations, each of which can be ordered via string comparison.
+                        if (locationDate.compareTo(mostRecentLocationDate) > 0) {
                             mostRecentLocationDate = locationDate;
                             computedCurrentLocation = currentLocation;
                         }