2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
22 package jalview.ws.uimodel;
24 import jalview.datamodel.SequenceI;
25 import jalview.ws.dbsources.PDBRestClient.PDBDocField;
27 import java.util.Collection;
30 * Represents the PDB request to be consumed by the PDBRestClient
35 public class PDBRestRequest
37 private String fieldToSearchBy;
39 private String searchTerm;
41 private String fieldToSortBy;
43 private SequenceI associatedSequence;
45 private boolean allowEmptySequence;
47 private boolean allowUnpublishedEntries;
49 private int responseSize;
51 private boolean isSortAscending;
53 private Collection<PDBDocField> wantedFields;// = new
54 // Collection<PDBDocField>();
56 public String getFieldToSearchBy()
58 return fieldToSearchBy;
61 public void setFieldToSearchBy(String fieldToSearchBy)
63 this.fieldToSearchBy = fieldToSearchBy;
66 public String getSearchTerm()
71 public void setSearchTerm(String searchTerm)
73 this.searchTerm = searchTerm;
76 public boolean isAllowEmptySeq()
78 return allowEmptySequence;
81 public void setAllowEmptySeq(boolean allowEmptySeq)
83 this.allowEmptySequence = allowEmptySeq;
86 public int getResponseSize()
91 public void setResponseSize(int responseSize)
93 this.responseSize = responseSize;
96 public Collection<PDBDocField> getWantedFields()
101 public void setWantedFields(Collection<PDBDocField> wantedFields)
103 this.wantedFields = wantedFields;
106 public String getFieldToSortBy()
108 return fieldToSortBy;
111 public void setFieldToSortBy(String fieldToSortBy, boolean isSortAscending)
113 this.fieldToSortBy = fieldToSortBy;
114 this.isSortAscending = isSortAscending;
117 public boolean isAscending()
119 return isSortAscending;
122 public SequenceI getAssociatedSequence()
124 return associatedSequence;
127 public void setAssociatedSequence(SequenceI associatedSequence)
129 this.associatedSequence = associatedSequence;
132 public String getQuery()
134 return fieldToSearchBy + searchTerm
135 + (isAllowEmptySeq() ? "" : " AND molecule_sequence:['' TO *]")
136 + (isAllowUnpublishedEntries() ? "" : " AND status:REL");
139 public String toString()
141 return "Query : " + getQuery() + " sort field: " + fieldToSortBy
142 + " isAsc: " + isAscending() + " Associated Seq : "
143 + associatedSequence;
146 public boolean isAllowUnpublishedEntries()
148 return allowUnpublishedEntries;
151 public void setAllowUnpublishedEntries(boolean allowUnpublishedEntries)
153 this.allowUnpublishedEntries = allowUnpublishedEntries;