Skip to content
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
85 changes: 85 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!groovy

node {
workspace = pwd()
properties([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [
[ name: 'app', $class: 'StringParameterDefinition', defaultValue: "dataverse" ],
[ name: 'branch', $class: 'StringParameterDefinition', defaultValue: "${env.JOB_BASE_NAME}" ],
[ name: 'deployenv', $class: 'StringParameterDefinition', defaultValue: 'dev-aws' ],
[ name: 'deployuser', $class: 'StringParameterDefinition', defaultValue: 'jenkins' ]
]]])

stage('Init') {
/*
* Checkout code
*/
checkout scm
currentBuild.result = 'SUCCESS'
//sh(script:"curl -X POST http://graphite.int.qdr.org:81/events/ -d '{\"what\": \"deploy ${app}/${branch} to ${deployenv}\", \"tags\" : \"deployment\"}'")
}

stage('Test') {
/*
* Run Unit tests
*/
notifyBuild("Running Tests", "good")

try {
withMaven(
jdk: 'jdk8',
maven: 'mvn-3-5-0') {
sh "mvn test"
}
}
catch (e) {
currentBuild.result = "UNSTABLE"
notifyBuild("Warning: Tests Failed!", "warning")
}
}

stage('Build') {
/*
* Run Unit tests
*/
notifyBuild("Building", "good")

try {
withMaven(
jdk: 'jdk8',
maven: 'mvn-3-5-0') {
sh "mvn clean package -DskipTests"
}
}
catch (e) {
currentBuild.result = "FAILURE"
notifyBuild("Warning: Build failed!", "warning")
}

stash includes: 'target/dataverse*.war', name: 'dataverse-war'
}

stage('Deploy') {
/*
* Deploy
*/
unstash 'dataverse-war'

timeout(time: 2, unit: "HOURS") {
input message: 'Deploy to', parameters: [string(defaultValue: 'dev', description: '', name: 'deploy-to')]
try {
sh "rsync -av target qdradmin@qdr-dev-ec2-01.int.qdr.org:"
}
catch (e) {
currentBuild.result = "FAILURE"
notifyBuild("Deploying ${app} to ${deploy-to} Failed! <$BUILD_URL/console|(See Logs)>", "danger")
throw e
}
}
}
}


@NonCPS
def notifyBuild(String message, String color) {
slackSend message: "<$JOB_URL|$JOB_NAME>: ${message}", color: "${color}"
}
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
# built documents.
#
# The short X.Y version.
version = '4.6.1'
version = '4.6.2'
# The full version, including alpha/beta/rc tags.
release = '4.6.1'
release = '4.6.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Dataverse 4.6.1 Guides
Dataverse 4.6.2 Guides
======================

These guides are for the most recent version of Dataverse. For the guides for **version 4.6** please go `here <http://guides.dataverse.org/en/4.6/>`_.
These guides are for the most recent version of Dataverse. For the guides for **version 4.6.1** please go `here <http://guides.dataverse.org/en/4.6.1/>`_.

.. toctree::
:glob:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>edu.harvard.iq</groupId>
<artifactId>dataverse</artifactId>
<version>4.6.1</version>
<version>4.6.2</version>
<packaging>war</packaging>

<name>dataverse</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ public Long getThumbnailByVersionId(Long versionId) {
+ "AND df.id = o.id "
+ "AND fm.datasetversion_id = dv.id "
+ "AND fm.datafile_id = df.id "
+ "AND df.restricted = false "
+ "AND o.previewImageAvailable = true "
+ "ORDER BY df.id LIMIT 1;").getSingleResult();
} catch (Exception ex) {
Expand All @@ -727,6 +728,7 @@ public Long getThumbnailByVersionId(Long versionId) {
+ "AND fm.datasetversion_id = dv.id "
+ "AND fm.datafile_id = df.id "
// + "AND o.previewImageAvailable = false "
+ "AND df.restricted = false "
+ "AND df.contenttype LIKE 'image/%' "
+ "AND NOT df.contenttype = 'image/fits' "
+ "AND df.filesize < " + imageThumbnailSizeLimit + " "
Expand Down Expand Up @@ -759,6 +761,7 @@ public Long getThumbnailByVersionId(Long versionId) {
+ "AND fm.datasetversion_id = dv.id "
+ "AND fm.datafile_id = df.id "
// + "AND o.previewImageAvailable = false "
+ "AND df.restricted = false "
+ "AND df.contenttype = 'application/pdf' "
+ "AND df.filesize < " + imageThumbnailSizeLimit + " "
+ "ORDER BY df.filesize ASC LIMIT 1;").getSingleResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,33 +177,55 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
if (dataFile.getFileMetadata() != null && dataFile.getFileMetadata().getDatasetVersion().equals(theDataset.getLatestVersion())) {
dataFile.setRestricted(dataFile.getFileMetadata().isRestricted());
}
if (dataFile.isRestricted() && ctxt.mapLayerMetadata().findMetadataByDatafile(dataFile) != null){
// (We need an AuthenticatedUser in order to produce a WorldMap token!)
String id = getUser().getIdentifier();
id = id.startsWith("@") ? id.substring(1) : id;
AuthenticatedUser authenticatedUser = ctxt.authentication().getAuthenticatedUser(id);
try {
logger.fine("(1 of 2) PublishDatasetCommand: delete MapLayer From *WorldMap*");
ctxt.mapLayerMetadata().deleteMapLayerFromWorldMap(dataFile, authenticatedUser);

// If that was successful, delete the layer on the Dataverse side as well:
//SEK 4/20/2017
//Command to delete from Dataverse side
logger.fine("(2 of 2) PublishDatasetCommand: Delete MapLayerMetadata From *Dataverse*");
boolean deleteMapSuccess = ctxt.engine().submit(new DeleteMapLayerMetadataCommand(this.getRequest(), dataFile));

// RP - Bit of hack, update the datafile here b/c the reference to the datafile
// is not being passed all the way up/down the chain.
//
dataFile.setPreviewImageAvailable(false);

} catch (IOException ioex) {
// We are not going to treat it as a fatal condition and bail out,
// but we will send a notification to the user, warning them about
// the layer still being out there, un-deleted:
ctxt.notifications().sendNotification(authenticatedUser, new Timestamp(new Date().getTime()), UserNotification.Type.MAPLAYERDELETEFAILED, dataFile.getFileMetadata().getId());


if (dataFile.isRestricted()) {
// A couple things need to happen if the file has been restricted:
// 1. If there's a map layer associated with this shape file, or
// tabular-with-geo-tag file, all that map layer data (that
// includes most of the actual data in the file!) need to be
// removed from WorldMap and GeoConnect, since anyone can get
// download the data from there;
// 2. If this (image) file has been assigned as the dedicated
// thumbnail for the dataset, we need to remove that assignment,
// now that the file is restricted.

// Map layer:

if (ctxt.mapLayerMetadata().findMetadataByDatafile(dataFile) != null) {
// (We need an AuthenticatedUser in order to produce a WorldMap token!)
String id = getUser().getIdentifier();
id = id.startsWith("@") ? id.substring(1) : id;
AuthenticatedUser authenticatedUser = ctxt.authentication().getAuthenticatedUser(id);
try {
logger.fine("(1 of 2) PublishDatasetCommand: delete MapLayer From *WorldMap*");
ctxt.mapLayerMetadata().deleteMapLayerFromWorldMap(dataFile, authenticatedUser);

// If that was successful, delete the layer on the Dataverse side as well:
//SEK 4/20/2017
//Command to delete from Dataverse side
logger.fine("(2 of 2) PublishDatasetCommand: Delete MapLayerMetadata From *Dataverse*");
boolean deleteMapSuccess = ctxt.engine().submit(new DeleteMapLayerMetadataCommand(this.getRequest(), dataFile));

// RP - Bit of hack, update the datafile here b/c the reference to the datafile
// is not being passed all the way up/down the chain.
//
dataFile.setPreviewImageAvailable(false);

} catch (IOException ioex) {
// We are not going to treat it as a fatal condition and bail out,
// but we will send a notification to the user, warning them about
// the layer still being out there, un-deleted:
ctxt.notifications().sendNotification(authenticatedUser, new Timestamp(new Date().getTime()), UserNotification.Type.MAPLAYERDELETEFAILED, dataFile.getFileMetadata().getId());
}

}

// Dataset thumbnail assignment:

if (dataFile.equals(theDataset.getThumbnailFile())) {
theDataset.setThumbnailFile(null);
}

}
}

Expand Down