Clover icon

Coverage Report

  1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package jalview.fts.core

File FTSRestRequest.java

 

Coverage histogram

../../../img/srcFileCovDistChart9.png
12% of files have more coverage

Code metrics

4
32
26
1
212
137
28
0.88
1.23
26
1.08

Classes

Class Line # Actions
FTSRestRequest 36 32 28
0.8225806482.3%
 

Contributing tests

This file is covered by 9 tests. .

Source view

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.core;
23   
24    import jalview.bin.Cache;
25    import jalview.datamodel.SequenceI;
26    import jalview.fts.api.FTSDataColumnI;
27   
28    import java.util.Collection;
29   
30    /**
31    * Represents the FTS request to be consumed by the FTSRestClient
32    *
33    * @author tcnofoegbu
34    *
35    */
 
36    public class FTSRestRequest
37    {
38    private String fieldToSearchBy;
39   
40    private String searchTerm;
41   
42    private String fieldToSortBy;
43   
44    private SequenceI associatedSequence;
45   
46    private boolean allowEmptySequence;
47   
48    private boolean allowUnpublishedEntries = Cache
49    .getDefault("ALLOW_UNPUBLISHED_PDB_QUERYING", false);
50   
51    private boolean facet;
52   
53    private String facetPivot;
54   
55    private int facetPivotMinCount;
56   
57    private int responseSize;
58   
59    private int offSet;
60   
61    private boolean isSortAscending;
62   
63    private Collection<FTSDataColumnI> wantedFields;
64   
 
65  35 toggle public String getFieldToSearchBy()
66    {
67  35 return fieldToSearchBy;
68    }
69   
 
70  35 toggle public void setFieldToSearchBy(String fieldToSearchBy)
71    {
72  35 this.fieldToSearchBy = fieldToSearchBy;
73    }
74   
 
75  48 toggle public String getSearchTerm()
76    {
77  48 return searchTerm;
78    }
79   
 
80  48 toggle public void setSearchTerm(String searchTerm)
81    {
82  48 this.searchTerm = searchTerm;
83    }
84   
 
85  34 toggle public boolean isAllowEmptySeq()
86    {
87  34 return allowEmptySequence;
88    }
89   
 
90  46 toggle public void setAllowEmptySeq(boolean allowEmptySeq)
91    {
92  46 this.allowEmptySequence = allowEmptySeq;
93    }
94   
 
95  68 toggle public int getResponseSize()
96    {
97  68 return responseSize;
98    }
99   
 
100  47 toggle public void setResponseSize(int responseSize)
101    {
102  47 this.responseSize = responseSize;
103    }
104   
 
105  13379 toggle public Collection<FTSDataColumnI> getWantedFields()
106    {
107  13379 return wantedFields;
108    }
109   
 
110  47 toggle public void setWantedFields(Collection<FTSDataColumnI> wantedFields)
111    {
112  47 this.wantedFields = wantedFields;
113    }
114   
 
115  40 toggle public String getFieldToSortBy()
116    {
117  40 return fieldToSortBy;
118    }
119   
 
120  2 toggle public void setFieldToSortBy(String fieldToSortBy,
121    boolean isSortAscending)
122    {
123  2 this.fieldToSortBy = fieldToSortBy;
124  2 this.isSortAscending = isSortAscending;
125    }
126   
 
127  2 toggle public boolean isAscending()
128    {
129  2 return isSortAscending;
130    }
131   
 
132  13345 toggle public SequenceI getAssociatedSequence()
133    {
134  13345 return associatedSequence;
135    }
136   
 
137  14 toggle public void setAssociatedSequence(SequenceI associatedSequence)
138    {
139  14 this.associatedSequence = associatedSequence;
140    }
141   
 
142  34 toggle public boolean isAllowUnpublishedEntries()
143    {
144  34 return allowUnpublishedEntries;
145    }
146   
 
147  0 toggle public void setAllowUnpublishedEntries(boolean allowUnpublishedEntries)
148    {
149  0 this.allowUnpublishedEntries = allowUnpublishedEntries;
150    }
151   
 
152  34 toggle public boolean isFacet()
153    {
154  34 return facet;
155    }
156   
 
157  0 toggle public void setFacet(boolean facet)
158    {
159  0 this.facet = facet;
160    }
161   
 
162  34 toggle public String getFacetPivot()
163    {
164  34 return facetPivot;
165    }
166   
 
167  0 toggle public void setFacetPivot(String facetPivot)
168    {
169  0 this.facetPivot = facetPivot;
170    }
171   
 
172  34 toggle public int getFacetPivotMinCount()
173    {
174  34 return facetPivotMinCount;
175    }
176   
 
177  0 toggle public void setFacetPivotMinCount(int facetPivotMinCount)
178    {
179  0 this.facetPivotMinCount = facetPivotMinCount;
180    }
181   
 
182  34 toggle public int getOffSet()
183    {
184  34 return offSet;
185    }
186   
 
187  0 toggle public void setOffSet(int offSet)
188    {
189  0 this.offSet = offSet;
190    }
191   
192    /**
193    * locate column given field name
194    *
195    * @param string
196    * - field name
197    * @return -1 if not located
198    */
 
199  178 toggle public int getFieldIndex(String string)
200    {
201  178 int i = associatedSequence != null ? 1 : 0;
202  178 for (FTSDataColumnI field : wantedFields)
203    {
204  671 if (field.getName().equals(string))
205    {
206  178 return i;
207    }
208  493 i++;
209    }
210  0 return -1;
211    }
212    }