Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustment on Deaccession and Destroy commands #3816

Merged
merged 3 commits into from
May 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ dataset.share.datasetShare.tip=Share this dataset on your favorite social media
dataset.share.datasetShare.shareText=View this dataset.
dataset.publish.error=This dataset may not be published because the <a href=\{1} target=\"_blank\"/> {0} </a> Service is currently inaccessible. Please try again. Does the issue continue to persist?
dataset.publish.error.doi=This dataset may not be published because the DOI update failed.
dataset.delete.error.datacite=Could not deaccession the dataset because the DOI update failed.
dataset.delete.error=Could not deaccession the dataset because the {0} update failed.

dataset.versionUI.draft=Draft
dataset.versionUI.inReview=In Review
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import edu.harvard.iq.dataverse.export.ExportException;
import edu.harvard.iq.dataverse.export.ExportService;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.BundleUtil;
import java.util.ArrayList;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import java.util.logging.Level;
Expand Down Expand Up @@ -53,16 +55,18 @@ public DatasetVersion execute(CommandContext ctxt) throws CommandException {
if (deleteDOIIdentifier) {
String nonNullDefaultIfKeyNotFound = "";
String protocol = ctxt.settings().getValueForKey(SettingsServiceBean.Key.Protocol, nonNullDefaultIfKeyNotFound);
ArrayList<String> currentProtocol = new ArrayList<>();
currentProtocol.add(protocol);
IdServiceBean idServiceBean = IdServiceBean.getBean(ctxt);

logger.fine("protocol=" + protocol);
try {
idServiceBean.deleteIdentifier(ds);
} catch (Exception e) {
if (e.toString().contains("Internal Server Error")) {
throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error.datacite"), this);
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.error", idServiceBean.getProviderInformation()),this);
}
throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.delete.error.datacite"), this);
throw new CommandException(BundleUtil.getStringFromBundle("dataset.delete.error", currentProtocol),this);
}
}
DatasetVersion managed = ctxt.em().merge(theVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.harvard.iq.dataverse.DataFile;
import edu.harvard.iq.dataverse.Dataset;
import edu.harvard.iq.dataverse.Dataverse;
import edu.harvard.iq.dataverse.IdServiceBean;
import edu.harvard.iq.dataverse.authorization.DataverseRole;
import edu.harvard.iq.dataverse.search.IndexServiceBean;
import edu.harvard.iq.dataverse.RoleAssignment;
Expand Down Expand Up @@ -85,7 +86,13 @@ protected void executeImpl(CommandContext ctxt) throws CommandException {
// TODO make ignorant of configured bean
ctxt.doiDataCite().deleteRecordFromCache(doomed);
}


IdServiceBean idServiceBean = IdServiceBean.getBean(ctxt);
try{
idServiceBean.deleteIdentifier(doomed);
} catch (Exception e) {
logger.log(Level.WARNING, "Identifier deletion was not successfull:",e.getMessage());
}
Dataverse toReIndex = managedDoomed.getOwner();

// dataset
Expand Down