X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Funiprot%2FUniProtFTSRestClient.java;fp=src%2Fjalview%2Ffts%2Fservice%2Funiprot%2FUniProtFTSRestClient.java;h=250fba04f29ee14d01746ca198f5d65c6c8197cb;hb=be762d8d9c71a7aa3121e845c45911c7192b7827;hp=a23df4cc58dd9ed3607981d3f4d124fa560def6b;hpb=d1bb7a31fc091606aedbc255a5766ac79e36fa91;p=jalview.git diff --git a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java index a23df4c..250fba0 100644 --- a/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java +++ b/src/jalview/fts/service/uniprot/UniProtFTSRestClient.java @@ -57,9 +57,10 @@ public class UniProtFTSRestClient extends FTSRestClient ClientConfig clientConfig = new DefaultClientConfig(); Client client = Client.create(clientConfig); - String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(uniportRestRequest - .getWantedFields()); - int responseSize = (uniportRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize() + String wantedFields = getDataColumnsFieldsAsCommaDelimitedString( + uniportRestRequest.getWantedFields()); + int responseSize = (uniportRestRequest.getResponseSize() == 0) + ? getDefaultResponsePageSize() : uniportRestRequest.getResponseSize(); int offSet = uniportRestRequest.getOffSet(); @@ -70,11 +71,13 @@ public class UniProtFTSRestClient extends FTSRestClient } else { - query = uniportRestRequest.getFieldToSearchBy().equalsIgnoreCase( - "Search All") ? uniportRestRequest.getSearchTerm() - + " or mnemonic:" + uniportRestRequest.getSearchTerm() - : uniportRestRequest.getFieldToSearchBy() + ":" - + uniportRestRequest.getSearchTerm(); + query = uniportRestRequest.getFieldToSearchBy() + .equalsIgnoreCase("Search All") + ? uniportRestRequest.getSearchTerm() + + " or mnemonic:" + + uniportRestRequest.getSearchTerm() + : uniportRestRequest.getFieldToSearchBy() + ":" + + uniportRestRequest.getSearchTerm(); } WebResource webResource = null; @@ -85,8 +88,8 @@ public class UniProtFTSRestClient extends FTSRestClient .queryParam("offset", String.valueOf(offSet)) .queryParam("sort", "score").queryParam("query", query); // Execute the REST request - ClientResponse clientResponse = webResource.accept( - MediaType.TEXT_PLAIN).get(ClientResponse.class); + ClientResponse clientResponse = webResource + .accept(MediaType.TEXT_PLAIN).get(ClientResponse.class); String uniProtTabDelimittedResponseString = clientResponse .getEntity(String.class); // Make redundant objects eligible for garbage collection to conserve @@ -100,8 +103,8 @@ public class UniProtFTSRestClient extends FTSRestClient throw new Exception(errorMessage); } - int xTotalResults = Integer.valueOf(clientResponse.getHeaders() - .get("X-Total-Results").get(0)); + int xTotalResults = Integer.valueOf( + clientResponse.getHeaders().get("X-Total-Results").get(0)); clientResponse = null; client = null; return parseUniprotResponse(uniProtTabDelimittedResponseString, @@ -112,9 +115,8 @@ public class UniProtFTSRestClient extends FTSRestClient if (exceptionMsg.contains("SocketException")) { // No internet connection - throw new Exception( - MessageManager - .getString("exception.unable_to_detect_internet_connection")); + throw new Exception(MessageManager.getString( + "exception.unable_to_detect_internet_connection")); } else if (exceptionMsg.contains("UnknownHostException")) { @@ -239,10 +241,12 @@ public class UniProtFTSRestClient extends FTSRestClient try { summaryRowData[colCounter++] = (field.getDataType() - .getDataTypeClass() == Integer.class) ? Integer - .valueOf(fieldData.replace(",", "")) - : (field.getDataType().getDataTypeClass() == Double.class) ? Double - .valueOf(fieldData) : fieldData; + .getDataTypeClass() == Integer.class) + ? Integer.valueOf(fieldData.replace(",", "")) + : (field.getDataType() + .getDataTypeClass() == Double.class) + ? Double.valueOf(fieldData) + : fieldData; } catch (Exception e) { e.printStackTrace();