From: Richard Millet Date: Wed, 29 Apr 2020 00:18:56 +0000 (-0700) Subject: DRYD-841, DRYD-855: Merging in UCB contributions to post-v6.0 master branch. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=5d73e9435fc5173d7d3fe86077dc09bb8a485db2;p=tmp%2Fjakarta-migration.git DRYD-841, DRYD-855: Merging in UCB contributions to post-v6.0 master branch. --- diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java index 17606f1a5..30c39a37d 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateVoucherBatchJob.java @@ -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; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java index 8faf41a10..41dde283e 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/MergeAuthorityItemsBatchJob.java @@ -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(Arrays.asList(sourceCsid))); } - public InvocationResults merge(String docType, String target, Set sourceCsids) throws Exception { + public InvocationResults merge(String docType, String target, Set 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 sourceItemPayloads) throws Exception { + private InvocationResults merge(String docType, PoxPayloadOut targetItemPayload, List sourceItemPayloads) throws URISyntaxException, DocumentException, Exception { int numAffected = 0; List userNotes = new ArrayList(); @@ -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 userNotes = new ArrayList(); 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++; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java index c130170c2..5aad4633c 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/ReindexFullTextBatchJob.java @@ -135,7 +135,7 @@ public class ReindexFullTextBatchJob extends AbstractBatchJob { // @Override protected List 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); diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java index 2aba0f020..c91f32f11 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateRareFlagBatchJob.java @@ -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 collectionObjectCsids) throws Exception { + public InvocationResults updateRareFlags(List 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;