Class ESAuditBackend

    • Method Detail

      • getClient

        protected ESClient getClient()
      • isMigrationDone

        protected boolean isMigrationDone()
      • queryLogs

        public List<LogEntry> queryLogs​(QueryBuilder builder)
        Description copied from interface: AuditReader
        Returns the logs given a collection of predicates and a default sort.
        Specified by:
        queryLogs in interface AuditReader
        Parameters:
        builder - the query builder to fetch log entries
        Returns:
        a list of log entries
      • createSearchRequestSource

        protected org.elasticsearch.search.builder.SearchSourceBuilder createSearchRequestSource​(MultiExpression predicate,
                                                                                                 OrderByList orders)
      • createQueryBuilder

        protected org.elasticsearch.index.query.QueryBuilder createQueryBuilder​(MultiExpression andPredicate)
      • buildLogEntries

        protected List<LogEntry> buildLogEntries​(org.elasticsearch.action.search.SearchResponse searchResponse)
      • createSearchRequest

        protected org.elasticsearch.action.search.SearchRequest createSearchRequest()
      • getLogEntryByID

        public LogEntry getLogEntryByID​(long id)
        Description copied from interface: AuditReader
        Returns a given log entry given its id.
        Specified by:
        getLogEntryByID in interface AuditReader
        Parameters:
        id - the log entry identifier
        Returns:
        a LogEntry instance
      • buildQuery

        public org.elasticsearch.action.search.SearchRequest buildQuery​(String query,
                                                                        Map<String,​Object> params)
      • createSearchSourceBuilder

        protected org.elasticsearch.search.builder.SearchSourceBuilder createSearchSourceBuilder​(String query)
      • expandQueryVariables

        public String expandQueryVariables​(String query,
                                           Object[] params)
      • nativeQuery

        public List<?> nativeQuery​(String query,
                                   Map<String,​Object> params,
                                   int pageNb,
                                   int pageSize)
        Description copied from interface: AuditReader
        Returns a batched list of entries.
        Specified by:
        nativeQuery in interface AuditReader
        Parameters:
        query - a JPA query language query if implementation of audit backend is JPA (< 7.3 or audit.elasticsearch.enabled=false) and JSON if implementation is Elasticsearch
        params - parameters for the query
        pageNb - the page number (starts at 1)
        pageSize - the number of results per page
      • addLogEntries

        public void addLogEntries​(List<LogEntry> entries)
        Description copied from interface: AuditLogger
        Adds given log entries.
        Specified by:
        addLogEntries in interface AuditLogger
        Parameters:
        entries - the list of log entries.
      • syncLogCreationEntries

        public long syncLogCreationEntries​(String repoId,
                                           String path,
                                           Boolean recurs)
        Description copied from interface: AuditAdmin
        Forces log Synchronisation for a branch of the repository. This can be useful to add the create entries if DB was initialized from a bulk import.
        Specified by:
        syncLogCreationEntries in interface AuditAdmin
      • search

        public org.elasticsearch.action.search.SearchResponse search​(org.elasticsearch.action.search.SearchRequest request)
      • isNonNullParam

        protected boolean isNonNullParam​(Object[] val)
      • migrate

        public String migrate​(int batchSize)
      • logSearchResponse

        protected void logSearchResponse​(org.elasticsearch.action.search.SearchResponse response)
      • logSearchRequest

        protected void logSearchRequest​(org.elasticsearch.action.search.SearchRequest request)
      • ensureUIDSequencer

        protected void ensureUIDSequencer​(ESClient esClient)
        Ensures the audit sequence returns an UID greater or equal than the maximum log entry id.
      • getESIndexName

        protected String getESIndexName()
      • getLatestLogIdAfterDate

        protected String getLatestLogIdAfterDate()