From 558d0d695b5e4aa6cbb6686ab84e33c7c45ad848 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Wed, 12 Dec 2012 11:38:00 -0800 Subject: [PATCH] CSPACE-5727: Revised computed current location refName validation logic for clarity. --- .../listener/UpdateObjectLocationOnMove.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java index 199a3a1ca..0565838bc 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java @@ -164,6 +164,9 @@ public class UpdateObjectLocationOnMove implements EventListener { RELATION_DOCTYPE, RELATIONS_COMMON_SCHEMA, movementCsid, COLLECTIONOBJECT_DOCTYPE); DocumentModelList relatedDocModels = coreSession.query(query); if (relatedDocModels == null || relatedDocModels.isEmpty()) { + // Encountering a Movement record that is not related to any + // CollectionObject is potentially a normal occurrence, so no + // error messages are logged here when we stop handling this event. return; } @@ -216,8 +219,10 @@ public class UpdateObjectLocationOnMove implements EventListener { // CollectionObject's computed current location meaningfully be 'un-set'?) // * Capable of being successfully parsed by an authority item parser; // that is, returning a non-null parse result. - if ((Tools.notBlank(computedCurrentLocationRefName) - && (RefNameUtils.parseAuthorityTermInfo(computedCurrentLocationRefName) != null))) { + if ((Tools.isBlank(computedCurrentLocationRefName) + || (RefNameUtils.parseAuthorityTermInfo(computedCurrentLocationRefName) == null))) { + logger.warn("Could not parse computed current location refName '" + computedCurrentLocationRefName + "'"); + } else { if (logger.isTraceEnabled()) { logger.trace("refName passes basic validation tests."); } @@ -239,13 +244,12 @@ public class UpdateObjectLocationOnMove implements EventListener { // ... set aside this CollectionObject's docModel and its new // computed current location value for subsequent updating docModelsToUpdate.put(collectionObjectDocModel, computedCurrentLocationRefName); - } - } else { - if (logger.isTraceEnabled()) { - logger.trace("computedCurrentLocation refName does NOT require updating."); - } + } else { + if (logger.isTraceEnabled()) { + logger.trace("computedCurrentLocation refName does NOT require updating."); + } + } } - } // For each CollectionObject docModel that has been set aside for updating, -- 2.47.3