From: remillet Date: Mon, 11 Apr 2016 20:34:47 +0000 (-0700) Subject: CSPACE-6935: Fixed bug with authority item update. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=7b7a48ddfe0e43af3926e5419211617f32573ba2;p=tmp%2Fjakarta-migration.git CSPACE-6935: Fixed bug with authority item update. --- 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 1daf48f46..c41bbae06 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 @@ -1175,8 +1175,9 @@ public abstract class AuthorityResource ServiceContext ctx = itemServiceCtx; if (ctx == null) { ctx = createServiceContext(getItemServiceName(), theUpdate, resourceMap, uriInfo); + } else { + ctx.setInput(theUpdate); // the update payload } - ctx.setInput(theUpdate); String itemcsid = lookupItemCSID(ctx, itemspecifier, parentcsid, "updateAuthorityItem(item)", "UPDATE_ITEM"); //use itemServiceCtx if it is not null diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java index 63162ed3e..3026248b2 100644 --- a/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java +++ b/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java @@ -200,50 +200,6 @@ extends NuxeoDocumentModelHandler { super.extractAllParts(wrapDoc); } - @Deprecated - public void xfillAllParts(DocumentWrapper wrapDoc, Action action) throws Exception { - ServiceContext ctx = this.getServiceContext(); - BlobInput blobInput = BlobUtil.getBlobInput(ctx); // The blobInput should have been put into the context by the Blob or Media resource - if (blobInput != null && blobInput.getBlobFile() != null) { - boolean purgeOriginal = false; - MultivaluedMap queryParams = ctx.getQueryParams(); - String purgeOriginalStr = queryParams.getFirst(BlobClient.BLOB_PURGE_ORIGINAL); - if (purgeOriginalStr != null && purgeOriginalStr.isEmpty() == false) { // Find our if the caller wants us to purge/delete the original - purgeOriginal = true; - } - // - // If blobInput has a file then we just received a multipart/form-data file post or a URI query parameter - // - DocumentModel documentModel = wrapDoc.getWrappedObject(); - CoreSessionInterface repoSession = this.getRepositorySession(); - - BlobsCommon blobsCommon = NuxeoBlobUtils.createBlobInRepository(ctx, repoSession, blobInput, purgeOriginal, true); - blobInput.setBlobCsid(documentModel.getName()); //Assumption here is that the documentModel "name" field is storing a CSID - - PoxPayloadIn input = ctx.getInput(); - // - // If the input payload is null, then we're creating a new blob from a post or a uri. This means there - // is no "input" payload for our framework to process. Therefore we need to synthesize a payload from - // the BlobsCommon instance we just filled out. - // - if (input == null) { - PoxPayloadOut output = new PoxPayloadOut(BlobClient.SERVICE_PAYLOAD_NAME); - PayloadOutputPart commonPart = new PayloadOutputPart(BlobClient.SERVICE_COMMON_PART_NAME, blobsCommon); - output.addPart(commonPart); - input = new PoxPayloadIn(output.toXML()); - ctx.setInput(input); - } else { - // At this point, we've created a blob document in the Nuxeo repository. Usually, we use the blob to create and instance of BlobsCommon and use - // that to populate the resource record. However, since the "input" var is not null the requester provided their own resource record data - // so we'll use it rather than deriving one from the blob. - logger.warn("A resource record payload was provided along with the actually blob binary file. This payload is usually derived from the blob binary. Since a payload was provided, we're creating the resource record from the payload and not from the corresponding blob binary." + - " The data in blob resource record fields may not correspond completely with the persisted blob binary file."); - } - } - - super.fillAllParts(wrapDoc, action); - } - @Override public void fillAllParts(DocumentWrapper wrapDoc, Action action) throws Exception { ServiceContext ctx = this.getServiceContext(); diff --git a/services/client/src/main/resources/collectionspace-client.properties b/services/client/src/main/resources/collectionspace-client.properties index d077dd6be..75cb8b86d 100644 --- a/services/client/src/main/resources/collectionspace-client.properties +++ b/services/client/src/main/resources/collectionspace-client.properties @@ -9,8 +9,8 @@ cspace.url=http://localhost:8180/cspace-services/ cspace.ssl=false cspace.auth=true # default user -#cspace.user=admin@core.collectionspace.org -cspace.user=admin@testsci.collectionspace.org +cspace.user=admin@core.collectionspace.org +#cspace.user=admin@testsci.collectionspace.org cspace.password=Administrator # default tenant cspace.tenant=1 diff --git a/services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextImpl.java b/services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextImpl.java index dd5c34799..e030f7439 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextImpl.java @@ -150,7 +150,7 @@ public class RemoteServiceContextImpl public void setInput(IT input) { //for security reasons, do not allow to set input again (from handlers) if (this.input != null) { - String msg = "Non-null input cannot be set!"; + String msg = "Resetting or changing an context's input is not allowed."; logger.error(msg); throw new IllegalStateException(msg); }