}
@Override
- //public Class<BatchCommon> getCommonPartClass() {
- public Class getCommonPartClass() {
+ public Class<?> getCommonPartClass() {
return BatchCommon.class;
}
// other resource methods and use the getRepositoryClient() methods.
@Override
- protected AbstractCommonList getCommonList(UriInfo ui) {
+ protected AbstractCommonList getCommonList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo ui) {
try {
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
+ if (parentCtx != null && parentCtx.getCurrentRepositorySession() != null) {
+ ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession()); // Reuse the current repo session if one exists
+ }
MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
DocumentHandler handler = createDocumentHandler(ctx);
String docType = queryParams.getFirst(IQueryManager.SEARCH_TYPE_DOCTYPE);
@GET
public AbstractCommonList getList(@Context UriInfo uriInfo) {
uriInfo = new UriInfoWrapper(uriInfo);
+ return this.getList(null, uriInfo);
+ }
+
+ public AbstractCommonList getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
AbstractCommonList list = null;
MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
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);
- list = search(uriInfo, orderBy, keywords, advancedSearch, partialTerm);
+ list = search(parentCtx, uriInfo, orderBy, keywords, advancedSearch, partialTerm);
} else {
- list = getCommonList(uriInfo);
+ list = getCommonList(parentCtx, uriInfo);
}
return list;
}
protected AbstractCommonList getCommonList(UriInfo uriInfo) {
+ return getCommonList(null, uriInfo);
+ }
+
+ protected AbstractCommonList getCommonList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
try {
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(uriInfo);
- DocumentHandler handler = createDocumentHandler(ctx);
+ if (parentCtx != null && parentCtx.getCurrentRepositorySession() != null) {
+ ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession()); // Reuse the current repo session if one exists
+ } DocumentHandler handler = createDocumentHandler(ctx);
getRepositoryClient(ctx).getFiltered(ctx, handler);
AbstractCommonList list = (AbstractCommonList) handler.getCommonPartList();
return list;
}
private AbstractCommonList search(
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx,
UriInfo uriInfo,
String orderBy,
String keywords,
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx;
try {
ctx = createServiceContext(uriInfo);
+ if (parentCtx != null && parentCtx.getCurrentRepositorySession() != null) {
+ ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession()); // Reuse the current repo session if one exists
+ }
DocumentHandler handler = createDocumentHandler(ctx);
result = search(ctx, handler, uriInfo, orderBy, keywords, advancedSearch, partialTerm);
} catch (Exception e) {
return this.getList(parentCtx, parentCtx.getUriInfo());
}
- private RelationsCommonList getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
+ public RelationsCommonList getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
String subjectCsid = queryParams.getFirst(IRelationsManager.SUBJECT_QP);
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.index.IndexClient;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.NuxeoBasedResource;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
+import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.UriInfoWrapper;
import org.collectionspace.services.common.context.RemoteServiceContext;
import org.collectionspace.services.common.document.DocumentHandler;
.build();
throw new CSWebApplicationException(response);
}
-
+
+ @Override
+ public AbstractCommonList getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
+ throw new UnsupportedOperationException();
+ }
}
@Path(ReportClient.SERVICE_PATH)
@Consumes("application/xml")
@Produces("application/xml")
-//@Produces("application/xml;charset=UTF-8")
public class ReportResource extends NuxeoBasedResource {
final Logger logger = LoggerFactory.getLogger(ReportResource.class);
}
@Override
- protected AbstractCommonList getCommonList(UriInfo ui) {
+ protected AbstractCommonList getCommonList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo ui) {
try {
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
+ if (parentCtx != null && parentCtx.getCurrentRepositorySession() != null) {
+ ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession()); // Reuse the current repo session if one exists
+ }
MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
DocumentHandler handler = createDocumentHandler(ctx);
String docType = queryParams.getFirst(IQueryManager.SEARCH_TYPE_DOCTYPE);
*/
package org.collectionspace.services.workflow;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.NuxeoBasedResource;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
+import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.jaxb.AbstractCommonList;
import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
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.Response;
import javax.ws.rs.core.UriInfo;
.build();
throw new CSWebApplicationException(response);
}
-
+
+ @Override
+ public AbstractCommonList getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx, UriInfo uriInfo) {
+ throw new UnsupportedOperationException();
+ }
}