Showing
3 changed files
with
5 additions
and
1 deletions
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | "name": "Root Rule Chain", | 4 | "name": "Root Rule Chain", |
5 | "firstRuleNodeId": null, | 5 | "firstRuleNodeId": null, |
6 | "root": true, | 6 | "root": true, |
7 | + "type": "SYSTEM", | ||
7 | "debugMode": false, | 8 | "debugMode": false, |
8 | "configuration": null | 9 | "configuration": null |
9 | }, | 10 | }, |
@@ -249,6 +249,7 @@ public final class EdgeGrpcSession implements Cloneable { | @@ -249,6 +249,7 @@ public final class EdgeGrpcSession implements Cloneable { | ||
249 | break; | 249 | break; |
250 | } | 250 | } |
251 | if (entityId != null) { | 251 | if (entityId != null) { |
252 | + final EntityId finalEntityId = entityId; | ||
252 | ListenableFuture<List<AttributeKvEntry>> ssAttrFuture = ctx.getAttributesService().findAll(edge.getTenantId(), entityId, DataConstants.SERVER_SCOPE); | 253 | ListenableFuture<List<AttributeKvEntry>> ssAttrFuture = ctx.getAttributesService().findAll(edge.getTenantId(), entityId, DataConstants.SERVER_SCOPE); |
253 | Futures.transform(ssAttrFuture, ssAttributes -> { | 254 | Futures.transform(ssAttrFuture, ssAttributes -> { |
254 | if (ssAttributes != null && !ssAttributes.isEmpty()) { | 255 | if (ssAttributes != null && !ssAttributes.isEmpty()) { |
@@ -267,7 +268,7 @@ public final class EdgeGrpcSession implements Cloneable { | @@ -267,7 +268,7 @@ public final class EdgeGrpcSession implements Cloneable { | ||
267 | entityNode.put(attr.getKey(), attr.getValueAsString()); | 268 | entityNode.put(attr.getKey(), attr.getValueAsString()); |
268 | } | 269 | } |
269 | } | 270 | } |
270 | - TbMsg tbMsg = new TbMsg(UUIDs.timeBased(), DataConstants.ATTRIBUTES_UPDATED, entityId, metaData, TbMsgDataType.JSON | 271 | + TbMsg tbMsg = new TbMsg(UUIDs.timeBased(), DataConstants.ATTRIBUTES_UPDATED, finalEntityId, metaData, TbMsgDataType.JSON |
271 | , objectMapper.writeValueAsString(entityNode) | 272 | , objectMapper.writeValueAsString(entityNode) |
272 | , null, null, 0L); | 273 | , null, null, 0L); |
273 | log.debug("Sending donwlink entity data msg, entityName [{}], tbMsg [{}]", entityName, tbMsg); | 274 | log.debug("Sending donwlink entity data msg, entityName [{}], tbMsg [{}]", entityName, tbMsg); |
@@ -27,6 +27,7 @@ import org.thingsboard.server.common.data.id.EntityId; | @@ -27,6 +27,7 @@ import org.thingsboard.server.common.data.id.EntityId; | ||
27 | import org.thingsboard.server.common.data.id.TenantId; | 27 | import org.thingsboard.server.common.data.id.TenantId; |
28 | import org.thingsboard.server.common.data.rule.RuleChain; | 28 | import org.thingsboard.server.common.data.rule.RuleChain; |
29 | import org.thingsboard.server.common.data.rule.RuleChainMetaData; | 29 | import org.thingsboard.server.common.data.rule.RuleChainMetaData; |
30 | +import org.thingsboard.server.common.data.rule.RuleChainType; | ||
30 | import org.thingsboard.server.common.data.widget.WidgetType; | 31 | import org.thingsboard.server.common.data.widget.WidgetType; |
31 | import org.thingsboard.server.common.data.widget.WidgetsBundle; | 32 | import org.thingsboard.server.common.data.widget.WidgetsBundle; |
32 | import org.thingsboard.server.dao.dashboard.DashboardService; | 33 | import org.thingsboard.server.dao.dashboard.DashboardService; |
@@ -114,6 +115,7 @@ public class InstallScripts { | @@ -114,6 +115,7 @@ public class InstallScripts { | ||
114 | RuleChainMetaData ruleChainMetaData = objectMapper.treeToValue(ruleChainJson.get("metadata"), RuleChainMetaData.class); | 115 | RuleChainMetaData ruleChainMetaData = objectMapper.treeToValue(ruleChainJson.get("metadata"), RuleChainMetaData.class); |
115 | 116 | ||
116 | ruleChain.setTenantId(tenantId); | 117 | ruleChain.setTenantId(tenantId); |
118 | + ruleChain.setType(RuleChainType.SYSTEM); | ||
117 | ruleChain = ruleChainService.saveRuleChain(ruleChain); | 119 | ruleChain = ruleChainService.saveRuleChain(ruleChain); |
118 | 120 | ||
119 | ruleChainMetaData.setRuleChainId(ruleChain.getId()); | 121 | ruleChainMetaData.setRuleChainId(ruleChain.getId()); |