Skip to content

Commit

Permalink
Merge pull request #4187 from IQSS/develop
Browse files Browse the repository at this point in the history
v4.8.1
  • Loading branch information
kcondon authored Oct 10, 2017
2 parents 896714e + 6b488e3 commit e2682d1
Show file tree
Hide file tree
Showing 10 changed files with 325 additions and 285 deletions.
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.8'
version = '4.8.1'
# The full version, including alpha/beta/rc tags.
release = '4.8'
release = '4.8.1'

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

These guides are for the most recent version of Dataverse. For the guides for **version 4.7.1** please go `here <http://guides.dataverse.org/en/4.7.1/>`_.
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.8</version>
<version>4.8.1</version>
<packaging>war</packaging>

<name>dataverse</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ notification.email.verifyEmail.subject={0}: Verify your email address
notification.email.greeting=Hello, \n
# Bundle file editors, please note that "notification.email.welcome" is used in a unit test
notification.email.welcome=Welcome to {0}! Get started by adding or finding data. Have questions? Check out the User Guide at {1}/{2}/user or contact {3} at {4} for assistance.
notification.email.welcomeConfirmEmailAddOn=\n\nPlease verify your email address at {0}. Note, the verify link will expire after {1}. Send another verification email by visiting your account page.
notification.email.welcomeConfirmEmailAddOn=\n\nPlease verify your email address at {0} . Note, the verify link will expire after {1}. Send another verification email by visiting your account page.
notification.email.requestFileAccess=File access requested for dataset: {0}. Manage permissions at {1}.
notification.email.grantFileAccess=Access granted for files in dataset: {0} (view at {1}).
notification.email.rejectFileAccess=Your request for access was rejected for the requested files in the dataset: {0} (view at {1}). If you have any questions about why your request was rejected, you may reach the dataset owner using the "Contact" link on the upper right corner of the dataset page.
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/edu/harvard/iq/dataverse/DataFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -949,15 +949,6 @@ public String getCreateDateFormattedYYYYMMDD() {
return null;
}


public String getThumbnailString() {
DatasetThumbnail datasetThumbnail = FileUtil.getThumbnail(this);
if (datasetThumbnail == null) {
return null;
}
return datasetThumbnail.getBase64image();
}


} // end of class

Expand Down
88 changes: 50 additions & 38 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
Expand Down Expand Up @@ -82,10 +80,7 @@
import edu.harvard.iq.dataverse.datasetutility.TwoRavensHelper;
import edu.harvard.iq.dataverse.datasetutility.WorldMapPermissionHelper;
import edu.harvard.iq.dataverse.engine.command.impl.RequestRsyncScriptCommand;
import edu.harvard.iq.dataverse.engine.command.DataverseRequest;
import edu.harvard.iq.dataverse.engine.command.impl.AddLockCommand;
import edu.harvard.iq.dataverse.engine.command.impl.PublishDatasetResult;
import edu.harvard.iq.dataverse.engine.command.impl.RemoveLockCommand;
import edu.harvard.iq.dataverse.engine.command.impl.RestrictFileCommand;
import edu.harvard.iq.dataverse.engine.command.impl.ReturnDatasetToAuthorCommand;
import edu.harvard.iq.dataverse.engine.command.impl.SubmitDatasetForReviewCommand;
Expand Down Expand Up @@ -286,7 +281,7 @@ public String getRsyncScriptFilename() {
public String getThumbnailString() {
// This method gets called 30 (!) times, just to load the page!
// - so let's cache that string the first time it's called.

if (thumbnailString != null) {
if ("".equals(thumbnailString)) {
return null;
Expand Down Expand Up @@ -439,19 +434,9 @@ public void setDataverseSiteUrl(String dataverseSiteUrl) {
this.dataverseSiteUrl = dataverseSiteUrl;
}

public List<FileMetadata> getDatasetFileMetadatas() {
Long datasetVersion = workingVersion.getId();
if (datasetVersion != null) {
int unlimited = 0;
int maxResults = unlimited;
return datafileService.findFileMetadataByDatasetVersionId(datasetVersion, maxResults, fileSortField, fileSortOrder);
}
return null;
}

public DataFile getInitialDataFile() {
if (getDatasetFileMetadatas() != null && getDatasetFileMetadatas().size() > 0) {
return getDatasetFileMetadatas().get(0).getDataFile();
if (workingVersion.getFileMetadatas() != null && workingVersion.getFileMetadatas().size() > 0) {
return workingVersion.getFileMetadatas().get(0).getDataFile();
}
return null;
}
Expand Down Expand Up @@ -488,10 +473,10 @@ public void setSwiftContainerName(String name){

}
//This function applies to an entire dataset
public boolean isSwiftStorage() {
private boolean isSwiftStorage() {
//containers without datafiles will not be stored in swift storage
if (getInitialDataFile() != null){
for (FileMetadata fmd : getDatasetFileMetadatas()) {
for (FileMetadata fmd : workingVersion.getFileMetadatas()) {
//if any of the datafiles are stored in swift
if (fmd.getDataFile().getStorageIdentifier().startsWith("swift://")) {
return true;
Expand All @@ -502,31 +487,51 @@ public boolean isSwiftStorage() {
}

//This function applies to a single datafile
public boolean isSwiftStorage(FileMetadata metadata){
private boolean isSwiftStorage(FileMetadata metadata){
if (metadata.getDataFile().getStorageIdentifier().startsWith("swift://")) {
return true;
}
return false;
}


private Boolean showComputeButtonForDataset = null;
//This function applies to an entire dataset
public boolean showComputeButton() {
if (showComputeButtonForDataset != null) {
return showComputeButtonForDataset;
}

if (isSwiftStorage() && (settingsService.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) != null)) {
return true;
showComputeButtonForDataset = true;
} else {
showComputeButtonForDataset = false;
}
return false;
return showComputeButtonForDataset;
}

private Map<Long, Boolean> showComputeButtonForFile = new HashMap<>();
//this function applies to a single datafile
public boolean showComputeButton(FileMetadata metadata) {
if (isSwiftStorage(metadata) && (settingsService.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) != null)) {
return true;
Long fileId = metadata.getDataFile().getId();

if (fileId == null) {
return false;
}
return false;

if (showComputeButtonForFile.containsKey(fileId)) {
return showComputeButtonForFile.get(fileId);
}

boolean result = isSwiftStorage(metadata)
&& settingsService.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) != null;

showComputeButtonForFile.put(fileId, result);
return result;
}

public boolean canDownloadAllFiles(){
for (FileMetadata fmd : getDatasetFileMetadatas()) {
for (FileMetadata fmd : workingVersion.getFileMetadatas()) {
if (!fileDownloadHelper.canDownloadFile(fmd)) {
return false;
}
Expand All @@ -548,8 +553,8 @@ public String getComputeUrl() throws IOException {
SwiftAccessIO swiftObject = getSwiftObject();
if (swiftObject != null) {
swiftObject.open();
if (settingsService.isTrueForKey(SettingsServiceBean.Key.PublicInstall, false)) {
return settingsService.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) + "?containerName=" + swiftObject.getSwiftContainerName();
if (settingsWrapper.isTrueForKey(SettingsServiceBean.Key.PublicInstall, false)) {
return settingsWrapper.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) + "?containerName=" + swiftObject.getSwiftContainerName();
}
//assuming we are able to get a temp url for a dataset
return settingsWrapper.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) + "?containerName=" + swiftObject.getSwiftContainerName() + "&temp_url_sig=" + swiftObject.getTempUrlSignature() + "&temp_url_expires=" + swiftObject.getTempUrlExpiry();
Expand All @@ -571,8 +576,8 @@ public String getComputeUrl(FileMetadata metadata) {
} catch (IOException e) {
logger.info("DatasetPage: Failed to get storageIO");
}
if (settingsService.isTrueForKey(SettingsServiceBean.Key.PublicInstall, false)) {
return settingsService.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) + "?containerName=" + swiftObject.getSwiftContainerName() + "&objectName=" + swiftObject.getSwiftFileName();
if (settingsWrapper.isTrueForKey(SettingsServiceBean.Key.PublicInstall, false)) {
return settingsWrapper.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) + "?containerName=" + swiftObject.getSwiftContainerName() + "&objectName=" + swiftObject.getSwiftFileName();
}

return settingsWrapper.getValueForKey(SettingsServiceBean.Key.ComputeBaseUrl) + "?containerName=" + swiftObject.getSwiftContainerName() + "&objectName=" + swiftObject.getSwiftFileName() + "&temp_url_sig=" + swiftObject.getTempUrlSignature() + "&temp_url_expires=" + swiftObject.getTempUrlExpiry();
Expand Down Expand Up @@ -700,9 +705,8 @@ public boolean isThumbnailAvailable(FileMetadata fileMetadata) {

// new and optimized logic:
// - check download permission here (should be cached - so it's free!)
// - only then ask the file service if the thumbnail is available/exists.
// the service itself no longer checks download permissions.
// plus, cache the results!
// - only then check if the thumbnail is available/exists.
// then cache the results!

Long dataFileId = fileMetadata.getDataFile().getId();

Expand Down Expand Up @@ -1416,7 +1420,7 @@ private String init(boolean initFull) {
this.loadMapLayerMetadataLookup(); // A DataFile may have a related MapLayerMetadata object
this.guestbookResponse = guestbookResponseService.initGuestbookResponseForFragment(dataset, null, session);
logger.fine("Checking if rsync support is enabled.");
if (DataCaptureModuleUtil.rsyncSupportEnabled(settingsService.getValueForKey(SettingsServiceBean.Key.UploadMethods))) {
if (DataCaptureModuleUtil.rsyncSupportEnabled(settingsWrapper.getValueForKey(SettingsServiceBean.Key.UploadMethods))) {
try {
ScriptRequestResponse scriptRequestResponse = commandEngine.submit(new RequestRsyncScriptCommand(dvRequestService.getDataverseRequest(), dataset));
logger.fine("script: " + scriptRequestResponse.getScript());
Expand Down Expand Up @@ -1472,7 +1476,7 @@ private String init(boolean initFull) {
updateDatasetFieldInputLevels();
}

if (settingsService.isTrueForKey(SettingsServiceBean.Key.PublicInstall, false)){
if (settingsWrapper.isTrueForKey(SettingsServiceBean.Key.PublicInstall, false)){
JH.addMessage(FacesMessage.SEVERITY_WARN, BundleUtil.getStringFromBundle("dataset.message.publicInstall"));
}

Expand All @@ -1482,7 +1486,7 @@ private String init(boolean initFull) {
} else {
return permissionsWrapper.notFound();
}
try {
try {
privateUrl = commandEngine.submit(new GetPrivateUrlCommand(dvRequestService.getDataverseRequest(), dataset));
if (privateUrl != null) {
JH.addMessage(FacesMessage.SEVERITY_INFO, BundleUtil.getStringFromBundle("dataset.privateurl.infoMessageAuthor", Arrays.asList(getPrivateUrlLink(privateUrl))));
Expand Down Expand Up @@ -3516,13 +3520,21 @@ public void saveAdvancedOptions() {
fileMetadataSelectedForIngestOptionsPopup = null;
}

private Boolean downloadButtonAvailable = null;

public boolean isDownloadButtonAvailable(){

if (downloadButtonAvailable != null) {
return downloadButtonAvailable;
}

for (FileMetadata fmd : workingVersion.getFileMetadatas()) {
if (this.fileDownloadHelper.canDownloadFile(fmd)) {
downloadButtonAvailable = true;
return true;
}
}
downloadButtonAvailable = false;
return false;
}

Expand Down Expand Up @@ -3968,7 +3980,7 @@ public String finishRsyncScriptAction() {
*
*/
public List<DatasetField> getDatasetSummaryFields() {
customFields = settingsService.getValueForKey(SettingsServiceBean.Key.CustomDatasetSummaryFields);
customFields = settingsWrapper.getValueForKey(SettingsServiceBean.Key.CustomDatasetSummaryFields);

return DatasetUtil.getDatasetSummaryFields(workingVersion, customFields);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class HarvestingServer extends AbstractApiBean {
// TODO: this should be available to admin only.

@GET
@Path("")
@Path("/")
public Response oaiSets(@QueryParam("key") String apiKey) throws IOException {


Expand Down
Loading

0 comments on commit e2682d1

Please sign in to comment.