Merge branch 'develop' into releases/Release_2_11_3_Branch
[jalview.git] / src / jalview / fts / service / threedbeacons / TDBeaconsFTSRestClient.java
index 0c07d37..c275bda 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.fts.service.threedbeacons;
 
 import java.net.URI;
@@ -6,7 +26,6 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 
 import javax.ws.rs.core.MediaType;
 
@@ -22,11 +41,10 @@ import jalview.fts.api.FTSData;
 import jalview.fts.api.FTSDataColumnI;
 import jalview.fts.api.FTSRestClientI;
 import jalview.fts.api.StructureFTSRestClientI;
+import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
 import jalview.fts.core.FTSRestClient;
 import jalview.fts.core.FTSRestRequest;
 import jalview.fts.core.FTSRestResponse;
-import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
-import jalview.fts.service.pdb.PDBFTSRestClient;
 import jalview.util.JSONUtils;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
@@ -83,7 +101,7 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
       webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN + query);
 
       URI uri = webResource.getURI();
-      System.out.println(uri.toString());
+      jalview.bin.Console.outPrintln(uri.toString());
 
       // Execute the REST request
       ClientResponse clientResponse;
@@ -223,7 +241,8 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
     return searchResult;
   }
 
-  private static FTSData getFTSData(Map<String, Object> tdbJsonStructure,
+  private static FTSData getFTSData(
+          Map<String, Object> tdbJsonStructureSummary,
           FTSRestRequest tdbRequest)
   {
     String primaryKey = null;
@@ -243,13 +262,14 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
       summaryRowData[0] = associatedSequence;
       colCounter = 1;
     }
-
+    Map<String, Object> tdbJsonStructure = (Map<String, Object>) tdbJsonStructureSummary
+            .get("summary");
     for (FTSDataColumnI field : displayFields)
     {
       String fieldData = (tdbJsonStructure.get(field.getCode()) == null)
               ? " "
               : tdbJsonStructure.get(field.getCode()).toString();
-      // System.out.println("Field : " + field + " Data : " + fieldData);
+      // jalview.bin.Console.outPrintln("Field : " + field + " Data : " + fieldData);
       if (field.isPrimaryKeyColumn())
       {
         primaryKey = fieldData;
@@ -273,7 +293,7 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
         } catch (Exception e)
         {
           // e.printStackTrace();
-          System.out.println("offending value:" + fieldData + fieldData);
+          jalview.bin.Console.outPrintln("offending value:" + fieldData + fieldData);
         }
       }
     }
@@ -321,6 +341,7 @@ public class TDBeaconsFTSRestClient extends FTSRestClient
 
   private Collection<FTSDataColumnI> allDefaultDisplayedStructureDataColumns;
 
+  @Override
   public Collection<FTSDataColumnI> getAllDefaultDisplayedStructureDataColumns()
   {
     if (allDefaultDisplayedStructureDataColumns == null