From: Patrick Schmitz Date: Wed, 26 Oct 2011 00:09:00 +0000 (+0000) Subject: CSPACE-4406 - added support for refObjs for vocabulary service items, so that termLis... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=5be11411015c67698ad2af92b5c3fe55dee33602;p=tmp%2Fjakarta-migration.git CSPACE-4406 - added support for refObjs for vocabulary service items, so that termList items can check for usage. Uses new termRef configuration, so that authorityRefs paylaods do not include termList items in the results. --- diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml index a4839170f..64aa09f3e 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml @@ -6,7 +6,7 @@ YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y - - - - + + + + + + GET + /cspace-services/vocabularies/${Vocabulary1.CSID}/items/${Item1.CSID} + + + + GET + /cspace-services/vocabularies/${Vocabulary1.CSID}/items/${Item1.CSID}/refObjs + + - diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java index 96d887e65..2764731c5 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java @@ -87,6 +87,18 @@ import java.util.List; /** * The Class AuthorityResource. */ +/** + * @author pschmitz + * + * @param + * @param + */ +/** + * @author pschmitz + * + * @param + * @param + */ @Consumes("application/xml") @Produces("application/xml") public abstract class AuthorityResource @@ -677,6 +689,15 @@ public abstract class AuthorityResource } } + /** + * @return the name of the property used to specify references for items in this type of + * authority. For most authorities, it is ServiceBindingUtils.AUTH_REF_PROP ("authRef"). + * Some types (like Vocabulary) use a separate property. + */ + protected String getRefPropName() { + return ServiceBindingUtils.AUTH_REF_PROP; + } + /** * Gets the entities referencing this Authority item instance. The service type * can be passed as a query param "type", and must match a configured type @@ -723,6 +744,7 @@ public abstract class AuthorityResource repoClient, serviceType, refName, + getRefPropName(), myFilter.getPageSize(), myFilter.getStartPage(), true /*computeTotal*/); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.GET_FAILED); diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java index 0731d476b..56fb51779 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java @@ -65,6 +65,7 @@ public class RefNameServiceUtils { RepositoryClient repoClient, String serviceType, String refName, + String refPropName, int pageSize, int pageNum, boolean computeTotal) throws DocumentException, DocumentNotFoundException { AuthorityRefDocList wrapperList = new AuthorityRefDocList(); AbstractCommonList commonList = (AbstractCommonList) wrapperList; @@ -89,7 +90,7 @@ public class RefNameServiceUtils { Map queriedServiceBindings = new HashMap(); Map> authRefFieldsByService = new HashMap>(); - String query = computeWhereClauseForAuthorityRefDocs(escapedRefName, docTypes, servicebindings, + String query = computeWhereClauseForAuthorityRefDocs(escapedRefName, refPropName, docTypes, servicebindings, queriedServiceBindings, authRefFieldsByService ); if (query == null) { // found no authRef fields - nothing to query return wrapperList; @@ -112,6 +113,7 @@ public class RefNameServiceUtils { private static String computeWhereClauseForAuthorityRefDocs( String escapedRefName, + String refPropName, ArrayList docTypes, List servicebindings, Map queriedServiceBindings, @@ -124,7 +126,7 @@ public class RefNameServiceUtils { // is also the table name, the way that the repository works). authRefFieldPaths = ServiceBindingUtils.getAllPartsPropertyValues(sb, - ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES); + refPropName, ServiceBindingUtils.QUALIFIED_PROP_NAMES); if (authRefFieldPaths.isEmpty()) { continue; } diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml index e45cb6845..3f3e15214 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml @@ -205,7 +205,6 @@ fieldCollectors|fieldCollector - - - - @@ -843,12 +835,10 @@ owner - @@ -983,16 +973,14 @@ --> - - @@ -1454,12 +1440,10 @@ --> - - @@ -1980,7 +1962,6 @@ --> - -