use of edu.harvard.iq.dataverse.DatasetVersion in project dataverse by IQSS.
the class FileUtilTest method testIsDownloadPopupRequiredHasTermsOfAccess.
@Test
public void testIsDownloadPopupRequiredHasTermsOfAccess() {
DatasetVersion dsv1 = new DatasetVersion();
dsv1.setVersionState(DatasetVersion.VersionState.RELEASED);
TermsOfUseAndAccess termsOfUseAndAccess = new TermsOfUseAndAccess();
termsOfUseAndAccess.setTermsOfAccess("Terms of *Access* is different than Terms of Use");
dsv1.setTermsOfUseAndAccess(termsOfUseAndAccess);
assertEquals(true, FileUtil.isDownloadPopupRequired(dsv1));
}
use of edu.harvard.iq.dataverse.DatasetVersion in project dataverse by IQSS.
the class FileUtilTest method testIsDownloadPopupRequiredLicenseCC0.
@Test
public void testIsDownloadPopupRequiredLicenseCC0() {
DatasetVersion dsv1 = new DatasetVersion();
dsv1.setVersionState(DatasetVersion.VersionState.RELEASED);
TermsOfUseAndAccess termsOfUseAndAccess = new TermsOfUseAndAccess();
termsOfUseAndAccess.setLicense(TermsOfUseAndAccess.License.CC0);
dsv1.setTermsOfUseAndAccess(termsOfUseAndAccess);
assertEquals(false, FileUtil.isDownloadPopupRequired(dsv1));
}
use of edu.harvard.iq.dataverse.DatasetVersion in project dataverse by IQSS.
the class FileUtilTest method testIsDownloadPopupRequiredHasGuestBook.
@Test
public void testIsDownloadPopupRequiredHasGuestBook() {
DatasetVersion datasetVersion = new DatasetVersion();
datasetVersion.setVersionState(DatasetVersion.VersionState.RELEASED);
Dataset dataset = new Dataset();
datasetVersion.setDataset(dataset);
Guestbook guestbook = new Guestbook();
guestbook.setEnabled(true);
dataset.setGuestbook(guestbook);
Dataverse dataverse = new Dataverse();
guestbook.setDataverse(dataverse);
assertEquals(true, FileUtil.isDownloadPopupRequired(datasetVersion));
}
use of edu.harvard.iq.dataverse.DatasetVersion in project dataverse by IQSS.
the class JsonParser method parseDataset.
public Dataset parseDataset(JsonObject obj) throws JsonParseException {
Dataset dataset = new Dataset();
dataset.setAuthority(obj.getString("authority", null) == null ? settingsService.getValueForKey(SettingsServiceBean.Key.Authority) : obj.getString("authority"));
dataset.setProtocol(obj.getString("protocol", null) == null ? settingsService.getValueForKey(SettingsServiceBean.Key.Protocol) : obj.getString("protocol"));
dataset.setDoiSeparator(obj.getString("doiSeparator", null) == null ? settingsService.getValueForKey(SettingsServiceBean.Key.DoiSeparator) : obj.getString("doiSeparator"));
dataset.setIdentifier(obj.getString("identifier", null));
DatasetVersion dsv = new DatasetVersion();
dsv.setDataset(dataset);
dsv = parseDatasetVersion(obj.getJsonObject("datasetVersion"), dsv);
LinkedList<DatasetVersion> versions = new LinkedList<>();
versions.add(dsv);
dataset.setVersions(versions);
return dataset;
}
use of edu.harvard.iq.dataverse.DatasetVersion in project dataverse by IQSS.
the class MailUtil method getSubjectTextBasedOnNotification.
public static String getSubjectTextBasedOnNotification(UserNotification userNotification, String rootDataverseName, Object objectOfNotification) {
List<String> rootDvNameAsList = Arrays.asList(BrandingUtil.getInstallationBrandName(rootDataverseName));
switch(userNotification.getType()) {
case ASSIGNROLE:
return BundleUtil.getStringFromBundle("notification.email.assign.role.subject", rootDvNameAsList);
case REVOKEROLE:
return BundleUtil.getStringFromBundle("notification.email.revoke.role.subject", rootDvNameAsList);
case CREATEDV:
return BundleUtil.getStringFromBundle("notification.email.create.dataverse.subject", rootDvNameAsList);
case REQUESTFILEACCESS:
return BundleUtil.getStringFromBundle("notification.email.request.file.access.subject", rootDvNameAsList);
case GRANTFILEACCESS:
return BundleUtil.getStringFromBundle("notification.email.grant.file.access.subject", rootDvNameAsList);
case REJECTFILEACCESS:
return BundleUtil.getStringFromBundle("notification.email.rejected.file.access.subject", rootDvNameAsList);
case MAPLAYERUPDATED:
return BundleUtil.getStringFromBundle("notification.email.update.maplayer", rootDvNameAsList);
case MAPLAYERDELETEFAILED:
return BundleUtil.getStringFromBundle("notification.email.maplayer.deletefailed.subject", rootDvNameAsList);
case CREATEDS:
return BundleUtil.getStringFromBundle("notification.email.create.dataset.subject", rootDvNameAsList);
case SUBMITTEDDS:
return BundleUtil.getStringFromBundle("notification.email.submit.dataset.subject", rootDvNameAsList);
case PUBLISHEDDS:
return BundleUtil.getStringFromBundle("notification.email.publish.dataset.subject", rootDvNameAsList);
case RETURNEDDS:
return BundleUtil.getStringFromBundle("notification.email.returned.dataset.subject", rootDvNameAsList);
case CREATEACC:
return BundleUtil.getStringFromBundle("notification.email.create.account.subject", rootDvNameAsList);
case CHECKSUMFAIL:
return BundleUtil.getStringFromBundle("notification.email.checksumfail.subject", rootDvNameAsList);
case FILESYSTEMIMPORT:
try {
DatasetVersion version = (DatasetVersion) objectOfNotification;
List<String> dsNameAsList = Arrays.asList(version.getDataset().getDisplayName());
return BundleUtil.getStringFromBundle("notification.email.import.filesystem.subject", dsNameAsList);
} catch (Exception e) {
return BundleUtil.getStringFromBundle("notification.email.import.filesystem.subject", rootDvNameAsList);
}
case CHECKSUMIMPORT:
return BundleUtil.getStringFromBundle("notification.email.import.checksum.subject", rootDvNameAsList);
case CONFIRMEMAIL:
return BundleUtil.getStringFromBundle("notification.email.verifyEmail.subject", rootDvNameAsList);
}
return "";
}
Aggregations