Commit e251bc575036753744daa321bd2ca6017665b0bd
1 parent
3d54384b
Improvement to deserialization and remove debug on dashboards
Showing
3 changed files
with
15 additions
and
5 deletions
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | }, | 17 | }, |
18 | "type": "org.thingsboard.rule.engine.filter.TbJsFilterNode", | 18 | "type": "org.thingsboard.rule.engine.filter.TbJsFilterNode", |
19 | "name": "Is Thermostat?", | 19 | "name": "Is Thermostat?", |
20 | - "debugMode": true, | 20 | + "debugMode": false, |
21 | "configuration": { | 21 | "configuration": { |
22 | "jsScript": "return msg.id.entityType === \"DEVICE\" && msg.type === \"thermostat\";" | 22 | "jsScript": "return msg.id.entityType === \"DEVICE\" && msg.type === \"thermostat\";" |
23 | } | 23 | } |
@@ -113,7 +113,7 @@ | @@ -113,7 +113,7 @@ | ||
113 | }, | 113 | }, |
114 | "type": "org.thingsboard.rule.engine.action.TbCreateRelationNode", | 114 | "type": "org.thingsboard.rule.engine.action.TbCreateRelationNode", |
115 | "name": "Relate to Asset", | 115 | "name": "Relate to Asset", |
116 | - "debugMode": true, | 116 | + "debugMode": false, |
117 | "configuration": { | 117 | "configuration": { |
118 | "direction": "FROM", | 118 | "direction": "FROM", |
119 | "relationType": "ToAlarmPropagationAsset", | 119 | "relationType": "ToAlarmPropagationAsset", |
@@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
81 | }, | 81 | }, |
82 | "type": "org.thingsboard.rule.engine.filter.TbJsSwitchNode", | 82 | "type": "org.thingsboard.rule.engine.filter.TbJsSwitchNode", |
83 | "name": "Check Alarms", | 83 | "name": "Check Alarms", |
84 | - "debugMode": true, | 84 | + "debugMode": false, |
85 | "configuration": { | 85 | "configuration": { |
86 | "jsScript": "var relations = [];\nif(metadata[\"ss_alarmTemperature\"] === \"true\"){\n if(msg.temperature > metadata[\"ss_thresholdTemperature\"]){\n relations.push(\"NewTempAlarm\");\n } else {\n relations.push(\"ClearTempAlarm\");\n }\n}\nif(metadata[\"ss_alarmHumidity\"] === \"true\"){\n if(msg.humidity < metadata[\"ss_thresholdHumidity\"]){\n relations.push(\"NewHumidityAlarm\");\n } else {\n relations.push(\"ClearHumidityAlarm\");\n }\n}\n\nreturn relations;" | 86 | "jsScript": "var relations = [];\nif(metadata[\"ss_alarmTemperature\"] === \"true\"){\n if(msg.temperature > metadata[\"ss_thresholdTemperature\"]){\n relations.push(\"NewTempAlarm\");\n } else {\n relations.push(\"ClearTempAlarm\");\n }\n}\nif(metadata[\"ss_alarmHumidity\"] === \"true\"){\n if(msg.humidity < metadata[\"ss_thresholdHumidity\"]){\n relations.push(\"NewHumidityAlarm\");\n } else {\n relations.push(\"ClearHumidityAlarm\");\n }\n}\n\nreturn relations;" |
87 | } | 87 | } |
@@ -93,7 +93,7 @@ | @@ -93,7 +93,7 @@ | ||
93 | }, | 93 | }, |
94 | "type": "org.thingsboard.rule.engine.metadata.TbGetAttributesNode", | 94 | "type": "org.thingsboard.rule.engine.metadata.TbGetAttributesNode", |
95 | "name": "Fetch Configuration", | 95 | "name": "Fetch Configuration", |
96 | - "debugMode": true, | 96 | + "debugMode": false, |
97 | "configuration": { | 97 | "configuration": { |
98 | "clientAttributeNames": [], | 98 | "clientAttributeNames": [], |
99 | "sharedAttributeNames": [], | 99 | "sharedAttributeNames": [], |
@@ -27,6 +27,7 @@ import org.thingsboard.server.common.data.id.RuleNodeId; | @@ -27,6 +27,7 @@ import org.thingsboard.server.common.data.id.RuleNodeId; | ||
27 | import org.thingsboard.server.common.msg.gen.MsgProtos; | 27 | import org.thingsboard.server.common.msg.gen.MsgProtos; |
28 | import org.thingsboard.server.common.msg.queue.TbMsgCallback; | 28 | import org.thingsboard.server.common.msg.queue.TbMsgCallback; |
29 | 29 | ||
30 | +import java.io.IOException; | ||
30 | import java.io.Serializable; | 31 | import java.io.Serializable; |
31 | import java.util.UUID; | 32 | import java.util.UUID; |
32 | 33 | ||
@@ -47,7 +48,7 @@ public final class TbMsg implements Serializable { | @@ -47,7 +48,7 @@ public final class TbMsg implements Serializable { | ||
47 | private final RuleChainId ruleChainId; | 48 | private final RuleChainId ruleChainId; |
48 | private final RuleNodeId ruleNodeId; | 49 | private final RuleNodeId ruleNodeId; |
49 | //This field is not serialized because we use queues and there is no need to do it | 50 | //This field is not serialized because we use queues and there is no need to do it |
50 | - private final TbMsgCallback callback; | 51 | + transient private final TbMsgCallback callback; |
51 | 52 | ||
52 | public static TbMsg newMsg(String type, EntityId originator, TbMsgMetaData metaData, String data) { | 53 | public static TbMsg newMsg(String type, EntityId originator, TbMsgMetaData metaData, String data) { |
53 | return new TbMsg(UUID.randomUUID(), type, originator, metaData.copy(), TbMsgDataType.JSON, data, null, null, TbMsgCallback.EMPTY); | 54 | return new TbMsg(UUID.randomUUID(), type, originator, metaData.copy(), TbMsgDataType.JSON, data, null, null, TbMsgCallback.EMPTY); |
@@ -156,4 +157,13 @@ public final class TbMsg implements Serializable { | @@ -156,4 +157,13 @@ public final class TbMsg implements Serializable { | ||
156 | public TbMsg copyWithRuleNodeId(RuleChainId ruleChainId, RuleNodeId ruleNodeId) { | 157 | public TbMsg copyWithRuleNodeId(RuleChainId ruleChainId, RuleNodeId ruleNodeId) { |
157 | return new TbMsg(this.id, this.type, this.originator, this.metaData, this.dataType, this.data, ruleChainId, ruleNodeId, callback); | 158 | return new TbMsg(this.id, this.type, this.originator, this.metaData, this.dataType, this.data, ruleChainId, ruleNodeId, callback); |
158 | } | 159 | } |
160 | + | ||
161 | + public TbMsgCallback getCallback() { | ||
162 | + //May be null in case of deserialization; | ||
163 | + if (callback != null) { | ||
164 | + return callback; | ||
165 | + } else { | ||
166 | + return TbMsgCallback.EMPTY; | ||
167 | + } | ||
168 | + } | ||
159 | } | 169 | } |