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 aQuery
testing 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
_operator
The operator.protected AdaptableDate
_value
The value to test.static DateTimeFormatter
DATE_FORMATTER
The 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 void
appendDateValue(StringBuilder query, Query.Operator operator, AdaptableDate value)
Format and append the given date to a StringBuilder.String
build()
Build the solr query string representing the Query object.boolean
equals(Object obj)
Query.Operator
getOperator()
Get the operator.AdaptableDate
getValue()
Get the value.int
hashCode()
-
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:Query
Build 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:
hashCode
in classAbstractFieldQuery
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in 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.
-
-