From 4fb542b80e100c93ce2d4b3ee2ac2c4fc86c522a Mon Sep 17 00:00:00 2001 From: Ray Lee Date: Thu, 13 Apr 2023 23:48:21 -0400 Subject: [PATCH] Revert "Upgrade dom4j to 2.1.4." This reverts commit b5ddea4ed216bc8ad06e265424e8fb507fe7167f. --- .../batch/nuxeo/FormatTaxonBatchJob.java | 45 +++++++++---------- services/claim/service/pom.xml | 2 +- services/client/pom.xml | 2 +- services/contact/client/pom.xml | 2 +- services/movement/service/pom.xml | 2 +- services/person/service/pom.xml | 2 +- services/pom.xml | 4 +- services/pottag/service/pom.xml | 2 +- services/propagation/service/pom.xml | 2 +- services/workflow/service/pom.xml | 2 +- 10 files changed, 32 insertions(+), 33 deletions(-) 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 948a29e1d..b745018f1 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,69 +63,68 @@ 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 termGroupNodes = termGroupListNode.selectNodes(termGroupFieldName); - - for (Node termGroupNode : termGroupNodes) { - Element termGroupElement = (Element) termGroupNode; + Node termGroupListNode = element.selectSingleNode(termGroupListFieldName); + List termGroupElements = termGroupListNode.selectNodes(termGroupFieldName); + + for (Element termGroupElement : termGroupElements) { 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 = "" + "" + "" + @@ -135,11 +134,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 77bd50927..90c4ef5eb 100644 --- a/services/claim/service/pom.xml +++ b/services/claim/service/pom.xml @@ -53,7 +53,7 @@ - org.dom4j + dom4j dom4j provided diff --git a/services/client/pom.xml b/services/client/pom.xml index ed12dbd0f..34af4826e 100644 --- a/services/client/pom.xml +++ b/services/client/pom.xml @@ -85,7 +85,7 @@ compile - org.dom4j + dom4j dom4j diff --git a/services/contact/client/pom.xml b/services/contact/client/pom.xml index bb18c2302..5e758de77 100644 --- a/services/contact/client/pom.xml +++ b/services/contact/client/pom.xml @@ -36,7 +36,7 @@ - org.dom4j + dom4j dom4j diff --git a/services/movement/service/pom.xml b/services/movement/service/pom.xml index fbef801fb..36db84b41 100644 --- a/services/movement/service/pom.xml +++ b/services/movement/service/pom.xml @@ -52,7 +52,7 @@ provided - org.dom4j + dom4j dom4j diff --git a/services/person/service/pom.xml b/services/person/service/pom.xml index 8c6e8814c..eab328713 100644 --- a/services/person/service/pom.xml +++ b/services/person/service/pom.xml @@ -64,7 +64,7 @@ provided - org.dom4j + dom4j dom4j diff --git a/services/pom.xml b/services/pom.xml index 4db1e4c7d..b88f834ca 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -443,9 +443,9 @@ ${postgres.driver.version} - org.dom4j + dom4j dom4j - 2.1.4 + 1.6.1 compile diff --git a/services/pottag/service/pom.xml b/services/pottag/service/pom.xml index 7d16a668b..6f86a7d17 100644 --- a/services/pottag/service/pom.xml +++ b/services/pottag/service/pom.xml @@ -53,7 +53,7 @@ - org.dom4j + dom4j dom4j provided diff --git a/services/propagation/service/pom.xml b/services/propagation/service/pom.xml index cba945709..a07d8cd7f 100644 --- a/services/propagation/service/pom.xml +++ b/services/propagation/service/pom.xml @@ -58,7 +58,7 @@ - org.dom4j + dom4j dom4j provided diff --git a/services/workflow/service/pom.xml b/services/workflow/service/pom.xml index 41065d72d..2a43c6faa 100644 --- a/services/workflow/service/pom.xml +++ b/services/workflow/service/pom.xml @@ -42,7 +42,7 @@ provided - org.dom4j + dom4j dom4j -- 2.47.3