From 367be9b9548be28c7f468015cc6e207a95ca77cb Mon Sep 17 00:00:00 2001 From: fintanorbert Date: Fri, 9 Feb 2024 14:15:49 +0100 Subject: [PATCH 1/2] Show the download limit in the RO-Crate download error message --- src/main/java/edu/harvard/iq/dataverse/DatasetPage.java | 4 +++- src/main/java/propertyFiles/Bundle.properties | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index 45e6385e1c6..228c4214b7a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -6512,7 +6512,9 @@ public String getDownloadRoCrateHeader() { } public String getDownloadRoCrateMessage() { - return BundleUtil.getStringFromBundle("arp.dataset.roCrate.too.big.simple", List.of(ArpServiceBean.RO_CRATE_METADATA_JSON_NAME)); + long zipDownloadLimit = settingsWrapper.getZipDownloadLimit() / (1024*1024); + var message = zipDownloadLimit > 1024 ? zipDownloadLimit / 1024 + " GB" : zipDownloadLimit + " MB"; + return BundleUtil.getStringFromBundle("arp.dataset.roCrate.too.big.simple", List.of(message, ArpServiceBean.RO_CRATE_METADATA_JSON_NAME)); } public void downloadRoCrate() throws Exception { diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 6053634dd6f..cc6070b287a 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -2957,7 +2957,7 @@ arp.rocrate.version.save.error=Failed to save the current version of the RO-Crat arp.rocrate.draft.deletion.error=Failed to delete the "Draft" version of the RO-Crate arp.dataverse.results.btn.addData.newRoCrate=New Ro-Crate arp.dataset.roCrate.too.big=The dataset is too large to download in RO-Crate format. -arp.dataset.roCrate.too.big.simple=Please select the files you need from the files table.
Only the {0} will be downloaded. +arp.dataset.roCrate.too.big.simple=The file download limit is: {0}.
Please select the files you need from the files table.
Only the {1} will be downloaded. dataset.describoTab=AROMA dataset.message.roCrateSuccess=The RO-Crate for this dataset has been updated. dataset.message.roCrateError=Something went wrong during saving the RO-Crate for this dataset. From a5503f45b594e175749449c212f776120f5d7fd4 Mon Sep 17 00:00:00 2001 From: fintanorbert Date: Mon, 12 Feb 2024 15:50:04 +0100 Subject: [PATCH 2/2] Provide some info about version diffs in case the changes are RO-Crate related only --- .../dataverse/DatasetVersionDifference.java | 29 ++++++++++++++++++- src/main/java/propertyFiles/Bundle.properties | 4 ++- src/main/webapp/dataset-versions.xhtml | 3 ++ src/main/webapp/dataset.xhtml | 3 ++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java b/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java index eca0c84ae84..0352f95f957 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java @@ -5,6 +5,7 @@ import edu.harvard.iq.dataverse.datavariable.VariableMetadataUtil; import edu.harvard.iq.dataverse.util.StringUtil; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -39,6 +40,7 @@ public final class DatasetVersionDifference { private List changedTermsAccess = new ArrayList<>(); private List summaryDataForNote = new ArrayList<>(); private List blockDataForNote = new ArrayList<>(); + private boolean roCrateRelatedChangesOnly; private VariableMetadataUtil variableMetadataUtil; @@ -171,6 +173,24 @@ public DatasetVersionDifference(DatasetVersion newVersion, DatasetVersion origin return Integer.valueOf(a).compareTo(b); }); getTermsDifferences(); + setRoCrateRelatedChangesOnly(areAllListsEmpty()); + } + + public boolean areAllListsEmpty() { + Field[] fields = this.getClass().getDeclaredFields(); + for (Field field : fields) { + if (List.class.isAssignableFrom(field.getType())) { + try { + List list = (List) field.get(this); + if (list != null && !list.isEmpty()) { + return false; + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + return true; } private void getReplacedFiles() { @@ -1360,7 +1380,14 @@ public String getEditSummaryForLog() { return retVal; } - + + public boolean isRoCrateRelatedChangesOnly() { + return roCrateRelatedChangesOnly; + } + + public void setRoCrateRelatedChangesOnly(boolean roCrateRelatedChangesOnly) { + this.roCrateRelatedChangesOnly = roCrateRelatedChangesOnly; + } public class DifferenceSummaryGroup { diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index cc6070b287a..4ac701f504c 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -2969,4 +2969,6 @@ arp.rocrate.functionalities.disabled.details.no.permission= The RO-Crate related arp.rocrate.uploaded.popup.header=Own RO-Crate metadata uploaded arp.rocrate.uploaded.popup.warning=Uploading your own \"{0}\" file(s) will disable the RO-Crate related functionalities. arp.rocrate.uploaded.popup.help=
Please take one of the following actions:

1. Rename the JSON file: If you wish to keep your uploaded RO-Crate metadata, please rename the file to something other than \"{0}.\"

2. Move the JSON file to a different location: Move your \"{0}\" file to a separate folder by adding a \"{1}\" to avoid conflicts with the application functionalities.

3. Delete the uploaded JSON file: If you do not wish to handle your RO-Crate metadata, you can delete the \"{0}\" file, and the application will handle it for you.

Please note that RO-CRATE functionalities will remain disabled until one of these actions is taken. If you have any questions, feel free to contact our support team. -arp.rocrate.uploaded.delete=Delete File(s) \ No newline at end of file +arp.rocrate.uploaded.delete=Delete File(s) +arp.rocrate.related.changes.summary=RO-Crate related change(s) +arp.rocrate.related.changes.description=The new version contains RO-Crate related change(s) only. Differences details are not available. \ No newline at end of file diff --git a/src/main/webapp/dataset-versions.xhtml b/src/main/webapp/dataset-versions.xhtml index fe0758d74f0..3d7fa794827 100644 --- a/src/main/webapp/dataset-versions.xhtml +++ b/src/main/webapp/dataset-versions.xhtml @@ -123,6 +123,9 @@ #{bundle['file.dataFilesTab.versions.description.deaccessionedReason']} #{versionTab.versionNote} #{bundle['file.dataFilesTab.versions.description.beAccessedAt']} #{versionTab.archiveNote} + + + + + +