]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Merge remote-tracking branch 'upstream/master' into CSPACE-5271
authorAron Roberts <aron@socrates.berkeley.edu>
Tue, 11 Sep 2012 18:36:27 +0000 (11:36 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Tue, 11 Sep 2012 18:36:27 +0000 (11:36 -0700)
Conflicts:
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java

1  2 
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java
services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java

index 72a7ac736a4b2b9ac945e62c56be71cf6c74023e,7276c2d3c0aad018ddb3244200e60edad476999a..4279f1a22c206297fd9d111cc4c87d2017c3b0cb
@@@ -65,7 -63,11 +64,8 @@@ import java.util.Set
  //import org.collectionspace.services.common.FileUtils;
  import org.collectionspace.services.authorization.PermissionResource;
  import org.collectionspace.services.authorization.RoleResource;
 -import org.collectionspace.services.common.ResourceBase;
 -import org.collectionspace.services.common.ResourceMap;
 -import org.collectionspace.services.common.ResourceMapHolder;
 -import org.collectionspace.services.common.ResourceMapImpl;
 +import org.collectionspace.services.common.*;
+ import org.collectionspace.services.common.relation.RelationResource;
  import org.collectionspace.services.common.security.SecurityInterceptor;
  import org.jboss.resteasy.core.Dispatcher;
  import org.jboss.resteasy.spi.ResteasyProviderFactory;
index cd6c6caf1d20234e8d618f90abb4b88b4f6ff7fa,e7a862fd63bfdcabe8dfa54a1039afe1271ff0d4..d4681fcc094eccea534ca3b67e81b9462ae580d9
@@@ -791,15 -774,13 +781,14 @@@ public abstract class AuthorityResource
      public AuthorityRefDocList getReferencingObjects(
              @PathParam("csid") String parentspecifier,
              @PathParam("itemcsid") String itemspecifier,
-             @Context UriInfo ui) {
 +            @Context UriTemplateRegistry uriTemplateRegistry,
+             @Context UriInfo uriInfo) {
          AuthorityRefDocList authRefDocList = null;
          try {
-             MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
-             String parentcsid = lookupParentCSID(parentspecifier, "getReferencingObjects(parent)", "GET_ITEM_REF_OBJS", queryParams);
+             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), uriInfo);
+             MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
  
-             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), queryParams);
+             String parentcsid = lookupParentCSID(parentspecifier, "getReferencingObjects(parent)", "GET_ITEM_REF_OBJS", uriInfo);
              String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "getReferencingObjects(item)", "GET_ITEM_REF_OBJS", ctx);
  
              List<String> serviceTypes = queryParams.remove(ServiceBindingUtils.SERVICE_TYPE_PROP);
index a00b74f9242799d4c279a6cc49c3935e5c24f93e,788e91b7a81227b746eeb2e9da248b88bc3e8a8b..2d1dee0c8db80303c5ba221a88d71bf03f15bd8c
  package org.collectionspace.services.common.vocabulary.nuxeo;
  
  import org.collectionspace.services.client.AuthorityClient;
+ import org.collectionspace.services.client.CollectionSpaceClient;
  import org.collectionspace.services.client.IQueryManager;
- import org.collectionspace.services.client.PayloadInputPart;
- import org.collectionspace.services.client.PayloadOutputPart;
  import org.collectionspace.services.client.PoxPayloadIn;
  import org.collectionspace.services.client.PoxPayloadOut;
- import org.collectionspace.services.client.RelationClient;
  
- import org.collectionspace.services.common.ResourceBase;
 +import org.collectionspace.services.common.UriTemplateRegistry;
  import org.collectionspace.services.common.api.CommonAPI;
  import org.collectionspace.services.common.api.RefName;
  import org.collectionspace.services.common.api.Tools;
@@@ -452,10 -436,8 +437,9 @@@ public abstract class AuthorityItemDocu
                  AuthorityItemJAXBSchema.IN_AUTHORITY, inAuthority);
      }
      
-     
      public AuthorityRefDocList getReferencingObjects(
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
 +                UriTemplateRegistry uriTemplateRegistry, 
                List<String> serviceTypes,
                String propertyName,
              String itemcsid) throws Exception {
index ef31879bb5d5b96c779d8434e1c031e6d5a271e6,e0855324c031bdc82d503f300b9f0ba0aa85276a..6909eea351cb5da28b6a1bd30608fe4e1ddcf5c6
@@@ -23,7 -23,7 +23,8 @@@
   */\r
  package org.collectionspace.services.common;\r
  \r
 +import java.util.*;\r
+ import org.collectionspace.services.client.IClientQueryParams;\r
  import org.collectionspace.services.client.IQueryManager;\r
  import org.collectionspace.services.client.PoxPayloadIn;\r
  import org.collectionspace.services.client.PoxPayloadOut;\r
@@@ -414,94 -509,6 +516,95 @@@ public abstract class ResourceBas
                        throws Exception, DocumentNotFoundException {\r
        return getDocModelForAuthorityItem(repoSession, RefName.AuthorityItem.parse(refName));\r
      }\r
 +    \r
 +    protected String getDocType(String tenantId) {\r
 +        return getDocType(tenantId, getServiceName());\r
 +    }\r
 +\r
 +    /**\r
 +     * Returns the Nuxeo document type associated with a specified service, within a specified tenant.\r
 +     * \r
 +     * @param tenantId a tenant ID\r
 +     * @param serviceName a service name\r
 +     * @return the Nuxeo document type associated with that service and tenant.\r
 +     */\r
 +    // FIXME: This method may properly belong in a different services package or class.\r
 +    // Also, we need to check for any existing methods that may duplicate this one.\r
 +    protected String getDocType(String tenantId, String serviceName) {\r
 +        String docType = "";\r
 +        if (Tools.isBlank(tenantId)) {\r
 +            return docType;\r
 +        }\r
 +        ServiceBindingType sb = getTenantBindingsReader().getServiceBinding(tenantId, serviceName);\r
 +        if (sb == null) {\r
 +            return docType;\r
 +        }\r
 +        docType = sb.getObject().getName(); // Reads the Nuxeo Document Type from tenant bindings configuration\r
 +        System.out.println(tenantId + " : " + serviceName + " : " + docType); // FIXME: for debugging\r
 +        return docType;\r
 +    }\r
 +    \r
 +    /**\r
 +     * Returns a UriRegistry entry: a map of tenant-qualified URI templates\r
 +     * for the current resource, for all tenants\r
 +     * \r
 +     * @return a map of URI templates for the current resource, for all tenants\r
 +     */\r
 +    public Map<UriTemplateRegistryKey,StoredValuesUriTemplate> getUriRegistryEntries() {\r
 +        Map<UriTemplateRegistryKey,StoredValuesUriTemplate> uriRegistryEntriesMap =\r
 +                new HashMap<UriTemplateRegistryKey,StoredValuesUriTemplate>();\r
 +        List<String> tenantIds = getTenantBindingsReader().getTenantIds();\r
 +        for (String tenantId : tenantIds) {\r
 +                uriRegistryEntriesMap.putAll(getUriRegistryEntries(tenantId, getDocType(tenantId), UriTemplateFactory.RESOURCE));\r
 +        }\r
 +        return uriRegistryEntriesMap;\r
 +    }\r
 +    \r
 +    /**\r
 +     * Returns a UriRegistry entry: a map of tenant-qualified URI templates\r
 +     * for the current resource, for a specified tenants\r
 +     * \r
 +     * @return a map of URI templates for the current resource, for a specified tenant\r
 +     */\r
 +    protected Map<UriTemplateRegistryKey,StoredValuesUriTemplate> getUriRegistryEntries(String tenantId,\r
 +            String docType, UriTemplateFactory.UriTemplateType type) {\r
 +        Map<UriTemplateRegistryKey,StoredValuesUriTemplate> uriRegistryEntriesMap =\r
 +                new HashMap<UriTemplateRegistryKey,StoredValuesUriTemplate>();\r
 +        UriTemplateRegistryKey key;\r
 +        if (Tools.isBlank(tenantId) || Tools.isBlank(docType)) {\r
 +            return uriRegistryEntriesMap;\r
 +        }\r
 +        key = new UriTemplateRegistryKey();\r
 +        key.setTenantId(tenantId);\r
 +        key.setDocType(docType); \r
 +        uriRegistryEntriesMap.put(key, getUriTemplate(type));\r
 +        return uriRegistryEntriesMap;\r
 +    }\r
 +    \r
 +    /**\r
 +     * Returns a URI template of the appropriate type, populated with the\r
 +     * current service name as one of its stored values.\r
 +     *      * \r
 +     * @param type a URI template type\r
 +     * @return a URI template of the appropriate type.\r
 +     */\r
 +    protected StoredValuesUriTemplate getUriTemplate(UriTemplateFactory.UriTemplateType type) {\r
 +        Map<String,String> storedValuesMap = new HashMap<String,String>();\r
 +        storedValuesMap.put(UriTemplateFactory.SERVICENAME_VAR, getServiceName());\r
 +        StoredValuesUriTemplate template =\r
 +                UriTemplateFactory.getURITemplate(type, storedValuesMap);\r
 +        return template;\r
 +    }\r
 +\r
 +    /**\r
 +     * Returns a reader for reading values from tenant bindings configuration\r
 +     * \r
 +     * @return a tenant bindings configuration reader\r
 +     */\r
 +    protected TenantBindingConfigReaderImpl getTenantBindingsReader() {\r
 +        return ServiceMain.getInstance().getTenantBindingConfigReader();\r
 +    }\r
 +\r
  \r
+     \r
  }\r
index e6691991aaee677efc77d9fca90f9512775e8613,9583ec9dc51adfdfee29ae2e01b6239597134ae1..fc962d79519fe62d345037ac5c71228202b2969e
@@@ -67,9 -65,7 +67,8 @@@ import org.collectionspace.services.com
  import org.collectionspace.services.config.service.ServiceBindingType;\r
  import org.collectionspace.services.jaxb.AbstractCommonList;\r
  import org.collectionspace.services.nuxeo.util.NuxeoUtils;\r
 +import org.jboss.resteasy.spi.ResteasyProviderFactory;\r
  \r
\r
  /**\r
   * RefNameServiceUtils is a collection of services utilities related to refName\r
   * usage.\r
index d4e446c4349b7e972b1d420891c3062be3d19472,ff40a3c489e95d7514f199d43b1c74f56c640357..1c8738892dc29268cf2435a9b0b252afacc44d9e
@@@ -41,8 -37,12 +41,8 @@@ import org.collectionspace.services.com
  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.GregorianCalendarDateTimeUtils;
  import org.collectionspace.services.common.api.Tools;
- import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
 -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.config.service.ServiceBindingType;
  import org.collectionspace.services.nuxeo.util.NuxeoUtils;
  import org.dom4j.Attribute;
  import org.dom4j.Document;