Package org.geotools.filter.text.commons
Class AbstractFilterBuilder
- Object
-
- AbstractFilterBuilder
-
public abstract class AbstractFilterBuilder extends Object
This abstract class provides the common behavior to build the filters for the related semantic actions of parsing language process.Builds Filter or Expression and their components (literal, functions, etc). It maintains the results of semantic actions in the stack used to build complex filters and expressions.
Warning: This component is not published. It is part of module implementation. Client module should not use this feature.
- Since:
- 2.6
- Author:
- Mauricio Pazos (Axios Engineering)
-
-
Field Summary
Fields Modifier and Type Field Description protected String
cqlSource
protected FilterFactory
filterFactory
-
Constructor Summary
Constructors Constructor Description AbstractFilterBuilder(String cqlSource, FilterFactory filterFactory)
New instance of FilterBuilder
-
Method Summary
-
-
-
Field Detail
-
filterFactory
protected final FilterFactory filterFactory
-
cqlSource
protected final String cqlSource
-
-
Constructor Detail
-
AbstractFilterBuilder
public AbstractFilterBuilder(String cqlSource, FilterFactory filterFactory)
New instance of FilterBuilder
-
-
Method Detail
-
getFilterFactory
protected FilterFactory getFilterFactory()
-
getResultStack
protected final BuildResultStack getResultStack()
-
getStatement
protected final String getStatement()
-
pushResult
public void pushResult(Result result)
Adds in the result stack the partial result associated to node.
-
peekResult
public Result peekResult()
-
getFilter
public Filter getFilter() throws CQLException
- Throws:
CQLException
-
getExpression
public Expression getExpression() throws CQLException
- Throws:
CQLException
-
getFilterList
public List<Filter> getFilterList() throws CQLException
- Throws:
CQLException
-
buildAddExpression
public BinaryExpression buildAddExpression() throws CQLException
- Throws:
CQLException
-
buildSubtractExression
public BinaryExpression buildSubtractExression() throws CQLException
- Throws:
CQLException
-
buildMultiplyExpression
public BinaryExpression buildMultiplyExpression() throws CQLException
- Throws:
CQLException
-
buildDivideExpression
public BinaryExpression buildDivideExpression() throws CQLException
- Throws:
CQLException
-
buildAndFilter
public Filter buildAndFilter() throws CQLException
- Throws:
CQLException
-
buildOrFilter
public Filter buildOrFilter() throws CQLException
- Throws:
CQLException
-
buildNotFilter
public Filter buildNotFilter() throws CQLException
- Throws:
CQLException
-
buildLikeFilter
public PropertyIsLike buildLikeFilter(boolean matchCase) throws CQLException
Builds a like filter- Returns:
- a PropertyIsLike
- Throws:
CQLException
-
buildPropertyIsNull
public PropertyIsNull buildPropertyIsNull() throws CQLException
Builds property is null filter- Returns:
- PropertyIsNull
- Throws:
CQLException
-
buildPorpertyNotIsNull
public Not buildPorpertyNotIsNull() throws CQLException
- Throws:
CQLException
-
buildBetween
public PropertyIsBetween buildBetween() throws CQLException
builds PropertyIsBetween filter- Returns:
- PropertyIsBetween
- Throws:
CQLException
-
buildNotBetween
public Not buildNotBetween() throws CQLException
- Throws:
CQLException
-
buildNotLikeFilter
public Not buildNotLikeFilter(boolean matchCase) throws CQLException
- Throws:
CQLException
-
buildPropertyExists
public PropertyIsEqualTo buildPropertyExists() throws CQLException
Creates PropertyIsEqualTo with PropertyExists predicate- Returns:
- PropertyIsEqualTo
- Throws:
CQLException
-
buildDateExpression
public Literal buildDateExpression(IToken token) throws CQLException
- Throws:
CQLException
-
buildDateTimeExpression
public Literal buildDateTimeExpression(IToken token) throws CQLException
Creates a literal with date time- Parameters:
token
- with date time- Returns:
- Literal
- Throws:
CQLException
-
asLiteralDate
protected Literal asLiteralDate(String cqlDate) throws CQLException
- Throws:
CQLException
-
asLiteralDateTime
protected Literal asLiteralDateTime(String cqlDateTime) throws CQLException
Transforms the cqlDateTime to a literal date.- Parameters:
cqlDateTime
- a string with the format yyyy-MM-ddTHH:mm:ss.s[(+|-)HH:mm]- Returns:
- a literal Date
- Throws:
CQLException
-
buildTrueLiteral
public Literal buildTrueLiteral()
-
buildFalseLiteral
public Literal buildFalseLiteral()
-
removeQuotes
protected String removeQuotes(String source)
Removes initial and final "'" from string. If some "''" is found it will be changed by a single quote "'".- Returns:
- string without initial and final quote, and "''" replaced by "'".
-
buildIdentifier
public String buildIdentifier(int nodeIdentifier) throws CQLException
- Throws:
CQLException
-
buildIdentifierPart
public String buildIdentifierPart(IToken token)
Creates the identifier part. An identifier like "idpart1:idpart2:idpart3: ... idpartN" has N part.- Returns:
- identifier part
-
buildSimpleAttribute
public PropertyName buildSimpleAttribute() throws CQLException
- Throws:
CQLException
-
buildCompoundAttribute
public PropertyName buildCompoundAttribute(int nodeSimpleAttr, String nodeAttrSeparator) throws CQLException
- Returns:
- PropertyName
- Throws:
CQLException
-
buildDistanceUnit
public Literal buildDistanceUnit(IToken token) throws CQLException
- Throws:
CQLException
-
buildTolerance
public Literal buildTolerance() throws CQLException
- Throws:
CQLException
-
buildSpatialEqualFilter
public BinarySpatialOperator buildSpatialEqualFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialDisjointFilter
public BinarySpatialOperator buildSpatialDisjointFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialIntersectsFilter
public BinarySpatialOperator buildSpatialIntersectsFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialRelateFilter
public PropertyIsEqualTo buildSpatialRelateFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialTouchesFilter
public BinarySpatialOperator buildSpatialTouchesFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialCrossesFilter
public BinarySpatialOperator buildSpatialCrossesFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialWithinFilter
public BinarySpatialOperator buildSpatialWithinFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialContainsFilter
public BinarySpatialOperator buildSpatialContainsFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialOverlapsFilter
public BinarySpatialOperator buildSpatialOverlapsFilter() throws CQLException
- Throws:
CQLException
-
buildBBox
public BBOX buildBBox() throws CQLException
- Throws:
CQLException
-
buildBBoxWithCRS
public BBOX buildBBoxWithCRS() throws CQLException
- Throws:
CQLException
-
buildSpatialDWithinFilter
public DistanceBufferOperator buildSpatialDWithinFilter() throws CQLException
- Throws:
CQLException
-
buildSpatialBeyondFilter
public DistanceBufferOperator buildSpatialBeyondFilter() throws CQLException
- Throws:
CQLException
-
buildPeriodBetweenDates
public PeriodNode buildPeriodBetweenDates() throws CQLException
builds a PeriodNode (date1,date2)- Returns:
- PeriodNode
- Throws:
CQLException
-
buildPeriodDurationAndDate
public PeriodNode buildPeriodDurationAndDate() throws CQLException
builds a Period Node with (duration,date).- Returns:
- PeriodNode
- Throws:
CQLException
-
buildPeriodDateAndDuration
public PeriodNode buildPeriodDateAndDuration() throws CQLException
builds a Period with (date,duration)- Returns:
- PeriodNode
- Throws:
CQLException
-
buildDurationExpression
public Literal buildDurationExpression(IToken token)
Create an integer literal with duration value.- Returns:
- Literal
-
buildPropertyBetweenDates
public And buildPropertyBetweenDates() throws CQLException
Create an AND filter with property between dates of period. (firstDate<= property <= lastDate)- Returns:
- And filter
- Throws:
CQLException
-
buildPropertyIsGTEFirstDate
public PropertyIsGreaterThanOrEqualTo buildPropertyIsGTEFirstDate() throws CQLException
Builds PropertyIsGreaterThanOrEqualTo begin of period- Returns:
- PropertyIsGreaterThanOrEqualTo
- Throws:
CQLException
-
buildPropertyIsGTLastDate
public PropertyIsGreaterThan buildPropertyIsGTLastDate() throws CQLException
creates PropertyIsGreaterThan end date of period- Returns:
- PropertyIsGreaterThan
- Throws:
CQLException
-
buildPropertyIsLTFirsDate
public PropertyIsLessThan buildPropertyIsLTFirsDate() throws CQLException
- Returns:
- PropertyIsLessThan
- Throws:
CQLException
-
buildPropertyIsLTELastDate
public PropertyIsLessThanOrEqualTo buildPropertyIsLTELastDate() throws CQLException
- Returns:
- PropertyIsLessThanOrEqualTo
- Throws:
CQLException
-
buildEquals
public PropertyIsEqualTo buildEquals() throws CQLException
- Returns:
- PropertyIsEqualTo
- Throws:
CQLException
-
buildGreater
public PropertyIsGreaterThan buildGreater() throws CQLException
- Returns:
- PropertyIsGreaterThan
- Throws:
CQLException
-
buildLess
public PropertyIsLessThan buildLess() throws CQLException
- Returns:
- PropertyIsLessThan
- Throws:
CQLException
-
buildGreaterOrEqual
public PropertyIsGreaterThanOrEqualTo buildGreaterOrEqual() throws CQLException
- Returns:
- PropertyIsGreaterThanOrEqualTo
- Throws:
CQLException
-
buildLessOrEqual
public PropertyIsLessThanOrEqualTo buildLessOrEqual() throws CQLException
- Returns:
- PropertyIsLessThanOrEqualTo
- Throws:
CQLException
-
buildGeometry
public Literal buildGeometry(IToken geometry) throws CQLException
Builds geometry- Returns:
- a geometry
- Throws:
CQLException
-
scanExpression
protected String scanExpression(IToken initialToken)
Extracts expression between initial token and last token in buffer.- Returns:
- String the expression
-
transformWKTGeometry
protected String transformWKTGeometry(String wktGeom)
This transformation is required because some geometries like Multipoint has different definition in vividsolucion library.Then OGC require MULTIPOINT((1 2), (3 4)) but vividsolunion works without point "(" ans ")" MULTIPOINT(1 2, 3 4)
- Parameters:
wktGeom
- ogc wkt geometry- Returns:
- String vividsolution geometry
-
buildEnvelope
public Literal buildEnvelope(IToken token) throws CQLException
Returns the Envelope- Returns:
- Literal
- Throws:
CQLException
-
buildFunction
public Function buildFunction(int functionNode) throws CQLException
Builds a function expression- Parameters:
functionNode
- symbol used to identify the function node in parser tree- Returns:
- Function
- Throws:
CQLException
-
buildTEquals
public TEquals buildTEquals() throws CQLException
BUild a TEquals date filter.- Throws:
CQLException
-
buildAfterDate
public After buildAfterDate() throws CQLException
Build an After date filter- Returns:
- After
- Throws:
CQLException
-
buildAfterPeriod
public After buildAfterPeriod() throws CQLException
Builds an after period filter- Returns:
- after
- Throws:
CQLException
-
buildBeforeDate
public Before buildBeforeDate() throws CQLException
- Throws:
CQLException
-
buildBeforePeriod
public Before buildBeforePeriod() throws CQLException
- Throws:
CQLException
-
buildDuringPeriod
public During buildDuringPeriod() throws CQLException
- Throws:
CQLException
-
buildDuringOrAfter
public Or buildDuringOrAfter() throws CQLException
Builds an Or filter composed of During and After.- Returns:
- Or filter
- Throws:
CQLException
-
buildBeforeOrDuring
public Or buildBeforeOrDuring() throws CQLException
Builds an Or filter composed of Before and During filters.- Returns:
- Or filter
- Throws:
CQLException
-
-