Package org.ametys.cms.search.query
Class DateQuery
- java.lang.Object
-
- org.ametys.cms.search.query.AbstractFieldQuery
-
- org.ametys.cms.search.query.DateQuery
-
- All Implemented Interfaces:
Query
public class DateQuery extends AbstractFieldQuery
Represents aQuerytesting a date field.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.cms.search.query.Query
Query.LogicalOperator, Query.Operator
-
-
Field Summary
Fields Modifier and Type Field Description protected Query.Operator_operatorThe operator.protected AdaptableDate_valueThe value to test.static DateTimeFormatterDATE_FORMATTERThe date formatter-
Fields inherited from class org.ametys.cms.search.query.AbstractFieldQuery
_fieldPath
-
-
Constructor Summary
Constructors Constructor Description DateQuery(String fieldPath)Build a DateQuery testing the existence of the field.DateQuery(String fieldPath, LocalDate value)Build a DateQuery.DateQuery(String fieldPath, Query.Operator op, LocalDate value)Build a DateQuery.DateQuery(String fieldPath, Query.Operator op, AdaptableDate value)Build a DateQuery.DateQuery(String fieldPath, AdaptableDate value)Build a DateQuery.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidappendDateValue(StringBuilder query, Query.Operator operator, AdaptableDate value)Format and append the given date to a StringBuilder.Stringbuild()Build the solr query string representing the Query object.booleanequals(Object obj)Query.OperatorgetOperator()Get the operator.AdaptableDategetValue()Get the value.inthashCode()-
Methods inherited from class org.ametys.cms.search.query.AbstractFieldQuery
getFieldPath
-
-
-
-
Field Detail
-
DATE_FORMATTER
public static final DateTimeFormatter DATE_FORMATTER
The date formatter
-
_operator
protected Query.Operator _operator
The operator.
-
_value
protected AdaptableDate _value
The value to test.
-
-
Constructor Detail
-
DateQuery
public DateQuery(String fieldPath)
Build a DateQuery testing the existence of the field.- Parameters:
fieldPath- the field path.
-
DateQuery
public DateQuery(String fieldPath, LocalDate value)
Build a DateQuery.- Parameters:
fieldPath- the field's pathvalue- the value.
-
DateQuery
public DateQuery(String fieldPath, AdaptableDate value)
Build a DateQuery.- Parameters:
fieldPath- the field's pathvalue- the value.
-
DateQuery
public DateQuery(String fieldPath, Query.Operator op, LocalDate value)
Build a DateQuery.- Parameters:
fieldPath- the field's pathop- the operator.value- the value.
-
DateQuery
public DateQuery(String fieldPath, Query.Operator op, AdaptableDate value)
Build a DateQuery.- Parameters:
fieldPath- the field's pathop- the operator.value- the value.
-
-
Method Detail
-
getOperator
public Query.Operator getOperator()
Get the operator.- Returns:
- the operator.
-
getValue
public AdaptableDate getValue()
Get the value.- Returns:
- the value.
-
build
public String build() throws QuerySyntaxException
Description copied from interface:QueryBuild the solr query string representing the Query object.- Returns:
- the solr query string representing the Query object.
- Throws:
QuerySyntaxException- if the query can't be built because of a syntax error.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractFieldQuery
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractFieldQuery
-
appendDateValue
public static void appendDateValue(StringBuilder query, Query.Operator operator, AdaptableDate value)
Format and append the given date to a StringBuilder.- Parameters:
query- The string builder containing the query being built.operator- The query operator.value- The test value.
-
-