JAL-1563 JAL-2091 Added generic pagination for FTS Service, pagination for PDB FTS...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 3 May 2016 13:22:59 +0000 (14:22 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 3 May 2016 13:22:59 +0000 (14:22 +0100)
resources/lang/Messages.properties
src/jalview/fts/api/GFTSPanelI.java
src/jalview/fts/core/FTSRestClient.java
src/jalview/fts/core/GFTSPanel.java
src/jalview/fts/service/pdb/PDBFTSPanel.java
src/jalview/fts/service/pdb/PDBFTSRestClient.java
src/jalview/fts/service/uniprot/UniProtFTSRestClient.java
src/jalview/fts/service/uniprot/UniprotFTSPanel.java

index cbadcbf..62c813a 100644 (file)
@@ -1279,10 +1279,10 @@ label.structure_chooser_filter_time = Structure Chooser - Filter time ({0})
 label.structure_chooser_no_of_structures = Structure Chooser - {0} Found ({1})
 info.no_pdb_entry_found_for = No PDB entry found for {0}
 exception.unable_to_detect_internet_connection = Jalview is unable to detect an internet connection
-exception.pdb_rest_service_no_longer_available = PDB rest services no longer available!
+exception.fts_rest_service_no_longer_available = {0} rest services no longer available!
 exception.resource_not_be_found = The requested resource could not be found
-exception.pdb_server_error = There seems to be an error from the PDB server
-exception.pdb_server_unreachable = Jalview is unable to reach the PDBe Solr server. \nPlease ensure that you are connected to the internet and try again.
+exception.fts_server_error = There seems to be an error from the {0} server
+exception.fts_server_unreachable = Jalview is unable to reach the {0} server. \nPlease ensure that you are connected to the internet and try again.
 label.nw_mapping = Needleman & Wunsch Alignment
 label.sifts_mapping = SIFTs Mapping
 label.mapping_method = Sequence \u27f7 Structure mapping method
@@ -1299,4 +1299,6 @@ label.uniprot_sequence_fetcher = UniProt Sequence Fetcher
 action.next_page= >> 
 action.prev_page= << 
 label.next_page_tooltop=Next Page
-label.prev_page_tooltop=Previous Page
\ No newline at end of file
+label.prev_page_tooltop=Previous Page
+exception.bad_request=Bad request. There is a problem with your input.
+exception.service_not_available=Service not available. The server is being updated, try again later.
index 16bf404..ce63576 100644 (file)
@@ -33,8 +33,12 @@ public interface GFTSPanelI
 
   /**
    * Action performed when a text is entered in the search field.
+   * 
+   * @param isFreshSearch
+   *          if true a fresh search is executed else a pagination search is
+   *          executed
    */
-  public void searchAction();
+  public void searchAction(boolean isFreshSearch);
 
   /**
    * Action performed when search results are selected and the 'ok' button is
index 8bf1dc2..2f24a01 100644 (file)
@@ -3,6 +3,7 @@ package jalview.fts.core;
 import jalview.fts.api.FTSDataColumnI;
 import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI;
 import jalview.fts.api.FTSRestClientI;
+import jalview.util.MessageManager;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -383,6 +384,42 @@ public abstract class FTSRestClient implements FTSRestClientI
     throw new Exception("Couldn't find data column group with id : " + id);
   }
 
+  public String getMessageByHTTPStatusCode(int code, String service)
+  {
+    String message = "";
+    switch (code)
+    {
+    case 400:
+      message = MessageManager
+              .getString("exception.bad_request");
+      break;
+      
+    case 410:
+      message = MessageManager.formatMessage(
+              "exception.fts_rest_service_no_longer_available", service);
+      break;
+    case 403:
+    case 404:
+      message = MessageManager.getString("exception.resource_not_be_found");
+      break;
+    case 408:
+    case 409:
+    case 500:
+    case 501:
+    case 502:
+    case 504:
+    case 505:
+      message = MessageManager.getString("exception.fts_server_error");
+      break;
+    case 503:
+      message = MessageManager.getString("exception.service_not_available");
+      break;
+    default:
+      break;
+    }
+    return message;
+  }
+
   protected String getResourceFile(String fileName)
   {
     String result = "";
index ccf33ed..1c799aa 100644 (file)
@@ -103,6 +103,43 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
 
   protected JButton btn_prev_page = new JButton();
 
+  protected StringBuilder errorWarning = new StringBuilder();
+
+  protected ImageIcon warningImage = new ImageIcon(getClass().getResource(
+          "/images/warning.gif"));
+
+  protected ImageIcon loadingImage = new ImageIcon(getClass().getResource(
+          "/images/loading.gif"));
+
+  protected ImageIcon balnkPlaceholderImage = new ImageIcon(getClass()
+          .getResource("/images/blank_16x16_placeholder.png"));
+
+  protected JLabel lbl_warning = new JLabel(warningImage);
+
+  protected JLabel lbl_loading = new JLabel(loadingImage);
+
+  protected JLabel lbl_blank = new JLabel(balnkPlaceholderImage);
+
+  private JTabbedPane tabbedPane = new JTabbedPane();
+
+  private JPanel pnl_actions = new JPanel();
+
+  private JPanel pnl_results = new JPanel(new CardLayout());
+
+  private JPanel pnl_inputs = new JPanel();
+
+  private BorderLayout mainLayout = new BorderLayout();
+
+  protected Object[] previousWantedFields;
+
+  protected int resultSetCount;
+
+  protected int totalResultSetCount;
+
+  protected int offSet;
+
+  protected int pageLimit;
+
   private JTable tbl_summary = new JTable()
   {
     private boolean inLayout;
@@ -178,38 +215,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
       return toolTipText;
     }
   };
-
-  protected StringBuilder errorWarning = new StringBuilder();
-
   protected JScrollPane scrl_searchResult = new JScrollPane(tbl_summary);
 
-  protected ImageIcon warningImage = new ImageIcon(getClass().getResource(
-          "/images/warning.gif"));
-
-  protected ImageIcon loadingImage = new ImageIcon(getClass().getResource(
-          "/images/loading.gif"));
-
-  protected ImageIcon balnkPlaceholderImage = new ImageIcon(getClass()
-          .getResource("/images/blank_16x16_placeholder.png"));
-
-  protected JLabel lbl_warning = new JLabel(warningImage);
-
-  protected JLabel lbl_loading = new JLabel(loadingImage);
-
-  protected JLabel lbl_blank = new JLabel(balnkPlaceholderImage);
-
-  private JTabbedPane tabbedPane = new JTabbedPane();
-
-  private JPanel pnl_actions = new JPanel();
-
-  private JPanel pnl_results = new JPanel(new CardLayout());
-
-  private JPanel pnl_inputs = new JPanel();
-
-  private BorderLayout mainLayout = new BorderLayout();
-
-  protected Object[] previousWantedFields;
-
   public GFTSPanel()
   {
     try
@@ -444,7 +451,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
         }
         txt_search.setToolTipText(JvSwingUtils.wrapTooltip(true,
                 tooltipText));
-        searchAction();
+        searchAction(true);
       }
     });
 
@@ -484,7 +491,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
               {
                 if (!getTypedText().equalsIgnoreCase(lastSearchTerm))
                 {
-                  searchAction();
+                  searchAction(true);
                   lastSearchTerm = getTypedText();
                 }
               }
@@ -529,6 +536,10 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
           btn_back.setEnabled(false);
           btn_cancel.setEnabled(false);
           btn_ok.setEnabled(false);
+          btn_next_page.setEnabled(false);
+          btn_prev_page.setEnabled(false);
+          txt_search.setEnabled(false);
+          cmb_searchTarget.setEnabled(false);
           previousWantedFields = getFTSRestClient()
                   .getAllDefaulDisplayedDataColumns()
                   .toArray(new Object[0]);
@@ -537,9 +548,12 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
         {
           btn_back.setEnabled(true);
           btn_cancel.setEnabled(true);
+          refreshPaginatorState();
+          txt_search.setEnabled(true);
+          cmb_searchTarget.setEnabled(true);
           if (wantedFieldsUpdated())
           {
-            searchAction();
+            searchAction(true);
           }
           else
           {
@@ -807,6 +821,45 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
     lbl_blank.setVisible(!isSearchInProgress);
     lbl_loading.setVisible(isSearchInProgress);
   }
+
+  @Override
+  public void prevPageAction()
+  {
+    if (offSet >= pageLimit)
+    {
+      offSet = offSet - pageLimit;
+      searchAction(false);
+    }
+    else
+    {
+      refreshPaginatorState();
+    }
+  }
+
+  @Override
+  public void nextPageAction()
+  {
+    offSet = offSet + pageLimit;
+    searchAction(false);
+
+  }
+
+  public void refreshPaginatorState()
+  {
+    // System.out.println("resultSet count : " + resultSetCount);
+    // System.out.println("offSet : " + offSet);
+    // System.out.println("page limit : " + pageLimit);
+    setPrevPageButtonEnabled(false);
+    setNextPageButtonEnabled(false);
+    if (resultSetCount >= pageLimit)
+    {
+      setNextPageButtonEnabled(true);
+    }
+    if (offSet >= pageLimit)
+    {
+      setPrevPageButtonEnabled(true);
+    }
+  }
   public void referesh()
   {
     mainFrame.setTitle(getFTSFrameTitle());
index ca1a902..4f308e3 100644 (file)
@@ -41,6 +41,7 @@ public class PDBFTSPanel extends GFTSPanel
 
   public PDBFTSPanel(SequenceFetcher seqFetcher)
   {
+    pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize();
     this.seqFetcher = seqFetcher;
     this.progressIdicator = (seqFetcher == null) ? null : seqFetcher
             .getProgressIndicator();
@@ -48,8 +49,12 @@ public class PDBFTSPanel extends GFTSPanel
 
 
   @Override
-  public void searchAction()
+  public void searchAction(boolean isFreshSearch)
   {
+    if (isFreshSearch)
+    {
+      offSet = 0;
+    }
     new Thread()
     {
       @Override
@@ -75,6 +80,7 @@ public class PDBFTSPanel extends GFTSPanel
           request.setResponseSize(100);
           request.setFieldToSearchBy("(" + searchTarget + ":");
           request.setSearchTerm(searchTerm + ")");
+          request.setOffSet(offSet);
           request.setWantedFields(wantedFields);
           FTSRestClientI pdbRestCleint = PDBFTSRestClient.getInstance();
           FTSRestResponse resultList;
@@ -100,14 +106,29 @@ public class PDBFTSPanel extends GFTSPanel
           }
 
           long endTime = System.currentTimeMillis();
-          int resultSetCount = resultList.getNumberOfItemsFound();
-          String result = (resultSetCount > 1) ? MessageManager
+          totalResultSetCount = resultList.getNumberOfItemsFound();
+          resultSetCount = resultList.getSearchSummary().size();
+          String result = (resultSetCount > 0) ? MessageManager
                   .getString("label.results") : MessageManager
                   .getString("label.result");
-          updateSearchFrameTitle(defaultFTSFrameTitle + " - "
-                  + resultSetCount + " " + result + " ("
-                  + (endTime - startTime) + " milli secs)");
+         
+          if (isPaginationEnabled() && resultSetCount > 0)
+          {
+            updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result
+                    + " " + (offSet + 1) + " to "
+                    + (offSet + resultSetCount) + " of "
+                    + totalResultSetCount
+                    + " " + " (" + (endTime - startTime) + " milli secs)");
+          }
+          else
+          {
+            updateSearchFrameTitle(defaultFTSFrameTitle + " - "
+                    + resultSetCount + " " + result + " ("
+                    + (endTime - startTime) + " milli secs)");
+          }
+          
           setSearchInProgress(false);
+          refreshPaginatorState();
         }
       }
     }.start();
@@ -164,7 +185,6 @@ public class PDBFTSPanel extends GFTSPanel
               false);
     } catch (Exception e)
     {
-      // TODO Auto-generated catch block
       e.printStackTrace();
     }
     int[] selectedRows = getResultTable().getSelectedRows();
@@ -217,8 +237,6 @@ public class PDBFTSPanel extends GFTSPanel
     return pdbIdWithChainCode;
   }
 
-
-
   @Override
   public FTSRestClientI getFTSRestClient()
   {
@@ -231,25 +249,10 @@ public class PDBFTSPanel extends GFTSPanel
     return ftsFrameTitle;
   }
 
-
-  @Override
-  public void prevPageAction()
-  {
-    // TODO pagination not yet implemented for PDB FTS
-
-  }
-
-  @Override
-  public void nextPageAction()
-  {
-    // TODO pagination not yet implemented for PDB FTS
-
-  }
-
   @Override
   public boolean isPaginationEnabled()
   {
-    return false;
+    return true;
   }
 
 }
index 08803b0..29450e8 100644 (file)
@@ -86,6 +86,7 @@ public class PDBFTSRestClient extends FTSRestClient
               .getWantedFields());
       int responseSize = (pdbRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize()
               : pdbRestRequest.getResponseSize();
+      int offSet = pdbRestRequest.getOffSet();
       String sortParam = null;
       if (pdbRestRequest.getFieldToSortBy() == null
               || pdbRestRequest.getFieldToSortBy().trim().isEmpty())
@@ -128,6 +129,7 @@ public class PDBFTSRestClient extends FTSRestClient
                 .queryParam("wt", "json").queryParam("fl", wantedFields)
                 .queryParam("rows", String.valueOf(responseSize))
                 .queryParam("q", query)
+                .queryParam("start", String.valueOf(offSet))
                 .queryParam("sort", sortParam).queryParam("facet", "true")
                 .queryParam("facet.pivot", facetPivot)
                 .queryParam("facet.pivot.mincount", facetPivotMinCount);
@@ -137,6 +139,7 @@ public class PDBFTSRestClient extends FTSRestClient
         webResource = client.resource(PDB_SEARCH_ENDPOINT)
                 .queryParam("wt", "json").queryParam("fl", wantedFields)
                 .queryParam("rows", String.valueOf(responseSize))
+                .queryParam("start", String.valueOf(offSet))
                 .queryParam("q", query)
                 .queryParam("sort", sortParam);
       }
@@ -160,7 +163,7 @@ public class PDBFTSRestClient extends FTSRestClient
         else
         {
           errorMessage = getMessageByHTTPStatusCode(clientResponse
-                  .getStatus());
+.getStatus(), "PDB");
           throw new Exception(errorMessage);
         }
       }
@@ -185,9 +188,8 @@ public class PDBFTSRestClient extends FTSRestClient
       else if (exceptionMsg.contains("UnknownHostException"))
       {
         // The server 'www.ebi.ac.uk' is unreachable
-        throw new Exception(
-                MessageManager
-                        .getString("exception.pdb_server_unreachable"));
+        throw new Exception(MessageManager.formatMessage(
+                "exception.fts_server_unreachable", "PDB Solr"));
       }
       else
       {
@@ -196,35 +198,6 @@ public class PDBFTSRestClient extends FTSRestClient
     }
   }
 
-  public String getMessageByHTTPStatusCode(int code)
-  {
-    String message = "";
-    switch (code)
-    {
-    case 410:
-      message = MessageManager
-              .getString("exception.pdb_rest_service_no_longer_available");
-      break;
-    case 403:
-    case 404:
-      message = MessageManager.getString("exception.resource_not_be_found");
-      break;
-    case 408:
-    case 409:
-    case 500:
-    case 501:
-    case 502:
-    case 503:
-    case 504:
-    case 505:
-      message = MessageManager.getString("exception.pdb_server_error");
-      break;
-
-    default:
-      break;
-    }
-    return message;
-  }
 
   /**
    * Process error response from PDB server if/when one occurs.
@@ -407,6 +380,12 @@ public class PDBFTSRestClient extends FTSRestClient
       {
         return Objects.hash(primaryKey1, this.toString());
       }
+
+      @Override
+      public boolean equals(Object that)
+      {
+        return this.toString().equals(that.toString());
+      }
     };
   }
 
index 0541881..8a21ffb 100644 (file)
@@ -27,6 +27,7 @@ import jalview.fts.api.FTSRestClientI;
 import jalview.fts.core.FTSRestClient;
 import jalview.fts.core.FTSRestRequest;
 import jalview.fts.core.FTSRestResponse;
+import jalview.util.MessageManager;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -49,54 +50,83 @@ public class UniProtFTSRestClient extends FTSRestClient
 
   @Override
   public FTSRestResponse executeRequest(FTSRestRequest uniportRestRequest)
+          throws Exception
   {
-    ClientConfig clientConfig = new DefaultClientConfig();
-    Client client = Client.create(clientConfig);
+    try
+    {
+      ClientConfig clientConfig = new DefaultClientConfig();
+      Client client = Client.create(clientConfig);
 
-    String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(uniportRestRequest
-            .getWantedFields());
-    int responseSize = (uniportRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize()
-            : uniportRestRequest.getResponseSize();
+      String wantedFields = getDataColumnsFieldsAsCommaDelimitedString(uniportRestRequest
+              .getWantedFields());
+      int responseSize = (uniportRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize()
+              : uniportRestRequest.getResponseSize();
 
-    int offSet = uniportRestRequest.getOffSet();
+      int offSet = uniportRestRequest.getOffSet();
 
-    String query = uniportRestRequest.getFieldToSearchBy()
-            .equalsIgnoreCase("Search All") ? uniportRestRequest
-            .getSearchTerm()
-            : uniportRestRequest.getFieldToSearchBy() + ":"
-                    + uniportRestRequest.getSearchTerm();
+      String query = uniportRestRequest.getFieldToSearchBy()
+              .equalsIgnoreCase("Search All") ? uniportRestRequest
+              .getSearchTerm() : uniportRestRequest.getFieldToSearchBy()
+              + ":" + uniportRestRequest.getSearchTerm();
 
-    // + (uniportRestRequest.isAllowUnpublishedEntries() ? ""
-    // : " AND status:REL");
-    // System.out.println(">>>>> Query : " + query);
-    // System.out.println(">>>>> Columns : " + wantedFields);
-    // System.out.println(">>>>> Response size: " + responseSize
-    // + " offset : "
-    // + offSet);
-    WebResource webResource = null;
-    webResource = client.resource(UNIPROT_SEARCH_ENDPOINT)
-            .queryParam("format", "tab")
-            .queryParam("columns", wantedFields)
-            .queryParam("limit", String.valueOf(responseSize))
-            .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);
-    String uniProtTabDelimittedResponseString = clientResponse
-            .getEntity(String.class);
-    // Make redundant objects eligible for garbage collection to conserve
-    // memory
-    clientResponse = null;
-    client = null;
-    // System.out.println(">>>>> response : "
-    // + uniProtTabDelimittedResponseString);
-    return parseUniprotResponse(uniProtTabDelimittedResponseString,
-            uniportRestRequest);
+      // + (uniportRestRequest.isAllowUnpublishedEntries() ? ""
+      // : " AND status:REL");
+      // System.out.println(">>>>> Query : " + query);
+      // System.out.println(">>>>> Columns : " + wantedFields);
+      // System.out.println(">>>>> Response size: " + responseSize
+      // + " offset : "
+      // + offSet);
+      WebResource webResource = null;
+      webResource = client.resource(UNIPROT_SEARCH_ENDPOINT)
+              .queryParam("format", "tab")
+              .queryParam("columns", wantedFields)
+              .queryParam("limit", String.valueOf(responseSize))
+              .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);
+      String uniProtTabDelimittedResponseString = clientResponse
+              .getEntity(String.class);
+      // Make redundant objects eligible for garbage collection to conserve
+      // memory
+      // System.out.println(">>>>> response : "
+      // + uniProtTabDelimittedResponseString);
+      if (clientResponse.getStatus() != 200)
+      {
+        String errorMessage = getMessageByHTTPStatusCode(
+                clientResponse.getStatus(), "Uniprot");
+        throw new Exception(errorMessage);
 
+      }
+      clientResponse = null;
+      client = null;
+      return parseUniprotResponse(uniProtTabDelimittedResponseString,
+              uniportRestRequest);
+    } catch (Exception e)
+    {
+      String exceptionMsg = e.getMessage();
+      if (exceptionMsg.contains("SocketException"))
+      {
+        // No internet connection
+        throw new Exception(
+                MessageManager
+                        .getString("exception.unable_to_detect_internet_connection"));
+      }
+      else if (exceptionMsg.contains("UnknownHostException"))
+      {
+        // The server 'http://www.uniprot.org' is unreachable
+        throw new Exception(MessageManager.formatMessage(
+                "exception.fts_server_unreachable", "Uniprot"));
+      }
+      else
+      {
+        throw e;
+      }
+    }
   }
 
+
   public FTSRestResponse parseUniprotResponse(
           String uniProtTabDelimittedResponseString,
           FTSRestRequest uniprotRestRequest)
@@ -164,6 +194,7 @@ public class UniProtFTSRestClient extends FTSRestClient
     }
     return result;
   }
+
   public static FTSData getFTSData(String tabDelimittedDataStr,
           FTSRestRequest request)
   {
@@ -250,6 +281,12 @@ public class UniProtFTSRestClient extends FTSRestClient
       {
         return Objects.hash(primaryKey1, this.toString());
       }
+
+      @Override
+      public boolean equals(Object that)
+      {
+        return this.toString().equals(that.toString());
+      }
     };
   }
 
index 32f359e..acf2fb0 100644 (file)
@@ -40,29 +40,24 @@ public class UniprotFTSPanel extends GFTSPanel
 
   private String ftsFrameTitle = defaultFTSFrameTitle;
 
-  private int resultSetCount;
 
-  private int offSet;
-
-  private static int pageLimit = UniProtFTSRestClient.getInstance()
-          .getDefaultResponsePageSize();
 
   public UniprotFTSPanel(SequenceFetcher seqFetcher)
   {
+    pageLimit = UniProtFTSRestClient.getInstance()
+            .getDefaultResponsePageSize();
     this.seqFetcher = seqFetcher;
     this.progressIdicator = (seqFetcher == null) ? null : seqFetcher
             .getProgressIndicator();
   }
 
   @Override
-  public void searchAction()
-  {
-    offSet = 0;
-    executeSearch();
-  }
-
-  public void executeSearch()
+  public void searchAction(boolean isFreshSearch)
   {
+    if (isFreshSearch)
+    {
+      offSet = 0;
+    }
     new Thread()
   {
       @Override
@@ -80,7 +75,8 @@ public class UniprotFTSPanel extends GFTSPanel
 
           wantedFields = UniProtFTSRestClient.getInstance()
                   .getAllDefaulDisplayedDataColumns();
-          String searchTerm = txt_search.getText();
+          String searchTerm = decodeSearchTerm(txt_search.getText(),
+                  searchTarget);
 
           FTSRestRequest request = new FTSRestRequest();
           request.setFieldToSearchBy(searchTarget);
@@ -138,44 +134,33 @@ public class UniprotFTSPanel extends GFTSPanel
 
   }
 
-
-
-  public void refreshPaginatorState()
-  {
-    // System.out.println("resultSet count : " + resultSetCount);
-    // System.out.println("offSet : " + offSet);
-    // System.out.println("page limit : " + pageLimit);
-    setPrevPageButtonEnabled(false);
-    setNextPageButtonEnabled(false);
-    if (resultSetCount >= pageLimit)
-    {
-      setNextPageButtonEnabled(true);
-    }
-    if (offSet >= pageLimit)
-    {
-      setPrevPageButtonEnabled(true);
-    }
-  }
-
-  @Override
-  public void prevPageAction()
+  public String decodeSearchTerm(String enteredText, String targetField)
   {
-    if (offSet >= pageLimit)
+    int searchTargetLength = targetField.equalsIgnoreCase("Search All") ? 0
+            : targetField.length() + 1;
+    String searchTarget = targetField.equalsIgnoreCase("Search All") ? ""
+            : targetField + ":";
+    String foundSearchTerms = enteredText;
+    StringBuilder foundSearchTermsBuilder = new StringBuilder();
+    if (enteredText.contains(";"))
     {
-      offSet = offSet - pageLimit;
-      executeSearch();
-    }else{
-      refreshPaginatorState();
+      String[] searchTerms = enteredText.split(";");
+      for (String searchTerm : searchTerms)
+      {
+        foundSearchTermsBuilder.append(searchTarget).append(searchTerm)
+                .append(" OR ");
+      }
+      int endIndex = foundSearchTermsBuilder.lastIndexOf(" OR ");
+      foundSearchTerms = foundSearchTermsBuilder.toString();
+      if (foundSearchTerms.contains(" OR "))
+      {
+        foundSearchTerms = foundSearchTerms.substring(searchTargetLength,
+                endIndex);
+      }
     }
+    return foundSearchTerms;
   }
 
-  @Override
-  public void nextPageAction()
-  {
-    offSet = offSet + pageLimit;
-    executeSearch();
-
-  }
 
   @Override
   public boolean isPaginationEnabled()