diff --git a/src/main/java/edu/harvard/iq/dataverse/DvObjectContainer.java b/src/main/java/edu/harvard/iq/dataverse/DvObjectContainer.java index a18b09cb4b8..da77df786d8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DvObjectContainer.java +++ b/src/main/java/edu/harvard/iq/dataverse/DvObjectContainer.java @@ -39,7 +39,7 @@ public boolean isEffectivelyPermissionRoot() { private String metadataLanguage=null; - private String guestbookAtRequest = null; + private Boolean guestbookAtRequest = null; public String getEffectiveStorageDriverId() { String id = storageDriver; @@ -101,7 +101,7 @@ public static boolean isMetadataLanguageSet(String mdLang) { public boolean getEffectiveGuestbookEntryAtRequest() { boolean gbAtRequest = false; - if (guestbookAtRequest==null || UNDEFINED_CODE.equals(guestbookAtRequest)) { + if (guestbookAtRequest==null) { if (this.getOwner() != null) { gbAtRequest = this.getOwner().getEffectiveGuestbookEntryAtRequest(); } else { @@ -111,15 +111,12 @@ public boolean getEffectiveGuestbookEntryAtRequest() { } } } else { - gbAtRequest = Boolean.parseBoolean(guestbookAtRequest); + gbAtRequest = guestbookAtRequest; } return gbAtRequest; } - public String getGuestbookEntryAtRequest() { - if (guestbookAtRequest == null) { - return UNDEFINED_CODE; - } + public Boolean getGuestbookEntryAtRequest() { return guestbookAtRequest; } @@ -128,7 +125,7 @@ public void setGuestbookEntryAtRequest(String gbAtRequest) { this.guestbookAtRequest = null; } else { //Force to true or false - this.guestbookAtRequest = Boolean.valueOf(Boolean.parseBoolean(gbAtRequest)).toString(); + this.guestbookAtRequest = Boolean.valueOf(Boolean.parseBoolean(gbAtRequest)); } } diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java b/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java index 55e329bea68..a1191a6f4e6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Datasets.java @@ -3888,8 +3888,8 @@ public Response getGuestbookEntryOption(@Context ContainerRequestContext crc, @P } catch (WrappedResponse ex) { return error(Response.Status.NOT_FOUND, "No such dataset"); } - String gbAtRequest = dataset.getGuestbookEntryAtRequest(); - if(gbAtRequest == null || gbAtRequest.equals(DvObjectContainer.UNDEFINED_CODE)) { + Boolean gbAtRequest = dataset.getGuestbookEntryAtRequest(); + if(gbAtRequest == null) { return ok("Not set on dataset, using the default: " + dataset.getEffectiveGuestbookEntryAtRequest()); } return ok(dataset.getEffectiveGuestbookEntryAtRequest());