Skip to content

Commit

Permalink
fix Dataset Differencing
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Dec 9, 2024
1 parent 1072c4b commit 13b727a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ private void getTermsDifferences() {
BundleUtil.getStringFromBundle("file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection"));
checkAndAddToChangeList(originalTerms.getStudyCompletion(), newTerms.getStudyCompletion(),
BundleUtil.getStringFromBundle("file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion"));
checkAndAddToChangeList(Boolean.toString(originalTerms.isFileAccessRequest()), Boolean.toString(newTerms.isFileAccessRequest()),
BundleUtil.getStringFromBundle("file.dataFilesTab.terms.list.termsOfAccess.addInfo.fileAccessRequest"));
String customTerms = BundleUtil.getStringFromBundle("license.custom");
checkAndAddToChangeList(
(originalTerms.getLicense() == null) ? customTerms : originalTerms.getLicense().getName(),
(newTerms.getLicense() == null) ? customTerms : newTerms.getLicense().getName(),
BundleUtil.getStringFromBundle("file.dataFilesTab.terms.list.termsOfUse.addInfo.license"));
}

private void checkAndAddToChangeList(String originalTerm, String newTerm,
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1994,10 +1994,10 @@ file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions=Conditions
file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions.title=Any additional information that will assist the user in understanding the access and use conditions of the Dataset.
file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer=Disclaimer
file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer.title=Information regarding responsibility for uses of the Dataset.
file.dataFilesTab.terms.list.termsOfUse.addInfo.license=License
file.dataFilesTab.terms.list.termsOfAccess.header=Restricted Files + Terms of Access
file.dataFilesTab.terms.list.termsOfAccess.description=Restricting limits access to published files. People who want to use the restricted files can request access by default. If you disable request access, you must add information about access to the Terms of Access field.
file.dataFilesTab.terms.list.termsOfAccess.description.line.2=Learn about restricting files and dataset access in the <a href="{0}/{1}/user/dataset-management.html#restricted-files-terms-of-access" title="Dataverse User Guide" target="_blank">User Guide</a>.

file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles=Restricted Files
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.title=The number of restricted files in this dataset.
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.txt=There {0, choice, 0#are|1#is|2#are} {0} restricted {0, choice, 0#files|1#file|2#files} in this dataset.
Expand All @@ -2023,6 +2023,8 @@ file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection=Size of Coll
file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection.tip=Summary of the number of physical files that exist in a Dataset, recording the number of files that contain data and noting whether the collection contains machine readable documentation and/or other supplementary files and information, such as code, data dictionaries, data definition statements, or data collection instruments.
file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion=Study Completion
file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion.title=Relationship of the data collected to the amount of data coded and stored in the Dataset. Information as to why certain items of collected information were not included in the dataset or a specific data file should be provided.
file.dataFilesTab.terms.list.termsOfAccess.addInfo.fileAccessRequest=File Access Requests Allowed

file.dataFilesTab.terms.list.guestbook=Guestbook
file.dataFilesTab.terms.list.guestbook.title=User information (i.e., name, email, institution, and position) will be collected when files are downloaded.
file.dataFilesTab.terms.list.guestbook.noSelected.tip=No guestbook is assigned to this dataset so users will not be prompted to provide any information when downloading files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,37 @@ public void testDifferencing() {
compareResults(datasetVersion, datasetVersion2, expectedAddedFiles, expectedRemovedFiles,
expectedChangedFileMetadata, expectedChangedVariableMetadata, expectedReplacedFiles, changedTerms);

// Set file access

datasetVersion.getTermsOfUseAndAccess().setFileAccessRequest(false);
datasetVersion2.getTermsOfUseAndAccess().setFileAccessRequest(true);
String[] termField3 = new String[] {
BundleUtil.getStringFromBundle("file.dataFilesTab.terms.list.termsOfAccess.addInfo.fileAccessRequest"),
"false", "true" };
changedTerms.add(termField3);

compareResults(datasetVersion, datasetVersion2, expectedAddedFiles, expectedRemovedFiles,
expectedChangedFileMetadata, expectedChangedVariableMetadata, expectedReplacedFiles, changedTerms);

// Set License

License license2 = new License("CC-BY-4.0",
"Creative Commons Attribution 4.0 International License.",
URI.create("http://creativecommons.org/licenses/by/4.0"), URI.create("https://licensebuttons.net/l/by/4.0/88x31.png"),
true, 1l);

datasetVersion.getTermsOfUseAndAccess().setLicense(license);
datasetVersion2.getTermsOfUseAndAccess().setLicense(license2);
String[] termField4 = new String[] {
BundleUtil.getStringFromBundle("file.dataFilesTab.terms.list.termsOfUse.addInfo.license"),
license.getName(), license2.getName() };
changedTerms.add(termField4);
changedTerms.remove(termField);
changedTerms.remove(termField2);

compareResults(datasetVersion, datasetVersion2, expectedAddedFiles, expectedRemovedFiles,
expectedChangedFileMetadata, expectedChangedVariableMetadata, expectedReplacedFiles, changedTerms);

}

private FileMetadata createFileMetadata(long id, DatasetVersion datasetVersion, DataFile dataFile, String label) {
Expand Down Expand Up @@ -250,6 +281,7 @@ private void compareResults(DatasetVersion datasetVersion, DatasetVersion datase

assertEquals(changedTerms.size(), diff.getChangedTermsAccess().size());
for (int i = 0; i < changedTerms.size(); i++) {
System.out.println("Changed Terms: " + Arrays.toString(changedTerms.get(i)));
String[] diffArray = diff.getChangedTermsAccess().get(i);
assertEquals(changedTerms.get(i)[0], diffArray[0]);
assertEquals(changedTerms.get(i)[1], diffArray[1]);
Expand Down

0 comments on commit 13b727a

Please sign in to comment.