Skip to content

Commit

Permalink
Merge branch 'develop' into 4197-dv-header IQSS#4197
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Nov 27, 2017
2 parents 36d9228 + caf6371 commit d8028f1
Show file tree
Hide file tree
Showing 16 changed files with 396 additions and 56 deletions.
3 changes: 2 additions & 1 deletion src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,8 @@ file.spss-savEncoding.current=Current Selection:
file.spss-porExtraLabels=Variable Labels
file.spss-porExtraLabels.title=Upload an additional text file with extra variable labels.
file.spss-porExtraLabels.selectToAddBtn=Select File to Add
file.ingestFailed=Tabular Data Ingest Failed
file.ingestFailed.header=Upload Completed with Errors
file.ingestFailed.message=Tabular data ingest failed.
file.explore.twoRavens=TwoRavens
file.map=Map
file.mapData=Map Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public String generateXML() {
if (author.getIdType() != null && author.getIdValue() != null && !author.getIdType().isEmpty() && !author.getIdValue().isEmpty() && author.getAffiliation() != null && !author.getAffiliation().getDisplayValue().isEmpty()) {

if (author.getIdType().equals("ORCID")) {
creatorsElement.append("<nameIdentifier schemeURI=\"http://orcid.org/\" nameIdentifierScheme=\"ORCID\">" + author.getIdValue() + "</nameIdentifier>");
creatorsElement.append("<nameIdentifier schemeURI=\"https://orcid.org/\" nameIdentifierScheme=\"ORCID\">" + author.getIdValue() + "</nameIdentifier>");
}
if (author.getIdType().equals("ISNI")) {
creatorsElement.append("<nameIdentifier schemeURI=\"http://isni.org/isni/\" nameIdentifierScheme=\"ISNI\">" + author.getIdValue() + "</nameIdentifier>");
Expand Down
60 changes: 33 additions & 27 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import edu.harvard.iq.dataverse.datasetutility.TwoRavensHelper;
import edu.harvard.iq.dataverse.datasetutility.WorldMapPermissionHelper;
import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException;
import edu.harvard.iq.dataverse.engine.command.impl.GetLatestPublishedDatasetVersionCommand;
import edu.harvard.iq.dataverse.engine.command.impl.RequestRsyncScriptCommand;
import edu.harvard.iq.dataverse.engine.command.impl.PublishDatasetResult;
import edu.harvard.iq.dataverse.engine.command.impl.RestrictFileCommand;
Expand Down Expand Up @@ -3944,23 +3945,6 @@ public String getDescription() {
return workingVersion.getDescriptionPlainText();
}

/**
* dataset publication date unpublished datasets will return an empty
* string.
*
* @return String dataset publication date (dd MMM yyyy).
*/
public String getPublicationDate() {
assert (null != workingVersion);
if (DatasetVersion.VersionState.DRAFT == workingVersion.getVersionState()) {
return "";
}
Date rel_date = workingVersion.getReleaseTime();
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
String r = fmt.format(rel_date.getTime());
return r;
}

/**
* dataset authors
*
Expand All @@ -3971,16 +3955,6 @@ public List<String> getDatasetAuthors() {
return workingVersion.getDatasetAuthorNames();
}

/**
* dataset subjects
*
* @return array of String containing the subjects for a page
*/
public List<String> getDatasetSubjects() {
assert (null != workingVersion);
return workingVersion.getDatasetSubjects();
}

/**
* publisher (aka - name of root dataverse)
*
Expand Down Expand Up @@ -4066,4 +4040,36 @@ public List<DatasetField> getDatasetSummaryFields() {
return DatasetUtil.getDatasetSummaryFields(workingVersion, customFields);
}

Boolean thisLatestReleasedVersion = null;

public boolean isThisLatestReleasedVersion() {
if (thisLatestReleasedVersion != null) {
return thisLatestReleasedVersion;
}

if (!workingVersion.isPublished()) {
thisLatestReleasedVersion = false;
return false;
}

DatasetVersion latestPublishedVersion = null;
Command<DatasetVersion> cmd = new GetLatestPublishedDatasetVersionCommand(dvRequestService.getDataverseRequest(), dataset);
try {
latestPublishedVersion = commandEngine.submit(cmd);
} catch (Exception ex) {
// whatever...
}

thisLatestReleasedVersion = workingVersion.equals(latestPublishedVersion);

return thisLatestReleasedVersion;

}

public String getJsonLd() {
if (isThisLatestReleasedVersion()) {
return workingVersion.getJsonLd();
}
return "";
}
}
Loading

0 comments on commit d8028f1

Please sign in to comment.