<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xmlReplay>
+
+ <testGroup ID="HierarchicCollectionObject" autoDeletePOSTS="false">
<testGroup ID="CreateCollectionObjects"> <!-- autoDeletePOSTS="true" -->
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(queryParams);
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> handler = createDocumentHandler(ctx);
DocumentFilter myFilter = handler.getDocumentFilter();
// Need to make the default sort order for authority items
// All items in dive can look at their child uri's to get uri. So we calculate the very first one. We could also do a GET and look at the common part uri field, but why...?
String calledUri = ui.getPath();
String uri = "/" + calledUri.substring(0, (calledUri.length() - ("/" + hierarchy).length()));
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName());
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), ui);
ctx.setUriInfo(ui);
String direction = ui.getQueryParameters().getFirst(Hierarchy.directionQP);
if (Tools.notBlank(direction) && Hierarchy.direction_parents.equals(direction)) {
@Context UriInfo ui) {
AbstractCommonList list;
if (docType != null && !docType.isEmpty() && mode != null && !mode.isEmpty()) {
- list = batchSearch(ui.getQueryParameters(), docType, mode);
+ list = batchSearch(ui, docType, mode);
} else {
list = getList(ui);
}
return list;
}
- private AbstractCommonList batchSearch(MultivaluedMap<String, String> queryParams,
+ private AbstractCommonList batchSearch(UriInfo ui,
String docType, String mode) {
try {
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
DocumentHandler handler = createDocumentHandler(ctx);
// perform a search by docType and invocation mode
DocumentFilter documentFilter = handler.getDocumentFilter();
return BlobsCommon.class;
}
- //FIXME: Is this method used/needed?
- @Deprecated
- private CommonList getBlobList(MultivaluedMap<String, String> queryParams) {
- return (CommonList)getList(queryParams);
- }
-
@Deprecated
public CommonList getBlobList(List<String> csidList) {
return (CommonList) getList(csidList);
return ctx;\r
}\r
\r
+ protected ServiceContext<IT, OT> createServiceContext(String serviceName, UriInfo ui) throws Exception { \r
+ ServiceContext<IT, OT> ctx = createServiceContext(\r
+ serviceName,\r
+ (IT)null, // The input part\r
+ null, // The resource map\r
+ (MultivaluedMap<String, String>)null, // The queryParams\r
+ (Class<?>)null /*input type's Class*/);\r
+ ctx.setUriInfo(ui);\r
+ return ctx;\r
+ } \r
+ \r
/**\r
* Creates the service context.\r
* \r
return ctx;\r
} \r
\r
- /**\r
- * Creates the service context.\r
- * \r
- * @param queryParams the query params\r
- * \r
- * @return the service context< i t, o t>\r
- * \r
- * @throws Exception the exception\r
- */\r
- protected ServiceContext<IT, OT> createServiceContext(MultivaluedMap<String, String> queryParams) throws Exception {\r
- ServiceContext<IT, OT> ctx = createServiceContext(\r
- (IT)null, /*input*/\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
ServiceContext<IT, OT> ctx = createServiceContext(\r
(IT)null, /*input*/\r
queryParams,\r
(Class<?>)null /*input type's Class*/);\r
+ ctx.setUriInfo(ui);\r
return ctx;\r
}\r
\r
-\r
-\r
- \r
/**\r
* Creates the service context.\r
* \r
PoxPayloadOut result = null;\r
ensureCSID(csid, READ);\r
try {\r
- MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
- RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = (RemoteServiceContext<PoxPayloadIn, PoxPayloadOut>) createServiceContext(queryParams);\r
+ RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = (RemoteServiceContext<PoxPayloadIn, PoxPayloadOut>) createServiceContext(ui);\r
result = get(csid, ctx);// ==> CALL implementation method, which subclasses may override.\r
if (result == null) {\r
Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
//======================= GET without csid. List, search, etc. =====================================\r
@GET\r
public AbstractCommonList getList(@Context UriInfo ui) {\r
- MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
AbstractCommonList list = null;\r
\r
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
if (isGetAllRequest(queryParams) == false) {\r
String orderBy = queryParams.getFirst(IClientQueryParams.ORDER_BY_PARAM);\r
String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);\r
String partialTerm = queryParams.getFirst(IQueryManager.SEARCH_TYPE_PARTIALTERM);\r
list = search(queryParams, orderBy, keywords, advancedSearch, partialTerm);\r
} else {\r
- list = getList(queryParams);\r
+ list = getCommonList(ui);\r
}\r
\r
return list;\r
}\r
\r
- protected AbstractCommonList getList(MultivaluedMap<String, String> queryParams) {\r
+ protected AbstractCommonList getCommonList(UriInfo ui) {\r
try {\r
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);\r
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);\r
DocumentHandler handler = createDocumentHandler(ctx);\r
getRepositoryClient(ctx).getFiltered(ctx, handler);\r
AbstractCommonList list = (AbstractCommonList) handler.getCommonPartList();\r
protected AbstractCommonList search(\r
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,\r
DocumentHandler handler, \r
- MultivaluedMap<String, String> queryParams,\r
+ UriInfo ui,\r
String orderBy,\r
String keywords,\r
String advancedSearch,\r
}\r
\r
private AbstractCommonList search(\r
- MultivaluedMap<String, String> queryParams,\r
+ UriInfo ui,\r
String orderBy,\r
String keywords,\r
String advancedSearch,\r
\r
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx;\r
try {\r
- ctx = createServiceContext(queryParams);\r
+ ctx = createServiceContext(ui);\r
DocumentHandler handler = createDocumentHandler(ctx);\r
- result = search(ctx, handler, queryParams, orderBy, keywords, advancedSearch, partialTerm);\r
+ result = search(ctx, handler, ui, orderBy, keywords, advancedSearch, partialTerm);\r
} catch (Exception e) {\r
throw bigReThrow(e, ServiceMessages.SEARCH_FAILED);\r
}\r
@Context UriInfo ui) {\r
AuthorityRefList authRefList = null;\r
try {\r
- MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);\r
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);\r
DocumentModelHandler<PoxPayloadIn, PoxPayloadOut> handler = (DocumentModelHandler<PoxPayloadIn, PoxPayloadOut>) createDocumentHandler(ctx);\r
List<AuthRefConfigInfo> authRefsInfo = RefNameServiceUtils.getConfiguredAuthorityRefs(ctx);\r
authRefList = handler.getAuthorityRefs(csid, authRefsInfo);\r
}
private static String dive(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String itemcsid, String uri, boolean lookupFirstName) {
- MultivaluedMap<String, String> queryParams = ctx.getUriInfo().getQueryParameters();
+ MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
//Run getList() once as sent to get childListOuter:
queryParams.putSingle(IRelationsManager.PREDICATE_QP, RelationshipType.HAS_BROADER.value());
queryParams.putSingle(IRelationsManager.SUBJECT_QP, null);
}
private static SurfaceResultStruct surface(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String itemcsid, String uri, boolean first) {
- MultivaluedMap<String, String> queryParams = ctx.getUriInfo().getQueryParameters();
+ MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
//Run getList() once as sent to get parentListOuter:
queryParams.putSingle(IRelationsManager.PREDICATE_QP, RelationshipType.HAS_BROADER.value());
queryParams.putSingle(IRelationsManager.SUBJECT_QP, itemcsid);
}
private RelationsCommonList getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
- if (parentCtx != null) {
- uriInfo = parentCtx.getUriInfo(); //Override the input param and use the parent context's UriInfo
- }
MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
-
+
String subjectCsid = queryParams.getFirst(IRelationsManager.SUBJECT_QP);
String subjectType = queryParams.getFirst(IRelationsManager.SUBJECT_TYPE_QP);
String predicate = queryParams.getFirst(IRelationsManager.PREDICATE_QP);
String objectCsid = queryParams.getFirst(IRelationsManager.OBJECT_QP);
String objectType = queryParams.getFirst(IRelationsManager.OBJECT_TYPE_QP);
- return this.getRelationList(parentCtx, queryParams, subjectCsid, subjectType, predicate, objectCsid, objectType);
+ return this.getRelationList(parentCtx, uriInfo, subjectCsid, subjectType, predicate, objectCsid, objectType);
}
private RelationsCommonList getRelationList(
ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx,
- MultivaluedMap<String, String> queryParams,
+ UriInfo uriInfo,
String subjectCsid, String subjectType,
String predicate,
String objectCsid,
String objectType) throws WebApplicationException {
try {
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(uriInfo);
if (parentCtx != null) { // If the parent context has an open repository session then use it
ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession());
}
//
// Handle keyword clause
//
- String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
+ String keywords = uriInfo.getQueryParameters().getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
if (keywords != null && keywords.isEmpty() == false) {
String keywordClause = QueryManager.createWhereClauseFromKeywords(keywords);
handler.getDocumentFilter().appendWhereClause(keywordClause, IQueryManager.SEARCH_QUALIFIER_AND);
}
}
} catch (Throwable t){
- logger.error("Unable to addOutputPart: "+partLabel
- +" in serviceContextPath: "+this.getServiceContextPath()
- +" with URI: "+this.getServiceContext().getUriInfo().getPath()
- +" error: "+t);
+ logger.error("Unable to addOutputPart: " + partLabel
+ + " in serviceContextPath: "+this.getServiceContextPath()
+ + " with URI: " + this.getServiceContext().getUriInfo().getPath()
+ + " error: " + t);
}
}
} else {
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
@Path(ReportClient.SERVICE_PATH)
@Consumes("application/xml")
}
@Override
- protected AbstractCommonList getList(MultivaluedMap<String, String> queryParams) {
+ protected AbstractCommonList getCommonList(UriInfo ui) {
try {
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
+ MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
DocumentHandler handler = createDocumentHandler(ctx);
String docType = queryParams.getFirst(IQueryManager.SEARCH_TYPE_DOCTYPE);
String mode = queryParams.getFirst(IQueryManager.SEARCH_TYPE_INVOCATION_MODE);
@Path("{csid}/output")
@Produces("application/pdf")
public Response invokeReport(
+ @Context UriInfo ui,
@PathParam("csid") String csid) {
InvocationContext invContext = new InvocationContext();
invContext.setMode(Invocable.INVOCATION_MODE_NO_CONTEXT);
- return invokeReport(csid, invContext);
+ return invokeReport(ui, csid, invContext);
}
@POST
@Path("{csid}")
@Produces("application/pdf")
public Response invokeReport(
+ @Context UriInfo ui,
@PathParam("csid") String csid,
InvocationContext invContext) {
if (csid == null || "".equals(csid)) {
ensureCSID(serviceGroupName, ResourceBase.READ);
AbstractCommonList list = null;
try {
- MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
- String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
ServiceGroupDocumentModelHandler handler = (ServiceGroupDocumentModelHandler)
createDocumentHandler(ctx);
ArrayList<String> groupsList = null;
groupsList.add(serviceGroupName);
}
// set up a keyword search
+ MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
+ String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
if (keywords != null && !keywords.isEmpty()) {
String whereClause = QueryManager.createWhereClauseFromKeywords(keywords);
if(Tools.isEmpty(whereClause)) {