|
183 | 183 | import org.labkey.panoramapublic.proteomexchange.ChemElement; |
184 | 184 | import org.labkey.panoramapublic.proteomexchange.ExperimentModificationGetter; |
185 | 185 | import org.labkey.panoramapublic.proteomexchange.Formula; |
186 | | -import org.labkey.panoramapublic.ncbi.NcbiConstants; |
187 | 186 | import org.labkey.panoramapublic.ncbi.NcbiConstants.DB; |
188 | 187 | import org.labkey.panoramapublic.proteomexchange.NcbiUtils; |
189 | 188 | import org.labkey.panoramapublic.proteomexchange.ProteomeXchangeService; |
@@ -10458,7 +10457,7 @@ public abstract static class UpdateDatasetStatusAction extends ConfirmAction<Sho |
10458 | 10457 | protected abstract void updateDatasetStatus(DatasetStatus datasetStatus); |
10459 | 10458 | protected abstract void postNotification(); |
10460 | 10459 | protected abstract String getConfirmViewTitle(); |
10461 | | - protected abstract String getConfirmViewMessage(); |
| 10460 | + protected abstract HtmlString getConfirmViewMessage(); |
10462 | 10461 |
|
10463 | 10462 | @Override |
10464 | 10463 | public ModelAndView getConfirmView(ShortUrlForm shortUrlForm, BindException errors) throws Exception |
@@ -10535,9 +10534,9 @@ protected String getConfirmViewTitle() |
10535 | 10534 | } |
10536 | 10535 |
|
10537 | 10536 | @Override |
10538 | | - protected String getConfirmViewMessage() |
| 10537 | + protected HtmlString getConfirmViewMessage() |
10539 | 10538 | { |
10540 | | - return "You are requesting an extension for the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL(); |
| 10539 | + return HtmlString.of("You are requesting an extension for the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL()); |
10541 | 10540 | } |
10542 | 10541 |
|
10543 | 10542 | @Override |
@@ -10599,9 +10598,9 @@ protected String getConfirmViewTitle() |
10599 | 10598 | } |
10600 | 10599 |
|
10601 | 10600 | @Override |
10602 | | - protected String getConfirmViewMessage() |
| 10601 | + protected HtmlString getConfirmViewMessage() |
10603 | 10602 | { |
10604 | | - return "You are requesting deletion of the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL(); |
| 10603 | + return HtmlString.of("You are requesting deletion of the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL()); |
10605 | 10604 | } |
10606 | 10605 |
|
10607 | 10606 | @Override |
@@ -10657,15 +10656,15 @@ protected String getConfirmViewTitle() |
10657 | 10656 | } |
10658 | 10657 |
|
10659 | 10658 | @Override |
10660 | | - protected String getConfirmViewMessage() |
| 10659 | + protected HtmlString getConfirmViewMessage() |
10661 | 10660 | { |
10662 | 10661 | String publicationRef = _publicationMatch.getCitation() != null |
10663 | 10662 | ? _publicationMatch.getCitation() |
10664 | | - : _publicationMatch.getPublicationLabel(); |
10665 | | - return "You are dismissing the publication suggestion for your data on Panorama Public at " |
| 10663 | + : _publicationMatch.getPublicationIdLabel(); |
| 10664 | + return HtmlString.of("You are dismissing the publication suggestion for your data on Panorama Public at " |
10666 | 10665 | + _exptAnnotations.getShortUrl().renderShortURL() + |
10667 | | - ". We will no longer suggest the following publication for this dataset - " |
10668 | | - + "\n\n" + publicationRef; |
| 10666 | + ". We will no longer suggest the following publication for this dataset - " + |
| 10667 | + HtmlString.BR + publicationRef); |
10669 | 10668 | } |
10670 | 10669 |
|
10671 | 10670 | @Override |
@@ -10930,7 +10929,7 @@ public boolean handlePost(NotifySubmitterForm form, BindException errors) throws |
10930 | 10929 | && form.getPublicationId().equals(datasetStatus.getPotentialPublicationId())) |
10931 | 10930 | { |
10932 | 10931 | errors.reject(ERROR_MSG, "The user has already dismissed the publication suggestion " |
10933 | | - + datasetStatus.getPublicationLabel() + " " + datasetStatus.getPotentialPublicationId() |
| 10932 | + + datasetStatus.getPublicationIdLabel() |
10934 | 10933 | + " for this dataset."); |
10935 | 10934 | return false; |
10936 | 10935 | } |
@@ -11186,49 +11185,94 @@ public static ActionURL getCatalogImageDownloadUrl(ExperimentAnnotations expAnno |
11186 | 11185 | .addParameter("name", filename); |
11187 | 11186 | } |
11188 | 11187 |
|
11189 | | - // ======================== Test support actions for Selenium tests ======================== |
| 11188 | + // ======================== Support actions for Selenium tests ======================== |
11190 | 11189 |
|
11191 | 11190 | @RequiresSiteAdmin |
11192 | | - public static class SetupMockNcbiServiceAction extends ReadOnlyApiAction<SetupMockForm> |
| 11191 | + public static class SetupMockNcbiServiceAction extends ReadOnlyApiAction<Object> |
11193 | 11192 | { |
11194 | 11193 | @Override |
11195 | | - public Object execute(SetupMockForm form, BindException errors) |
| 11194 | + public Object execute(Object form, BindException errors) |
11196 | 11195 | { |
11197 | | - if (form.isCheckNcbiReachable() && NcbiPublicationSearchServiceImpl.isNcbiReachable()) |
11198 | | - { |
11199 | | - return new ApiSimpleResponse("mock", false); |
11200 | | - } |
11201 | 11196 | NcbiPublicationSearchServiceImpl.setInstance(new MockNcbiPublicationSearchService()); |
11202 | 11197 | return new ApiSimpleResponse("mock", true); |
11203 | 11198 | } |
11204 | 11199 | } |
11205 | 11200 |
|
11206 | | - public static class SetupMockForm |
| 11201 | + @RequiresSiteAdmin |
| 11202 | + public static class RestoreNcbiServiceAction extends ReadOnlyApiAction<Object> |
11207 | 11203 | { |
11208 | | - private boolean _checkNcbiReachable; |
11209 | | - |
11210 | | - public boolean isCheckNcbiReachable() |
11211 | | - { |
11212 | | - return _checkNcbiReachable; |
11213 | | - } |
11214 | | - |
11215 | | - public void setCheckNcbiReachable(boolean checkNcbiReachable) |
| 11204 | + @Override |
| 11205 | + public Object execute(Object form, BindException errors) |
11216 | 11206 | { |
11217 | | - _checkNcbiReachable = checkNcbiReachable; |
| 11207 | + NcbiPublicationSearchServiceImpl.setInstance(new NcbiPublicationSearchServiceImpl()); |
| 11208 | + return new ApiSimpleResponse("restored", true); |
11218 | 11209 | } |
11219 | 11210 | } |
11220 | 11211 |
|
11221 | 11212 | @RequiresSiteAdmin |
11222 | | - public static class RestoreNcbiServiceAction extends ReadOnlyApiAction<Object> |
| 11213 | + public static class RegisterMockPublicationAction extends ReadOnlyApiAction<RegisterMockPublicationForm> |
11223 | 11214 | { |
11224 | 11215 | @Override |
11225 | | - public Object execute(Object form, BindException errors) |
| 11216 | + public Object execute(RegisterMockPublicationForm form, BindException errors) |
11226 | 11217 | { |
11227 | | - NcbiPublicationSearchServiceImpl.setInstance(new NcbiPublicationSearchServiceImpl()); |
11228 | | - return new ApiSimpleResponse("restored", true); |
| 11218 | + NcbiPublicationSearchService service = NcbiPublicationSearchServiceImpl.getInstance(); |
| 11219 | + if (!(service instanceof MockNcbiPublicationSearchService mock)) |
| 11220 | + { |
| 11221 | + errors.reject(ERROR_MSG, "Mock NCBI service is not available. Call setupMockNcbiService first."); |
| 11222 | + return null; |
| 11223 | + } |
| 11224 | + mock.register(form.getDatabase(), form.getId(), form.getSearchKey(), |
| 11225 | + form.getPmid(), form.getTitle(), form.getAuthors(), |
| 11226 | + form.getPubDate(), form.getSource(), form.getJournalFull(), |
| 11227 | + form.getCitation()); |
| 11228 | + return new ApiSimpleResponse("registered", true); |
11229 | 11229 | } |
11230 | 11230 | } |
11231 | 11231 |
|
| 11232 | + public static class RegisterMockPublicationForm |
| 11233 | + { |
| 11234 | + private String _database; |
| 11235 | + private String _id; |
| 11236 | + private String _searchKey; |
| 11237 | + private String _pmid; |
| 11238 | + private String _title; |
| 11239 | + private String _authors; |
| 11240 | + private String _pubDate; |
| 11241 | + private String _source; |
| 11242 | + private String _journalFull; |
| 11243 | + private String _citation; |
| 11244 | + |
| 11245 | + public String getDatabase() { return _database; } |
| 11246 | + public void setDatabase(String database) { _database = database; } |
| 11247 | + |
| 11248 | + public String getId() { return _id; } |
| 11249 | + public void setId(String id) { _id = id; } |
| 11250 | + |
| 11251 | + public String getSearchKey() { return _searchKey; } |
| 11252 | + public void setSearchKey(String searchKey) { _searchKey = searchKey; } |
| 11253 | + |
| 11254 | + public String getPmid() { return _pmid; } |
| 11255 | + public void setPmid(String pmid) { _pmid = pmid; } |
| 11256 | + |
| 11257 | + public String getTitle() { return _title; } |
| 11258 | + public void setTitle(String title) { _title = title; } |
| 11259 | + |
| 11260 | + public String getAuthors() { return _authors; } |
| 11261 | + public void setAuthors(String authors) { _authors = authors; } |
| 11262 | + |
| 11263 | + public String getPubDate() { return _pubDate; } |
| 11264 | + public void setPubDate(String pubDate) { _pubDate = pubDate; } |
| 11265 | + |
| 11266 | + public String getSource() { return _source; } |
| 11267 | + public void setSource(String source) { _source = source; } |
| 11268 | + |
| 11269 | + public String getJournalFull() { return _journalFull; } |
| 11270 | + public void setJournalFull(String journalFull) { _journalFull = journalFull; } |
| 11271 | + |
| 11272 | + public String getCitation() { return _citation; } |
| 11273 | + public void setCitation(String citation) { _citation = citation; } |
| 11274 | + } |
| 11275 | + |
11232 | 11276 | public static class TestCase extends AbstractActionPermissionTest |
11233 | 11277 | { |
11234 | 11278 | @Override |
|
0 commit comments