From dfe56a1c5d3fee679b42546e9e925b380e8b1ee8 Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Wed, 21 Feb 2024 13:52:48 +0100 Subject: [PATCH] Assign ID to logical
s in imported METS files which don't have one (#5931) --- .../kitodo/dataformat/access/DivXmlElementAccess.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java index 691246f595b..c0cad752e5c 100644 --- a/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java +++ b/Kitodo-DataFormat/src/main/java/org/kitodo/dataformat/access/DivXmlElementAccess.java @@ -80,9 +80,14 @@ public DivXmlElementAccess() { */ DivXmlElementAccess(LogicalDivision logicalDivision) { super(logicalDivision); - metsReferrerId = logicalDivision instanceof DivXmlElementAccess - ? ((DivXmlElementAccess) logicalDivision).metsReferrerId - : KitodoUUID.randomUUID(); + String obtainedReferrerId = null; + if (logicalDivision instanceof DivXmlElementAccess) { + obtainedReferrerId = ((DivXmlElementAccess) logicalDivision).metsReferrerId; + } + if (Objects.isNull(obtainedReferrerId)) { + obtainedReferrerId = KitodoUUID.randomUUID(); + } + metsReferrerId = obtainedReferrerId; } /**