import com.sun.jersey.api.client.config.DefaultClientConfig;
/**
- * A rest client for querying the Search endpoint of the PDB REST API
+ * A rest client for querying the Search endpoint of the PDB API
*
* @author tcnofoegbu
*
public static final String PDB_SEARCH_ENDPOINT = "http://www.ebi.ac.uk/pdbe/search/pdb/select?";
- private static int DEFAULT_RESPONSE_SIZE = 200;
-
protected PDBFTSRestClient()
{
}
String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(pdbRestRequest
.getWantedFields());
- int responseSize = (pdbRestRequest.getResponseSize() == 0) ? DEFAULT_RESPONSE_SIZE
+ int responseSize = (pdbRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize()
: pdbRestRequest.getResponseSize();
String sortParam = null;
if (pdbRestRequest.getFieldToSortBy() == null
primaryKey = fieldData;
summaryRowData[colCounter++] = primaryKey;
}
+ else if (fieldData == null || fieldData.isEmpty())
+ {
+ summaryRowData[colCounter++] = null;
+ }
else
{
- if (field.getGroup().getName().equals("Quality Measures"))
+ try
{
- try
- {
- if (fieldData == null || fieldData.isEmpty())
- {
- summaryRowData[colCounter++] = null;
- }
- else
- {
- Double value = Double.valueOf(fieldData);
- summaryRowData[colCounter++] = value;
- }
- } catch (Exception e)
- {
- e.printStackTrace();
- System.out.println("offending value:" + fieldData);
- summaryRowData[colCounter++] = 0.0;
- }
- }
- else
+ summaryRowData[colCounter++] = (field.getDataColumnClass() == Integer.class) ? Integer
+ .valueOf(fieldData)
+ : (field.getDataColumnClass() == Double.class) ? Double
+ .valueOf(fieldData)
+ : fieldData;
+ } catch (Exception e)
{
- summaryRowData[colCounter++] = (fieldData == null || fieldData
- .isEmpty()) ? null : fieldData;
+ e.printStackTrace();
+ System.out.println("offending value:" + fieldData);
}
}
}
}
@Override
- public String getColumnDataConfigFile()
+ public String getColumnDataConfigFileName()
{
- return getFile("fts/pdb_data_columns.conf");
+ return getResourceFile("fts/pdb_data_columns.conf");
}