Skip to content

Commit

Permalink
add caching for showQueryButton
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Aug 4, 2023
1 parent 1753e9e commit 5528add
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -5531,15 +5531,21 @@ public boolean isShowPreviewButton(Long fileId) {
return previewTools.size() > 0;
}

public boolean isShowQueryButton(Long fileId) {
DataFile dataFile = datafileService.find(fileId);
Boolean showQueryButton = null;

if(dataFile.isRestricted() || !dataFile.isReleased() || FileUtil.isActivelyEmbargoed(dataFile)){
return false;
public boolean isShowQueryButton(Long fileId) {
if (showQueryButton == null) {
DataFile dataFile = datafileService.find(fileId);

if (dataFile.isRestricted() || !dataFile.isReleased() || FileUtil.isActivelyEmbargoed(dataFile)) {
showQueryButton = false;
} else {

List<ExternalTool> fileQueryTools = getQueryToolsForDataFile(fileId);
showQueryButton = fileQueryTools.size() > 0;
}
}

List<ExternalTool> fileQueryTools = getQueryToolsForDataFile(fileId);
return fileQueryTools.size() > 0;
return showQueryButton;
}

public List<ExternalTool> getPreviewToolsForDataFile(Long fileId) {
Expand Down

0 comments on commit 5528add

Please sign in to comment.