From: Jim Procter Date: Fri, 3 Sep 2021 16:01:04 +0000 (+0100) Subject: JAL-3865 isolate PDB and TDB clients and last query records in their query objects X-Git-Tag: Release_2_11_2_0~39^2~25 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d64daffb893f7efbf8e424e41f3ddb22f04ab121;p=jalview.git JAL-3865 isolate PDB and TDB clients and last query records in their query objects --- diff --git a/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java b/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java index 4dede2e..3d1b982 100644 --- a/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java +++ b/src/jalview/gui/structurechooser/PDBStructureChooserQuerySource.java @@ -37,6 +37,10 @@ public class PDBStructureChooserQuerySource private static int MAX_QLENGTH = 7820; + protected FTSRestRequest lastPdbRequest; + + protected FTSRestClientI pdbRestClient; + public PDBStructureChooserQuerySource() { pdbRestClient = PDBFTSRestClient.getInstance(); @@ -344,4 +348,11 @@ public class PDBStructureChooserQuerySource return pdbEntriesToView; } + + @Override + protected FTSRestRequest getLastFTSRequest() + { + return lastPdbRequest; + } + } \ No newline at end of file diff --git a/src/jalview/gui/structurechooser/StructureChooserQuerySource.java b/src/jalview/gui/structurechooser/StructureChooserQuerySource.java index 4faa2de..96b67e4 100644 --- a/src/jalview/gui/structurechooser/StructureChooserQuerySource.java +++ b/src/jalview/gui/structurechooser/StructureChooserQuerySource.java @@ -28,9 +28,6 @@ import jalview.jbgui.FilterOption; */ public abstract class StructureChooserQuerySource { - protected FTSRestRequest lastPdbRequest; - - protected FTSRestClientI pdbRestClient; protected FTSDataColumnPreferences docFieldPrefs; @@ -191,10 +188,12 @@ public abstract class StructureChooserQuerySource public TableModel getTableModel( Collection discoveredStructuresSet) { - return FTSRestResponse.getTableModel(lastPdbRequest, + return FTSRestResponse.getTableModel(getLastFTSRequest(), discoveredStructuresSet); } + protected abstract FTSRestRequest getLastFTSRequest(); + public abstract PDBEntry[] collectSelectedRows(JTable restable, int[] selectedRows, List selectedSeqsToView); diff --git a/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java b/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java index e188b23..0bf9fdb 100644 --- a/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java +++ b/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java @@ -14,6 +14,7 @@ import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.fts.api.FTSDataColumnI; +import jalview.fts.api.FTSRestClientI; import jalview.fts.core.FTSDataColumnPreferences; import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource; import jalview.fts.core.FTSRestRequest; @@ -23,7 +24,7 @@ import jalview.jbgui.FilterOption; import jalview.util.MessageManager; /** - * logic for querying the PDBe API for structures of sequences + * logic for querying the 3DBeacons API for structures of sequences * * @author jprocter */ @@ -33,9 +34,13 @@ public class ThreeDBStructureChooserQuerySource private static int MAX_QLENGTH = 7820; + protected FTSRestRequest lastTdbRequest; + + protected FTSRestClientI tdbRestClient; + public ThreeDBStructureChooserQuerySource() { - pdbRestClient = TDBeaconsFTSRestClient.getInstance(); + tdbRestClient = TDBeaconsFTSRestClient.getInstance(); docFieldPrefs = new FTSDataColumnPreferences( PreferenceSource.STRUCTURE_CHOOSER, TDBeaconsFTSRestClient.getInstance()); @@ -143,10 +148,10 @@ public class ThreeDBStructureChooserQuerySource FilterOption selectedFilterOpt, boolean b) throws Exception { FTSRestResponse resultList; - FTSRestRequest pdbRequest = getTDBeaconsRequest(seq, wantedFields); - resultList = pdbRestClient.executeRequest(pdbRequest); + FTSRestRequest tdbRequest = getTDBeaconsRequest(seq, wantedFields); + resultList = tdbRestClient.executeRequest(tdbRequest); - lastPdbRequest = pdbRequest; + lastTdbRequest = tdbRequest; return resultList; } @@ -214,11 +219,11 @@ public class ThreeDBStructureChooserQuerySource return null; } pdbRequest.setResponseSize(1); - resultList = pdbRestClient.executeRequest(pdbRequest); + resultList = tdbRestClient.executeRequest(pdbRequest); // TODO: client side filtering - sort results and pick top one (or N) - lastPdbRequest = pdbRequest; + lastTdbRequest = pdbRequest; return resultList; } @@ -271,4 +276,11 @@ public class ThreeDBStructureChooserQuerySource } return pdbEntriesToView; } + + + @Override + protected FTSRestRequest getLastFTSRequest() + { + return lastTdbRequest; + } } \ No newline at end of file