Commit 96dfc0691bd86fd3f70d755136e3ec9a2064e42d

Authored by Volodymyr Babak
1 parent f8981638

Added device profile rule node to default edge root. Fixed notification event

@@ -9,10 +9,24 @@ @@ -9,10 +9,24 @@
9 "configuration": null 9 "configuration": null
10 }, 10 },
11 "metadata": { 11 "metadata": {
12 - "firstNodeIndex": 2, 12 + "firstNodeIndex": 0,
13 "nodes": [ 13 "nodes": [
14 { 14 {
15 "additionalInfo": { 15 "additionalInfo": {
  16 + "description": "Process incoming messages from devices with the alarm rules defined in the device profile. Dispatch all incoming messages with \"Success\" relation type.",
  17 + "layoutX": 203,
  18 + "layoutY": 259
  19 + },
  20 + "type": "org.thingsboard.rule.engine.profile.TbDeviceProfileNode",
  21 + "name": "Device Profile Node",
  22 + "debugMode": false,
  23 + "configuration": {
  24 + "persistAlarmRulesState": false,
  25 + "fetchAlarmRulesStateOnStart": false
  26 + }
  27 + },
  28 + {
  29 + "additionalInfo": {
16 "layoutX": 823, 30 "layoutX": 823,
17 "layoutY": 157 31 "layoutY": 157
18 }, 32 },
@@ -99,42 +113,47 @@ @@ -99,42 +113,47 @@
99 "connections": [ 113 "connections": [
100 { 114 {
101 "fromIndex": 0, 115 "fromIndex": 0,
102 - "toIndex": 6, 116 + "toIndex": 3,
103 "type": "Success" 117 "type": "Success"
104 }, 118 },
105 { 119 {
106 "fromIndex": 1, 120 "fromIndex": 1,
107 - "toIndex": 6, 121 + "toIndex": 7,
108 "type": "Success" 122 "type": "Success"
109 }, 123 },
110 { 124 {
111 "fromIndex": 2, 125 "fromIndex": 2,
112 - "toIndex": 4, 126 + "toIndex": 7,
  127 + "type": "Success"
  128 + },
  129 + {
  130 + "fromIndex": 3,
  131 + "toIndex": 6,
  132 + "type": "RPC Request to Device"
  133 + },
  134 + {
  135 + "fromIndex": 3,
  136 + "toIndex": 5,
113 "type": "Other" 137 "type": "Other"
114 }, 138 },
115 { 139 {
116 - "fromIndex": 2,  
117 - "toIndex": 1, 140 + "fromIndex": 3,
  141 + "toIndex": 2,
118 "type": "Post attributes" 142 "type": "Post attributes"
119 }, 143 },
120 { 144 {
121 - "fromIndex": 2,  
122 - "toIndex": 0, 145 + "fromIndex": 3,
  146 + "toIndex": 1,
123 "type": "Post telemetry" 147 "type": "Post telemetry"
124 }, 148 },
125 { 149 {
126 - "fromIndex": 2,  
127 - "toIndex": 3, 150 + "fromIndex": 3,
  151 + "toIndex": 4,
128 "type": "RPC Request from Device" 152 "type": "RPC Request from Device"
129 }, 153 },
130 { 154 {
131 - "fromIndex": 2,  
132 - "toIndex": 5,  
133 - "type": "RPC Request to Device"  
134 - },  
135 - {  
136 - "fromIndex": 3,  
137 - "toIndex": 6, 155 + "fromIndex": 4,
  156 + "toIndex": 7,
138 "type": "Success" 157 "type": "Success"
139 } 158 }
140 ], 159 ],
@@ -103,7 +103,7 @@ public class DeviceProfileController extends BaseController { @@ -103,7 +103,7 @@ public class DeviceProfileController extends BaseController {
103 null, 103 null,
104 savedDeviceProfile.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); 104 savedDeviceProfile.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
105 105
106 - sendNotificationMsgToEdgeService(getTenantId(), deviceProfile.getId(), EntityType.DEVICE_PROFILE, 106 + sendNotificationMsgToEdgeService(getTenantId(), savedDeviceProfile.getId(), EntityType.DEVICE_PROFILE,
107 deviceProfile.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED); 107 deviceProfile.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
108 108
109 return savedDeviceProfile; 109 return savedDeviceProfile;
@@ -38,7 +38,6 @@ public class DeviceProfileMsgConstructor { @@ -38,7 +38,6 @@ public class DeviceProfileMsgConstructor {
38 .setIdMSB(deviceProfile.getId().getId().getMostSignificantBits()) 38 .setIdMSB(deviceProfile.getId().getId().getMostSignificantBits())
39 .setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits()) 39 .setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits())
40 .setName(deviceProfile.getName()) 40 .setName(deviceProfile.getName())
41 - .setDescription(deviceProfile.getDescription())  
42 .setDefault(deviceProfile.isDefault()) 41 .setDefault(deviceProfile.isDefault())
43 .setType(deviceProfile.getType().name()) 42 .setType(deviceProfile.getType().name())
44 .setTransportType(deviceProfile.getTransportType().name()) 43 .setTransportType(deviceProfile.getTransportType().name())
@@ -52,6 +51,9 @@ public class DeviceProfileMsgConstructor { @@ -52,6 +51,9 @@ public class DeviceProfileMsgConstructor {
52 // if (deviceProfile.getDefaultQueueName() != null) { 51 // if (deviceProfile.getDefaultQueueName() != null) {
53 // builder.setDefaultQueueName(deviceProfile.getDefaultQueueName()); 52 // builder.setDefaultQueueName(deviceProfile.getDefaultQueueName());
54 // } 53 // }
  54 + if (deviceProfile.getDescription() != null) {
  55 + builder.setDescription(deviceProfile.getDescription());
  56 + }
55 if (deviceProfile.getProvisionDeviceKey() != null) { 57 if (deviceProfile.getProvisionDeviceKey() != null) {
56 builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey()); 58 builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey());
57 } 59 }