From: Laramie Crocker Date: Thu, 12 May 2011 05:08:26 +0000 (+0000) Subject: CSPACE-3932 (on branch 3899 because of 1.7 code freeze). Made all current AuthorityI... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=ba7ef15d83b052f8a4807cadab002a1122f68f4c;p=tmp%2Fjakarta-migration.git CSPACE-3932 (on branch 3899 because of 1.7 code freeze). Made all current AuthorityItemDocumentModelHandler subclasses implement getAuthorityServicePath() to map from names like persons to names like personauthorities in URIs. --- diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person.xml index b13b339cd..840bbc84e 100755 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person.xml @@ -238,7 +238,7 @@ !-- ========================= POST a person ===================================================== --> - + POST /cspace-services/personauthorities/ diff --git a/services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java b/services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java index 8bbfd41cf..1af842ea5 100644 --- a/services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java +++ b/services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java @@ -105,31 +105,18 @@ public abstract class AuthorityItemDocumentModelHandler this.inAuthority = inAuthority; } - // Laramie20110510 CSPACE-3932 - public static final String HACK_VOCABULARIES = "vocabularies"; //TODO: get rid of these. - //public static final String HACK_ORGANIZATIONS = "Organizations"; //TODO: get rid of these. - public static final String HACK_ORGAUTHORITIES = "orgauthorities"; //TODO: get rid of these. - public static final String HACK_PERSONAUTHORITIES = "personauthorities"; //TODO: get rid of these. - public static final String HACK_LOCATIONAUTHORITIES = "locationauthorities"; //TODO: get rid of these. - private final static Map hackMap = new HashMap(); - static { - hackMap.put("persons", HACK_PERSONAUTHORITIES); - hackMap.put("organizations", HACK_ORGAUTHORITIES); - hackMap.put("vocabularies", HACK_VOCABULARIES); - hackMap.put("locations", HACK_LOCATIONAUTHORITIES); + /** Subclasses may override this to customize the URI segment. */ + public String getAuthorityServicePath(){ + return getServiceContext().getServiceName().toLowerCase(); // Laramie20110510 CSPACE-3932 } + @Override public String getUri(DocumentModel docModel) { // Laramie20110510 CSPACE-3932 - String serviceContextName = getServiceContext().getServiceName().toLowerCase(); - String displayContextPath = hackMap.get(serviceContextName); - if (Tools.isEmpty(displayContextPath)){ - displayContextPath = serviceContextName; - } - return "/"+displayContextPath+'/'+inAuthority+'/'+ AuthorityClient.ITEMS+'/'+getCsid(docModel); + String authorityServicePath = getAuthorityServicePath(); + return "/"+authorityServicePath+'/'+inAuthority+'/'+ AuthorityClient.ITEMS+'/'+getCsid(docModel); } - public String getAuthorityRefNameBase(){ return this.authorityRefNameBase; } diff --git a/services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java b/services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java index d8d00d943..93f7634ae 100644 --- a/services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java +++ b/services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import org.collectionspace.services.LocationJAXBSchema; +import org.collectionspace.services.client.LocationAuthorityClient; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.service.ObjectPartType; @@ -69,6 +70,11 @@ public class LocationDocumentModelHandler public LocationDocumentModelHandler() { super(COMMON_PART_LABEL); } + + @Override + public String getAuthorityServicePath(){ + return LocationAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + } /* (non-Javadoc) * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper) diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java index a417bf369..766a6ae10 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java @@ -43,7 +43,7 @@ public class OrgAuthorityResource extends AuthorityResourceWithContacts { - private final static String orgAuthorityServiceName = "orgauthorities"; + private final static String orgAuthorityServiceName = OrgAuthorityClient.SERVICE_NAME; private final static String ORGAUTHORITIES_COMMON = "orgauthorities_common"; private final static String organizationServiceName = "organizations"; diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java index 6ee9045ed..fa42403fb 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.collectionspace.services.client.OrgAuthorityClient; import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler; import org.collectionspace.services.OrganizationJAXBSchema; import org.collectionspace.services.common.document.DocumentWrapper; @@ -60,6 +61,11 @@ public class OrganizationDocumentModelHandler public OrganizationDocumentModelHandler() { super(COMMON_PART_LABEL); } + + @Override + public String getAuthorityServicePath(){ + return OrgAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + } /* (non-Javadoc) * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper) diff --git a/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java b/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java index d03e5e9c6..f29ee1618 100644 --- a/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java +++ b/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import org.collectionspace.services.client.PersonAuthorityClient; import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.common.document.DocumentWrapper; @@ -67,6 +68,11 @@ public class PersonDocumentModelHandler public PersonDocumentModelHandler() { super(COMMON_PART_LABEL); } + + @Override + public String getAuthorityServicePath(){ + return PersonAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + } /* (non-Javadoc) * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper) diff --git a/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java b/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java index 5e48687dd..92b0737f7 100644 --- a/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java +++ b/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java @@ -196,7 +196,7 @@ public class RelationDocumentModelHandler String itemDocType = itemDocModel.getDocumentType().getName(); item.setDocumentTypeFromModel(itemDocType); //this one comes from the nuxeo documentType - System.out.println("\r\n******** AuthorityItemDocumentModelHandlder documentType **************\r\n\tdocModel: "+itemDocType+"\r\n\tpayload: "+documentType); + //DEBUG: System.out.println("\r\n******** AuthorityItemDocumentModelHandlder documentType **************\r\n\tdocModel: "+itemDocType+"\r\n\tpayload: "+documentType); boolean usedDocumentTypeFromPayload = true; if ( ! Tools.isBlank(documentType)){ if (documentType.equals(itemDocType)){ diff --git a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java index 242a08013..99bf3d630 100644 --- a/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java +++ b/services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import org.collectionspace.services.TaxonJAXBSchema; +import org.collectionspace.services.client.TaxonomyAuthorityClient; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.service.ObjectPartType; @@ -70,6 +71,11 @@ public class TaxonDocumentModelHandler super(COMMON_PART_LABEL); } + @Override + public String getAuthorityServicePath(){ + return TaxonomyAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + } + /* (non-Javadoc) * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper) */ diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java index eb8828dbe..0d751ac67 100644 --- a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java +++ b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java @@ -26,6 +26,7 @@ package org.collectionspace.services.vocabulary.nuxeo; import java.util.Iterator; import java.util.List; +import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler; @@ -55,6 +56,11 @@ public class VocabularyItemDocumentModelHandler public VocabularyItemDocumentModelHandler() { super(COMMON_PART_LABEL); } + + @Override + public String getAuthorityServicePath(){ + return VocabularyClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + } @Override