Skip to content
Permalink
Browse files

Merge remote-tracking branch 'IQSS/develop' into develop

Conflicts:
	src/main/java/Bundle.properties
	src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
	src/main/java/edu/harvard/iq/dataverse/FilePage.java
	src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
  • Loading branch information...
qqmyers committed Mar 5, 2019
2 parents c034321 + e707a22 commit c83ca236c079a7261df2415f074c658fdf48eb81
@@ -72,3 +72,8 @@ Send Dataset metadata to PID provider
Forces update to metadata provided to the PID provider of a published dataset. Only accessible to superusers. ::

curl -H "X-Dataverse-key: $API_TOKEN" -X POST http://$SERVER/api/datasets/$dataset-id/modifyRegistrationMetadata

Make Metadata Updates Without Changing Dataset Version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As a superuser, click "Update Current Version" when publishing. (This option is only available when a 'Minor' update would be allowed.)
@@ -372,7 +372,7 @@ For these deletes your JSON file must include an exact match of those dataset fi
Publish a Dataset
~~~~~~~~~~~~~~~~~

Publishes the dataset whose id is passed. If this is the first version of the dataset, its version number will be set to ``1.0``. Otherwise, the new dataset version number is determined by the most recent version number and the ``type`` parameter. Passing ``type=minor`` increases the minor version number (2.3 is updated to 2.4). Passing ``type=major`` increases the major version number (2.3 is updated to 3.0). ::
Publishes the dataset whose id is passed. If this is the first version of the dataset, its version number will be set to ``1.0``. Otherwise, the new dataset version number is determined by the most recent version number and the ``type`` parameter. Passing ``type=minor`` increases the minor version number (2.3 is updated to 2.4). Passing ``type=major`` increases the major version number (2.3 is updated to 3.0). Superusers can pass ``type=updatecurrent`` to update metadata without changing the version number::

POST http://$SERVER/api/datasets/$id/actions/:publish?type=$type&key=$apiKey

@@ -5,4 +5,4 @@ ALTER TABLE metric ADD COLUMN dayString text;
ALTER TABLE metric ADD COLUMN dataLocation text;
ALTER TABLE metric DROP CONSTRAINT "metric_metricname_key";
ALTER TABLE metric RENAME COLUMN metricValue TO valueJson;
ALTER TABLE metric RENAME COLUMN metricName TO name;
ALTER TABLE metric RENAME COLUMN metricName TO name;
@@ -1215,7 +1215,7 @@ dataset.publishBoth.tip=Once you publish this data project it must remain publis
dataset.unregistered.tip= This data project is unregistered. We will attempt to register it before publishing.
dataset.republish.tip=Are you sure you want to republish this data project?
dataset.selectVersionNumber=Select if this is a minor or major version update.
dataset.updateRelease=Update Current Version
dataset.updateRelease=Update Current Version (will permanently overwrite the latest published version)
dataset.majorRelease=Major Release
dataset.minorRelease=Minor Release
dataset.majorRelease.tip=Due to the nature of changes to the current draft this will be a major release ({0})
@@ -2091,37 +2091,45 @@ public String registerDataset() {
}

public String updateCurrentVersion() {
/*
* Note: The code here mirrors that in the
* edu.harvard.iq.dataverse.api.Datasets:publishDataset method (case
* "updatecurrent"). Any changes to the core logic (i.e. beyond updating the
* messaging about results) should be applied to the code there as well.
*/
String errorMsg = null;
String successMsg = BundleUtil.getStringFromBundle("datasetversion.update.success");
try {
CuratePublishedDatasetVersionCommand cmd = new CuratePublishedDatasetVersionCommand(dataset, dvRequestService.getDataverseRequest());
dataset = commandEngine.submit(cmd);
// If configured, update archive copy as well
String className = settingsService.get(SettingsServiceBean.Key.ArchiverClassName.toString());
// If configured, and currently published version is archived, try to update archive copy as well
DatasetVersion updateVersion = dataset.getLatestVersion();
AbstractSubmitToArchiveCommand archiveCommand = ArchiverUtil.createSubmitToArchiveCommand(className, dvRequestService.getDataverseRequest(), updateVersion);
if (archiveCommand != null) {
// Delete the record of any existing copy since it is now out of date/incorrect
updateVersion.setArchivalCopyLocation(null);
/*
* Then try to generate and submit an archival copy. Note that running this
* command within the CuratePublishedDatasetVersionCommand was causing an error:
* "The attribute [id] of class
* [edu.harvard.iq.dataverse.DatasetFieldCompoundValue] is mapped to a primary
* key column in the database. Updates are not allowed." To avoid that, and to
* simplify reporting back to the GUI whether this optional step succeeded, I've
* pulled this out as a separate submit().
*/
try {
updateVersion = commandEngine.submit(archiveCommand);
if(updateVersion.getArchivalCopyLocation()!=null) {
successMsg = BundleUtil.getStringFromBundle("datasetversion.update.archive.success");
} else {
errorMsg = BundleUtil.getStringFromBundle("datasetversion.update.archive.failure");
if (updateVersion.getArchivalCopyLocation() != null) {
String className = settingsService.get(SettingsServiceBean.Key.ArchiverClassName.toString());
AbstractSubmitToArchiveCommand archiveCommand = ArchiverUtil.createSubmitToArchiveCommand(className, dvRequestService.getDataverseRequest(), updateVersion);
if (archiveCommand != null) {
// Delete the record of any existing copy since it is now out of date/incorrect
updateVersion.setArchivalCopyLocation(null);
/*
* Then try to generate and submit an archival copy. Note that running this
* command within the CuratePublishedDatasetVersionCommand was causing an error:
* "The attribute [id] of class
* [edu.harvard.iq.dataverse.DatasetFieldCompoundValue] is mapped to a primary
* key column in the database. Updates are not allowed." To avoid that, and to
* simplify reporting back to the GUI whether this optional step succeeded, I've
* pulled this out as a separate submit().
*/
try {
updateVersion = commandEngine.submit(archiveCommand);
if (updateVersion.getArchivalCopyLocation() != null) {
successMsg = BundleUtil.getStringFromBundle("datasetversion.update.archive.success");
} else {
errorMsg = BundleUtil.getStringFromBundle("datasetversion.update.archive.failure");
}
} catch (CommandException ex) {
errorMsg = BundleUtil.getStringFromBundle("datasetversion.update.archive.failure") + " - " + ex.toString();
logger.severe(ex.getMessage());
}
} catch (CommandException ex) {
errorMsg = BundleUtil.getStringFromBundle("datasetversion.update.archive.failure") + " - " + ex.toString();
logger.severe(ex.getMessage());
}
}
} catch (CommandException ex) {
@@ -81,7 +81,6 @@
import edu.harvard.iq.dataverse.util.ArchiverUtil;
import edu.harvard.iq.dataverse.util.BundleUtil;
import edu.harvard.iq.dataverse.util.EjbUtil;
import edu.harvard.iq.dataverse.util.JsfHelper;
import edu.harvard.iq.dataverse.util.SystemConfig;
import edu.harvard.iq.dataverse.util.json.JsonParseException;
import edu.harvard.iq.dataverse.search.IndexServiceBean;
@@ -814,7 +813,12 @@ public Response publishDataset(@PathParam("id") String id, @QueryParam("type") S

Dataset ds = findDatasetOrDie(id);
if (updateCurrent) {

/*
* Note: The code here mirrors that in the
* edu.harvard.iq.dataverse.DatasetPage:updateCurrentVersion method. Any changes
* to the core logic (i.e. beyond updating the messaging about results) should
* be applied to the code there as well.
*/
String errorMsg = null;
String successMsg = null;
try {
@@ -20,19 +20,19 @@ public ArchiverUtil() {
}

public static AbstractSubmitToArchiveCommand createSubmitToArchiveCommand(String className, DataverseRequest dvr, DatasetVersion version) {

try {
Class<?> clazz = Class.forName(className);
if (AbstractSubmitToArchiveCommand.class.isAssignableFrom(clazz)) {
Constructor<?> ctor;
ctor = clazz.getConstructor(DataverseRequest.class, DatasetVersion.class);
return (AbstractSubmitToArchiveCommand) ctor.newInstance(new Object[] { dvr, version });
if (className != null) {
try {
Class<?> clazz = Class.forName(className);
if (AbstractSubmitToArchiveCommand.class.isAssignableFrom(clazz)) {
Constructor<?> ctor;
ctor = clazz.getConstructor(DataverseRequest.class, DatasetVersion.class);
return (AbstractSubmitToArchiveCommand) ctor.newInstance(new Object[] { dvr, version });
}
} catch (Exception e) {
logger.warning("Unable to instantiate an Archiver of class: " + className);
e.printStackTrace();
}
} catch (Exception e) {
logger.warning("Unable to instantiate an Archiver of class: " + className);
e.printStackTrace();
}

return null;
}
}

0 comments on commit c83ca23

Please sign in to comment.
You can’t perform that action at this time.