Class ESAuditChangeFinder

java.lang.Object
org.nuxeo.drive.service.impl.AuditChangeFinder
org.nuxeo.drive.elasticsearch.ESAuditChangeFinder
All Implemented Interfaces:
FileSystemChangeFinder

public class ESAuditChangeFinder extends AuditChangeFinder
Override the JPA audit based change finder to execute query in ES.

The structure of the query executed by the AuditChangeFinder is:

 
 from LogEntry log where log.repositoryId = :repositoryId

 + AND if ActiveRoots (activeRoots) NOT empty

 from LogEntry log where log.repositoryId = :repositoryId and (
 LIST_DOC_EVENTS_IDS_QUERY and ( ROOT_PATHS or COLECTIONS_PATHS) or
 (log.category = 'NuxeoDrive' and log.eventId != 'rootUnregistered') )


 if ActiveRoots EMPTY:

 from LogEntry log where log.repositoryId = :repositoryId and ((log.category =
 'NuxeoDrive' and log.eventId != 'rootUnregistered'))

 + AND (log.id > :lowerBound and log.id <= :upperBound) + order by
 log.repositoryId asc, log.eventDate desc
 
 
Since:
7.3
  • Field Details

  • Constructor Details

    • ESAuditChangeFinder

      public ESAuditChangeFinder()
  • Method Details

    • queryESAuditEntries

      protected List<LogEntry> queryESAuditEntries(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound, int limit)
    • buildFilterClauses

      protected org.opensearch.index.query.QueryBuilder buildFilterClauses(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound)
    • getLogIdBoundsClause

      protected org.opensearch.index.query.RangeQueryBuilder getLogIdBoundsClause(long lowerBound, long upperBound)
    • getCollectionSyncRootClause

      protected org.opensearch.index.query.TermsQueryBuilder getCollectionSyncRootClause(Set<String> collectionSyncRootMemberIds)
    • getCurrentRootsClause

      protected org.opensearch.index.query.BoolQueryBuilder getCurrentRootsClause(Set<String> rootPaths)
    • getDriveLogsQueryClause

      protected org.opensearch.index.query.BoolQueryBuilder getDriveLogsQueryClause()
    • getEventsClause

      protected org.opensearch.index.query.BoolQueryBuilder getEventsClause(String category, String[] eventIds, boolean shouldMatch)
    • getUpperBound

      public long getUpperBound()
      Description copied from class: AuditChangeFinder
      Returns the last available log id in the audit log table (primary key) to be used as the upper bound of the event log id range clause in the change query.
      Specified by:
      getUpperBound in interface FileSystemChangeFinder
      Overrides:
      getUpperBound in class AuditChangeFinder
    • queryAuditEntries

      protected List<LogEntry> queryAuditEntries(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound, int limit)
      Overrides:
      queryAuditEntries in class AuditChangeFinder
    • getClient

      protected ESClient getClient()
    • getESIndexName

      protected String getESIndexName()
    • logSearchRequest

      protected void logSearchRequest(org.opensearch.action.search.SearchRequest request)
    • logSearchResponse

      protected void logSearchResponse(org.opensearch.action.search.SearchResponse response)