From 754ad03546dba1c3d00fe564a5943eabf65145f2 Mon Sep 17 00:00:00 2001 From: Silvio Hermann Date: Tue, 16 Jul 2024 14:16:42 +0200 Subject: [PATCH] #550 Added resolve and create mode to HISinOneResolver --- .../thunibib/his/xml/HISinOneResolver.java | 16 +++++++--- ...object-mods-create-unresolved-his-keys.xsl | 5 ++- .../mycoreobject-mods-resolve-his-keys.xsl | 32 +++++++++---------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/common/src/main/java/de/uni_jena/thunibib/his/xml/HISinOneResolver.java b/common/src/main/java/de/uni_jena/thunibib/his/xml/HISinOneResolver.java index 1aebf00da..500661a4c 100644 --- a/common/src/main/java/de/uni_jena/thunibib/his/xml/HISinOneResolver.java +++ b/common/src/main/java/de/uni_jena/thunibib/his/xml/HISinOneResolver.java @@ -61,7 +61,11 @@ public class HISinOneResolver implements URIResolver { private static final Map THESIS_TYPE_MAP = new HashMap<>(); private static final Map VISIBILITY_TYPE_MAP = new HashMap<>(); - public enum SUPPORTED_URI_PARTS { + public enum Mode { + resolve, create + } + + public enum ResolvableTypes { creatorType, documentType, genre, @@ -82,16 +86,18 @@ public Source resolve(String href, String base) throws TransformerException { LOGGER.debug("Resolving '{}'", href); String[] parts = href.split(":"); - String entity = parts[1]; - String value = parts[2]; - var sysValue = switch (SUPPORTED_URI_PARTS.valueOf(entity)) { + Mode mode = Mode.valueOf(parts[1]); + String entity = parts[2]; + String value = parts[3]; + + var sysValue = switch (ResolvableTypes.valueOf(entity)) { case creatorType -> resolveCreatorType(value); case documentType -> resolveDocumentType(value); case genre -> resolveGenre(value); case globalIdentifiers -> resolveIdentifierType(value); case language -> resolveLanguage(value); - case publisher -> resolvePublisher(value); + case publisher -> Mode.resolve.equals(mode) ? resolvePublisher(value) : SysValue.NotObtainedSysValue; case peerReviewed -> resolvePeerReviewedType(value); case publicationAccessType -> resolvePublicationAccessType(value); case researchAreaKdsf -> resolveResearchAreaKdsf(value); diff --git a/common/src/main/resources/xsl/mycoreobject-mods-create-unresolved-his-keys.xsl b/common/src/main/resources/xsl/mycoreobject-mods-create-unresolved-his-keys.xsl index bba14aea8..0e0807cbf 100644 --- a/common/src/main/resources/xsl/mycoreobject-mods-create-unresolved-his-keys.xsl +++ b/common/src/main/resources/xsl/mycoreobject-mods-create-unresolved-his-keys.xsl @@ -32,8 +32,11 @@ + + + - + diff --git a/common/src/main/resources/xsl/mycoreobject-mods-resolve-his-keys.xsl b/common/src/main/resources/xsl/mycoreobject-mods-resolve-his-keys.xsl index e35b628b8..750095d8a 100644 --- a/common/src/main/resources/xsl/mycoreobject-mods-resolve-his-keys.xsl +++ b/common/src/main/resources/xsl/mycoreobject-mods-resolve-his-keys.xsl @@ -62,7 +62,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -95,13 +95,13 @@ - + - + @@ -111,14 +111,14 @@ - + - + @@ -128,7 +128,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -165,7 +165,7 @@ - + @@ -175,7 +175,7 @@ - + @@ -197,7 +197,7 @@ Begin - transformer 'mods-resolve-his-keys' - + @@ -205,7 +205,7 @@ - + @@ -219,7 +219,7 @@ TODO GET /fs/res/publication/documentTypes/article TODO GET /fs/res/publication/documentTypes/book --> - + @@ -234,7 +234,7 @@ - + Begin - transformer 'mods-resolve-his-keys'