Skip to content

Commit

Permalink
Remove "doi:" label before identifier.doi property
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanmansum committed Jan 22, 2025
1 parent d60f713 commit 3881eb6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void updateProperties(Map<String, String> properties) {
@Override
public void onSuccess(@NonNull String pid, String message) {
var map = new HashMap<String, String>();
map.put(IDENTIFIER_DOI_KEY, pid);
map.put(IDENTIFIER_DOI_KEY, removeDoiLabel(pid));
updateProperties(map);
}

Expand All @@ -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);
}
Expand All @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/nl/knaw/dans/dvingest/core/Deposit.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down

0 comments on commit 3881eb6

Please sign in to comment.