Class AbstractSearchOperation
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractReadOperation
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractSearchOperation
- Direct Known Subclasses:
AbstractEntitySearchOperation
,AbstractRelationshipSearchOperation
Base class that all search operations should implement.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final int
protected final List<InstanceStatus>
protected final SearchClassifications
protected final int
protected final SequencingOrder
protected final String
protected final String
protected final String
Fields inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractReadOperation
asOfTime, existingDB, xtdb
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractSearchOperation
(XTDBOMRSRepositoryConnector xtdb, String typeGUID, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, Date asOfTime, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String userId) Create a new search operation.protected
AbstractSearchOperation
(XTDBOMRSRepositoryConnector xtdb, String typeGUID, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, xtdb.api.IXtdbDatasource existingDB, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String userId) Create a new search operation. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<List<?>>
deduplicateAndPage
(xtdb.api.ICursor<List<?>> results, int fromElement, int pageSize) De-duplicate and return only the selected page of results from the provided collection of XTDB query results.protected abstract Collection<List<?>>
runQuery
(xtdb.api.IXtdbDatasource db) Interface that must be implemented to actually execute the query logic.protected Collection<List<?>>
searchXtdb
(xtdb.api.IXtdbDatasource db, TypeDefCategory category, String typeGuid, List<String> subtypeGuids, SearchProperties matchProperties, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String namespace, String userId) Search XTDB based on the provided parameters, using an already-opened point-in-time view of the database (should work across both Entities and Relationships).protected Collection<List<?>>
searchXtdbText
(xtdb.api.IXtdbDatasource db, TypeDefCategory category, String typeGuid, String searchCriteria, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String namespace, String userId) Search all text properties in XTDB based on the provided parameters, using an already-opened point-in-time view of the database (should work across both Entities and Relationships).protected void
updateQuery
(XTDBQuery query, TypeDefCategory category, String typeGuid, List<String> subtypeGuids, SearchProperties matchProperties, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, String sequencingProperty, SequencingOrder sequencingOrder, String namespace, String userId) Update the provided query with the specified parameters.Methods inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractReadOperation
getXtdbObjectByReference
-
Field Details
-
typeGUID
-
fromElement
protected final int fromElement -
limitResultsByStatus
-
matchClassifications
-
sequencingProperty
-
sequencingOrder
-
pageSize
protected final int pageSize -
userId
-
-
Constructor Details
-
AbstractSearchOperation
protected AbstractSearchOperation(XTDBOMRSRepositoryConnector xtdb, String typeGUID, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, Date asOfTime, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String userId) Create a new search operation.- Parameters:
xtdb
- connectivity to XTDBtypeGUID
- unique identifier of a type definition by which to limit resultsfromElement
- starting element for paged resultslimitResultsByStatus
- list of statuses by which to limit resultsmatchClassifications
- classification criteria by which to limit resultsasOfTime
- the point-in-time for which to retrieve resultssequencingProperty
- the name of the property by which to sort results (only applicable when sorting by property)sequencingOrder
- the mechanism to use for sorting resultspageSize
- the number of results to include per pageuserId
- executing the search
-
AbstractSearchOperation
protected AbstractSearchOperation(XTDBOMRSRepositoryConnector xtdb, String typeGUID, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, xtdb.api.IXtdbDatasource existingDB, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String userId) Create a new search operation.- Parameters:
xtdb
- connectivity to XTDBtypeGUID
- unique identifier of a type definition by which to limit resultsfromElement
- starting element for paged resultslimitResultsByStatus
- list of statuses by which to limit resultsmatchClassifications
- classification criteria by which to limit resultsexistingDB
- the already-opened point-in-time from which to retrieve resultssequencingProperty
- the name of the property by which to sort results (only applicable when sorting by property)sequencingOrder
- the mechanism to use for sorting resultspageSize
- the number of results to include per pageuserId
- executing the search
-
-
Method Details
-
runQuery
protected abstract Collection<List<?>> runQuery(xtdb.api.IXtdbDatasource db) throws TypeErrorException, TimeoutException, RepositoryErrorException Interface that must be implemented to actually execute the query logic.- Parameters:
db
- the datasource against which to run the query- Returns:
Collection<List<?>>
of internal XT references (IDs) that match the query- Throws:
TypeErrorException
- if a requested type for searching is not known to the repositoryTimeoutException
- if the query times outRepositoryErrorException
- if there is any issue iterating through the results
-
searchXtdb
protected Collection<List<?>> searchXtdb(xtdb.api.IXtdbDatasource db, TypeDefCategory category, String typeGuid, List<String> subtypeGuids, SearchProperties matchProperties, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String namespace, String userId) throws TypeErrorException, RepositoryErrorException Search XTDB based on the provided parameters, using an already-opened point-in-time view of the database (should work across both Entities and Relationships).- Parameters:
db
- already opened point-in-time view of the databasecategory
- to limit the search to either entities or relationships (required)typeGuid
- to limit the search by type (optional)subtypeGuids
- to limit the search to a set of subtypes (optional)matchProperties
- by which to limit the results (optional)fromElement
- starting element for paginglimitResultsByStatus
- by which to limit results (optional)matchClassifications
- by which to limit entity results (must be null for relationships) (optional)sequencingProperty
- by which to order the results (required if sequencingOrder involves a property)sequencingOrder
- by which to order results (optional, will default to GUID)pageSize
- maximum number of results per pagenamespace
- by which to qualify the matchPropertiesuserId
- of the user running the query- Returns:
Collection<List<?>>
list of the XTDB document references that match- Throws:
TypeErrorException
- if a requested type for searching is not known to the repositoryRepositoryErrorException
- if there is any issue iterating through the results
-
updateQuery
protected void updateQuery(XTDBQuery query, TypeDefCategory category, String typeGuid, List<String> subtypeGuids, SearchProperties matchProperties, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, String sequencingProperty, SequencingOrder sequencingOrder, String namespace, String userId) throws TypeErrorException Update the provided query with the specified parameters.- Parameters:
query
- into which to add conditionscategory
- to limit the search to either entities or relationships (required)typeGuid
- to limit the search by type (optional)subtypeGuids
- to limit the search to a set of subtypes (optional)matchProperties
- by which to limit the results (optional)limitResultsByStatus
- by which to limit results (optional)matchClassifications
- by which to limit entity results (must be null for relationships) (optional)sequencingProperty
- by which to order the results (required if sequencingOrder involves a property)sequencingOrder
- by which to order results (optional, will default to GUID)namespace
- by which to qualify the matchPropertiesuserId
- of the user running the query- Throws:
TypeErrorException
- if a requested type for searching is not known to the repository
-
searchXtdbText
protected Collection<List<?>> searchXtdbText(xtdb.api.IXtdbDatasource db, TypeDefCategory category, String typeGuid, String searchCriteria, int fromElement, List<InstanceStatus> limitResultsByStatus, SearchClassifications matchClassifications, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize, String namespace, String userId) throws TypeErrorException, RepositoryErrorException Search all text properties in XTDB based on the provided parameters, using an already-opened point-in-time view of the database (should work across both Entities and Relationships).- Parameters:
db
- already opened point-in-time view of the databasecategory
- to limit the search to either entities or relationships (required)typeGuid
- to limit the search by type (optional)searchCriteria
- by which to limit the results (required, must be a Java regular expression)fromElement
- starting element for paginglimitResultsByStatus
- by which to limit results (optional)matchClassifications
- by which to limit entity results (must be null for relationships) (optional)sequencingProperty
- by which to order the results (required if sequencingOrder involves a property)sequencingOrder
- by which to order results (optional, will default to GUID)pageSize
- maximum number of results per pagenamespace
- by which to qualify the matchPropertiesuserId
- of the user running the query- Returns:
Collection<List<?>>
list of the XTDB document references that match- Throws:
TypeErrorException
- if a requested type for searching is not known to the repositoryRepositoryErrorException
- if there is any issue iterating through the results
-
deduplicateAndPage
protected Collection<List<?>> deduplicateAndPage(xtdb.api.ICursor<List<?>> results, int fromElement, int pageSize) De-duplicate and return only the selected page of results from the provided collection of XTDB query results.- Parameters:
results
- from a XTDB queryfromElement
- starting point for the pagepageSize
- number of elements to include in the page- Returns:
Collection<List<?>>
of only the single page of results specified
-