From: Patrick Schmitz Date: Sat, 9 Jun 2012 03:58:02 +0000 (-0700) Subject: CSPACE-3771, CSPACE-4791 refObjs call did not support wf_deleted filter, so was not... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=15fc12187cee0f9df7c4278f1496788976e0428d;p=tmp%2Fjakarta-migration.git CSPACE-3771, CSPACE-4791 refObjs call did not support wf_deleted filter, so was not correctly ignoring soft-deleted records. Since term delete checks for refObjs, this caused failure on term delete for which referencing objects had been (soft) deleted. --- 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 c1b3cdad8..0cb449c13 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 @@ -459,7 +459,7 @@ public abstract class AuthorityItemDocumentModelHandler serviceTypes, refName, propertyName, - myFilter.getPageSize(), myFilter.getStartPage(), true /*computeTotal*/); + myFilter, true /*computeTotal*/); } catch (PropertyException pe) { throw pe; } catch (DocumentException de) { 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 5e01c2430..c79344749 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 @@ -54,6 +54,7 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; import org.collectionspace.services.common.context.ServiceBindingUtils; import org.collectionspace.services.common.document.DocumentException; +import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentUtils; import org.collectionspace.services.common.document.DocumentWrapper; @@ -214,10 +215,12 @@ public class RefNameServiceUtils { List serviceTypes, String refName, String refPropName, - int pageSize, int pageNum, boolean computeTotal) + DocumentFilter filter, boolean computeTotal) throws DocumentException, DocumentNotFoundException { AuthorityRefDocList wrapperList = new AuthorityRefDocList(); AbstractCommonList commonList = (AbstractCommonList) wrapperList; + int pageNum = filter.getStartPage(); + int pageSize = filter.getPageSize(); commonList.setPageNum(pageNum); commonList.setPageSize(pageSize); List list = @@ -229,7 +232,8 @@ public class RefNameServiceUtils { RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl)repoClient; try { DocumentModelList docList = findAuthorityRefDocs(ctx, repoClient, repoSession, - serviceTypes, refName, refPropName, queriedServiceBindings, authRefFieldsByService, pageSize, pageNum, computeTotal); + serviceTypes, refName, refPropName, queriedServiceBindings, authRefFieldsByService, + filter.getWhereClause(), pageSize, pageNum, computeTotal); if (docList == null) { // found no authRef fields - nothing to process return wrapperList; @@ -302,7 +306,7 @@ public class RefNameServiceUtils { // reliable (stateless). DocumentModelList docList = findAuthorityRefDocs(ctx, repoClient, repoSession, getRefNameServiceTypes(), oldRefName, refPropName, - queriedServiceBindings, authRefFieldsByService, pageSize, 0, false); + queriedServiceBindings, authRefFieldsByService, null, pageSize, 0, false); if((docList == null) // found no authRef fields - nothing to do || (docList.size() == 0)) { // No more to handle @@ -340,6 +344,7 @@ public class RefNameServiceUtils { String refPropName, Map queriedServiceBindings, Map> authRefFieldsByService, + String whereClauseAdditions, int pageSize, int pageNum, boolean computeTotal) throws DocumentException, DocumentNotFoundException { // Get the service bindings for this tenant @@ -361,6 +366,10 @@ public class RefNameServiceUtils { if (query == null) { // found no authRef fields - nothing to query return null; } + // Additional qualifications, like workflow state + if(whereClauseAdditions!=null) { + query += " AND " + whereClauseAdditions; + } // Now we have to issue the search RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl)repoClient; DocumentWrapper docListWrapper = nuxeoRepoClient.findDocs(ctx, repoSession,