use of edu.harvard.iq.dataverse.engine.command.impl.DeaccessionDatasetVersionCommand in project dataverse by IQSS.
the class DatasetPage method deaccessionVersions.
public String deaccessionVersions() {
Command<DatasetVersion> cmd;
try {
if (selectedDeaccessionVersions == null) {
for (DatasetVersion dv : this.dataset.getVersions()) {
if (dv.isReleased()) {
DatasetVersion deaccession = datasetVersionService.find(dv.getId());
cmd = new DeaccessionDatasetVersionCommand(dvRequestService.getDataverseRequest(), setDatasetVersionDeaccessionReasonAndURL(deaccession), true);
DatasetVersion datasetv = commandEngine.submit(cmd);
}
}
} else {
for (DatasetVersion dv : selectedDeaccessionVersions) {
DatasetVersion deaccession = datasetVersionService.find(dv.getId());
cmd = new DeaccessionDatasetVersionCommand(dvRequestService.getDataverseRequest(), setDatasetVersionDeaccessionReasonAndURL(deaccession), false);
DatasetVersion datasetv = commandEngine.submit(cmd);
}
}
} catch (CommandException ex) {
logger.severe(ex.getMessage());
JH.addMessage(FacesMessage.SEVERITY_FATAL, JH.localize("dataset.message.deaccessionFailure"));
}
JsfHelper.addSuccessMessage(JH.localize("datasetVersion.message.deaccessionSuccess"));
return returnToDatasetOnly();
}
Aggregations