From: Patrick Schmitz Date: Tue, 15 May 2012 15:25:20 +0000 (-0700) Subject: CSPACE-5059 Re-enabled creation of missing shortId values from (term)displayNames... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=59d08a754dfeb61b515a07cb0286aec64e56fe19;p=tmp%2Fjakarta-migration.git CSPACE-5059 Re-enabled creation of missing shortId values from (term)displayNames for the simple create by auto-complete in the UI. Fixed a minor bug with the expected element name in list results. --- diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java index c38ade306..a257cced0 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java @@ -153,7 +153,7 @@ public abstract class AuthorityItemDocumentModelHandler // In CSPACE-5134, these list results will change substantially // to return display names for both the preferred term and for // each non-preferred term (if any). - result.setElement(AuthorityItemJAXBSchema.DISPLAY_NAME); + result.setElement(AuthorityItemJAXBSchema.TERM_DISPLAY_NAME); result.setXpath(NuxeoUtils.getPrimaryXPathPropertyName( authorityItemCommonSchemaName, getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME)); @@ -240,7 +240,7 @@ public abstract class AuthorityItemDocumentModelHandler // re-enable it. // // CSPACE-3178: - // handleDisplayNameAsShortIdentifier(wrapDoc.getWrappedObject(), authorityItemCommonSchemaName); + handleDisplayNameAsShortIdentifier(wrapDoc.getWrappedObject(), authorityItemCommonSchemaName); // refName includes displayName, so we force a correct value here. updateRefnameForAuthorityItem(wrapDoc, authorityItemCommonSchemaName, getAuthorityRefNameBase()); } @@ -359,17 +359,17 @@ public abstract class AuthorityItemDocumentModelHandler String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER); - String termDisplayName = getPrimaryDisplayName( - docModel, authorityItemCommonSchemaName, - getItemTermInfoGroupXPathBase(), - AuthorityItemJAXBSchema.TERM_DISPLAY_NAME); + if (Tools.isEmpty(shortIdentifier)) { + String termDisplayName = getPrimaryDisplayName( + docModel, authorityItemCommonSchemaName, + getItemTermInfoGroupXPathBase(), + AuthorityItemJAXBSchema.TERM_DISPLAY_NAME); - String termName = getPrimaryDisplayName( - docModel, authorityItemCommonSchemaName, - getItemTermInfoGroupXPathBase(), - AuthorityItemJAXBSchema.TERM_NAME); + String termName = getPrimaryDisplayName( + docModel, authorityItemCommonSchemaName, + getItemTermInfoGroupXPathBase(), + AuthorityItemJAXBSchema.TERM_NAME); - if (Tools.isEmpty(shortIdentifier)) { String generatedShortIdentifier = AuthorityIdentifierUtils.generateShortIdentifierFromDisplayName(termDisplayName, termName); docModel.setProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER,