Package org.nuxeo.drive.elasticsearch
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 Summary
Fields Modifier and Type Field Description protected static String
EVENT_ID
-
Fields inherited from class org.nuxeo.drive.service.impl.AuditChangeFinder
parameters
-
-
Constructor Summary
Constructors Constructor Description ESAuditChangeFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.elasticsearch.index.query.QueryBuilder
buildFilterClauses(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound)
protected ESClient
getClient()
protected org.elasticsearch.index.query.TermsQueryBuilder
getCollectionSyncRootClause(Set<String> collectionSyncRootMemberIds)
protected org.elasticsearch.index.query.BoolQueryBuilder
getCurrentRootsClause(Set<String> rootPaths)
protected org.elasticsearch.index.query.BoolQueryBuilder
getDriveLogsQueryClause()
protected String
getESIndexName()
protected org.elasticsearch.index.query.BoolQueryBuilder
getEventsClause(String category, String[] eventIds, boolean shouldMatch)
protected org.elasticsearch.index.query.RangeQueryBuilder
getLogIdBoundsClause(long lowerBound, long upperBound)
long
getUpperBound()
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.protected void
logSearchRequest(org.elasticsearch.action.search.SearchRequest request)
protected void
logSearchResponse(org.elasticsearch.action.search.SearchResponse response)
protected List<LogEntry>
queryAuditEntries(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound, int limit)
protected List<LogEntry>
queryESAuditEntries(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound, int limit)
-
Methods inherited from class org.nuxeo.drive.service.impl.AuditChangeFinder
getCollectionSyncRootFilteringClause, getCurrentRootFilteringClause, getFileSystemChanges, getFileSystemItemChange, getJPARangeClause, handleParameters
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.drive.service.FileSystemChangeFinder
getUpperBound
-
-
-
-
Field Detail
-
EVENT_ID
protected static final String EVENT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
queryESAuditEntries
protected List<LogEntry> queryESAuditEntries(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound, int limit)
-
buildFilterClauses
protected org.elasticsearch.index.query.QueryBuilder buildFilterClauses(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound)
-
getLogIdBoundsClause
protected org.elasticsearch.index.query.RangeQueryBuilder getLogIdBoundsClause(long lowerBound, long upperBound)
-
getCollectionSyncRootClause
protected org.elasticsearch.index.query.TermsQueryBuilder getCollectionSyncRootClause(Set<String> collectionSyncRootMemberIds)
-
getCurrentRootsClause
protected org.elasticsearch.index.query.BoolQueryBuilder getCurrentRootsClause(Set<String> rootPaths)
-
getDriveLogsQueryClause
protected org.elasticsearch.index.query.BoolQueryBuilder getDriveLogsQueryClause()
-
getEventsClause
protected org.elasticsearch.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 interfaceFileSystemChangeFinder
- Overrides:
getUpperBound
in classAuditChangeFinder
-
queryAuditEntries
protected List<LogEntry> queryAuditEntries(CoreSession session, SynchronizationRoots activeRoots, Set<String> collectionSyncRootMemberIds, long lowerBound, long upperBound, int limit)
- Overrides:
queryAuditEntries
in classAuditChangeFinder
-
getClient
protected ESClient getClient()
-
getESIndexName
protected String getESIndexName()
-
logSearchRequest
protected void logSearchRequest(org.elasticsearch.action.search.SearchRequest request)
-
logSearchResponse
protected void logSearchResponse(org.elasticsearch.action.search.SearchResponse response)
-
-