From 393bf0a1d40777d57c29e27983ace02c24e0a685 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Thu, 20 Sep 2012 16:08:39 -0700 Subject: [PATCH] CSPACE-5504: Added proper update handling for refName updates for authority items and structured objects -includes updating refNames in relationship records and in collectionspace_core schema. --- .../collectionobject-hierarchy-refname.xml | 1 + .../vocabulary/RefNameServiceUtils.java | 6 +-- .../nuxeo/client/java/CommonList.java | 1 + .../nuxeo/client/java/DocHandlerBase.java | 38 ++++++++++++------- .../client/java/RepositoryJavaClientImpl.java | 1 - 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml index 722defb1b..ef53bb79b 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-refname.xml @@ -233,6 +233,7 @@ /cspace-services/collectionobjects/${CreateBlackRook.CSID} collectionobject/hierarchy/7-collectionobject-update-with-parent-child-refnames.xml + CSPACE-5518-BlackRook This black rook is nearly intact, save for two tiny fragments. ${CreateBlackRook.CSID} ${CreateBlackRook.objectNumber} 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 67065302f..5268d340d 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 @@ -426,10 +426,10 @@ public class RefNameServiceUtils { morePages = false; } - int nRefsFoundThisPage = processRefObjsDocList(docList, ctx.getTenantId(), oldRefName, queriedServiceBindings, authRefFieldsByService, + int nRefsFoundThisPage = processRefObjsDocList(docList, ctx.getTenantId(), oldRefName, queriedServiceBindings, authRefFieldsByService, // Perform the refName updates on the list of document models null, newRefName); if (nRefsFoundThisPage > 0) { - ((RepositoryJavaClientImpl) repoClient).saveDocListWithoutHandlerProcessing(ctx, repoSession, docList, true); + ((RepositoryJavaClientImpl) repoClient).saveDocListWithoutHandlerProcessing(ctx, repoSession, docList, true); // Flush the document model list out to Nuxeo storage nRefsFound += nRefsFoundThisPage; } @@ -556,7 +556,7 @@ public class RefNameServiceUtils { * Runs through the list of found docs, processing them. If list is * non-null, then processing means gather the info for items. If list is * null, and newRefName is non-null, then processing means replacing and - * updating. If processing/updating, this must be called in teh context of + * updating. If processing/updating, this must be called in the context of * an open session, and caller must release Session after calling this. * */ diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java index 6dde05775..629dfd00c 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java @@ -121,6 +121,7 @@ public class CommonList extends AbstractCommonList { el.setTextContent((String)value); anyList.add(el); } else if (value instanceof List) { + @SuppressWarnings("unchecked") // We expect and assume String values only here List valueList = (List)value; for (String val : valueList) { addItem(anyList, key, val); diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java index b8cdda1a5..1064fa4a8 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java @@ -228,17 +228,23 @@ public abstract class DocHandlerBase extends RemoteDocumentModelHandlerImpl extends RemoteDocumentModelHandlerImpl