Skip to content

Commit

Permalink
Merge pull request #3816 from solhm/2437-handle-support
Browse files Browse the repository at this point in the history
Adjustment on Deaccession and Destroy commands
  • Loading branch information
sekmiller authored May 5, 2017
2 parents b6d9382 + 1996032 commit e8b87e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
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

0 comments on commit e8b87e6

Please sign in to comment.