Commit ead30d700bd84ceffbbb5764ec5f39bf78681265

Authored by Volodymyr Babak
1 parent 69422fea

Fixed user ID for JPA impl

... ... @@ -25,10 +25,7 @@ import org.thingsboard.server.common.data.EntityType;
25 25 import org.thingsboard.server.common.data.audit.ActionStatus;
26 26 import org.thingsboard.server.common.data.audit.ActionType;
27 27 import org.thingsboard.server.common.data.audit.AuditLog;
28   -import org.thingsboard.server.common.data.id.AuditLogId;
29   -import org.thingsboard.server.common.data.id.CustomerId;
30   -import org.thingsboard.server.common.data.id.EntityIdFactory;
31   -import org.thingsboard.server.common.data.id.TenantId;
  28 +import org.thingsboard.server.common.data.id.*;
32 29 import org.thingsboard.server.dao.model.BaseEntity;
33 30 import org.thingsboard.server.dao.model.BaseSqlEntity;
34 31 import org.thingsboard.server.dao.model.ModelConstants;
... ... @@ -100,6 +97,9 @@ public class AuditLogEntity extends BaseSqlEntity<AuditLog> implements BaseEntit
100 97 this.entityId = toString(auditLog.getEntityId().getId());
101 98 this.entityType = auditLog.getEntityId().getEntityType();
102 99 }
  100 + if (auditLog.getUserId() != null) {
  101 + this.userId = toString(auditLog.getUserId().getId());
  102 + }
103 103 this.entityName = auditLog.getEntityName();
104 104 this.userName = auditLog.getUserName();
105 105 this.actionType = auditLog.getActionType();
... ... @@ -121,6 +121,9 @@ public class AuditLogEntity extends BaseSqlEntity<AuditLog> implements BaseEntit
121 121 if (entityId != null) {
122 122 auditLog.setEntityId(EntityIdFactory.getByTypeAndId(entityType.name(), toUUID(entityId).toString()));
123 123 }
  124 + if (userId != null) {
  125 + auditLog.setUserId(new UserId(toUUID(entityId)));
  126 + }
124 127 auditLog.setEntityName(this.entityName);
125 128 auditLog.setUserName(this.userName);
126 129 auditLog.setActionType(this.actionType);
... ...