|
|
@ -23,13 +23,13 @@ import com.google.common.collect.Lists; |
|
|
import com.google.common.util.concurrent.Futures; |
|
|
import com.google.common.util.concurrent.Futures; |
|
|
import com.google.common.util.concurrent.ListenableFuture; |
|
|
import com.google.common.util.concurrent.ListenableFuture; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
import org.thingsboard.server.common.data.EntityType; |
|
|
import org.thingsboard.server.common.data.EntityType; |
|
|
import org.thingsboard.server.common.data.HasName; |
|
|
import org.thingsboard.server.common.data.HasName; |
|
|
import org.thingsboard.server.common.data.StringUtils; |
|
|
|
|
|
import org.thingsboard.server.common.data.audit.ActionStatus; |
|
|
import org.thingsboard.server.common.data.audit.ActionStatus; |
|
|
import org.thingsboard.server.common.data.audit.ActionType; |
|
|
import org.thingsboard.server.common.data.audit.ActionType; |
|
|
import org.thingsboard.server.common.data.audit.AuditLog; |
|
|
import org.thingsboard.server.common.data.audit.AuditLog; |
|
|
@ -382,7 +382,15 @@ public class AuditLogServiceImpl implements AuditLogService { |
|
|
AuditLog auditLogEntry = createAuditLogEntry(tenantId, entityId, entityName, customerId, userId, userName, |
|
|
AuditLog auditLogEntry = createAuditLogEntry(tenantId, entityId, entityName, customerId, userId, userName, |
|
|
actionType, actionData, actionStatus, actionFailureDetails); |
|
|
actionType, actionData, actionStatus, actionFailureDetails); |
|
|
log.trace("Executing logAction [{}]", auditLogEntry); |
|
|
log.trace("Executing logAction [{}]", auditLogEntry); |
|
|
auditLogValidator.validate(auditLogEntry, AuditLog::getTenantId); |
|
|
try { |
|
|
|
|
|
auditLogValidator.validate(auditLogEntry, AuditLog::getTenantId); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
if (StringUtils.contains(e.getMessage(), "value is malformed")) { |
|
|
|
|
|
auditLogEntry.setEntityName("MALFORMED"); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Futures.immediateFailedFuture(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
List<ListenableFuture<Void>> futures = Lists.newArrayListWithExpectedSize(INSERTS_PER_ENTRY); |
|
|
List<ListenableFuture<Void>> futures = Lists.newArrayListWithExpectedSize(INSERTS_PER_ENTRY); |
|
|
futures.add(auditLogDao.saveByTenantId(auditLogEntry)); |
|
|
futures.add(auditLogDao.saveByTenantId(auditLogEntry)); |
|
|
|
|
|
|
|
|
|