Skip to content

Commit

Permalink
simplifying the JSF
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Mar 27, 2024
1 parent 83ab52a commit f3f538b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
22 changes: 16 additions & 6 deletions src/main/java/edu/harvard/iq/dataverse/FilePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1372,15 +1372,19 @@ public boolean isCantRequestDueToEmbargo() {

public String getEmbargoPhrase() {
//Should only be getting called when there is an embargo
StringBuilder sb = new StringBuilder();
if(file.isReleased()) {
if(FileUtil.isActivelyEmbargoed(file)) {
return BundleUtil.getStringFromBundle("embargoed.until");
sb.append(BundleUtil.getStringFromBundle("embargoed.until"));
} else {
return BundleUtil.getStringFromBundle("embargoed.wasthrough");
sb.append(BundleUtil.getStringFromBundle("embargoed.wasthrough"));
}
} else {
return BundleUtil.getStringFromBundle("embargoed.willbeuntil");
sb.append(BundleUtil.getStringFromBundle("embargoed.willbeuntil"));
}
sb.append(" ");
sb.append(file.getEmbargo().getFormattedDateAvailable());
return sb.toString();
}

public boolean isValidRetentionSelection() {
Expand Down Expand Up @@ -1494,15 +1498,21 @@ public boolean isCantRequestDueToRetention() {

public String getRetentionPhrase() {
//Should only be getting called when there is a retention
StringBuilder sb = new StringBuilder();
if(file.isReleased()) {
if(FileUtil.isRetentionExpired(file)) {
return BundleUtil.getStringFromBundle("retention.after");
sb.append(BundleUtil.getStringFromBundle("retention.after"));
} else {
return BundleUtil.getStringFromBundle("retention.isfrom");
sb.append(BundleUtil.getStringFromBundle("retention.isfrom"));
}
} else {
return BundleUtil.getStringFromBundle("retention.willbeafter");
sb.append(BundleUtil.getStringFromBundle("retention.willbeafter"));
}
sb.append(" ");
sb.append(file.getRetention().getFormattedDateUnavailable());
sb.append(", ");
sb.append(BundleUtil.getStringFromBundle("retention.enddateinfo"));
return sb.toString();
}

public String getToolTabTitle(){
Expand Down
6 changes: 2 additions & 4 deletions src/main/webapp/file.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,9 @@
<th scope="row">
#{bundle['file.metadataTab.fileMetadata.publicationDate.label']}
</th>
<td>#{!(empty FilePage.file.embargo) ? FilePage.embargoPhrase: ''} #{!(empty FilePage.file.embargo) ? FilePage.file.embargo.dateAvailable : ''}
<td>#{!(empty FilePage.file.embargo) ? FilePage.embargoPhrase: ''}
#{!(empty FilePage.file.embargo) and !(empty FilePage.file.retention) ? '; ': ''}
#{!(empty FilePage.file.retention) ? FilePage.retentionPhrase: ''} #{!(empty FilePage.file.retention) ? FilePage.file.retention.dateUnavailable: ''}
#{!(empty FilePage.file.retention) ? ', ': ''}
#{!(empty FilePage.file.retention) ? bundle['retention.enddateinfo']: ''}
#{!(empty FilePage.file.retention) ? FilePage.retentionPhrase: ''}
#{(empty FilePage.file.embargo and empty FilePage.file.retention)? FilePage.file.publicationDateFormattedYYYYMMDD : ''}
</td>
</tr>
Expand Down

0 comments on commit f3f538b

Please sign in to comment.