use of edu.harvard.iq.dataverse.engine.command.CommandContext in project dataverse by IQSS.
the class FinalizeDatasetPublicationCommand method notifyUsersFileDownload.
// These notification methods are fairly similar, but it was cleaner to create a few copies.
// If more notifications are needed in this command, they should probably be collapsed.
private void notifyUsersFileDownload(CommandContext ctxt, DvObject subject) {
Timestamp timestamp = new Timestamp(new Date().getTime());
ctxt.roles().directRoleAssignments(subject).stream().filter(ra -> ra.getRole().permissions().contains(Permission.DownloadFile)).flatMap(ra -> ctxt.roleAssignees().getExplicitUsers(ctxt.roleAssignees().getRoleAssignee(ra.getAssigneeIdentifier())).stream()).distinct().forEach(au -> ctxt.notifications().sendNotification(au, timestamp, UserNotification.Type.GRANTFILEACCESS, theDataset.getId()));
}
use of edu.harvard.iq.dataverse.engine.command.CommandContext in project dataverse by IQSS.
the class FinalizeDatasetPublicationCommand method notifyUsersDatasetPublish.
private void notifyUsersDatasetPublish(CommandContext ctxt, DvObject subject) {
Timestamp timestamp = new Timestamp(new Date().getTime());
ctxt.roles().rolesAssignments(subject).stream().filter(ra -> ra.getRole().permissions().contains(Permission.ViewUnpublishedDataset) || ra.getRole().permissions().contains(Permission.DownloadFile)).flatMap(ra -> ctxt.roleAssignees().getExplicitUsers(ctxt.roleAssignees().getRoleAssignee(ra.getAssigneeIdentifier())).stream()).distinct().forEach(au -> ctxt.notifications().sendNotification(au, timestamp, UserNotification.Type.PUBLISHEDDS, theDataset.getLatestVersion().getId()));
}
Aggregations