diff --git a/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDeposit.java b/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDeposit.java index dccf2c4..5116cb3 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDeposit.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDeposit.java @@ -102,7 +102,7 @@ public void updateProperties(Map properties) { @Override public void onSuccess(@NonNull String pid, String message) { var map = new HashMap(); - map.put(IDENTIFIER_DOI_KEY, pid); + map.put(IDENTIFIER_DOI_KEY, removeDoiLabel(pid)); updateProperties(map); } @@ -112,7 +112,7 @@ public void onFailed(String pid, String message) { map.put(STATE_LABEL_KEY, "FAILED"); map.put(STATE_DESCRIPTION_KEY, message); if (pid != null) { - map.put(IDENTIFIER_DOI_KEY, pid); + map.put(IDENTIFIER_DOI_KEY, removeDoiLabel(pid)); } updateProperties(map); } @@ -123,11 +123,15 @@ public void onRejected(String pid, String message) { map.put(STATE_LABEL_KEY, "REJECTED"); map.put(STATE_DESCRIPTION_KEY, message); if (pid != null) { - map.put(IDENTIFIER_DOI_KEY, pid); + map.put(IDENTIFIER_DOI_KEY, removeDoiLabel(pid)); } updateProperties(map); } + private String removeDoiLabel(String doi) { + return doi.startsWith("doi:") ? doi.substring(4) : doi; + } + @Override public void validate() { log.debug("No validation implemented for DataverseIngestDeposit"); diff --git a/src/main/java/nl/knaw/dans/dvingest/core/Deposit.java b/src/main/java/nl/knaw/dans/dvingest/core/Deposit.java index 474223c..aa771e9 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/Deposit.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/Deposit.java @@ -26,6 +26,7 @@ public interface Deposit { String UPDATES_DATASET_KEY = "updates-dataset"; String CREATION_TIMESTAMP_KEY = "creation.timestamp"; String IDENTIFIER_DOI_KEY = "identifier.doi"; + String IDENTIFIER_NBN_KEY = "identifier.urn"; String STATE_LABEL_KEY = "state.label"; String STATE_DESCRIPTION_KEY = "state.description"; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupport.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupport.java index f53b4f5..8a6400a 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupport.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupport.java @@ -151,8 +151,8 @@ private void handlePublishAction(String pid, boolean isMigration) { newProps.put("state.label", "PUBLISHED"); newProps.put("state.description", "The dataset is published"); if (!isMigration) { - newProps.put("identifier.doi", pid); - newProps.put("identifier.urn", nbn); + newProps.put(IDENTIFIER_DOI_KEY, removeDoiLabel(pid)); + newProps.put(IDENTIFIER_NBN_KEY, nbn); } ingestDataverseIngestDeposit.updateProperties(newProps); } @@ -161,6 +161,10 @@ private void handlePublishAction(String pid, boolean isMigration) { } } + private String removeDoiLabel(String doi) { + return doi.startsWith("doi:") ? doi.substring(4) : doi; + } + @Override public void onFailed(String pid, String message) { ingestDataverseIngestDeposit.onFailed(pid, message);