Skip to content

Commit

Permalink
Merge pull request #4 from solhm/dans-master
Browse files Browse the repository at this point in the history
Bundle items with variable, and additional method to get provider's name
  • Loading branch information
4tikhonov authored Mar 30, 2017
2 parents faea650 + a87e382 commit d23b0bf
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 11 deletions.
5 changes: 1 addition & 4 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,7 @@ dataset.email.datasetLinkBtn.tip=Link Dataset to Your Dataverse
dataset.share.datasetShare=Share Dataset
dataset.share.datasetShare.tip=Share this dataset on your favorite social media networks.
dataset.share.datasetShare.shareText=View this dataset.
dataset.publish.error.datacite=This dataset may not be published because the <a href=\"http://status.datacite.org/\" title=\"DataCite Status Page\" target=\"_blank\"/>DataCite Service</a> is currently inaccessible. Please try again. Does the issue continue to persist?
dataset.publish.error.DataCiteException=This dataset may not be published because the <a href=\"http://status.datacite.org/\" title=\"DataCite Status Page\" target=\"_blank\"/>DataCite Service</a> is currently inaccessible. Please try again. Does the issue continue to persist?
dataset.publish.error.HandleException=This dataset may not be published because the <a href=\"https://hdl.handle.net/\" title=\"handle proxy \" target=\"_blank\"/>Handle.net Service</a> is currently inaccessible. Please try again. Does the issue continue to persist?
dataset.publish.error.EZIDException=This dataset may not be published because the <a href=\"http://ezid.lib.purdue.edu/contact/\" title=\"ezid contact Page\" target=\"_blank\"/>EZID Service</a> is currently inaccessible. Please try again. Does the issue continue to persist?
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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*/
package edu.harvard.iq.dataverse;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
Expand Down Expand Up @@ -238,4 +240,14 @@ private boolean updateIdentifierStatus(Dataset dataset, String statusIn) {
return false;
}
}
}

@Override
public List<String> getProviderInformation(){
ArrayList <String> providerInfo = new ArrayList<>();
String providerName = "DataCite";
String providerLink = "http://status.datacite.org";
providerInfo.add(providerName);
providerInfo.add(providerLink);
return providerInfo;
}
}
13 changes: 13 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DOIEZIdServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

import edu.ucsb.nceas.ezid.EZIDException;
import edu.ucsb.nceas.ezid.EZIDService;
import java.util.ArrayList;

import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
Expand Down Expand Up @@ -228,4 +230,15 @@ private boolean updateIdentifierStatus(Dataset dataset, String statusIn) {
}

}

@Override
public List<String> getProviderInformation(){
ArrayList <String> providerInfo = new ArrayList<>();
String providerName = "EZID";
String providerLink = baseURLString;
providerInfo.add(providerName);
providerInfo.add(providerLink);
return providerInfo;
}
}

12 changes: 11 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/HandlenetServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private String getRegistrationUrl(Dataset dataset) {
+ "/" + dataset.getIdentifier();
return targetUrl;
}

public String getSiteUrl() {
logger.log(Level.FINE,"getSiteUrl");
String hostUrl = System.getProperty("dataverse.siteUrl");
Expand Down Expand Up @@ -406,6 +406,16 @@ private String getAuthHandle(Dataset datasetIn) {
// TODO hack: GNRSServiceBean retrieved this from vdcNetworkService
return "0.NA/" + datasetIn.getAuthority();
}

@Override
public List<String> getProviderInformation(){
ArrayList <String> providerInfo = new ArrayList<>();
String providerName = "Handle";
String providerLink = "https://hdl.handle.net";
providerInfo.add(providerName);
providerInfo.add(providerLink);
return providerInfo;
}
}


Expand Down
2 changes: 2 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/IdServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public interface IdServiceBean {
boolean alreadyExists(Dataset dataset) throws Exception;

boolean registerWhenPublished();

List<String> getProviderInformation();

String createIdentifier(Dataset dataset) throws Throwable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import edu.harvard.iq.dataverse.privateurl.PrivateUrl;
import edu.harvard.iq.dataverse.search.IndexResponse;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.BundleUtil;
import static edu.harvard.iq.dataverse.util.json.JsonPrinter.jsonAsDatasetDto;
import java.io.FileOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -97,8 +98,7 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
}
}
} catch (Throwable e) {
String exceptionName=e.getClass().getSimpleName();
throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error."+exceptionName), this);
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.error", idServiceBean.getProviderInformation()),this);
}
} else {
throw new IllegalCommandException("This dataset may not be published because its id registry service is not supported.", this);
Expand Down Expand Up @@ -223,8 +223,7 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
try{
idServiceBean.publicizeIdentifier(savedDataset);
}catch (Throwable e) {
String exceptionName=e.getClass().getSimpleName();
throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error."+exceptionName), this);
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.error", idServiceBean.getProviderInformation()),this);
}
PrivateUrl privateUrl = ctxt.engine().submit(new GetPrivateUrlCommand(getRequest(), savedDataset));
if (privateUrl != null) {
Expand All @@ -248,6 +247,6 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
IndexResponse indexResponse = ctxt.solrIndex().indexPermissionsForOneDvObject(savedDataset);

return savedDataset;
}
}

}

0 comments on commit d23b0bf

Please sign in to comment.