JAL-3438 spotless for 2.11.2.0
[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.FTSDataColumnPreferences.PreferenceSource;
26 import jalview.fts.core.FTSRestRequest;
27 import jalview.fts.core.FTSRestResponse;
28
29 import java.util.Collection;
30
31 /**
32  * Methods for FTS Rest client.
33  * 
34  * @author tcnofoegbu
35  */
36 public interface FTSRestClientI
37 {
38
39   /**
40    * Execute a given FTS request, process the response and return it as an
41    * FTSRestResponse object
42    * 
43    * @param ftsRestRequest
44    *          the FTS request to execute
45    * @return FTSRestResponse - the response after executing an FTS request
46    * @throws Exception
47    */
48   public FTSRestResponse executeRequest(FTSRestRequest ftsRequest)
49           throws Exception;
50
51   /**
52    * Return the resource file path for the data columns configuration file
53    * 
54    * @return
55    */
56   public String getColumnDataConfigFileName();
57
58   /**
59    * Fetch FTSDataColumnGroupI by the group's Id
60    * 
61    * @param groupId
62    * @return FTSDataColumnGroupI
63    * @throws Exception
64    */
65   public FTSDataColumnGroupI getDataColumnGroupById(String groupId)
66           throws Exception;
67
68   /**
69    * Fetch FTSDataColumnI by name or code
70    * 
71    * @param nameOrCode
72    * @return FTSDataColumnI
73    * @throws Exception
74    */
75   public FTSDataColumnI getDataColumnByNameOrCode(String nameOrCode)
76           throws Exception;
77
78   /**
79    * Convert collection of FTSDataColumnI objects to a comma delimited string of
80    * the 'code' values
81    * 
82    * @param wantedFields
83    *          the collection of FTSDataColumnI to process
84    * @return the generated comma delimited string from the supplied
85    *         FTSDataColumnI collection
86    */
87   public String getDataColumnsFieldsAsCommaDelimitedString(
88           Collection<FTSDataColumnI> wantedFields);
89
90   /**
91    * Fetch index of the primary key column for the dynamic table TODO: consider
92    * removing 'hasRefSeq' - never used in code
93    * 
94    * @param wantedFields
95    *          the available table columns
96    * @param hasRefSeq
97    *          true if the data columns has an additional column for reference
98    *          sequence
99    * @return index of the primary key column
100    * @throws Exception
101    */
102   public int getPrimaryKeyColumIndex(
103           Collection<FTSDataColumnI> wantedFields, boolean hasRefSeq)
104           throws Exception;
105
106   /**
107    * Fetch the primary key data column object
108    * 
109    * @return the FTSDataColumnI object for the primary key column
110    */
111   public FTSDataColumnI getPrimaryKeyColumn();
112
113   /**
114    * Returns list of FTSDataColumnI objects to be displayed by default
115    * 
116    * @return list of columns to display by default
117    */
118   public Collection<FTSDataColumnI> getAllDefaultDisplayedFTSDataColumns();
119
120   /**
121    * Return list of FTSDataColumnI objects that can be used to perform a search
122    * query
123    * 
124    * @return list of searchable FTSDataColumnI object
125    */
126   public Collection<FTSDataColumnI> getSearchableDataColumns();
127
128   /**
129    * Return list of all available FTSDataColumnI object
130    * 
131    * @return list of all FTSColumnI objcet
132    */
133   public Collection<FTSDataColumnI> getAllFTSDataColumns();
134
135   /**
136    * Return the default response page limit
137    * 
138    * @return the default response page size
139    */
140   public int getDefaultResponsePageSize();
141
142   public String[] getPreferencesColumnsFor(PreferenceSource source);
143 }