Viacheslav Klimov
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
3 deletions
-
common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/AbstractEntityFields.java
-
common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java
|
|
|
@ -17,7 +17,7 @@ package org.thingsboard.server.common.data.edqs.fields; |
|
|
|
|
|
|
|
import lombok.Data; |
|
|
|
import lombok.experimental.SuperBuilder; |
|
|
|
import org.thingsboard.server.common.data.id.CustomerId; |
|
|
|
import org.thingsboard.server.common.data.id.EntityId; |
|
|
|
|
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ public class AbstractEntityFields implements EntityFields { |
|
|
|
this.id = id; |
|
|
|
this.createdTime = createdTime; |
|
|
|
this.tenantId = tenantId; |
|
|
|
this.customerId = (customerId != null && customerId != CustomerId.NULL_UUID) ? customerId : null; |
|
|
|
this.customerId = checkId(customerId); |
|
|
|
this.name = name; |
|
|
|
this.version = version; |
|
|
|
} |
|
|
|
@ -62,4 +62,8 @@ public class AbstractEntityFields implements EntityFields { |
|
|
|
this(id, createdTime, tenantId, null, null, null); |
|
|
|
} |
|
|
|
|
|
|
|
protected UUID checkId(UUID id) { |
|
|
|
return id != null && !id.equals(EntityId.NULL_UUID) ? id : null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ public class TenantRepo { |
|
|
|
getEntitySet(entityType).add(entityData); |
|
|
|
} |
|
|
|
|
|
|
|
UUID newCustomerId = CustomerId.NULL_UUID.equals(fields.getCustomerId()) ? null : fields.getCustomerId(); |
|
|
|
UUID newCustomerId = fields.getCustomerId(); |
|
|
|
UUID oldCustomerId = entityData.getCustomerId(); |
|
|
|
entityData.setCustomerId(newCustomerId); |
|
|
|
if (entityIdMismatch(oldCustomerId, newCustomerId)) { |
|
|
|
|