X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Fthreedbeacons%2FTDBeaconsFTSRestClient.java;fp=src%2Fjalview%2Ffts%2Fservice%2Fthreedbeacons%2FTDBeaconsFTSRestClient.java;h=ac02a5fa1705775e9bd87b2800e70e6cf34ce46f;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=ccdc525b3187efbad87c2e85e41aebe2a12ec628;hpb=49db0dff1da16c3355b43a41498c1fc93ef47e91;p=jalview.git diff --git a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java index ccdc525..ac02a5f 100644 --- a/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java +++ b/src/jalview/fts/service/threedbeacons/TDBeaconsFTSRestClient.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.fts.service.threedbeacons; import java.net.URI; @@ -37,18 +57,21 @@ public class TDBeaconsFTSRestClient extends FTSRestClient /** * production server URI */ - private static String TDB_PROD_API="https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/"; + private static String TDB_PROD_API = "https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/"; + /** * dev server URI */ - private static String TDB_DEV_API="https://wwwdev.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/"; - private static String DEFAULT_THREEDBEACONS_DOMAIN = TDB_PROD_API; + private static String TDB_DEV_API = "https://wwwdev.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/"; + + private static String DEFAULT_THREEDBEACONS_DOMAIN = TDB_PROD_API; public static FTSRestClientI instance = null; protected TDBeaconsFTSRestClient() { } + @SuppressWarnings("unchecked") @Override public FTSRestResponse executeRequest(FTSRestRequest tdbRestRequest) @@ -77,14 +100,15 @@ public class TDBeaconsFTSRestClient extends FTSRestClient } WebResource webResource; - webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN+query); + webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN + query); URI uri = webResource.getURI(); System.out.println(uri.toString()); // Execute the REST request ClientResponse clientResponse; - if (isMocked()) { + if (isMocked()) + { clientResponse = null; } else @@ -99,7 +123,9 @@ public class TDBeaconsFTSRestClient extends FTSRestClient String responseString = null; // Check the response status and report exception if one occurs - int responseStatus = isMocked() ? (mockQueries.containsKey(query) ? 200 : 404) : clientResponse.getStatus(); + int responseStatus = isMocked() + ? (mockQueries.containsKey(query) ? 200 : 404) + : clientResponse.getStatus(); switch (responseStatus) { // if success @@ -110,7 +136,8 @@ public class TDBeaconsFTSRestClient extends FTSRestClient } else { - responseString = isMocked() ? mockQueries.get(query): clientResponse.getEntity(String.class); + responseString = isMocked() ? mockQueries.get(query) + : clientResponse.getEntity(String.class); } break; case 400: @@ -143,14 +170,14 @@ public class TDBeaconsFTSRestClient extends FTSRestClient } } throw e; - + } } /** * returns response for when the 3D-Beacons service doesn't have a record for - * the given query - in 2.11.2 this triggers a failover to the PDBe FTS + * the given query - in 2.11.2 this triggers a failover to the PDBe FTS * * @return null */ @@ -228,14 +255,14 @@ public class TDBeaconsFTSRestClient extends FTSRestClient SequenceI associatedSeq = tdbRequest.getAssociatedSequence(); int colCounter = 0; summaryRowData = new Object[(associatedSeq != null) - ? displayFields.size() + 1 - : displayFields.size()]; - if (associatedSeq != null) - { - associatedSequence = associatedSeq; - summaryRowData[0] = associatedSequence; - colCounter = 1; - } + ? displayFields.size() + 1 + : displayFields.size()]; + if (associatedSeq != null) + { + associatedSequence = associatedSeq; + summaryRowData[0] = associatedSequence; + colCounter = 1; + } for (FTSDataColumnI field : displayFields) { @@ -339,8 +366,8 @@ public class TDBeaconsFTSRestClient extends FTSRestClient columnNames = new String[] { "", "Display", "Group" }; break; case PREFERENCES: - columnNames = new String[] { "3DB Beacons Field", "Show in search summary", - "Show in structure summary" }; + columnNames = new String[] { "3DB Beacons Field", + "Show in search summary", "Show in structure summary" }; break; default: break;