From b905b2acc79173651fdf95330b341a76561fd799 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Thu, 16 Aug 2012 20:17:01 -0700 Subject: [PATCH] CSPACE-5271,CSPACE-5453: Removed temporary UriUtils class in favor of the new URI template registry. --- .../services/common/config/URIUtils.java | 70 ------------------- .../services/imports/TemplateExpander.java | 4 -- 2 files changed, 74 deletions(-) delete mode 100644 services/config/src/main/java/org/collectionspace/services/common/config/URIUtils.java diff --git a/services/config/src/main/java/org/collectionspace/services/common/config/URIUtils.java b/services/config/src/main/java/org/collectionspace/services/common/config/URIUtils.java deleted file mode 100644 index fcd035504..000000000 --- a/services/config/src/main/java/org/collectionspace/services/common/config/URIUtils.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.collectionspace.services.common.config; - -// client module is built after this config module, so we can't currently include this -// import org.collectionspace.services.client.AuthorityClient; -import java.util.HashMap; -import java.util.Map; - -// This class is a hack for CSPACE-5406 - -public class URIUtils { - - private static Map docTypeSvcNameRegistry = new HashMap(); - private static final String ITEMS_PATH_COMPONENT = "items"; - - // FIXME: This is a quick hack, which assumes that URI construction - // behaviors are bound to categories of services. Those behaviors - // should instead be specified on a per-service basis via a registry, - // mechanism. (See comments below for more details.) - ADR 2012-05-24 - public static final String AUTHORITY_SERVICE_CATEGORY = "authority"; - public static final String OBJECT_SERVICE_CATEGORY = "object"; - public static final String PROCEDURE_SERVICE_CATEGORY = "procedure"; - - // FIXME: This is a quick hack; a stub / mock of a registry of - // authority document types and their associated parent authority - // service names. This MUST be replaced by a more general registry mechanism. - // If not, the manually-entered values below represent a DRY violation, - // and risk falling out of sync with comparable values elsewhere. - // - // Per Patrick, this registry needs to be available system-wide; - // extend to all relevant record types; and be automatically built - // in some manner, such as via per-resource registration, from - // existing configuration, etc. - ADR 2012-05-24 - private static Map getDocTypeSvcNameRegistry() { - if (docTypeSvcNameRegistry.isEmpty()) { - docTypeSvcNameRegistry.put("Conceptitem", "Conceptauthorities"); - docTypeSvcNameRegistry.put("Locationitem", "Locationauthorities"); - docTypeSvcNameRegistry.put("Person", "Personauthorities"); - docTypeSvcNameRegistry.put("Placeitem", "Placeauthorities"); - docTypeSvcNameRegistry.put("Organization", "Orgauthorities"); - docTypeSvcNameRegistry.put("Taxon", "Taxonomyauthority"); - } - return docTypeSvcNameRegistry; - } - - /** - * Return the parent authority service name, based on the item document - * type. - */ - public static String getAuthoritySvcName(String docType) { - return getDocTypeSvcNameRegistry().get(docType); - } - - // FIXME: The following URI construction methods are also intended to be - // made generally available and associated to individual services, via the - // registry mechanism described above. - ADR, 2012-05-24 - public static String getUri(String serviceName, String docID) { - return "/" + serviceName.toLowerCase() - + "/" + docID; - } - - public static String getAuthorityItemUri(String authorityServiceName, String inAuthorityID, String docID) { - return "/" + authorityServiceName.toLowerCase() - + '/' + inAuthorityID - + '/' + ITEMS_PATH_COMPONENT // AuthorityClient.ITEMS - + '/' + docID; - } - - // FIXME: Create equivalent getUri-type method(s) for sub-resources, - // such as contacts - ADR, 2012-05-24 -} diff --git a/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java b/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java index bbf13fe53..d4e446c43 100644 --- a/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java +++ b/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java @@ -42,11 +42,7 @@ import org.collectionspace.services.common.XmlSaxFragmenter; import org.collectionspace.services.common.XmlTools; import org.collectionspace.services.common.api.FileTools; import org.collectionspace.services.common.api.Tools; -import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; -import org.collectionspace.services.common.config.URIUtils; -import org.collectionspace.services.common.context.ServiceBindingUtils; import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils; -import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.dom4j.Attribute; import org.dom4j.Document; -- 2.47.3