Package com.luciad.ogc.csw.server
Class ALcdCSWFilterQueryHandler
java.lang.Object
com.luciad.ogc.csw.server.ALcdCSWFilterQueryHandler
- All Implemented Interfaces:
ILcdCSWQueryHandler
Abstract handler for OGC Filter based catalog record queries.
It takes care of all data-independent functionality.
The data-dependent functionality is to
execute an OGC Filter query
.
The method should retrieve metadata from a data storage, such as a database or in-memory collection.
The simplest implementation of a filter query handler is backed by an in-memory collection of Dublin Core records
.
It can use TLcdOGCFilter.asPredicate(com.luciad.ogc.filter.evaluator.TLcdOGCFilterContext)
and TLcdOGCSortBy.asComparator(com.luciad.ogc.filter.evaluator.TLcdOGCFilterContext)
to filter and sort, and
TLcdCSWRecordTransformationFactory
to perform the needed record transformations.
Database backed implementations should translate the filter, pagination, and sorting constraints into equivalent database query statements, such as SQL or QueryDSL.
- Since:
- 2017.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Object
executeFilter
(TLcdOGCFilter filter, TLcdCSWQuery aQuery, TLcdCSWRecordType aOutputFormat, long aMaxRecords, long aStartPosition, ILcdRequest aRequest) Returns the result of applying the given OGC filter expression to the underlying data set(s) corresponding to the typesreferred to
in the query.final Object
executeQuery
(TLcdCSWQuery aQuery, long aMaxRecords, long aStartPosition, TLcdCSWRecordType aOutputFormat, ILcdRequest aRequest) Executes the given query and returns its result.boolean
validateQuery
(TLcdCSWQuery aQuery, ILcdRequest aRequest) Returns true if the given query is a valid query, meaning that is is syntactically correct and uses the right property and type names.
-
Constructor Details
-
ALcdCSWFilterQueryHandler
public ALcdCSWFilterQueryHandler()
-
-
Method Details
-
validateQuery
public boolean validateQuery(TLcdCSWQuery aQuery, ILcdRequest aRequest) throws TLcdCSWServiceException Description copied from interface:ILcdCSWQueryHandler
Returns true if the given query is a valid query, meaning that is is syntactically correct and uses the right property and type names.- Specified by:
validateQuery
in interfaceILcdCSWQueryHandler
- Parameters:
aQuery
- the query to validateaRequest
- the request triggering the query- Returns:
- true if the given query is a valid query, false otherwise.
- Throws:
TLcdCSWServiceException
- can be thrown to provide more meaningful error messages
-
executeQuery
public final Object executeQuery(TLcdCSWQuery aQuery, long aMaxRecords, long aStartPosition, TLcdCSWRecordType aOutputFormat, ILcdRequest aRequest) throws TLcdCSWServiceException Description copied from interface:ILcdCSWQueryHandler
Executes the given query and returns its result.- Specified by:
executeQuery
in interfaceILcdCSWQueryHandler
- Parameters:
aQuery
- A query to executeaMaxRecords
- the maximum number of records to returnaStartPosition
- The start position to return queries foraOutputFormat
- the output format for the recordaRequest
- the request triggering the query- Returns:
- a result set corresponding to the output format and output schema (for example,
TLcdCSWSearchResults
with Dublin Core or ISO metadata, or anatom feed
- Throws:
TLcdCSWServiceException
- if the query could not be executed
-
executeFilter
protected abstract Object executeFilter(TLcdOGCFilter filter, TLcdCSWQuery aQuery, TLcdCSWRecordType aOutputFormat, long aMaxRecords, long aStartPosition, ILcdRequest aRequest) throws TLcdCSWServiceException Returns the result of applying the given OGC filter expression to the underlying data set(s) corresponding to the typesreferred to
in the query. The implementation is responsible for pagination, sorting, and transforming the results into the request output type.- Parameters:
filter
- An OGC Filter. Can be null, in which case no filter should be applied.aQuery
- additional query properties of the corresponding GetRecords or GetRecordByID requestaOutputFormat
- the requested record output formataMaxRecords
- The maximum amount of records to returnaStartPosition
- a start position: a positive non-zero value included in the query.aRequest
- the request triggering the query- Returns:
- a result set corresponding to the output format and output schema (usually a
TLcdCSWSearchResults
object with Dubline Core or ISO metadata, or anatom feed
) - Throws:
TLcdCSWServiceException
- if the query could not be executed
-