Merge branch 'feature/JAL-3144noJTree' into
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 1 Nov 2018 11:32:20 +0000 (11:32 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 1 Nov 2018 11:32:20 +0000 (11:32 +0000)
Jalview-BH/JAL-3026-JAL-3063-JAXB

Conflicts:
src/jalview/ext/ensembl/EnsemblRestClient.java

1  2 
src/jalview/fts/service/pdb/PDBFTSRestClient.java
src/jalview/fts/service/uniprot/UniProtFTSRestClient.java

@@@ -20,6 -20,6 +20,7 @@@
   */
  package jalview.fts.service.pdb;
  
++import jalview.bin.Jalview;
  import jalview.datamodel.SequenceI;
  import jalview.fts.api.FTSData;
  import jalview.fts.api.FTSDataColumnI;
@@@ -137,9 -123,10 +124,9 @@@ public class PDBFTSRestClient extends F
  
        // BH 2018 the trick here is to coerce the classes in Javascript to be 
        // different from the ones in Java yet still allow this to be correct for Java
+       Client client;
        Class<ClientResponse> clientResponseClass;
--      if (/** @j2sNative true || */
--      false)
++      if (Jalview.isJS())
        {
          // JavaScript only -- coerce types to Java types for Java
          client = (Client) (Object) new jalview.javascript.web.Client();
@@@ -59,35 -59,51 +59,50 @@@ public class UniProtFTSRestClient exten
    }
  
    @Override
--  public FTSRestResponse executeRequest(FTSRestRequest uniportRestRequest)
++  public FTSRestResponse executeRequest(FTSRestRequest uniprotRestRequest)
            throws Exception
    {
      try
      {
-       ClientConfig clientConfig = new DefaultClientConfig();
-       Client client = Client.create(clientConfig);
        String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(
--              uniportRestRequest.getWantedFields());
--      int responseSize = (uniportRestRequest.getResponseSize() == 0)
++              uniprotRestRequest.getWantedFields());
++      int responseSize = (uniprotRestRequest.getResponseSize() == 0)
                ? getDefaultResponsePageSize()
--              : uniportRestRequest.getResponseSize();
++              : uniprotRestRequest.getResponseSize();
  
--      int offSet = uniportRestRequest.getOffSet();
++      int offSet = uniprotRestRequest.getOffSet();
        String query;
--      if (isAdvancedQuery(uniportRestRequest.getSearchTerm()))
++      if (isAdvancedQuery(uniprotRestRequest.getSearchTerm()))
        {
--        query = uniportRestRequest.getSearchTerm();
++        query = uniprotRestRequest.getSearchTerm();
        }
        else
        {
--        query = uniportRestRequest.getFieldToSearchBy()
++        query = uniprotRestRequest.getFieldToSearchBy()
                  .equalsIgnoreCase("Search All")
--                        ? uniportRestRequest.getSearchTerm()
++                        ? uniprotRestRequest.getSearchTerm()
                                  + " or mnemonic:"
--                                + uniportRestRequest.getSearchTerm()
--                        : uniportRestRequest.getFieldToSearchBy() + ":"
--                                + uniportRestRequest.getSearchTerm();
++                                + uniprotRestRequest.getSearchTerm()
++                        : uniprotRestRequest.getFieldToSearchBy() + ":"
++                                + uniprotRestRequest.getSearchTerm();
+       }
+       // BH 2018 the trick here is to coerce the classes in Javascript to be
+       // different from the ones in Java yet still allow this to be correct for
+       // Java
+       Client client;
+       Class<ClientResponse> clientResponseClass;
 -      if (/** @j2sNative true || */
 -      false)
++      if (Jalview.isJS())
+       {
+         // JavaScript only -- coerce types to Java types for Java
+         client = (Client) (Object) new jalview.javascript.web.Client();
+         clientResponseClass = (Class<ClientResponse>) (Object) jalview.javascript.web.ClientResponse.class;
+       }
+       else
+       {
+         // Java only
+         client = Client.create(new DefaultClientConfig());
+         clientResponseClass = ClientResponse.class;
        }
  
        WebResource webResource = null;
        clientResponse = null;
        client = null;
        return parseUniprotResponse(uniProtTabDelimittedResponseString,
--              uniportRestRequest, xTotalResults);
++              uniprotRestRequest, xTotalResults);
      } catch (Exception e)
      {
        String exceptionMsg = e.getMessage();