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);
} 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;
*/
@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
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.
*
*************************************************************************/
@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
@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...
@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);
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);
}
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);
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);
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
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
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
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
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
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
* \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
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