JAL-3829 look up column in FTS data
[jalview.git] / src / jalview / fts / core / FTSRestRequest.java
index 94f9bfb..bf88d2d 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -28,7 +28,7 @@ import jalview.fts.api.FTSDataColumnI;
 import java.util.Collection;
 
 /**
- * Represents the PDB request to be consumed by the PDBRestClient
+ * Represents the FTS request to be consumed by the FTSRestClient
  * 
  * @author tcnofoegbu
  *
@@ -45,8 +45,8 @@ public class FTSRestRequest
 
   private boolean allowEmptySequence;
 
-  private boolean allowUnpublishedEntries = Cache.getDefault(
-          "ALLOW_UNPUBLISHED_PDB_QUERYING", false);
+  private boolean allowUnpublishedEntries = Cache
+          .getDefault("ALLOW_UNPUBLISHED_PDB_QUERYING", false);
 
   private boolean facet;
 
@@ -56,6 +56,8 @@ public class FTSRestRequest
 
   private int responseSize;
 
+  private int offSet;
+
   private boolean isSortAscending;
 
   private Collection<FTSDataColumnI> wantedFields;
@@ -105,8 +107,7 @@ public class FTSRestRequest
     return wantedFields;
   }
 
-  public void setWantedFields(
-          Collection<FTSDataColumnI> wantedFields)
+  public void setWantedFields(Collection<FTSDataColumnI> wantedFields)
   {
     this.wantedFields = wantedFields;
   }
@@ -116,7 +117,8 @@ public class FTSRestRequest
     return fieldToSortBy;
   }
 
-  public void setFieldToSortBy(String fieldToSortBy, boolean isSortAscending)
+  public void setFieldToSortBy(String fieldToSortBy,
+          boolean isSortAscending)
   {
     this.fieldToSortBy = fieldToSortBy;
     this.isSortAscending = isSortAscending;
@@ -176,4 +178,33 @@ public class FTSRestRequest
   {
     this.facetPivotMinCount = facetPivotMinCount;
   }
+
+  public int getOffSet()
+  {
+    return offSet;
+  }
+
+  public void setOffSet(int offSet)
+  {
+    this.offSet = offSet;
+  }
+
+  /**
+   * locate column given field name
+   * @param string - field name
+   * @return -1 if not located
+   */
+  public int getFieldIndex(String string)
+  {
+    int i=associatedSequence!=null ? 1 : 0;
+    for (FTSDataColumnI field:wantedFields)
+    {
+      if (field.getName().equals(string))
+      {
+        return i; 
+      }
+      i++;
+    }
+    return -1;
+  }
 }