public FTSRestResponse joinResponses(FTSRestResponse upResponse,
FTSRestResponse pdbResponse)
{
+ boolean hasPdbResp = lastPdbRequest != null;
+
int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
// join on
int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
- int pdbIdx = lastPdbRequest.getFieldIndex("PDB Id");
- int pdbTitle_idx = lastPdbRequest.getFieldIndex("Title");
+ int pdbIdx = hasPdbResp ? lastPdbRequest.getFieldIndex("PDB Id") : -1;
+ int pdbTitle_idx = hasPdbResp ? lastPdbRequest.getFieldIndex("Title")
+ : -1;
int tdbTitle_idx = getLastFTSRequest().getFieldIndex("Title");
List<FTSData> joinedRows = new ArrayList<FTSData>();
String provider = (String) row.getSummaryData()[idx_provider];
if ("PDBe".equalsIgnoreCase(provider))
{
- for (final FTSData pdbrow : pdbResponse.getSearchSummary())
+ if (!hasPdbResp)
+ {
+ System.out.println(
+ "Warning: seems like we couldn't get to the PDBe search interface.");
+ }
+ else
{
- String pdbid = (String) pdbrow.getSummaryData()[pdbIdx];
- if (id.equalsIgnoreCase(pdbid))
+ for (final FTSData pdbrow : pdbResponse.getSearchSummary())
{
- row.getSummaryData()[tdbTitle_idx] = pdbrow
- .getSummaryData()[pdbTitle_idx];
+ String pdbid = (String) pdbrow.getSummaryData()[pdbIdx];
+ if (id.equalsIgnoreCase(pdbid))
+ {
+ row.getSummaryData()[tdbTitle_idx] = pdbrow
+ .getSummaryData()[pdbTitle_idx];
+ }
}
}
+
}
else
{