|
|
@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
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.cluster.TbClusterService; |
|
|
import org.thingsboard.server.cluster.TbClusterService; |
|
|
|
|
|
import org.thingsboard.server.common.data.AttributeScope; |
|
|
import org.thingsboard.server.common.data.DataConstants; |
|
|
import org.thingsboard.server.common.data.DataConstants; |
|
|
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; |
|
|
@ -127,20 +128,20 @@ public class EntityActionService { |
|
|
} else { |
|
|
} else { |
|
|
entityNode = JacksonUtil.newObjectNode(); |
|
|
entityNode = JacksonUtil.newObjectNode(); |
|
|
if (actionType == ActionType.ATTRIBUTES_UPDATED) { |
|
|
if (actionType == ActionType.ATTRIBUTES_UPDATED) { |
|
|
String scope = extractParameter(String.class, 0, additionalInfo); |
|
|
AttributeScope scope = extractParameter(AttributeScope.class, 0, additionalInfo); |
|
|
@SuppressWarnings("unchecked") |
|
|
@SuppressWarnings("unchecked") |
|
|
List<AttributeKvEntry> attributes = extractParameter(List.class, 1, additionalInfo); |
|
|
List<AttributeKvEntry> attributes = extractParameter(List.class, 1, additionalInfo); |
|
|
metaData.putValue(DataConstants.SCOPE, scope); |
|
|
metaData.putValue(DataConstants.SCOPE, scope.name()); |
|
|
if (attributes != null) { |
|
|
if (attributes != null) { |
|
|
for (AttributeKvEntry attr : attributes) { |
|
|
for (AttributeKvEntry attr : attributes) { |
|
|
JacksonUtil.addKvEntry(entityNode, attr); |
|
|
JacksonUtil.addKvEntry(entityNode, attr); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else if (actionType == ActionType.ATTRIBUTES_DELETED) { |
|
|
} else if (actionType == ActionType.ATTRIBUTES_DELETED) { |
|
|
String scope = extractParameter(String.class, 0, additionalInfo); |
|
|
AttributeScope scope = extractParameter(AttributeScope.class, 0, additionalInfo); |
|
|
@SuppressWarnings("unchecked") |
|
|
@SuppressWarnings("unchecked") |
|
|
List<String> keys = extractParameter(List.class, 1, additionalInfo); |
|
|
List<String> keys = extractParameter(List.class, 1, additionalInfo); |
|
|
metaData.putValue(DataConstants.SCOPE, scope); |
|
|
metaData.putValue(DataConstants.SCOPE, scope.name()); |
|
|
ArrayNode attrsArrayNode = entityNode.putArray("attributes"); |
|
|
ArrayNode attrsArrayNode = entityNode.putArray("attributes"); |
|
|
if (keys != null) { |
|
|
if (keys != null) { |
|
|
keys.forEach(attrsArrayNode::add); |
|
|
keys.forEach(attrsArrayNode::add); |
|
|
|