Skip to content

Commit

Permalink
intermediate changes for the adjusted citation date. #9763
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Aug 31, 2023
1 parent ccd6b7d commit 2d27c03
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ public void setCitationDateDatasetFieldType(DatasetFieldType citationDateDataset
this.citationDateDatasetFieldType = citationDateDatasetFieldType;
}

// Per DataCite best practices, the citation date of a dataset may need
// to be adjusted to reflect the latest embargo availability date of any
// file within the first published version.
// If any files are embargoed in the first version, we will find calculate
// the date and cache it here.
private Timestamp embargoCitationDate;

public Timestamp getEmbargoCitationDate() {
return embargoCitationDate;
}

public void setEmbargoCitationDate(Timestamp embargoCitationDate) {
this.embargoCitationDate = embargoCitationDate;
}



@ManyToOne
@JoinColumn(name="template_id",nullable = true)
Expand Down Expand Up @@ -680,6 +696,11 @@ public Timestamp getCitationDate() {
// TODo - is this ever not version 1.0 (or draft if not published yet)
//DatasetVersion oldest = versions.get(versions.size() - 1);
citationDate = super.getPublicationDate();
if (embargoCitationDate != null) {
if (citationDate.compareTo(embargoCitationDate) < 0) {
return embargoCitationDate;
}
}
/*if (oldest.isPublished()) {
List<FileMetadata> fms = oldest.getFileMetadatas();
for (FileMetadata fm : fms) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ public List<FileMetadata> getFileMetadatas(DatasetVersion datasetVersion, Intege
.setHint("eclipselink.left-join-fetch", "fm.dataFile.embargo")
.setHint("eclipselink.left-join-fetch", "fm.datasetVersion")
.setHint("eclipselink.left-join-fetch", "fm.dataFile.releaseUser")
.setHint("eclipselink.left-join-fetch", "fm.dataFile.dataFileTags")
.setHint("eclipselink.left-join-fetch", "fm.dataFile.creator");
} else {
// @todo: is there really no way to use offset-limit with left join hints?
Expand Down

0 comments on commit 2d27c03

Please sign in to comment.