JAL-2189 source formatting
[jalview.git] / src / jalview / fts / api / FTSRestClientI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21
22 package jalview.fts.api;
23
24 import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI;
25 import jalview.fts.core.FTSRestRequest;
26 import jalview.fts.core.FTSRestResponse;
27
28 import java.util.Collection;
29
30 /**
31  * Methods for FTS Rest client.
32  * 
33  * @author tcnofoegbu
34  */
35 public interface FTSRestClientI
36 {
37
38   /**
39    * Execute a given FTS request, process the response and return it as an
40    * FTSRestResponse object
41    * 
42    * @param ftsRestRequest
43    *          the FTS request to execute
44    * @return FTSRestResponse - the response after executing an FTS request
45    * @throws Exception
46    */
47   public FTSRestResponse executeRequest(FTSRestRequest ftsRequest)
48           throws Exception;
49
50   /**
51    * Return the resource file path for the data columns configuration file
52    * 
53    * @return
54    */
55   public String getColumnDataConfigFileName();
56
57   /**
58    * Fetch FTSDataColumnGroupI by the group's Id
59    * 
60    * @param groupId
61    * @return FTSDataColumnGroupI
62    * @throws Exception
63    */
64   public FTSDataColumnGroupI getDataColumnGroupById(String groupId)
65           throws Exception;
66
67   /**
68    * Fetch FTSDataColumnI by name or code
69    * 
70    * @param nameOrCode
71    * @return FTSDataColumnI
72    * @throws Exception
73    */
74   public FTSDataColumnI getDataColumnByNameOrCode(String nameOrCode)
75           throws Exception;
76
77   /**
78    * Convert collection of FTSDataColumnI objects to a comma delimited string of
79    * the 'code' values
80    * 
81    * @param wantedFields
82    *          the collection of FTSDataColumnI to process
83    * @return the generated comma delimited string from the supplied
84    *         FTSDataColumnI collection
85    */
86   public String getDataColumnsFieldsAsCommaDelimitedString(
87           Collection<FTSDataColumnI> wantedFields);
88
89   /**
90    * Fetch index of the primary key column for the dynamic table
91    * 
92    * @param wantedFields
93    *          the available table columns
94    * @param hasRefSeq
95    *          true if the data columns has an additional column for reference
96    *          sequence
97    * @return index of the primary key column
98    * @throws Exception
99    */
100   public int getPrimaryKeyColumIndex(
101           Collection<FTSDataColumnI> wantedFields, boolean hasRefSeq)
102           throws Exception;
103
104   /**
105    * Fetch the primary key data column object
106    * 
107    * @return the FTSDataColumnI object for the primary key column
108    */
109   public FTSDataColumnI getPrimaryKeyColumn();
110
111   /**
112    * Returns list of FTSDataColumnI objects to be displayed by default
113    * 
114    * @return list of columns to display by default
115    */
116   public Collection<FTSDataColumnI> getAllDefaultDisplayedFTSDataColumns();
117
118   /**
119    * Return list of FTSDataColumnI objects that can be used to perform a search
120    * query
121    * 
122    * @return list of searchable FTSDataColumnI object
123    */
124   public Collection<FTSDataColumnI> getSearchableDataColumns();
125
126   /**
127    * Return list of all available FTSDataColumnI object
128    * 
129    * @return list of all FTSColumnI objcet
130    */
131   public Collection<FTSDataColumnI> getAllFTSDataColumns();
132
133   /**
134    * Return the default response page limit
135    * 
136    * @return the default response page size
137    */
138   public int getDefaultResponsePageSize();
139 }