]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5518: More changes to service context setup to support existing hierarchy...
authorRichard Millet <richard.millet@berkeley.edu>
Mon, 10 Sep 2012 15:43:11 +0000 (08:43 -0700)
committerRichard Millet <richard.millet@berkeley.edu>
Mon, 10 Sep 2012 15:43:11 +0000 (08:43 -0700)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/common/src/main/java/org/collectionspace/services/common/AbstractCollectionSpaceResourceImpl.java
services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java
services/common/src/main/java/org/collectionspace/services/common/context/MultipartServiceContextFactory.java
services/common/src/main/java/org/collectionspace/services/common/context/MultipartServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextFactory.java
services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/common/context/ServiceContextFactory.java
services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java
services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java

index c8f304b5a143ba53f141017d5ada79cc7b8af263..e7a862fd63bfdcabe8dfa54a1039afe1271ff0d4 100644 (file)
@@ -265,13 +265,16 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         String shortIdentifier;
     }
 
-    protected String lookupParentCSID(String parentspecifier, String method, String op, MultivaluedMap<String, String> queryParams)
-            throws Exception {
-        CsidAndShortIdentifier tempResult = lookupParentCSIDAndShortIdentifer(parentspecifier, method, op, queryParams);
-        return tempResult.CSID;
-    }
+       protected String lookupParentCSID(String parentspecifier, String method,
+                       String op, UriInfo uriInfo) throws Exception {
+               CsidAndShortIdentifier tempResult = lookupParentCSIDAndShortIdentifer(
+                               parentspecifier, method, op, uriInfo);
+               return tempResult.CSID;
+       }
 
-    private CsidAndShortIdentifier lookupParentCSIDAndShortIdentifer(String parentspecifier, String method, String op, MultivaluedMap<String, String> queryParams)
+    private CsidAndShortIdentifier lookupParentCSIDAndShortIdentifer(String parentspecifier,
+               String method, String op,
+               UriInfo uriInfo)
             throws Exception {
         CsidAndShortIdentifier result = new CsidAndShortIdentifier();
         Specifier parentSpec = getSpecifier(parentspecifier, method, op);
@@ -287,7 +290,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         } else {
             parentShortIdentifier = parentSpec.value;
             String whereClause = buildWhereForAuthByName(parentSpec.value);
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getServiceName(), queryParams);
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getServiceName(), uriInfo);
             parentcsid = getRepositoryClient(ctx).findDocCSID(null, ctx, whereClause); //FIXME: REM - If the parent has been soft-deleted, should we be looking for the item?
         }
         result.CSID = parentcsid;
@@ -422,10 +425,13 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      */
     @GET
     @Produces("application/xml")
-    public AbstractCommonList getAuthorityList(@Context UriInfo ui) { //FIXME - REM 5/3/2012 - This is not reachable from the JAX-RS dispatcher.  Instead the equivalent method in ResourceBase is getting called.
-        try {
-            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
+    public AbstractCommonList getAuthorityList(@Context UriInfo uriInfo) { //FIXME - REM 5/3/2012 - This is not reachable from the JAX-RS dispatcher.  Instead the equivalent method in ResourceBase is getting called.
+       AbstractCommonList result = null;
+       
+       try {
+            MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(uriInfo);
+            
             DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> handler = createDocumentHandler(ctx);
             DocumentFilter myFilter = handler.getDocumentFilter();
             // Need to make the default sort order for authority items
@@ -441,13 +447,14 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
                 myFilter.setWhereClause(authorityCommonSchemaName + ":refName='" + nameQ + "'");
             }
             getRepositoryClient(ctx).getFiltered(ctx, handler);
-            return handler.getCommonPartList();
+            result = handler.getCommonPartList();
         } catch (Exception e) {
             throw bigReThrow(e, ServiceMessages.GET_FAILED);
         }
+        
+        return result;
     }
     
-
     /**
      * Update authority.
      *
@@ -512,25 +519,30 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      *************************************************************************/
     @POST
     @Path("{csid}/items")
-    public Response createAuthorityItem(@Context ResourceMap resourceMap, @Context UriInfo ui, 
-               @PathParam("csid") String specifier, String xmlPayload) {
+    public Response createAuthorityItem(
+               @Context ResourceMap resourceMap,
+               @Context UriInfo uriInfo, 
+               @PathParam("csid") String specifier,
+               String xmlPayload) {
+       Response result = null;
+       
         try {
             PoxPayloadIn input = new PoxPayloadIn(xmlPayload);
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), input);
-            ctx.setResourceMap(resourceMap);
-            ctx.setUriInfo(ui);
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), input, resourceMap, uriInfo);
 
             // Note: must have the parentShortId, to do the create.
             CsidAndShortIdentifier parent = lookupParentCSIDAndShortIdentifer(specifier, "createAuthorityItem", "CREATE_ITEM", null);
-            DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> handler = createItemDocumentHandler(ctx, parent.CSID, parent.shortIdentifier);
+            DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> handler = 
+               createItemDocumentHandler(ctx, parent.CSID, parent.shortIdentifier);
             String itemcsid = getRepositoryClient(ctx).create(ctx, handler);
             UriBuilder path = UriBuilder.fromResource(resourceClass);
             path.path(parent.CSID + "/items/" + itemcsid);
-            Response response = Response.created(path.build()).build();
-            return response;
+            result = Response.created(path.build()).build();
         } catch (Exception e) {
             throw bigReThrow(e, ServiceMessages.CREATE_FAILED);
         }
+        
+        return result;
     }
 
     @GET
@@ -607,19 +619,18 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     @Path("{csid}/items/{itemcsid}")
     public byte[] getAuthorityItem(
             @Context Request request,
-            @Context UriInfo ui,
+            @Context UriInfo uriInfo,
                @Context ResourceMap resourceMap,            
             @PathParam("csid") String parentspecifier,
             @PathParam("itemcsid") String itemspecifier) {
         PoxPayloadOut result = null;
         try {
-            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
-            String parentcsid = lookupParentCSID(parentspecifier, "getAuthorityItem(parent)", "GET_ITEM", queryParams);
+            String parentcsid = lookupParentCSID(parentspecifier, "getAuthorityItem(parent)", "GET_ITEM", uriInfo);
 
-            RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = null;
-            ctx = (RemoteServiceContext<PoxPayloadIn, PoxPayloadOut>) createServiceContext(getItemServiceName(), resourceMap, ui);
+            RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = 
+               (RemoteServiceContext<PoxPayloadIn, PoxPayloadOut>) createServiceContext(getItemServiceName(), resourceMap, uriInfo);
             
-            JaxRsContext jaxRsContext = new JaxRsContext(request, ui); // REM - Why are we setting this?  Who is using the getter?
+            JaxRsContext jaxRsContext = new JaxRsContext(request, uriInfo); // REM - Why are we setting this?  Who is using the getter?
             ctx.setJaxRsContext(jaxRsContext);
 
             // We omit the parentShortId, only needed when doing a create...
@@ -690,22 +701,23 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     @Path("{csid}/items")
     @Produces("application/xml")
     public AbstractCommonList getAuthorityItemList(@PathParam("csid") String specifier,
-            @Context UriInfo ui) {
+            @Context UriInfo uriInfo) {
        AbstractCommonList result = null;
        
         try {
-            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), uriInfo);
+            MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
+            
             String orderBy = queryParams.getFirst(IClientQueryParams.ORDER_BY_PARAM);
             String termStatus = queryParams.getFirst(SEARCH_TYPE_TERMSTATUS);
             String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
             String advancedSearch = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_AS);
             String partialTerm = queryParams.getFirst(IQueryManager.SEARCH_TYPE_PARTIALTERM);
 
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), queryParams);
             // For the wildcard case, parentcsid is null, but docHandler will deal with this.
             // We omit the parentShortId, only needed when doing a create...
             String parentcsid = PARENT_WILDCARD.equals(specifier) ? null :
-                               lookupParentCSID(specifier, "getAuthorityItemList", "LIST", queryParams);
+                               lookupParentCSID(specifier, "getAuthorityItemList", "LIST", uriInfo);
             DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> handler =
                createItemDocumentHandler(ctx, parentcsid, null);
             
@@ -727,7 +739,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
                 myFilter.appendWhereClause(tsClause, IQueryManager.SEARCH_QUALIFIER_AND);
             }
 
-            result = search(ctx, handler, queryParams, orderBy, keywords, advancedSearch, partialTerm);            
+            result = search(ctx, handler, uriInfo, orderBy, keywords, advancedSearch, partialTerm);            
         } catch (Exception e) {
             throw bigReThrow(e, ServiceMessages.LIST_FAILED);
         }
@@ -762,14 +774,13 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     public AuthorityRefDocList getReferencingObjects(
             @PathParam("csid") String parentspecifier,
             @PathParam("itemcsid") String itemspecifier,
-            @Context UriInfo ui) {
+            @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);
@@ -810,19 +821,16 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
     public AuthorityRefList getAuthorityItemAuthorityRefs(
             @PathParam("csid") String parentspecifier,
             @PathParam("itemcsid") String itemspecifier,
-            @Context UriInfo ui) {
+            @Context UriInfo uriInfo) {
         AuthorityRefList authRefList = null;
         try {
             // Note that we have to create the service context for the Items, not the main service
-            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = null;
-
-            String parentcsid = lookupParentCSID(parentspecifier, "getAuthorityItemAuthRefs(parent)", "GET_ITEM_AUTH_REFS", queryParams);
-
-            ctx = createServiceContext(getItemServiceName(), queryParams);
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), uriInfo);
+            MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
+            String parentcsid = lookupParentCSID(parentspecifier, "getAuthorityItemAuthRefs(parent)", "GET_ITEM_AUTH_REFS", uriInfo);
             // We omit the parentShortId, only needed when doing a create...
             DocumentModelHandler<?, AbstractCommonList> handler =
-                    (DocumentModelHandler<?, AbstractCommonList>)createItemDocumentHandler(ctx, parentcsid, null);
+                    (DocumentModelHandler<?, AbstractCommonList>)createItemDocumentHandler(ctx, parentcsid, null /*no parent short ID*/);
 
             String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "getAuthorityItemAuthRefs(item)", "GET_ITEM_AUTH_REFS", ctx);
 
index ed5cd247c7a302e109bac43769f81b5bf83cae3d..1388e31c890c37504ee97e784046e939ad87f414 100644 (file)
@@ -160,7 +160,7 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
         ServiceContext<IT, OT> ctx = createServiceContext(this.getServiceName(),\r
                        (IT)null, //inputType\r
                        null, // The resource map\r
-                       (MultivaluedMap<String, String>)null, // The query params\r
+                       (UriInfo)null, // The query params\r
                        this.getCommonPartClass());\r
         return ctx;\r
     }    \r
@@ -179,7 +179,7 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
                        serviceName,\r
                        (IT)null, // The input part\r
                        null, // The resource map\r
-                       (MultivaluedMap<String, String>)null, // The queryParams\r
+                       (UriInfo)null, // The queryParams\r
                        (Class<?>)null  /*input type's Class*/);\r
         return ctx;\r
     }\r
@@ -189,7 +189,7 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
                        serviceName,\r
                        (IT)null, // The input part\r
                        null, // The resource map\r
-                       (MultivaluedMap<String, String>)null, // The queryParams\r
+                       (UriInfo)null, // The queryParams\r
                        (Class<?>)null  /*input type's Class*/);\r
         ctx.setUriInfo(ui);\r
         return ctx;\r
@@ -210,35 +210,16 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
         ServiceContext<IT, OT> ctx = createServiceContext(serviceName,\r
                        input,\r
                        null, // The resource map\r
-                       (MultivaluedMap<String, String>)null, /*queryParams*/\r
+                       (UriInfo)null, /*queryParams*/\r
                        (Class<?>)null  /*input type's Class*/);\r
         return ctx;\r
     }\r
     \r
-    /**\r
-     * Creates the service context.\r
-     * \r
-     * @param serviceName the service name\r
-     * @return the service context< i t, o t>\r
-     * @throws Exception the exception\r
-     */\r
-    protected ServiceContext<IT, OT> createServiceContext(String serviceName,\r
-               MultivaluedMap<String, String> queryParams) throws Exception {          \r
-        ServiceContext<IT, OT> ctx = createServiceContext(serviceName,\r
-                       (IT)null,\r
-                       null, // The resource map\r
-                       queryParams,\r
-                       (Class<?>)null  /*input type's Class*/);\r
-        return ctx;\r
-    }    \r
-\r
-    protected ServiceContext<IT, OT> createServiceContext(UriInfo ui) throws Exception {\r
-        MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
+    protected ServiceContext<IT, OT> createServiceContext(UriInfo uriInfo) throws Exception {\r
         ServiceContext<IT, OT> ctx = createServiceContext(\r
                        (IT)null, /*input*/\r
-                       queryParams,\r
+                       uriInfo,\r
                        (Class<?>)null  /*input type's Class*/);\r
-        ctx.setUriInfo(ui);\r
         return ctx;\r
     }\r
 \r
@@ -271,7 +252,7 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
     protected ServiceContext<IT, OT> createServiceContext(IT input, Class<?> theClass) throws Exception {      \r
         ServiceContext<IT, OT> ctx = createServiceContext(\r
                        input,\r
-                       (MultivaluedMap<String, String>)null, //queryParams,\r
+                       (UriInfo)null, //queryParams,\r
                        theClass);\r
         return ctx;\r
     }\r
@@ -279,41 +260,43 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
     protected ServiceContext<IT, OT> createServiceContext(\r
                String serviceName,\r
                ResourceMap resourceMap,\r
-               UriInfo ui) throws Exception {\r
+               UriInfo uriInfo) throws Exception {\r
        ServiceContext<IT, OT> ctx = createServiceContext(\r
                        serviceName,\r
                        null, // The input object\r
                        resourceMap,\r
-                       ui.getQueryParameters(),\r
+                       uriInfo,\r
                        null /* the class of the input type */);\r
-       ctx.setUriInfo(ui);\r
        return ctx;\r
     }\r
     \r
     protected ServiceContext<IT, OT> createServiceContext(\r
                IT input,\r
                ResourceMap resourceMap,\r
-               UriInfo ui) throws Exception {\r
+               UriInfo uriInfo) throws Exception {\r
        ServiceContext<IT, OT> ctx = createServiceContext(\r
                        this.getServiceName(),\r
                        input,\r
                        resourceMap,\r
-                       ui.getQueryParameters(),\r
+                       uriInfo,\r
                        null /* the class of the input type */);\r
-       ctx.setUriInfo(ui);\r
        return ctx;\r
     }\r
-\r
+    \r
     protected ServiceContext<IT, OT> createServiceContext(\r
+               String serviceName,\r
                IT input,\r
-               MultivaluedMap<String, String> queryParams) throws Exception {\r
-       return createServiceContext(this.getServiceName(),\r
+               ResourceMap resourceMap,\r
+               UriInfo uriInfo) throws Exception {\r
+       ServiceContext<IT, OT> ctx = createServiceContext(\r
+                       serviceName,\r
                        input,\r
-                       null, // The resource map\r
-                       queryParams,\r
-                       null); // The class of the input type.\r
+                       resourceMap,\r
+                       uriInfo,\r
+                       null /* the class of the input type */);\r
+       return ctx;\r
     }\r
-    \r
+        \r
     /**\r
      * Creates the service context.\r
      * \r
@@ -325,14 +308,14 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
      * \r
      * @throws Exception the exception\r
      */\r
-    protected ServiceContext<IT, OT> createServiceContext(\r
+    private ServiceContext<IT, OT> createServiceContext(\r
                IT input,\r
-               MultivaluedMap<String, String> queryParams,\r
+               UriInfo uriInfo,\r
                Class<?> theClass) throws Exception {\r
        return createServiceContext(this.getServiceName(),\r
                        input,\r
                        null, // The resource map\r
-                       queryParams,\r
+                       uriInfo,\r
                        theClass);\r
     }\r
 \r
@@ -352,13 +335,13 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
                String serviceName,\r
                IT input,\r
                ResourceMap resourceMap,\r
-               MultivaluedMap<String, String> queryParams,\r
+               UriInfo uriInfo,\r
                Class<?> theClass) throws Exception {\r
         ServiceContext<IT, OT> ctx = getServiceContextFactory().createServiceContext(\r
                        serviceName,\r
                        input,\r
                        resourceMap,\r
-                       queryParams,\r
+                       uriInfo,\r
                        theClass != null ? theClass.getPackage().getName() : null,\r
                        theClass != null ? theClass.getName() : null);\r
         if (theClass != null) {\r
index 3cf450ea554f0e03368b633c3d3ef70188f900d8..3d0c57675e3a8a513b6b1639cb7991895fdd851f 100644 (file)
@@ -292,7 +292,7 @@ public abstract class ResourceBase
             String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);\r
             String advancedSearch = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_AS);\r
             String partialTerm = queryParams.getFirst(IQueryManager.SEARCH_TYPE_PARTIALTERM);\r
-            list = search(queryParams, orderBy, keywords, advancedSearch, partialTerm);\r
+            list = search(ui, orderBy, keywords, advancedSearch, partialTerm);\r
         } else {\r
             list = getCommonList(ui);\r
         }\r
index c98bc8fd909d76c8ee36ffcc7d273aae89987f88..0b8df0143172a206d3468ca3d9c3c83d5f249714 100644 (file)
@@ -24,6 +24,7 @@
 package org.collectionspace.services.common.context;
 
 import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
 
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
@@ -82,12 +83,12 @@ public class MultipartServiceContextFactory
                String serviceName,
                PoxPayloadIn input,
                ResourceMap resourceMap,
-               MultivaluedMap<String, String> queryParams)
+               UriInfo uriInfo)
                        throws Exception {
        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = new MultipartServiceContextImpl(serviceName,
                        input,
                        resourceMap,
-                       queryParams);
+                       uriInfo);
        return ctx;
     }
     
@@ -99,9 +100,9 @@ public class MultipartServiceContextFactory
                String serviceName, 
                PoxPayloadIn input,
                ResourceMap resourceMap,
-               MultivaluedMap<String, String> queryParams,
+               UriInfo uriInfo,
                String documentType,
                String entityName) throws Exception {
-       return this.createServiceContext(serviceName, input, resourceMap, queryParams);
+       return this.createServiceContext(serviceName, input, resourceMap, uriInfo);
     }
 }
index 1faa6097c4c8fff7460f813d5716bbb9cc2c2f21..7c786735c709afc1c00e78c3bd20d036add25c7e 100644 (file)
@@ -28,6 +28,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
 
 import org.collectionspace.services.client.PayloadInputPart;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -96,9 +97,9 @@ public class MultipartServiceContextImpl
                String serviceName,
                PoxPayloadIn theInput,
                ResourceMap resourceMap,
-               MultivaluedMap<String, String> queryParams
+               UriInfo uriInfo
                        throws DocumentException, UnauthorizedException {
-       super(serviceName, theInput, resourceMap, queryParams);
+       super(serviceName, theInput, resourceMap, uriInfo);
        setOutput(new PoxPayloadOut(serviceName));
     }
 
index ac9a4e76ff9a8e8c57f84078a2f54abdaec36c2d..93272ac8486d2a05647d3d4a468b993814261a64 100644 (file)
@@ -27,6 +27,7 @@
 package org.collectionspace.services.common.context;\r
 \r
 import javax.ws.rs.core.MultivaluedMap;\r
+import javax.ws.rs.core.UriInfo;\r
 \r
 import org.collectionspace.services.common.ResourceMap;\r
 \r
@@ -82,11 +83,11 @@ public class RemoteServiceContextFactory<IT, OT>
                String serviceName,\r
                IT theInput,\r
                ResourceMap resourceMap,\r
-               MultivaluedMap<String, String> queryParams) throws Exception {\r
+               UriInfo uriInfo) throws Exception {\r
        ServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName,\r
                        theInput,\r
                        resourceMap,\r
-                       queryParams);\r
+                       uriInfo);\r
        \r
         return ctx;\r
     }\r
@@ -95,14 +96,14 @@ public class RemoteServiceContextFactory<IT, OT>
     public ServiceContext<IT, OT> createServiceContext(String serviceName,\r
                IT input,\r
                ResourceMap resourceMap,\r
-               MultivaluedMap<String, String> queryParams,\r
+               UriInfo uriInfo,\r
                String documentType,\r
                String entityName) throws Exception {\r
        ServiceContext<IT, OT> ctx = createServiceContext(\r
                        serviceName,\r
                        input,\r
                        resourceMap,\r
-                       queryParams);\r
+                       uriInfo);\r
         ctx.setDocumentType(documentType); //persistence unit\r
         ctx.setProperty(ServiceContextProperties.ENTITY_NAME, entityName);\r
         return ctx;\r
index 50c1a704c41e11f770a8d163658f55e74f1a30a7..614ad665c00e2a07e652d1803e4c133722a423ef 100644 (file)
 package org.collectionspace.services.common.context;
 
 import java.lang.reflect.Constructor;
-
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
 
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.security.UnauthorizedException;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -99,10 +99,11 @@ public class RemoteServiceContextImpl<IT, OT>
     protected RemoteServiceContextImpl(String serviceName,
                IT theInput,
                ResourceMap resourceMap,
-               MultivaluedMap<String, String> queryParams) throws UnauthorizedException {
+               UriInfo uriInfo) throws UnauthorizedException {
         this(serviceName, theInput);
         this.setResourceMap(resourceMap);
-        this.setQueryParams(queryParams);
+        this.setUriInfo(uriInfo);
+        this.setQueryParams(uriInfo.getQueryParameters());
     }
 
     /* (non-Javadoc)
index dcaa909a65bf5f446b3a01d1aae62a988335500a..bcc5e79a8ad3da81106ddfcc89100a681821404e 100644 (file)
@@ -24,6 +24,7 @@
 package org.collectionspace.services.common.context;
 
 import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
 
 import org.collectionspace.services.common.ResourceMap;
 
@@ -72,7 +73,7 @@ public interface ServiceContextFactory<IT, OT> {
                String serviceName,
                IT input,
                ResourceMap resourceMap,                
-               MultivaluedMap<String, String> queryParams) throws Exception;    
+               UriInfo uriInfo) throws Exception;    
         
     /**
      * Creates a new ServiceContext object.
@@ -91,7 +92,7 @@ public interface ServiceContextFactory<IT, OT> {
                String serviceName,
                IT input, 
                ResourceMap resourceMap,
-               MultivaluedMap<String, String> queryParams,
+               UriInfo uriInfo,
                String documentType,
                String entityName) throws Exception;
 }
index cd2c047a0f7703035e8ef8b9de17ac0e3c98c009..76158bfdd452442d68cf914bbe31c37ada4d8a09 100644 (file)
@@ -150,17 +150,18 @@ public abstract class AuthorityResourceWithContacts<AuthCommon, AuthItemHandler>
     public AbstractCommonList getContactList(
             @PathParam("parentcsid") String parentspecifier,
             @PathParam("itemcsid") String itemspecifier,
-            @Context UriInfo ui) {
+            @Context UriInfo uriInfo) {
         AbstractCommonList contactObjectList = new AbstractCommonList();
+
         try {
+            ServiceContext ctx = createServiceContext(getContactServiceName(), uriInfo);
+            MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
+               
             String parentcsid = lookupParentCSID(parentspecifier, "getContactList(parent)", "GET_CONTACT_LIST", null);
-
             ServiceContext itemCtx = createServiceContext(getItemServiceName());
             String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "getContactList(item)", "GET_CONTACT_LIST", itemCtx);
 
-            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
-            ServiceContext ctx = createServiceContext(getContactServiceName(), queryParams);
-            DocumentHandler handler = createContactDocumentHandler(ctx, parentcsid, itemcsid, ui);
+            DocumentHandler handler = createContactDocumentHandler(ctx, parentcsid, itemcsid, uriInfo);
             DocumentFilter myFilter = handler.getDocumentFilter(); //new DocumentFilter();
             myFilter.appendWhereClause(ContactJAXBSchema.CONTACTS_COMMON + ":"
                     + ContactJAXBSchema.IN_AUTHORITY
@@ -178,6 +179,7 @@ public abstract class AuthorityResourceWithContacts<AuthCommon, AuthItemHandler>
                     + parentspecifier + ": and item:" + itemspecifier + ": was not found.",
                     itemspecifier);
         }
+        
         return contactObjectList;
     }
 
index eaa97f7c0f40e9a449262aa02c448c0e0637b5ac..4e44778b6dc0a36a2e8abe2dec5568b2cf210623 100644 (file)
@@ -120,13 +120,12 @@ public class MediaResource extends ResourceBase {
      * Creates a new media record/resource AND creates a new blob (using a URL pointing to a media file/resource) and associates
      * it with the new media record/resource.
      */
-    protected Response createBlobWithUri(ResourceMap resourceMap, UriInfo ui, String xmlPayload, String blobUri) {
+    protected Response createBlobWithUri(ResourceMap resourceMap, UriInfo uriInfo, String xmlPayload, String blobUri) {
        Response response = null;
        
        try {
-            MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(BlobClient.SERVICE_NAME,
-                               queryParams);
+                               uriInfo);
                BlobInput blobInput = BlobUtil.getBlobInput(ctx); // the blob doc handler will look for this in the context
                blobInput.createBlobFile(blobUri); // The blobUri argument is our payload
                response = this.create((PoxPayloadIn)null, ctx); // By now the binary bits have been created and we just need to create the metadata blob record -this info is in the blobInput var