Skip to content

Commit

Permalink
Merge remote-tracking branch 'dsd/arp-prod' into arp-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
beepsoft committed Feb 13, 2024
2 parents d402577 + a5503f4 commit 5a406be
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -39,6 +40,7 @@ public final class DatasetVersionDifference {
private List<String[]> changedTermsAccess = new ArrayList<>();
private List<Object[]> summaryDataForNote = new ArrayList<>();
private List<Object[]> blockDataForNote = new ArrayList<>();
private boolean roCrateRelatedChangesOnly;

private VariableMetadataUtil variableMetadataUtil;

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/> Only the <b>{0}</b> will be downloaded.
arp.dataset.roCrate.too.big.simple=The file download limit is: {0}.<br/>Please select the files you need from the files table.<br/> Only the <b>{1}</b> 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.
Expand All @@ -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=<br/>Please take one of the following actions:<br/><br/>1. <b>Rename</b> the JSON file: If you wish to keep your uploaded RO-Crate metadata, please rename the file to something other than \"{0}.\"<br/><br/>2. <b>Move</b> 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.<br/><br/>3. <b>Delete</b> 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.<br/><br/><b>Please note that RO-CRATE functionalities will remain disabled until one of these actions is taken.</b> If you have any questions, feel free to contact our support team.
arp.rocrate.uploaded.delete=Delete File(s)
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.
3 changes: 3 additions & 0 deletions src/main/webapp/dataset-versions.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
#{bundle['file.dataFilesTab.versions.description.deaccessionedReason']} #{versionTab.versionNote} <ui:fragment rendered="#{!empty versionTab.archiveNote}">#{bundle['file.dataFilesTab.versions.description.beAccessedAt']} <a href="#{versionTab.archiveNote}" target="_blank">#{versionTab.archiveNote}</a></ui:fragment>
</ui:fragment>
</ui:fragment>
<ui:fragment rendered="#{versionTab.defaultVersionDifference.roCrateRelatedChangesOnly}">
<h:outputText styleClass="highlightBold" value="#{bundle['arp.rocrate.related.changes.summary']}; " />
</ui:fragment>
<p:commandLink rendered="#{(!empty(versionTab.defaultVersionDifference)) and DatasetPage.versionTabListForPostLoad.size() > (rowNum + 1)}"
actionListener="#{DatasetPage.updateVersionDifferences(versionTab, null)}"
oncomplete="PF('detailsBlocks').show();post_differences();"
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,9 @@
#{bundle['file.viewDiffDialog.lastUpdated']}: #{DatasetPage.datasetVersionDifference.newVersion.localeLastUpdateTime}
</div>
</div>
<ui:fragment rendered="#{DatasetPage.datasetVersionDifference.roCrateRelatedChangesOnly}">
<h:outputText styleClass="highlightBold" value="#{bundle['arp.rocrate.related.changes.description']}" />
</ui:fragment>
<ui:fragment rendered="#{!empty(DatasetPage.datasetVersionDifference.detailDataByBlock)}">
<ui:repeat value="#{DatasetPage.datasetVersionDifference.detailDataByBlock}" var="block">
<div class="panel panel-default">
Expand Down

0 comments on commit 5a406be

Please sign in to comment.