From adb7bc4659b25f011183211342e388b6deddf4d2 Mon Sep 17 00:00:00 2001 From: andrew-cenkner-digitalservice Date: Tue, 17 Dec 2024 09:11:04 +0100 Subject: [PATCH] RISDEV-5168 (#2420) * RISDEV-5168 Adjustment structure LDML-R *Fixing minor bugs found during re-export of all caselaw in the database * RISDEV-5168 Adjustment structure LDML-R *Fixing minor bugs found during re-export of all caselaw in the database * RISDEV-5168 Adjustment structure LDML-R *Fixing minor bugs found during re-export of all caselaw in the database --- .../caselaw/adapter/LdmlExporterService.java | 4 ++ .../adapter/caselawldml/AknMultipleBlock.java | 10 ++--- .../caselaw/adapter/caselawldml/Header.java | 45 ------------------- .../caselawhandover/htmlToAknHtml.xslt | 11 +++-- 4 files changed, 13 insertions(+), 57 deletions(-) delete mode 100644 backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/Header.java diff --git a/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/LdmlExporterService.java b/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/LdmlExporterService.java index 7625c1c9d7..fe4ebe7117 100644 --- a/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/LdmlExporterService.java +++ b/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/LdmlExporterService.java @@ -209,6 +209,10 @@ private void logXsdError(String caseLawId, String beforeXslt, Exception e) { hint = "KARE600062214 contains an invalid width (escaping issue)"; } else if (beforeXslt.contains("JURE200002538")) { hint = "JURE200002538 contains an invalid href (invalid whitespace in the middle of the url)"; + } else if (beforeXslt.matches("(?s).*.*.*")) { + hint = "Ldml contained
inside title."; + } else if (beforeXslt.matches("(?s).*.*.*")) { + hint = "Ldml contained
inside title."; } logger.error("Error: {} Case Law {} does not match akomantoso30.xsd. {}", hint, caseLawId, e); } diff --git a/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/AknMultipleBlock.java b/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/AknMultipleBlock.java index 03aa91be32..b221ae8a15 100644 --- a/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/AknMultipleBlock.java +++ b/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/AknMultipleBlock.java @@ -3,18 +3,20 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlTransient; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; @AllArgsConstructor +@NoArgsConstructor public class AknMultipleBlock { // Jaxb doesn't handle elements with the same name very well. // They need to be in a list with the same class instead of two separate fields. // A Map is used with @XmlElement added to a helper getter/setter to facilitate easier use. - @XmlTransient private Map blocks; + @XmlTransient private Map blocks = new LinkedHashMap<>(); @XmlElement(name = "block", namespace = CaseLawLdml.AKN_NS) public void setJaxbBlocks(List blocks) { @@ -28,10 +30,6 @@ public List getJaxbBlocks() { return new ArrayList<>(blocks.values()); } - public AknMultipleBlock() { - this.blocks = new HashMap<>(); - } - public AknMultipleBlock withBlock(String name, AknBlock block) { if (block != null) { blocks.put(name, block); diff --git a/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/Header.java b/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/Header.java deleted file mode 100644 index 2ebe7152f0..0000000000 --- a/backend/src/main/java/de/bund/digitalservice/ris/caselaw/adapter/caselawldml/Header.java +++ /dev/null @@ -1,45 +0,0 @@ -package de.bund.digitalservice.ris.caselaw.adapter.caselawldml; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlTransient; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import lombok.AllArgsConstructor; - -@AllArgsConstructor -public class Header { - - // Jaxb doesn't handle elements with the same name very well. - // They need to be in a list with the same class instead of two separate fields. - // A Map is used with @XmlElement added to a helper getter/setter to facilitate easier use. - @XmlTransient private Map blocks; - - @XmlElement(name = "block", namespace = CaseLawLdml.AKN_NS) - public void setJaxbBlocks(List blocks) { - for (AknBlock block : blocks) { - this.blocks.put(block.getName(), block); - } - } - - @XmlElement(name = "block", namespace = CaseLawLdml.AKN_NS) - public List getJaxbBlocks() { - return new ArrayList<>(blocks.values()); - } - - public Header() { - this.blocks = new HashMap<>(); - } - - public Header withBlock(String name, AknBlock block) { - if (block != null) { - blocks.put(name, block); - } - return this; - } - - public AknBlock getBlock(String name) { - return blocks.get(name); - } -} diff --git a/backend/src/main/resources/caselawhandover/htmlToAknHtml.xslt b/backend/src/main/resources/caselawhandover/htmlToAknHtml.xslt index 186ee764d8..fea1ebd06c 100644 --- a/backend/src/main/resources/caselawhandover/htmlToAknHtml.xslt +++ b/backend/src/main/resources/caselawhandover/htmlToAknHtml.xslt @@ -46,9 +46,7 @@ - - - + - + @@ -242,7 +241,7 @@ - +