]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-841, DRYD-855: Merging in UCB contributions to post-v6.0 master branch.
authorRichard Millet <remillet@yahoo.com>
Wed, 29 Apr 2020 00:18:56 +0000 (17:18 -0700)
committerRichard Millet <remillet@yahoo.com>
Wed, 29 Apr 2020 00:18:56 +0000 (17:18 -0700)
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java

index 17606f1a5e5deed7511b308a9d994e539ecbafbe..30c39a37dda992d74a939c91f7bae4ab4127ac70 100644 (file)
@@ -72,11 +72,11 @@ public class CreateVoucherBatchJob extends AbstractBatchJob {
                }
        }
 
-       public InvocationResults createVoucherFromCataloging(String collectionObjectCsid) throws Exception {
+       public InvocationResults createVoucherFromCataloging(String collectionObjectCsid) throws ResourceException, URISyntaxException, DocumentException, Exception {
                return createVoucherFromCataloging(collectionObjectCsid, null);
        }
        
-       public InvocationResults createVoucherFromCataloging(String collectionObjectCsid, String movementCsid) throws Exception {
+       public InvocationResults createVoucherFromCataloging(String collectionObjectCsid, String movementCsid) throws ResourceException, URISyntaxException, DocumentException, Exception {
                InvocationResults results = new InvocationResults();
 
                PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid);
@@ -126,7 +126,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob {
                return results;
        }
        
-       private String getFieldCollectionNote(PoxPayloadOut collectionObjectPayload) throws Exception {
+       private String getFieldCollectionNote(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException, Exception {
                String placeNote = "";
                String reverseFieldCollectionPlace = getReverseFieldCollectionPlace(collectionObjectPayload);
                
@@ -159,7 +159,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob {
                return collectionNote;
        }
        
-       private String getReverseFieldCollectionPlace(PoxPayloadOut collectionObjectPayload) throws Exception {
+       private String getReverseFieldCollectionPlace(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException, Exception {
                String reverseDisplayName = null;
                String fieldCollectionPlaceRefName = getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.FIELD_COLLECTION_PLACE_SCHEMA_NAME, 
                                CollectionObjectBotGardenConstants.FIELD_COLLECTION_PLACE_FIELD_NAME);          
@@ -230,7 +230,7 @@ public class CreateVoucherBatchJob extends AbstractBatchJob {
                return annotation;
        }
        
-       public InvocationResults createVoucherFromCurrentLocation(String movementCsid) throws Exception {
+       public InvocationResults createVoucherFromCurrentLocation(String movementCsid) throws ResourceException, URISyntaxException, DocumentException, Exception {
                long numAffected = 0;
                String primaryUriCreated = null;
                
index 8faf41a1043bc40c6e49d02b30771fe84fbaf49e..41dde283ee8af1d923cb729d0519eed2e3bece26 100644 (file)
@@ -129,11 +129,11 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob {
                }
        }
 
-       public InvocationResults merge(String docType, String target, String sourceCsid) throws Exception {
+       public InvocationResults merge(String docType, String target, String sourceCsid) throws URISyntaxException, DocumentException, Exception {
                return merge(docType, target, new LinkedHashSet<String>(Arrays.asList(sourceCsid)));
        }
 
-       public InvocationResults merge(String docType, String target, Set<String> sourceCsids) throws Exception {
+       public InvocationResults merge(String docType, String target, Set<String> sourceCsids) throws URISyntaxException, DocumentException, Exception {
                logger.debug("Merging docType=" + docType + " target=" + target + " sourceCsids=" + StringUtils.join(sourceCsids, ","));
 
                String serviceName = getAuthorityServiceNameForDocType(docType);
@@ -159,7 +159,7 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob {
                return merge(docType, targetItemPayload, sourceItemPayloads);
        }
 
-       private InvocationResults merge(String docType, PoxPayloadOut targetItemPayload, List<PoxPayloadOut> sourceItemPayloads) throws Exception {
+       private InvocationResults merge(String docType, PoxPayloadOut targetItemPayload, List<PoxPayloadOut> sourceItemPayloads) throws URISyntaxException, DocumentException, Exception {
                int numAffected = 0;
                List<String> userNotes = new ArrayList<String>();
 
@@ -228,7 +228,7 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob {
                return results;
        }
 
-       private InvocationResults updateReferences(String serviceName, String inAuthority, String sourceCsid, String sourceRefName, String targetRefName) throws Exception {
+       private InvocationResults updateReferences(String serviceName, String inAuthority, String sourceCsid, String sourceRefName, String targetRefName) throws URISyntaxException, DocumentException, Exception {
                logger.debug("Updating references: serviceName=" + serviceName + " inAuthority=" + inAuthority + " sourceCsid=" + sourceCsid + " sourceRefName=" + sourceRefName + " targetRefName=" + targetRefName);
 
                String sourceDisplayName = RefNameUtils.getDisplayName(sourceRefName);
@@ -403,10 +403,10 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob {
                String serviceName = getAuthorityServiceNameForDocType(docType);
                AuthorityResource<?, ?> resource = (AuthorityResource<?, ?>) getResourceMap().get(serviceName);
 
-               resource.updateAuthorityItem(getResourceMap(), createUriInfo(), inAuthority, csid, payload);
+               resource.updateAuthorityItem(getServiceContext(), getResourceMap(), createUriInfo(), inAuthority, csid, payload);
        }
 
-       private InvocationResults deleteAuthorityItem(String docType, String inAuthority, String csid, String refName) throws URISyntaxException {
+       private InvocationResults deleteAuthorityItem(String docType, String inAuthority, String csid, String refName) throws URISyntaxException, Exception {
                int numAffected = 0;
                List<String> userNotes = new ArrayList<String>();
                String displayName = RefNameUtils.getDisplayName(refName);
@@ -443,7 +443,7 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob {
 
                                        logger.debug("Deleting hasBroader relation " + relationCsid);
 
-                                       relationResource.delete(relationCsid);
+                                       relationResource.deleteWithParentCtx(getServiceContext(), relationCsid);
 
                                        userNotes.add("Deleted the \"has broader\" relation from " + subjectDisplayName + " to " + objectDisplayName + ".");
                                        numAffected++;
@@ -455,7 +455,7 @@ public class MergeAuthorityItemsBatchJob extends AbstractBatchJob {
 
                        logger.debug("Soft deleting: docType=" + docType + " inAuthority=" + inAuthority + " csid=" + csid);
 
-                       resource.updateItemWorkflowWithTransition(null, inAuthority, csid, "delete");
+                       resource.updateItemWorkflowWithTransition(getServiceContext(), createUriInfo(), inAuthority, csid, "delete");
 
                        userNotes.add("Deleted the source record, " + displayName + ".");
                        numAffected++;
index c130170c2be841767eb810fd1d856b85b3008297..5aad4633ccf2bdb899c8cafb6dc64823f42a4772 100644 (file)
@@ -135,7 +135,7 @@ public class ReindexFullTextBatchJob extends AbstractBatchJob {
        //
        @Override
        protected List<String> findAllAuthorityItems(AuthorityResource<?, ?> resource, String vocabularyCsid, int pageSize, int pageNum, String sortBy)
-                       throws URISyntaxException, Exception {
+                       throws URISyntaxException, DocumentException, Exception {
                boolean tx = false;
                if (TransactionHelper.isTransactionActive() == false) {
                        tx = TransactionHelper.startTransaction();
@@ -150,7 +150,6 @@ public class ReindexFullTextBatchJob extends AbstractBatchJob {
                }
        }
 
-
        @Override
        public void run() {
                run(null);
index 2aba0f0209707eafcb72502ca3281a647ff00bb0..c91f32f11c4e6198ba8288c9e531ac7468297d38 100644 (file)
@@ -107,9 +107,10 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob {
         * 
         * @param taxonCsid             The csid of the taxon record
         * @return
-        * @throws Exception 
+        * @throws URISyntaxException
+        * @throws DocumentException
         */
-       public InvocationResults updateReferencingRareFlags(String taxonCsid, String vocabularyCsid) throws Exception {
+       public InvocationResults updateReferencingRareFlags(String taxonCsid, String vocabularyCsid) throws URISyntaxException, DocumentException, Exception {
                PoxPayloadOut taxonPayload = vocabularyCsid == null
                                ? findTaxonByCsid(taxonCsid)
                                : findTaxonByCsid(taxonCsid, vocabularyCsid);
@@ -154,9 +155,10 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob {
         * 
         * @param collectionObjectCsid  The csid of the collectionobject
         * @return
-        * @throws Exception 
+        * @throws URISyntaxException
+        * @throws DocumentException
         */
-       public InvocationResults updateRareFlag(String collectionObjectCsid) throws Exception {
+       public InvocationResults updateRareFlag(String collectionObjectCsid) throws URISyntaxException, DocumentException, Exception {
                PoxPayloadOut collectionObjectPayload = findCollectionObjectByCsid(collectionObjectCsid);
                
                return updateRareFlag(collectionObjectPayload);
@@ -170,9 +172,10 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob {
         * 
         * @param collectionObjectPayload       The payload representing the collectionobject
         * @return
-        * @throws Exception 
+        * @throws URISyntaxException
+        * @throws DocumentException
         */
-       public InvocationResults updateRareFlag(PoxPayloadOut collectionObjectPayload) throws Exception {
+       public InvocationResults updateRareFlag(PoxPayloadOut collectionObjectPayload) throws URISyntaxException, DocumentException, Exception {
                InvocationResults results = new InvocationResults();
 
                String uri = this.getFieldValue(collectionObjectPayload, CollectionObjectBotGardenConstants.URI_SCHEMA_NAME, 
@@ -270,9 +273,10 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob {
         * 
         * @param collectionObjectCsids         The csids of the collectionobjects
         * @return
-        * @throws Exception
+        * @throws URISyntaxException
+        * @throws DocumentException
         */
-       public InvocationResults updateRareFlags(List<String> collectionObjectCsids) throws Exception {
+       public InvocationResults updateRareFlags(List<String> collectionObjectCsids) throws URISyntaxException, DocumentException, Exception {
                int numSubmitted = collectionObjectCsids.size();
                long numAffected = 0;
                
@@ -294,9 +298,10 @@ public class UpdateRareFlagBatchJob extends AbstractBatchJob {
         * Updates the rare flags of all collectionobjects.
         * 
         * @return
-        * @throws Exception
+        * @throws URISyntaxException
+        * @throws DocumentException
         */
-       public InvocationResults updateAllRareFlags() throws Exception {
+       public InvocationResults updateAllRareFlags() throws URISyntaxException, DocumentException, Exception {
                long numFound = 0;
                long numAffected = 0;