]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6935: Fixed bug with authority item update.
authorremillet <remillet@yahoo.com>
Mon, 11 Apr 2016 20:34:47 +0000 (13:34 -0700)
committerremillet <remillet@yahoo.com>
Mon, 11 Apr 2016 20:34:47 +0000 (13:34 -0700)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java
services/client/src/main/resources/collectionspace-client.properties
services/common/src/main/java/org/collectionspace/services/common/context/RemoteServiceContextImpl.java

index 1daf48f469fccd148893c95b4f7d597c5990ed15..c41bbae066be63d3866508eec601a6b26f887e42 100644 (file)
@@ -1175,8 +1175,9 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         ServiceContext<PoxPayloadIn, PoxPayloadOut> 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
 
index 63162ed3efcdf3d712eea309fe4e33cafbb75e94..3026248b2681353868c3b977c85699c307774d84 100644 (file)
@@ -200,50 +200,6 @@ extends NuxeoDocumentModelHandler<BlobsCommon> {
                super.extractAllParts(wrapDoc);
        }
 
-       @Deprecated
-       public void xfillAllParts(DocumentWrapper<DocumentModel> wrapDoc, Action action) throws Exception {
-               ServiceContext<PoxPayloadIn, PoxPayloadOut> 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<String, String> 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<DocumentModel> wrapDoc, Action action) throws Exception {
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
index d077dd6be879108ab694872fb370e96e02011b2b..75cb8b86d83f3ff4143e77ab00055aad2fe391e8 100644 (file)
@@ -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
index dd5c3479992f9d142bae422f0613f949dc9bfe97..e030f7439df47806a78228134ebc00f43ff73af7 100644 (file)
@@ -150,7 +150,7 @@ public class RemoteServiceContextImpl<IT, OT>
     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);
         }