1 /*****************************************************************************
5 * Creation date 04.03.2013
8 * @copyright OPEN CASCADE 2012
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.SimulationContext;
20 * Base search criteria.
22 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
24 public class SearchFilterDTO {
27 * "all": match all criteria.
29 public final static String MATCH_ALL = "all";
31 * "any": match any criteria.
33 public final static String MATCH_ANY = "any";
35 * Study author id to search.
37 protected String _author = "0";
39 * Current contexts search criteria.
41 protected transient List<SimulationContext> _simContexts = new ArrayList<SimulationContext>();
43 * Simulation context match: "all" or "any".
45 private String _contextMatch = MATCH_ALL;
47 * Criteria match: "all" or "any".
49 private String _criteriaMatch = MATCH_ALL;
51 * Search studies created after this date.
53 private Date _createdAfter;
55 * Search studies created before this date.
57 private Date _createdBefore;
59 * Full text search words.
61 private String _words = "";
65 private String _reference = "";
67 * Currently connected user id.
69 private long _connectedUserId = 0;
72 * Get author id of objects to find.
74 * @return the author id criteria
76 public String getAuthor() {
81 * Get context criteria operation (all or any).
83 * @return the simulation context criteria operation value
85 public String getContextMatch() {
90 * Get the createdAfter.
92 * @return the createdAfter
94 public Date getCreatedAfter() {
99 * Get the createdBefore.
101 * @return the createdBefore
103 public Date getCreatedBefore() {
104 return _createdBefore;
108 * Get main criteria operation (all or any).
110 * @return the main criteria operation value
112 public String getCriteriaMatch() {
113 return _criteriaMatch;
117 * Get full text search criterion value.
119 * @return the full text search criterion value
121 public String getWords() {
125 // ==============================================================================================================================
127 // ==============================================================================================================================
130 * Set author id to search.
135 public void setAuthor(final String index) {
136 this._author = index;
140 * Set context criteria operation (all or any).
145 public void setContextMatch(final String value) {
146 this._contextMatch = value;
150 * Set the createdAfter.
152 * @param createdAfter
153 * the createdAfter to set
155 public void setCreatedAfter(final Date createdAfter) {
156 _createdAfter = createdAfter;
160 * Set the createdBefore.
162 * @param createdBefore
163 * the createdBefore to set
165 public void setCreatedBefore(final Date createdBefore) {
166 _createdBefore = createdBefore;
170 * Set main criteria operation (all or any).
175 public void setCriteriaMatch(final String value) {
176 this._criteriaMatch = value;
180 * Set full text search criterion value.
183 * the full text search criterion value
185 public void setWords(final String value) {
192 * @return the context
194 public List<SimulationContext> getSimContexts() {
199 * Check if it is necessary to satisfy all main criteria.
201 * @return true if it is necessary to satisfy all main criteria
203 public boolean isMatchAllCriteria() {
204 return MATCH_ALL.equals(getCriteriaMatch());
208 * Check if it is necessary to satisfy all simulation contexts criteria.
210 * @return true if it is necessary to satisfy all simulation contexts criteria
212 public boolean isMatchAllContexts() {
213 return MATCH_ALL.equals(getContextMatch());
216 // ==============================================================================================================================
218 // ==============================================================================================================================
221 * Get study reference criteria.
223 * @return study reference to search
225 public String getReference() {
230 * Set study reference criteria.
233 * the study reference to search
235 public void setReference(final String value) {
236 this._reference = value;
240 * Set the simContexts.
241 * @param simContexts the simContexts to set
243 public void setSimContexts(final List<SimulationContext> simContexts) {
244 _simContexts = simContexts;
248 * Get the connectedUserId.
249 * @return the connectedUserId
251 public long getConnectedUserId() {
252 return _connectedUserId;
256 * Set the connectedUserId.
257 * @param connectedUserId the connectedUserId to set
259 public void setConnectedUserId(final long connectedUserId) {
260 _connectedUserId = connectedUserId;