Skip to content

Commit 686a368

Browse files
committed
In DismissPublicationSuggestionAction's confirm view, if there is an exception fetching the citation from NCBI, display the publication Id label instead.
1 parent d647fdb commit 686a368

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicController.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10679,6 +10679,7 @@ protected String getConfirmViewTitle()
1067910679
@Override
1068010680
protected Renderable getConfirmViewMessage()
1068110681
{
10682+
fetchCitation();
1068210683
String publicationRef = _publicationMatch.getCitation() != null
1068310684
? _publicationMatch.getCitation()
1068410685
: _publicationMatch.getPublicationIdLabel();
@@ -10704,13 +10705,24 @@ else if (_datasetStatus.getUserDismissedPublication() != null)
1070410705
errors.reject(ERROR_MSG, "The publication suggestion for the data with short URL " + _exptAnnotations.getShortUrl().renderShortURL()
1070510706
+ " has already been dismissed");
1070610707
}
10707-
else
10708+
}
10709+
10710+
// Fetch the citation from NCBI. If NCBI is unavailable, the publication ID label will be used as a fallback.
10711+
private void fetchCitation()
10712+
{
10713+
if (_publicationMatch != null && _publicationMatch.getCitation() == null)
1070810714
{
10709-
// Fetch the citation from NCBI. If we cannot retrieve it, the publication ID will be used as a fallback.
10710-
String citation = NcbiPublicationSearchService.get().getCitation(_publicationMatch.getPublicationId(), _publicationMatch.getPublicationType());
10711-
if (!StringUtils.isBlank(citation))
10715+
try
10716+
{
10717+
String citation = NcbiPublicationSearchService.get().getCitation(_publicationMatch.getPublicationId(), _publicationMatch.getPublicationType());
10718+
if (!StringUtils.isBlank(citation))
10719+
{
10720+
_publicationMatch.setCitation(citation);
10721+
}
10722+
}
10723+
catch (Exception e)
1071210724
{
10713-
_publicationMatch.setCitation(citation);
10725+
LOG.warn("Failed to fetch citation for " + _publicationMatch.getPublicationIdLabel() + ": " + e.getMessage());
1071410726
}
1071510727
}
1071610728
}
@@ -10724,6 +10736,7 @@ protected void updateDatasetStatus(DatasetStatus datasetStatus)
1072410736
@Override
1072510737
protected void postNotification()
1072610738
{
10739+
fetchCitation();
1072710740
// Post a message to the support thread.
1072810741
JournalSubmission submission = SubmissionManager.getSubmissionForExperiment(_exptAnnotations);
1072910742
Journal journal = JournalManager.getJournal(submission.getJournalId());

0 commit comments

Comments
 (0)