Skip to content

Commit

Permalink
ldjson should will only be embedded into the page if this is the LATE…
Browse files Browse the repository at this point in the history
…ST PUBLISHED version (IQSS#2243)
  • Loading branch information
landreev committed Nov 17, 2017
1 parent a2742c5 commit 0801d56
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import java.util.logging.Level;
import edu.harvard.iq.dataverse.datasetutility.TwoRavensHelper;
import edu.harvard.iq.dataverse.datasetutility.WorldMapPermissionHelper;
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 @@ -3957,8 +3958,37 @@ 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() {
return workingVersion.getJsonLd();
if (isThisLatestReleasedVersion()) {
return workingVersion.getJsonLd();
}
return "";
}
}

0 comments on commit 0801d56

Please sign in to comment.