Search in sources :

Example 1 with AuditLogEntity

use of org.thingsboard.server.dao.model.sql.AuditLogEntity in project thingsboard by thingsboard.

the class JpaAuditLogDao method findAuditLogs.

private List<AuditLog> findAuditLogs(UUID tenantId, EntityId entityId, CustomerId customerId, UserId userId, TimePageLink pageLink) {
    Specification<AuditLogEntity> timeSearchSpec = JpaAbstractSearchTimeDao.getTimeSearchPageSpec(pageLink, "id");
    Specification<AuditLogEntity> fieldsSpec = getEntityFieldsSpec(tenantId, entityId, customerId, userId);
    Sort.Direction sortDirection = pageLink.isAscOrder() ? Sort.Direction.ASC : Sort.Direction.DESC;
    Pageable pageable = new PageRequest(0, pageLink.getLimit(), sortDirection, ID_PROPERTY);
    return DaoUtil.convertDataList(auditLogRepository.findAll(where(timeSearchSpec).and(fieldsSpec), pageable).getContent());
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Pageable(org.springframework.data.domain.Pageable) Sort(org.springframework.data.domain.Sort) AuditLogEntity(org.thingsboard.server.dao.model.sql.AuditLogEntity)

Aggregations

PageRequest (org.springframework.data.domain.PageRequest)1 Pageable (org.springframework.data.domain.Pageable)1 Sort (org.springframework.data.domain.Sort)1 AuditLogEntity (org.thingsboard.server.dao.model.sql.AuditLogEntity)1