Skip to content

Commit f733f1c

Browse files
committed
A quick fix for the issue with file-level handles bombing on create. #12174
Another quick fix, for #8881 (combined with #12174) A release note #12174
1 parent 27e1f1f commit f733f1c

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This release offers improved support for Handles as persistent ids.
2+
3+
The following issues are fixed:
4+
- When pid registration of persistent ids for files is enabled, Dataverse will create the handle as soon as the file is created (similary to other persistent id providers) (issue #12174);
5+
- When a new handle is created, for a dataset or file that is still a draft, it will be reserved and registered, but not visible publicly. The handle will become visible and the redirects will start working once it is published. This is also in line with how DOI providers work (issue #8881).

src/main/java/edu/harvard/iq/dataverse/DataFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
public class DataFile extends DvObject implements Comparable {
8181
private static final Logger logger = Logger.getLogger(DatasetPage.class.getCanonicalName());
8282
private static final long serialVersionUID = 1L;
83-
public static final String TARGET_URL = "/file.xhtml?persistentId=";
83+
public static final String TARGET_URL = "/citation?persistentId=";
8484
public static final char INGEST_STATUS_NONE = 65;
8585
public static final char INGEST_STATUS_SCHEDULED = 66;
8686
public static final char INGEST_STATUS_INPROGRESS = 67;

src/main/java/edu/harvard/iq/dataverse/pidproviders/handle/HandlePidProvider.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public Throwable registerNewHandle(DvObject dvObject) {
185185
timestamp, null, true, true, true, false), new HandleValue(1, "URL".getBytes(StandardCharsets.UTF_8),
186186
datasetUrl.getBytes(),
187187
HandleValue.TTL_TYPE_RELATIVE, 86400,
188-
timestamp, null, true, true, true, false)};
188+
timestamp, null, true, true, false, false)};
189189

190190
CreateHandleRequest req
191191
= new CreateHandleRequest(handle.getBytes(StandardCharsets.UTF_8), val, auth);
@@ -259,7 +259,7 @@ private String getRegistrationUrl(DvObject dvObject) {
259259
logger.log(Level.FINE,"getRegistrationUrl");
260260
String siteUrl = SystemConfig.getDataverseSiteUrlStatic();
261261
String targetUrl = siteUrl + dvObject.getTargetUrl() + "hdl:" + dvObject.getAuthority()
262-
+ "/" + dvObject.getIdentifier();
262+
+ "/" + dvObject.getIdentifier();
263263
return targetUrl;
264264
}
265265

@@ -324,12 +324,6 @@ private String getAuthenticationHandle(String handlePrefix) {
324324
return "0.NA/" + handlePrefix;
325325
}
326326
}
327-
328-
@Override
329-
public boolean alreadyRegistered(DvObject dvObject) {
330-
String handle = getDvObjectHandle(dvObject);
331-
return isHandleRegistered(handle);
332-
}
333327

334328
@Override
335329
public boolean alreadyRegistered(GlobalId pid, boolean noProviderDefault) throws Exception {
@@ -400,6 +394,10 @@ public List<String> getProviderInformation(){
400394

401395
@Override
402396
public String createIdentifier(DvObject dvObject) throws Throwable {
397+
if (dvObject.getIdentifier() == null || dvObject.getIdentifier().isEmpty()) {
398+
dvObject = generatePid(dvObject);
399+
logger.fine("generated identifier: " + getIdentifier(dvObject));
400+
}
403401
Throwable result = registerNewHandle(dvObject);
404402
if (result != null)
405403
throw result;

0 commit comments

Comments
 (0)