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

public abstract class AbstractSearchOperation extends AbstractReadOperation
Base class that all search operations should implement.
  • Field Details

    • typeGUID

      protected final String typeGUID
    • fromElement

      protected final int fromElement
    • limitResultsByStatus

      protected final List<InstanceStatus> limitResultsByStatus
    • matchClassifications

      protected final SearchClassifications matchClassifications
    • sequencingProperty

      protected final String sequencingProperty
    • sequencingOrder

      protected final SequencingOrder sequencingOrder
    • pageSize

      protected final int pageSize
    • userId

      protected final String 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 XTDB
      typeGUID - unique identifier of a type definition by which to limit results
      fromElement - starting element for paged results
      limitResultsByStatus - list of statuses by which to limit results
      matchClassifications - classification criteria by which to limit results
      asOfTime - the point-in-time for which to retrieve results
      sequencingProperty - the name of the property by which to sort results (only applicable when sorting by property)
      sequencingOrder - the mechanism to use for sorting results
      pageSize - the number of results to include per page
      userId - 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 XTDB
      typeGUID - unique identifier of a type definition by which to limit results
      fromElement - starting element for paged results
      limitResultsByStatus - list of statuses by which to limit results
      matchClassifications - classification criteria by which to limit results
      existingDB - the already-opened point-in-time from which to retrieve results
      sequencingProperty - the name of the property by which to sort results (only applicable when sorting by property)
      sequencingOrder - the mechanism to use for sorting results
      pageSize - the number of results to include per page
      userId - 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 repository
      TimeoutException - if the query times out
      RepositoryErrorException - 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 database
      category - 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 paging
      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)
      pageSize - maximum number of results per page
      namespace - by which to qualify the matchProperties
      userId - 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 repository
      RepositoryErrorException - 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 conditions
      category - 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 matchProperties
      userId - 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 database
      category - 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 paging
      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)
      pageSize - maximum number of results per page
      namespace - by which to qualify the matchProperties
      userId - 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 repository
      RepositoryErrorException - 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 query
      fromElement - starting point for the page
      pageSize - number of elements to include in the page
      Returns:
      Collection<List<?>> of only the single page of results specified