]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/service/dto/SearchFilterDTO.java
Salome HOME
1fd296e5b5b84c9db84a44b2537aaf40a8f024fa
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / dto / SearchFilterDTO.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   04.03.2013
6  * @author         $Author$
7  * @version        $Revision$
8  * @copyright      OPEN CASCADE 2012
9  *****************************************************************************/
10
11 package org.splat.service.dto;
12
13 import java.util.ArrayList;
14 import java.util.Date;
15 import java.util.List;
16
17 import org.splat.dal.bo.som.SimulationContext;
18
19 /**
20  * Base search criteria.
21  * 
22  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
23  */
24 public class SearchFilterDTO {
25
26         /**
27          * "all": match all criteria.
28          */
29         public final static String MATCH_ALL = "all";
30         /**
31          * "any": match any criteria.
32          */
33         public final static String MATCH_ANY = "any";
34         /**
35          * Study author id to search.
36          */
37         protected String _author = "0";
38         /**
39          * Current contexts search criteria.
40          */
41         protected transient List<SimulationContext> _simContexts = new ArrayList<SimulationContext>();
42         /**
43          * Simulation context match: "all" or "any".
44          */
45         private String _contextMatch = MATCH_ALL;
46         /**
47          * Criteria match: "all" or "any".
48          */
49         private String _criteriaMatch = MATCH_ALL;
50         /**
51          * Search studies created after this date.
52          */
53         private Date _createdAfter;
54         /**
55          * Search studies created before this date.
56          */
57         private Date _createdBefore;
58         /**
59          * Full text search words.
60          */
61         private String _words = "";
62         /**
63          * Study reference.
64          */
65         private String _reference = "";
66         /**
67          * Currently connected user id.
68          */
69         private long _connectedUserId = 0;
70
71         /**
72          * Get author id of objects to find.
73          * 
74          * @return the author id criteria
75          */
76         public String getAuthor() {
77                 return _author;
78         }
79
80         /**
81          * Get context criteria operation (all or any).
82          * 
83          * @return the simulation context criteria operation value
84          */
85         public String getContextMatch() {
86                 return _contextMatch;
87         }
88
89         /**
90          * Get the createdAfter.
91          * 
92          * @return the createdAfter
93          */
94         public Date getCreatedAfter() {
95                 return _createdAfter;
96         }
97
98         /**
99          * Get the createdBefore.
100          * 
101          * @return the createdBefore
102          */
103         public Date getCreatedBefore() {
104                 return _createdBefore;
105         }
106
107         /**
108          * Get main criteria operation (all or any).
109          * 
110          * @return the main criteria operation value
111          */
112         public String getCriteriaMatch() {
113                 return _criteriaMatch;
114         }
115
116         /**
117          * Get full text search criterion value.
118          * 
119          * @return the full text search criterion value
120          */
121         public String getWords() {
122                 return _words;
123         }
124
125         // ==============================================================================================================================
126         // Setters
127         // ==============================================================================================================================
128
129         /**
130          * Set author id to search.
131          * 
132          * @param index
133          *            persistent user id
134          */
135         public void setAuthor(final String index) {
136                 this._author = index;
137         }
138
139         /**
140          * Set context criteria operation (all or any).
141          * 
142          * @param value
143          *            "all" or "any"
144          */
145         public void setContextMatch(final String value) {
146                 this._contextMatch = value;
147         }
148
149         /**
150          * Set the createdAfter.
151          * 
152          * @param createdAfter
153          *            the createdAfter to set
154          */
155         public void setCreatedAfter(final Date createdAfter) {
156                 _createdAfter = createdAfter;
157         }
158
159         /**
160          * Set the createdBefore.
161          * 
162          * @param createdBefore
163          *            the createdBefore to set
164          */
165         public void setCreatedBefore(final Date createdBefore) {
166                 _createdBefore = createdBefore;
167         }
168
169         /**
170          * Set main criteria operation (all or any).
171          * 
172          * @param value
173          *            "all" or "any"
174          */
175         public void setCriteriaMatch(final String value) {
176                 this._criteriaMatch = value;
177         }
178
179         /**
180          * Set full text search criterion value.
181          * 
182          * @param value
183          *            the full text search criterion value
184          */
185         public void setWords(final String value) {
186                 this._words = value;
187         }
188
189         /**
190          * Get the context.
191          * 
192          * @return the context
193          */
194         public List<SimulationContext> getSimContexts() {
195                 return _simContexts;
196         }
197
198         /**
199          * Check if it is necessary to satisfy all main criteria.
200          * 
201          * @return true if it is necessary to satisfy all main criteria
202          */
203         public boolean isMatchAllCriteria() {
204                 return MATCH_ALL.equals(getCriteriaMatch());
205         }
206
207         /**
208          * Check if it is necessary to satisfy all simulation contexts criteria.
209          * 
210          * @return true if it is necessary to satisfy all simulation contexts criteria
211          */
212         public boolean isMatchAllContexts() {
213                 return MATCH_ALL.equals(getContextMatch());
214         }
215
216         // ==============================================================================================================================
217         // Getters
218         // ==============================================================================================================================
219         
220         /**
221          * Get study reference criteria.
222          * 
223          * @return study reference to search
224          */
225         public String getReference() {
226                 return _reference;
227         }
228
229         /**
230          * Set study reference criteria.
231          * 
232          * @param value
233          *            the study reference to search
234          */
235         public void setReference(final String value) {
236                 this._reference = value;
237         }
238
239         /**
240          * Set the simContexts.
241          * @param simContexts the simContexts to set
242          */
243         public void setSimContexts(final List<SimulationContext> simContexts) {
244                 _simContexts = simContexts;
245         }
246
247         /**
248          * Get the connectedUserId.
249          * @return the connectedUserId
250          */
251         public long getConnectedUserId() {
252                 return _connectedUserId;
253         }
254
255         /**
256          * Set the connectedUserId.
257          * @param connectedUserId the connectedUserId to set
258          */
259         public void setConnectedUserId(final long connectedUserId) {
260                 _connectedUserId = connectedUserId;
261         }
262 }