Class SearchCriteria
- java.lang.Object
-
- ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria
-
- All Implemented Interfaces:
java.io.Serializable
@JsonObject("SearchCriteria") public class SearchCriteria extends java.lang.Object implements java.io.Serializable
A (mutable) object representing the specification of a search. A search is specified by MatchClause objects and an operator for combining match clauses. Additionally sub criteria can be added for entities connected with the main entity object.A MatchClause is made up of a property or attribute to compare against and a desired value for that property or attribute.
Example:
Match all of the following clauses:
- Attribute('TYPE') = [desired value]
- Property('PROPERTY_CODE') = [desired value]
Looks like this:
SearchCriteria sc = new SearchCriteria();
sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, "A_TYPE_CODE"));
sc.addMatchClause(MatchClause.createPropertyMatch("PROPERTY_CODE", "a property value"));
Extension of the previous example with with experiment criteria:
SearchCriteria ec = new SearchCriteria();
ec.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, "EXP_CODE"));
sc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(ec));
For other sub criteria types see
SearchSubCriteria
.- See Also:
SearchSubCriteria
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchCriteria.AnyFieldMatchClause
A MatchClause for checking that any of the properties or attributes equals a desired value.static class
SearchCriteria.AnyPropertyMatchClause
A MatchClause for checking that any of the properties equals a desired value.static class
SearchCriteria.AttributeMatchClause
A MatchClause for checking that an attribute equals a desired value.static class
SearchCriteria.CompareMode
static class
SearchCriteria.MatchClause
A specification of one field (either property or attribute) and desired value for that field.static class
SearchCriteria.MatchClauseAttribute
An enum listing the different attributes that can be compared against.static class
SearchCriteria.MatchClauseFieldType
An enum listing the different field types that can be compared against.static class
SearchCriteria.MatchClauseTimeAttribute
An enum listing the different attributes containing time values that can be compared against.static class
SearchCriteria.PropertyMatchClause
A MatchClause for checking that a property equals a desired value.static class
SearchCriteria.SearchOperator
Operators for combining MatchClause objects.static class
SearchCriteria.TimeAttributeMatchClause
A MatchClause for comparing a time attribute to a specified value.
-
Constructor Summary
Constructors Constructor Description SearchCriteria()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMatchClause(SearchCriteria.MatchClause criterion)
Add a new match clause.void
addSubCriteria(SearchSubCriteria criteria)
Add a new sub search criteria.boolean
equals(java.lang.Object obj)
java.util.List<SearchCriteria.MatchClause>
getMatchClauses()
Get a list of MatchClause objects this SearchCriteria will match against.SearchCriteria.SearchOperator
getOperator()
Gets the operator for combining MatchClause objects.java.util.List<SearchSubCriteria>
getSubCriterias()
Get a list ofSearchSubCriteria
objects for this SearchCriteria.int
hashCode()
void
setOperator(SearchCriteria.SearchOperator operator)
Set the operator for combining MatchClause objects.java.lang.String
toString()
-
-
-
Method Detail
-
setOperator
public void setOperator(SearchCriteria.SearchOperator operator)
Set the operator for combining MatchClause objects.
-
getOperator
public SearchCriteria.SearchOperator getOperator()
Gets the operator for combining MatchClause objects. Default value isSearchCriteria.SearchOperator
.MATCH_ALL_CRITERIA.
-
getMatchClauses
public java.util.List<SearchCriteria.MatchClause> getMatchClauses()
Get a list of MatchClause objects this SearchCriteria will match against.
-
addMatchClause
public void addMatchClause(SearchCriteria.MatchClause criterion)
Add a new match clause.
-
getSubCriterias
public java.util.List<SearchSubCriteria> getSubCriterias()
Get a list ofSearchSubCriteria
objects for this SearchCriteria.
-
addSubCriteria
public void addSubCriteria(SearchSubCriteria criteria)
Add a new sub search criteria.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-