From d8e1fb74fe58a774014e567784d48b86315abe65 Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Tue, 20 Nov 2012 17:27:21 -0800 Subject: [PATCH] CSPACE-5681 Added refName to refObjs return schema --- .../vocabulary/RefNameServiceUtils.java | 19 ++++++++++++++++++- .../src/main/resources/authorityrefdocs.xsd | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java index 58c5788e1..bd60deed5 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java @@ -283,11 +283,12 @@ public class RefNameServiceUtils { * * * + * * * */ - String fieldList = "docType|docId|docNumber|docName|sourceField|uri|updatedAt|workflowState"; + String fieldList = "docType|docId|docNumber|docName|sourceField|uri|refName|updatedAt|workflowState"; commonList.setFieldsReturned(fieldList); // As a side-effect, the method called below modifies the value of @@ -557,6 +558,14 @@ public class RefNameServiceUtils { return whereClauseStr; } + + // TODO there are multiple copies of this that should be put somewhere common. + protected static String getRefname(DocumentModel docModel) throws ClientException { + String result = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA, + CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME); + return result; + } + /* * Runs through the list of found docs, processing them. If list is @@ -600,6 +609,14 @@ public class RefNameServiceUtils { } ilistItem = new AuthorityRefDocList.AuthorityRefDocItem(); String csid = NuxeoUtils.getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString()); + try { + String itemRefName = getRefname(docModel); + ilistItem.setRefName(itemRefName); + } catch (ClientException ce) { + throw new RuntimeException( + "processRefObjsDocList: Problem fetching refName from item Object: " + + ce.getLocalizedMessage()); + } ilistItem.setDocId(csid); String uri = ""; UriTemplateRegistry registry = ServiceMain.getInstance().getUriTemplateRegistry(); diff --git a/services/jaxb/src/main/resources/authorityrefdocs.xsd b/services/jaxb/src/main/resources/authorityrefdocs.xsd index 4a4b155d9..fdce838ed 100644 --- a/services/jaxb/src/main/resources/authorityrefdocs.xsd +++ b/services/jaxb/src/main/resources/authorityrefdocs.xsd @@ -47,6 +47,7 @@ + -- 2.47.3