1 /*****************************************************************************
5 * Creation date 04.03.2013
8 * @copyright OPEN CASCADE 2012-2015
9 *****************************************************************************/
11 package org.splat.service.dto;
13 import java.util.ArrayList;
14 import java.util.Date;
15 import java.util.List;
17 import org.splat.dal.bo.som.ProgressState;
18 import org.splat.dal.bo.som.SimulationContext;
21 * Base search criteria.
23 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
25 public class SearchFilterDTO {
28 * "all": match all criteria.
30 public final static String MATCH_ALL = "all";
32 * "any": match any criteria.
34 public final static String MATCH_ANY = "any";
36 * "ANY": match any status.
38 public final static String ANY_STATE = "ANY";
40 * Study author id to search.
42 protected String _author = "0";
44 * Current contexts search criteria.
46 protected transient List<SimulationContext> _simContexts = new ArrayList<SimulationContext>();
48 * Simulation context match: "all" or "any".
50 private String _contextMatch = MATCH_ALL;
52 * Criteria match: "all" or "any".
54 private String _criteriaMatch = MATCH_ALL;
56 * Search studies created after this date.
58 private Date _createdAfter;
60 * Search studies created before this date.
62 private Date _createdBefore;
64 * Full text search words.
66 private String _words = "";
70 private String _reference = "";
72 * Currently connected user id.
74 private long _connectedUserId = 0;
76 * "In-Work", "In-Draft", "In-Check"...
78 private String _state = ANY_STATE;
81 * Get author id of objects to find.
83 * @return the author id criteria
85 public String getAuthor() {
90 * Get context criteria operation (all or any).
92 * @return the simulation context criteria operation value
94 public String getContextMatch() {
99 * Get the createdAfter.
101 * @return the createdAfter
103 public Date getCreatedAfter() {
104 return _createdAfter;
108 * Get the createdBefore.
110 * @return the createdBefore
112 public Date getCreatedBefore() {
113 return _createdBefore;
117 * Get main criteria operation (all or any).
119 * @return the main criteria operation value
121 public String getCriteriaMatch() {
122 return _criteriaMatch;
126 * Get full text search criterion value.
128 * @return the full text search criterion value
130 public String getWords() {
134 // ==============================================================================================================================
136 // ==============================================================================================================================
139 * Set author id to search.
144 public void setAuthor(final String index) {
145 this._author = index;
149 * Set context criteria operation (all or any).
154 public void setContextMatch(final String value) {
155 this._contextMatch = value;
159 * Set the createdAfter.
161 * @param createdAfter
162 * the createdAfter to set
164 public void setCreatedAfter(final Date createdAfter) {
165 _createdAfter = createdAfter;
169 * Set the createdBefore.
171 * @param createdBefore
172 * the createdBefore to set
174 public void setCreatedBefore(final Date createdBefore) {
175 _createdBefore = createdBefore;
179 * Set main criteria operation (all or any).
184 public void setCriteriaMatch(final String value) {
185 this._criteriaMatch = value;
189 * Set full text search criterion value.
192 * the full text search criterion value
194 public void setWords(final String value) {
201 * @return the context
203 public List<SimulationContext> getSimContexts() {
208 * Check if it is necessary to satisfy all main criteria.
210 * @return true if it is necessary to satisfy all main criteria
212 public boolean isMatchAllCriteria() {
213 return MATCH_ALL.equals(getCriteriaMatch());
217 * Check if it is necessary to satisfy all simulation contexts criteria.
219 * @return true if it is necessary to satisfy all simulation contexts criteria
221 public boolean isMatchAllContexts() {
222 return MATCH_ALL.equals(getContextMatch());
225 // ==============================================================================================================================
227 // ==============================================================================================================================
230 * Get study reference criteria.
232 * @return study reference to search
234 public String getReference() {
239 * Set study reference criteria.
242 * the study reference to search
244 public void setReference(final String value) {
245 this._reference = value;
249 * Set the simContexts.
250 * @param simContexts the simContexts to set
252 public void setSimContexts(final List<SimulationContext> simContexts) {
253 _simContexts = simContexts;
257 * Get the connectedUserId.
258 * @return the connectedUserId
260 public long getConnectedUserId() {
261 return _connectedUserId;
265 * Set the connectedUserId.
266 * @param connectedUserId the connectedUserId to set
268 public void setConnectedUserId(final long connectedUserId) {
269 _connectedUserId = connectedUserId;
272 // ==============================================================================================================================
274 // ==============================================================================================================================
277 * Get progress state criteria.
279 * @return study progress state to search
281 public String getState() {
286 * Set progress state criteria.
289 * the progress state to search
291 public void setState(final String value) {
296 * Set progress state criteria.
299 * the progress state to search
301 public void setState(final ProgressState value) {
302 this._state = value.toString();