From: Ray Lee Date: Fri, 14 Apr 2023 03:35:34 +0000 (-0400) Subject: Upgrade dom4j to 2.1.4. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=b5ddea4ed216bc8ad06e265424e8fb507fe7167f;p=tmp%2Fjakarta-migration.git Upgrade dom4j to 2.1.4. This resolves a couple of dependabot alerts. --- diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatTaxonBatchJob.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatTaxonBatchJob.java index b745018f1..948a29e1d 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatTaxonBatchJob.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/FormatTaxonBatchJob.java @@ -24,7 +24,7 @@ public class FormatTaxonBatchJob extends AbstractBatchJob { final Logger logger = LoggerFactory.getLogger(FormatTaxonBatchJob.class); private TaxonFormatter taxonFormatter; - + public FormatTaxonBatchJob() { setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE, INVOCATION_MODE_LIST, INVOCATION_MODE_NO_CONTEXT)); this.taxonFormatter = new TaxonFormatter(); @@ -63,68 +63,69 @@ public class FormatTaxonBatchJob extends AbstractBatchJob { setErrorInfo(new InvocationError(INT_ERROR_STATUS, e.getMessage())); } } - + public InvocationResults formatAllTaxons() throws URISyntaxException, DocumentException { return formatTaxons(findAllTaxonRecords()); - } + } public InvocationResults formatTaxon(String taxonCsid) throws URISyntaxException, DocumentException { return formatTaxons(Arrays.asList(taxonCsid)); } - + public InvocationResults formatTaxons(List taxonCsids) throws URISyntaxException, DocumentException { InvocationResults results = new InvocationResults(); int numAffected = 0; - + for (String taxonCsid : taxonCsids) { formatDisplayNames(taxonCsid); numAffected = numAffected + 1; } - + results.setNumAffected(numAffected); results.setUserNote("Updated " + numAffected + " taxonomy " + (numAffected == 1 ? "record" : "records")); - + return results; } - + private List formatDisplayNames(String taxonCsid) throws URISyntaxException, DocumentException { List formattedDisplayNames = new ArrayList(); PoxPayloadOut taxonPayload = findTaxonByCsid(taxonCsid); String inAuthority = getFieldValue(taxonPayload, TaxonConstants.IN_AUTHORITY_SCHEMA_NAME, TaxonConstants.IN_AUTHORITY_FIELD_NAME); - + String[] displayNamePathElements = TaxonConstants.DISPLAY_NAME_FIELD_NAME.split("/"); String termGroupListFieldName = displayNamePathElements[0]; String termGroupFieldName = displayNamePathElements[1]; String displayNameFieldName = displayNamePathElements[2]; - + String[] formattedDisplayNamePathElements = TaxonConstants.FORMATTED_DISPLAY_NAME_FIELD_NAME.split("/"); String formattedDisplayNameFieldName = formattedDisplayNamePathElements[2]; - + PayloadOutputPart part = taxonPayload.getPart(TaxonConstants.DISPLAY_NAME_SCHEMA_NAME); if (part != null) { Element element = part.asElement(); - Node termGroupListNode = element.selectSingleNode(termGroupListFieldName); - List termGroupElements = termGroupListNode.selectNodes(termGroupFieldName); - - for (Element termGroupElement : termGroupElements) { + Node termGroupListNode = element.selectSingleNode(termGroupListFieldName); + List termGroupNodes = termGroupListNode.selectNodes(termGroupFieldName); + + for (Node termGroupNode : termGroupNodes) { + Element termGroupElement = (Element) termGroupNode; Node displayNameNode = termGroupElement.selectSingleNode(displayNameFieldName); String displayName = (displayNameNode == null) ? "" : displayNameNode.getText(); String formattedDisplayName = taxonFormatter.format(displayName); Element formattedDisplayNameElement = (Element) termGroupElement.selectSingleNode(formattedDisplayNameFieldName); - + if (formattedDisplayNameElement == null) { formattedDisplayNameElement = termGroupElement.addElement(formattedDisplayNameFieldName); } - + formattedDisplayNameElement.setText(formattedDisplayName); formattedDisplayNames.add(formattedDisplayName); } - - String updatePayload = + + String updatePayload = "" + "" + "" + @@ -134,11 +135,11 @@ public class FormatTaxonBatchJob extends AbstractBatchJob { AuthorityResource resource = (AuthorityResource) getResourceMap().get(TaxonomyAuthorityClient.SERVICE_NAME); resource.updateAuthorityItem(getResourceMap(), createUriInfo(), inAuthority, taxonCsid, updatePayload); - } - + } + return formattedDisplayNames; } - + private List findAllTaxonRecords() { // TODO return Collections.emptyList(); diff --git a/services/claim/service/pom.xml b/services/claim/service/pom.xml index 90c4ef5eb..77bd50927 100644 --- a/services/claim/service/pom.xml +++ b/services/claim/service/pom.xml @@ -53,7 +53,7 @@ - dom4j + org.dom4j dom4j provided diff --git a/services/client/pom.xml b/services/client/pom.xml index 34af4826e..ed12dbd0f 100644 --- a/services/client/pom.xml +++ b/services/client/pom.xml @@ -85,7 +85,7 @@ compile - dom4j + org.dom4j dom4j diff --git a/services/contact/client/pom.xml b/services/contact/client/pom.xml index 5e758de77..bb18c2302 100644 --- a/services/contact/client/pom.xml +++ b/services/contact/client/pom.xml @@ -36,7 +36,7 @@ - dom4j + org.dom4j dom4j diff --git a/services/movement/service/pom.xml b/services/movement/service/pom.xml index 36db84b41..fbef801fb 100644 --- a/services/movement/service/pom.xml +++ b/services/movement/service/pom.xml @@ -52,7 +52,7 @@ provided - dom4j + org.dom4j dom4j diff --git a/services/person/service/pom.xml b/services/person/service/pom.xml index eab328713..8c6e8814c 100644 --- a/services/person/service/pom.xml +++ b/services/person/service/pom.xml @@ -64,7 +64,7 @@ provided - dom4j + org.dom4j dom4j diff --git a/services/pom.xml b/services/pom.xml index b88f834ca..4db1e4c7d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -443,9 +443,9 @@ ${postgres.driver.version} - dom4j + org.dom4j dom4j - 1.6.1 + 2.1.4 compile diff --git a/services/pottag/service/pom.xml b/services/pottag/service/pom.xml index 6f86a7d17..7d16a668b 100644 --- a/services/pottag/service/pom.xml +++ b/services/pottag/service/pom.xml @@ -53,7 +53,7 @@ - dom4j + org.dom4j dom4j provided diff --git a/services/propagation/service/pom.xml b/services/propagation/service/pom.xml index a07d8cd7f..cba945709 100644 --- a/services/propagation/service/pom.xml +++ b/services/propagation/service/pom.xml @@ -58,7 +58,7 @@ - dom4j + org.dom4j dom4j provided diff --git a/services/workflow/service/pom.xml b/services/workflow/service/pom.xml index 2a43c6faa..41065d72d 100644 --- a/services/workflow/service/pom.xml +++ b/services/workflow/service/pom.xml @@ -42,7 +42,7 @@ provided - dom4j + org.dom4j dom4j