]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CB-20: Use controlled object name in computed title for anthro.
authorRay Lee <ray.lee@lyrasis.org>
Wed, 6 Dec 2023 21:42:21 +0000 (16:42 -0500)
committerRay Lee <ray.lee@lyrasis.org>
Wed, 6 Dec 2023 21:42:21 +0000 (16:42 -0500)
3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/anthro/AnthroESDocumentWriter.java

index f3a8a7d428e3deb510abee8db3de7e588e7e9986..d41557eefe749ae5aa67d1e715445a177529f9b0 100644 (file)
@@ -34,7 +34,23 @@ public class AnthroESDocumentWriter extends DefaultESDocumentWriter {
 
                if (objectNameGroups.size() > 0) {
                        Map<String, Object> primaryObjectNameGroup = objectNameGroups.get(0);
-                       primaryObjectName = (String) primaryObjectNameGroup.get("objectName");
+
+                       primaryObjectName = (String) primaryObjectNameGroup.get("objectNameControlled");
+
+                       if (primaryObjectName == null) {
+                               primaryObjectName = (String) primaryObjectNameGroup.get("objectName");
+                       }
+
+                       // The object might be a refname. If it is, use only the display name.
+
+                       try {
+                               String displayName = RefNameUtils.getDisplayName(primaryObjectName);
+
+                               if (displayName != null) {
+                                       primaryObjectName = displayName;
+                               }
+                       }
+                       catch (Exception e) {}
                }
 
                if (StringUtils.isNotEmpty(primaryObjectName)) {