+/*****************************************************************************
+ * Company OPEN CASCADE
+ * Application SIMAN
+ * File $Id$
+ * Creation date 04.03.2013
+ * @author $Author$
+ * @version $Revision$
+ * @copyright OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.service.dto;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.splat.dal.bo.som.SimulationContext;
+
+/**
+ * Base search criteria.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class SearchFilterDTO {
+
+ /**
+ * "all": match all criteria.
+ */
+ public final static String MATCH_ALL = "all";
+ /**
+ * "any": match any criteria.
+ */
+ public final static String MATCH_ANY = "any";
+ /**
+ * Study author id to search.
+ */
+ protected String _author = "0";
+ /**
+ * Current contexts search criteria.
+ */
+ protected transient List<SimulationContext> _simContexts = new ArrayList<SimulationContext>();
+ /**
+ * Simulation context match: "all" or "any".
+ */
+ private String _contextMatch = MATCH_ALL;
+ /**
+ * Criteria match: "all" or "any".
+ */
+ private String _criteriaMatch = MATCH_ALL;
+ /**
+ * Search studies created after this date.
+ */
+ private Date _createdAfter;
+ /**
+ * Search studies created before this date.
+ */
+ private Date _createdBefore;
+ /**
+ * Full text search words.
+ */
+ private String _words = "";
+ /**
+ * Study reference.
+ */
+ private String _reference = "";
+ /**
+ * Currently connected user id.
+ */
+ private long _connectedUserId = 0;
+
+ /**
+ * Get author id of objects to find.
+ *
+ * @return the author id criteria
+ */
+ public String getAuthor() {
+ return _author;
+ }
+
+ /**
+ * Get context criteria operation (all or any).
+ *
+ * @return the simulation context criteria operation value
+ */
+ public String getContextMatch() {
+ return _contextMatch;
+ }
+
+ /**
+ * Get the createdAfter.
+ *
+ * @return the createdAfter
+ */
+ public Date getCreatedAfter() {
+ return _createdAfter;
+ }
+
+ /**
+ * Get the createdBefore.
+ *
+ * @return the createdBefore
+ */
+ public Date getCreatedBefore() {
+ return _createdBefore;
+ }
+
+ /**
+ * Get main criteria operation (all or any).
+ *
+ * @return the main criteria operation value
+ */
+ public String getCriteriaMatch() {
+ return _criteriaMatch;
+ }
+
+ /**
+ * Get full text search criterion value.
+ *
+ * @return the full text search criterion value
+ */
+ public String getWords() {
+ return _words;
+ }
+
+ // ==============================================================================================================================
+ // Setters
+ // ==============================================================================================================================
+
+ /**
+ * Set author id to search.
+ *
+ * @param index
+ * persistent user id
+ */
+ public void setAuthor(final String index) {
+ this._author = index;
+ }
+
+ /**
+ * Set context criteria operation (all or any).
+ *
+ * @param value
+ * "all" or "any"
+ */
+ public void setContextMatch(final String value) {
+ this._contextMatch = value;
+ }
+
+ /**
+ * Set the createdAfter.
+ *
+ * @param createdAfter
+ * the createdAfter to set
+ */
+ public void setCreatedAfter(final Date createdAfter) {
+ _createdAfter = createdAfter;
+ }
+
+ /**
+ * Set the createdBefore.
+ *
+ * @param createdBefore
+ * the createdBefore to set
+ */
+ public void setCreatedBefore(final Date createdBefore) {
+ _createdBefore = createdBefore;
+ }
+
+ /**
+ * Set main criteria operation (all or any).
+ *
+ * @param value
+ * "all" or "any"
+ */
+ public void setCriteriaMatch(final String value) {
+ this._criteriaMatch = value;
+ }
+
+ /**
+ * Set full text search criterion value.
+ *
+ * @param value
+ * the full text search criterion value
+ */
+ public void setWords(final String value) {
+ this._words = value;
+ }
+
+ /**
+ * Get the context.
+ *
+ * @return the context
+ */
+ public List<SimulationContext> getSimContexts() {
+ return _simContexts;
+ }
+
+ /**
+ * Check if it is necessary to satisfy all main criteria.
+ *
+ * @return true if it is necessary to satisfy all main criteria
+ */
+ public boolean isMatchAllCriteria() {
+ return MATCH_ALL.equals(getCriteriaMatch());
+ }
+
+ /**
+ * Check if it is necessary to satisfy all simulation contexts criteria.
+ *
+ * @return true if it is necessary to satisfy all simulation contexts criteria
+ */
+ public boolean isMatchAllContexts() {
+ return MATCH_ALL.equals(getContextMatch());
+ }
+
+ // ==============================================================================================================================
+ // Getters
+ // ==============================================================================================================================
+
+ /**
+ * Get study reference criteria.
+ *
+ * @return study reference to search
+ */
+ public String getReference() {
+ return _reference;
+ }
+
+ /**
+ * Set study reference criteria.
+ *
+ * @param value
+ * the study reference to search
+ */
+ public void setReference(final String value) {
+ this._reference = value;
+ }
+
+ /**
+ * Set the simContexts.
+ * @param simContexts the simContexts to set
+ */
+ public void setSimContexts(final List<SimulationContext> simContexts) {
+ _simContexts = simContexts;
+ }
+
+ /**
+ * Get the connectedUserId.
+ * @return the connectedUserId
+ */
+ public long getConnectedUserId() {
+ return _connectedUserId;
+ }
+
+ /**
+ * Set the connectedUserId.
+ * @param connectedUserId the connectedUserId to set
+ */
+ public void setConnectedUserId(final long connectedUserId) {
+ _connectedUserId = connectedUserId;
+ }
+}