From 2d5a1d4634947805fe5108a3a72efb532f88254d Mon Sep 17 00:00:00 2001 From: remillet Date: Tue, 12 Apr 2016 16:37:39 -0700 Subject: [PATCH] CSPACE-6937: Added some inline comments. Set default updating of revision numbers for POST and PUT operations on authority items. --- .../common/vocabulary/AuthorityResource.java | 58 ++++++--------- .../{nuxeo => }/AuthorityServiceUtils.java | 28 +++++++- .../nuxeo/AuthorityDocumentModelHandler.java | 70 +++++++++---------- .../AuthorityItemDocumentModelHandler.java | 63 ++++++----------- .../services/common/NuxeoBasedResource.java | 9 +++ 5 files changed, 111 insertions(+), 117 deletions(-) rename services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/{nuxeo => }/AuthorityServiceUtils.java (57%) diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java index c41bbae06..558bfecba 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java @@ -73,7 +73,6 @@ import org.collectionspace.services.common.document.Hierarchy; import org.collectionspace.services.common.query.QueryManager; import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler; import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler; -import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityServiceUtils; import org.collectionspace.services.common.workflow.service.nuxeo.WorkflowDocumentModelHandler; import org.collectionspace.services.config.ClientType; import org.collectionspace.services.jaxb.AbstractCommonList; @@ -364,6 +363,7 @@ public abstract class AuthorityResource PoxPayloadIn input = new PoxPayloadIn(xmlPayload); ServiceContext ctx = createServiceContext(input); DocumentHandler handler = createDocumentHandler(ctx); + String csid = getRepositoryClient(ctx).create(ctx, handler); UriBuilder path = UriBuilder.fromResource(resourceClass); path.path("" + csid); @@ -417,43 +417,7 @@ public abstract class AuthorityResource } return result; } - - /** - * We override the base method, so we can decide if we need to update the rev number. We won't - * if we are performing a synchronization with the SAS. - * @param csid - * @param theUpdate - * @param ctx - * @return - * @throws Exception - */ - @Override - protected PoxPayloadOut update(String csid, - PoxPayloadIn theUpdate, // not used in this method, but could be used by an overriding method - ServiceContext ctx) - throws Exception { - AuthorityDocumentModelHandler handler = (AuthorityDocumentModelHandler) createDocumentHandler(ctx); - handler.setShouldUpdateRevNumber(this.shouldUpdateRevNumber(ctx)); - getRepositoryClient(ctx).update(ctx, csid, handler); - return ctx.getOutput(); - } - - /** - * Look for a property in the current context to determine if we're handling a sync request. - * @param ctx - * @return - */ - private boolean shouldUpdateRevNumber(ServiceContext ctx) { - boolean result = true; - - Boolean flag = (Boolean) ctx.getProperty(AuthorityServiceUtils.SHOULD_UPDATE_REV_PROPERTY); - if (flag != null) { - result = flag.booleanValue(); - } - - return result; - } - + /** * Gets the authority. * @@ -540,6 +504,24 @@ public abstract class AuthorityResource return result; } + /** + * Overriding this methods to see if we should update the revision number during the update. We don't + * want to update the rev number of synchronization operations. + */ + @Override + protected PoxPayloadOut update(String csid, + PoxPayloadIn theUpdate, // not used in this method, but could be used by an overriding method + ServiceContext ctx) + throws Exception { + AuthorityDocumentModelHandler handler = (AuthorityDocumentModelHandler) createDocumentHandler(ctx); + Boolean shouldUpdateRev = (Boolean) ctx.getProperty(AuthorityServiceUtils.SHOULD_UPDATE_REV_PROPERTY); + if (shouldUpdateRev != null && shouldUpdateRev == true) { + handler.setShouldUpdateRevNumber(true); + } + getRepositoryClient(ctx).update(ctx, csid, handler); + return ctx.getOutput(); + } + /** * Update authority. * diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityServiceUtils.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityServiceUtils.java similarity index 57% rename from services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityServiceUtils.java rename to services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityServiceUtils.java index ca8973f66..7213612d2 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityServiceUtils.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityServiceUtils.java @@ -1,4 +1,4 @@ -package org.collectionspace.services.common.vocabulary.nuxeo; +package org.collectionspace.services.common.vocabulary; import javax.ws.rs.core.Response; @@ -7,6 +7,8 @@ import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.common.context.MultipartServiceContextImpl; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier; +import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier; +import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityIdentifierUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,7 +19,29 @@ public class AuthorityServiceUtils { public static final boolean DONT_UPDATE_REV = false; public static final boolean UPDATE_REV = true; - static public PoxPayloadIn getPayloadIn(AuthorityItemSpecifier specifier, String serviceName, Class responseType) throws Exception { + static public PoxPayloadIn requestPayloadIn(ServiceContext ctx, Specifier specifier, Class responseType) throws Exception { + PoxPayloadIn result = null; + + AuthorityClient client = (AuthorityClient) ctx.getClient(); + Response res = client.read(specifier.value); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + logger.debug(client.getClass().getCanonicalName() + ": status = " + statusCode); + } + + result = new PoxPayloadIn((String)res.readEntity(responseType)); // Get the entire response! + } finally { + res.close(); + } + + return result; + } + + static public PoxPayloadIn requestPayloadIn(AuthorityItemSpecifier specifier, String serviceName, Class responseType) throws Exception { PoxPayloadIn result = null; ServiceContext parentCtx = new MultipartServiceContextImpl(serviceName); diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java index 08637d068..4e919d85c 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java @@ -44,11 +44,13 @@ import org.collectionspace.services.common.api.RefNameUtils.AuthorityTermInfo; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentException; +import org.collectionspace.services.common.document.DocumentHandler; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema; import org.collectionspace.services.common.vocabulary.AuthorityResource; +import org.collectionspace.services.common.vocabulary.AuthorityServiceUtils; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.SpecifierForm; @@ -77,7 +79,7 @@ public abstract class AuthorityDocumentModelHandler protected String authorityCommonSchemaName; protected String authorityItemCommonSchemaName; - protected boolean shouldUpdateRevNumber; + protected boolean shouldUpdateRevNumber = true; // default to updating the revision number public AuthorityDocumentModelHandler(String authorityCommonSchemaName, String authorityItemCommonSchemaName) { this.authorityCommonSchemaName = authorityCommonSchemaName; @@ -98,7 +100,12 @@ public abstract class AuthorityDocumentModelHandler public Class getEntityResponseType() { return String.class; } - + + @Override + public void prepareSync() throws Exception { + this.setShouldUpdateRevNumber(AuthorityServiceUtils.DONT_UPDATE_REV); // Never update rev nums on sync operations + } + protected PayloadInputPart extractPart(Response res, String partLabel) throws Exception { PoxPayloadIn input = new PoxPayloadIn((String)res.readEntity(getEntityResponseType())); @@ -118,17 +125,18 @@ public abstract class AuthorityDocumentModelHandler // Get the rev number of the authority so we can compare with rev number of shared authority // DocumentModel docModel = NuxeoUtils.getDocFromSpecifier(ctx, getRepositorySession(), authorityCommonSchemaName, specifier); - Long rev = (Long) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.REV); + Long localRev = (Long) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.REV); String shortId = (String) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.SHORT_IDENTIFIER); - String refName = (String) NuxeoUtils.getProperyValue(docModel, AuthorityJAXBSchema.REF_NAME); // // Using the short ID of the local authority, create a URN specifier to retrieve the SAS authority // Specifier sasSpecifier = new Specifier(SpecifierForm.URN_NAME, RefNameUtils.createShortIdRefName(shortId)); - PoxPayloadIn sasPayloadIn = getPayloadIn(ctx, sasSpecifier); - + PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(ctx, sasSpecifier, getEntityResponseType()); + // + // If the authority on the SAS is newer, synch all the items and then the authority record as well + // Long sasRev = getRevision(sasPayloadIn); - if (sasRev > rev) { + if (sasRev > localRev) { // // First, sync all the authority items // @@ -139,8 +147,6 @@ public abstract class AuthorityDocumentModelHandler ResourceMap resourceMap = ctx.getResourceMap(); String resourceName = ctx.getClient().getServiceName(); AuthorityResource authorityResource = (AuthorityResource) resourceMap.get(resourceName); - ctx.setProperty(AuthorityServiceUtils.SHOULD_UPDATE_REV_PROPERTY, // Since it is a sync, don't update the rev. Instead use the rev from the SAS - new Boolean(AuthorityServiceUtils.DONT_UPDATE_REV)); PoxPayloadOut payloadOut = authorityResource.update(ctx, resourceMap, ctx.getUriInfo(), docModel.getName(), sasPayloadIn); if (payloadOut != null) { @@ -162,7 +168,9 @@ public abstract class AuthorityDocumentModelHandler int synched = 0; int alreadySynched = 0; int totalItemsProcessed = 0; - + // + // Iterate over the list of items/terms in the remote authority + // PoxPayloadIn sasPayloadInItemList = getPayloadInItemList(ctx, sasSpecifier); List itemList = getItemList(sasPayloadInItemList); if (itemList != null) { @@ -189,7 +197,7 @@ public abstract class AuthorityDocumentModelHandler } /** - * + * This is a sync method. * @param ctx * @param parentIdentifier - Must be in short-id-refname form -i.e., urn:cspace:name(shortid) * @param itemIdentifier - Must be in short-id-refname form -i.e., urn:cspace:name(shortid) @@ -197,14 +205,15 @@ public abstract class AuthorityDocumentModelHandler */ protected void createLocalItem(ServiceContext ctx, String parentIdentifier, String itemIdentifier) throws Exception { // - // Create a URN short ID specifier for the getting to the remote item payload + // Create a URN short ID specifier for the getting a copy of the remote authority item + // Specifier authoritySpecifier = new Specifier(SpecifierForm.URN_NAME, parentIdentifier); Specifier itemSpecifier = new Specifier(SpecifierForm.URN_NAME, itemIdentifier); AuthorityItemSpecifier sasAuthorityItemSpecifier = new AuthorityItemSpecifier(authoritySpecifier, itemSpecifier); // // Get the remote payload // - PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.getPayloadIn(sasAuthorityItemSpecifier, + PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(sasAuthorityItemSpecifier, ctx.getServiceName(), getEntityResponseType()); // // Using the payload from the remote server, create a local copy of the item @@ -214,6 +223,9 @@ public abstract class AuthorityDocumentModelHandler AuthorityResource authorityResource = (AuthorityResource) resourceMap.get(resourceName); Response response = authorityResource.createAuthorityItemWithParentContext(ctx, authoritySpecifier.value, sasPayloadIn, AuthorityServiceUtils.DONT_UPDATE_REV); + // + // Check the response for successful POST result + // if (response.getStatus() != Response.Status.CREATED.getStatusCode()) { throw new DocumentException(String.format("Could not create new authority item '%s' during synchronization of the '%s' authority.", itemIdentifier, parentIdentifier)); @@ -234,11 +246,15 @@ public abstract class AuthorityDocumentModelHandler */ protected long syncRemoteItemWithLocalItem(ServiceContext ctx, String remoteRefName) throws Exception { long result = -1; - + // + // Using the remote refname, create specifiers that we'll use to find the local versions + // AuthorityTermInfo authorityTermInfo = RefNameUtils.parseAuthorityTermInfo(remoteRefName); String parentIdentifier = RefNameUtils.createShortIdRefName(authorityTermInfo.inAuthority.name); String itemIdentifier = RefNameUtils.createShortIdRefName(authorityTermInfo.name); - + // + // We'll use the Authority JAX-RS resource to peform sync operations (creates and updates) + // ResourceMap resourceMap = ctx.getResourceMap(); String resourceName = ctx.getClient().getServiceName(); AuthorityResource authorityResource = (AuthorityResource) resourceMap.get(resourceName); @@ -247,6 +263,9 @@ public abstract class AuthorityDocumentModelHandler try { localItemPayloadOut = authorityResource.getAuthorityItemWithParentContext(ctx, parentIdentifier, itemIdentifier); } catch (DocumentNotFoundException dnf) { + // + // Document not found, means we need to create an item/term that exists only on the SAS + // logger.info(String.format("Remote item with refname='%s' doesn't exist locally, so we'll create it.", remoteRefName)); createLocalItem(ctx, parentIdentifier, itemIdentifier); return 1; // exit with status of 1 means we created a new authority item @@ -289,27 +308,6 @@ public abstract class AuthorityDocumentModelHandler return result; } - private PoxPayloadIn getPayloadIn(ServiceContext ctx, Specifier specifier) throws Exception { - PoxPayloadIn result = null; - - AuthorityClient client = (AuthorityClient) ctx.getClient(); - Response res = client.read(specifier.value); - try { - int statusCode = res.getStatus(); - - // Check the status code of the response: does it match - // the expected response(s)? - if (logger.isDebugEnabled()) { - logger.debug(client.getClass().getCanonicalName() + ": status = " + statusCode); - } - - result = new PoxPayloadIn((String)res.readEntity(getEntityResponseType())); // Get the entire response! - } finally { - res.close(); - } - - return result; - } /* * Non standard injection of CSID into common part, since caller may access through diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java index e1e664a46..470c93d4b 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java @@ -31,22 +31,20 @@ import org.collectionspace.services.common.ResourceMap; import org.collectionspace.services.common.UriTemplateRegistry; import org.collectionspace.services.common.api.RefName; import org.collectionspace.services.common.api.RefNameUtils; -import org.collectionspace.services.common.api.RefNameUtils.AuthorityTermInfo; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.api.RefNameUtils.AuthorityInfo; import org.collectionspace.services.common.authorityref.AuthorityRefDocList; import org.collectionspace.services.common.context.MultipartServiceContext; -import org.collectionspace.services.common.context.MultipartServiceContextImpl; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentWrapper; -import org.collectionspace.services.common.document.DocumentHandler.Action; import org.collectionspace.services.common.repository.RepositoryClient; import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema; import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.common.vocabulary.AuthorityResource; +import org.collectionspace.services.common.vocabulary.AuthorityServiceUtils; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier; @@ -59,14 +57,14 @@ import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.relation.RelationsCommonList; import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema; + import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.model.PropertyException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.Collections; @@ -92,7 +90,7 @@ public abstract class AuthorityItemDocumentModelHandler protected String authorityCommonSchemaName; protected String authorityItemCommonSchemaName; private String authorityItemTermGroupXPathBase; - private boolean shouldUpdateRevNumber = true; + private boolean shouldUpdateRevNumber = true; // by default we should update the revision number -not true on synchronization with SAS /** * inVocabulary is the parent Authority for this context */ @@ -118,6 +116,11 @@ public abstract class AuthorityItemDocumentModelHandler this.shouldUpdateRevNumber = flag; } + @Override + public void prepareSync() throws Exception { + this.setShouldUpdateRevNumber(AuthorityServiceUtils.DONT_UPDATE_REV); // Never update rev nums on sync operations + } + @Override protected String getRefnameDisplayName(DocumentWrapper docWrapper) { String result = null; @@ -336,7 +339,7 @@ public abstract class AuthorityItemDocumentModelHandler } } - + setListItemArrayExtended(true); } // end of synchronized block } @@ -344,55 +347,31 @@ public abstract class AuthorityItemDocumentModelHandler return list; } -// private PoxPayloadIn getPayloadIn(AuthorityItemSpecifier specifier) throws Exception { -// PoxPayloadIn result = null; -// -// ServiceContext parentCtx = new MultipartServiceContextImpl(this.getAuthorityServicePath()); -// AuthorityClient client = (AuthorityClient) parentCtx.getClient(); -// Response res = client.readItem(specifier.getParentSpecifier().value, specifier.getItemSpecifier().value); -// try { -// int statusCode = res.getStatus(); -// -// // Check the status code of the response: does it match -// // the expected response(s)? -// if (logger.isDebugEnabled()) { -// logger.debug(client.getClass().getCanonicalName() + ": status = " + statusCode); -// } -// -// result = new PoxPayloadIn((String)res.readEntity(getEntityResponseType())); // Get the entire response! -// } finally { -// res.close(); -// } -// -// return result; -// } - + /** + * This method synchronizes/updates a single authority item resource. + */ @Override public boolean handleSync(DocumentWrapper wrapDoc) throws Exception { boolean result = false; ServiceContext ctx = getServiceContext(); - AuthorityItemSpecifier authorityItemSpecifier = (AuthorityItemSpecifier) wrapDoc.getWrappedObject(); // - // Get the rev number of the authority item so we can compare with rev number of shared authority + // Get the rev number of the local authority item so we can compare with rev number of shared authority // + AuthorityItemSpecifier authorityItemSpecifier = (AuthorityItemSpecifier) wrapDoc.getWrappedObject(); DocumentModel itemDocModel = NuxeoUtils.getDocFromSpecifier(ctx, getRepositorySession(), getAuthorityItemCommonSchemaName(), authorityItemSpecifier); if (itemDocModel == null) { throw new DocumentNotFoundException(String.format("Could not find authority item resource with CSID='%s'", authorityItemSpecifier.getItemSpecifier().value)); } - Long itemRev = (Long) NuxeoUtils.getProperyValue(itemDocModel, AuthorityItemJAXBSchema.REV); + Long localItemRev = (Long) NuxeoUtils.getProperyValue(itemDocModel, AuthorityItemJAXBSchema.REV); String itemShortId = (String) NuxeoUtils.getProperyValue(itemDocModel, AuthorityItemJAXBSchema.SHORT_IDENTIFIER); - String itemRefName = (String) NuxeoUtils.getProperyValue(itemDocModel, AuthorityItemJAXBSchema.REF_NAME); // // Now get the Authority (the parent) information // DocumentModel authorityDocModel = NuxeoUtils.getDocFromSpecifier(ctx, getRepositorySession(), authorityCommonSchemaName, authorityItemSpecifier.getParentSpecifier()); - Long authorityRev = (Long) NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.REV); String authorityShortId = (String) NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.SHORT_IDENTIFIER); - String authorityRefName = (String) NuxeoUtils.getProperyValue(authorityDocModel, AuthorityJAXBSchema.REF_NAME); - AuthorityInfo authorityInfo = RefNameUtils.parseAuthorityInfo(authorityRefName); // // Using the short IDs of the local authority and item, create URN specifiers to retrieve the SAS authority item // @@ -400,11 +379,13 @@ public abstract class AuthorityItemDocumentModelHandler Specifier sasItemSpecifier = new Specifier(SpecifierForm.URN_NAME, RefNameUtils.createShortIdRefName(itemShortId)); AuthorityItemSpecifier sasAuthorityItemSpecifier = new AuthorityItemSpecifier(sasAuthoritySpecifier, sasItemSpecifier); // Get the shared authority server's copy - PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.getPayloadIn(sasAuthorityItemSpecifier, + PoxPayloadIn sasPayloadIn = AuthorityServiceUtils.requestPayloadIn(sasAuthorityItemSpecifier, getAuthorityServicePath(), getEntityResponseType()); - Long sasRev = getRevision(sasPayloadIn); - if (sasRev > itemRev) { + // + // If the shared authority item is newer, update our local copy + // + if (sasRev > localItemRev) { ResourceMap resourceMap = ctx.getResourceMap(); String resourceName = this.getAuthorityServicePath(); AuthorityResource authorityResource = (AuthorityResource) resourceMap.get(resourceName); @@ -414,7 +395,7 @@ public abstract class AuthorityItemDocumentModelHandler authorityDocModel.getName(), // parent's CSID itemDocModel.getName(), // item's CSID sasPayloadIn, // the payload from the SAS - false); // don't update the parent's revision number + AuthorityServiceUtils.DONT_UPDATE_REV); // don't update the parent's revision number if (payloadOut != null) { ctx.setOutput(payloadOut); result = true; diff --git a/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java b/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java index 0bd7f85ce..acc9bb8b7 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java @@ -215,6 +215,15 @@ public abstract class NuxeoBasedResource return this.update(null, resourceMap, uriInfo, csid, xmlPayload); } + /** + * + * @param parentCtx + * @param resourceMap + * @param uriInfo + * @param csid + * @param xmlPayload + * @return + */ public byte[] update(ServiceContext parentCtx, // REM: 8/13/2012 - Some sub-classes will override this method -e.g., MediaResource does. @Context ResourceMap resourceMap, @Context UriInfo uriInfo, -- 2.47.3