if (parentShortIdentifier == null) {
authorityRefNameBase = null;
} else {
- ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx =
- createServiceContext(getServiceName());
- if (parentShortIdentifier.equals(FETCH_SHORT_ID)) {
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx = createServiceContext(getServiceName());
+ if (parentShortIdentifier.equals(FETCH_SHORT_ID)) { // We need to fetch this from the repo
+ if (ctx.getCurrentRepositorySession() != null) {
+ parentCtx.setCurrentRepositorySession(ctx.getCurrentRepositorySession()); // We need to use the current repo session if one exists
+ }
// Get from parent document
parentShortIdentifier = getAuthShortIdentifier(parentCtx, inAuthority);
}
return docHandler;
}
- public String getAuthShortIdentifier(
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String authCSID)
+ public String getAuthShortIdentifier(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String authCSID)
throws DocumentNotFoundException, DocumentException {
String shortIdentifier = null;
+
try {
- AuthorityDocumentModelHandler<?> handler =
- (AuthorityDocumentModelHandler<?>) createDocumentHandler(ctx);
- shortIdentifier = handler.getShortIdentifier(authCSID, authorityCommonSchemaName);
+ AuthorityDocumentModelHandler<?> handler = (AuthorityDocumentModelHandler<?>) createDocumentHandler(ctx);
+ shortIdentifier = handler.getShortIdentifier(ctx, authCSID, authorityCommonSchemaName);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Caught exception ", e);
}
throw new DocumentException(e);
}
+
return shortIdentifier;
}
return result;
}
- public String lookupItemCSID(String itemspecifier, String parentcsid, String method, String op, ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx)
+ public String lookupItemCSID(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String itemspecifier, String parentcsid, String method, String op)
throws DocumentException {
String itemcsid;
Specifier itemSpec = getSpecifier(itemspecifier, method, op);
MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
String parentcsid = lookupParentCSID(parentspecifier, "getReferencingObjects(parent)", "GET_ITEM_REF_OBJS", uriInfo);
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "getReferencingObjects(item)", "GET_ITEM_REF_OBJS", ctx);
+ String itemcsid = lookupItemCSID(ctx, itemspecifier, parentcsid, "getReferencingObjects(item)", "GET_ITEM_REF_OBJS");
List<String> serviceTypes = queryParams.remove(ServiceBindingUtils.SERVICE_TYPE_PROP);
if(serviceTypes == null || serviceTypes.isEmpty()) {
DocumentModelHandler<?, AbstractCommonList> handler =
(DocumentModelHandler<?, AbstractCommonList>)createItemDocumentHandler(ctx, parentcsid, null /*no parent short ID*/);
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "getAuthorityItemAuthRefs(item)", "GET_ITEM_AUTH_REFS", ctx);
+ String itemcsid = lookupItemCSID(ctx, itemspecifier, parentcsid, "getAuthorityItemAuthRefs(item)", "GET_ITEM_AUTH_REFS");
List<RefNameServiceUtils.AuthRefConfigInfo> authRefsInfo = RefNameServiceUtils.getConfiguredAuthorityRefs(ctx);
authRefList = handler.getAuthorityRefs(itemcsid, authRefsInfo);
if (ctx == null) {
ctx = createServiceContext(getItemServiceName(), theUpdate, resourceMap, uriInfo);
}
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "updateAuthorityItem(item)", "UPDATE_ITEM", ctx); //use itemServiceCtx if it is not null
+ ctx.setInput(theUpdate);
+
+ String itemcsid = lookupItemCSID(ctx, itemspecifier, parentcsid, "updateAuthorityItem(item)", "UPDATE_ITEM"); //use itemServiceCtx if it is not null
// We omit the parentShortId, only needed when doing a create...
AuthorityItemDocumentModelHandler handler = (AuthorityItemDocumentModelHandler)createItemDocumentHandler(ctx, parentcsid, parentShortId);
String parentcsid = lookupParentCSID(parentspecifier, "createContact(authority)", "CREATE_ITEM_CONTACT", null);
ServiceContext itemCtx = createServiceContext(getItemServiceName());
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "createContact(item)", "CREATE_ITEM_CONTACT", itemCtx);
+ String itemcsid = lookupItemCSID(itemCtx, itemspecifier, parentcsid, "createContact(item)", "CREATE_ITEM_CONTACT");
// Note that we have to create the service context and document
// handler for the Contact service, not the main service.
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);
+ String itemcsid = lookupItemCSID(itemCtx, itemspecifier, parentcsid, "getContactList(item)", "GET_CONTACT_LIST");
DocumentHandler handler = createContactDocumentHandler(ctx, parentcsid, itemcsid, uriInfo);
DocumentFilter myFilter = handler.getDocumentFilter(); //new DocumentFilter();
String parentcsid = lookupParentCSID(parentspecifier, "getContact(parent)", "GET_ITEM_CONTACT", null);
ServiceContext itemCtx = createServiceContext(getItemServiceName());
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "getContact(item)", "GET_ITEM_CONTACT", itemCtx);
+ String itemcsid = lookupItemCSID(itemCtx, itemspecifier, parentcsid, "getContact(item)", "GET_ITEM_CONTACT");
// Note that we have to create the service context and document handler for the Contact service, not the main service.
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getContactServiceName());
String parentcsid = lookupParentCSID(parentspecifier, "updateContact(authority)", "UPDATE_CONTACT", null);
ServiceContext itemCtx = createServiceContext(getItemServiceName());
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "updateContact(item)", "UPDATE_CONTACT", itemCtx);
+ String itemcsid = lookupItemCSID(itemCtx, itemspecifier, parentcsid, "updateContact(item)", "UPDATE_CONTACT");
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = null;
// Note that we have to create the service context and document handler for the Contact service, not the main service.
String parentcsid = lookupParentCSID(parentspecifier, "deleteContact(authority)", "DELETE_CONTACT", null);
ServiceContext itemCtx = createServiceContext(getItemServiceName());
- String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "deleteContact(item)", "DELETE_CONTACT", itemCtx);
+ String itemcsid = lookupItemCSID(itemCtx, itemspecifier, parentcsid, "deleteContact(item)", "DELETE_CONTACT");
//NOTE: itemcsid is not used below. Leaving the above call in for possible side effects??? CSPACE-3175
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = null;