thingsboard-memoizeit

JSON type cast enhancements

11/2/2018 10:45:28 AM

Details

diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml
index cb7beb6..da2b7b1 100644
--- a/application/src/main/resources/thingsboard.yml
+++ b/application/src/main/resources/thingsboard.yml
@@ -406,6 +406,9 @@ transport:
     enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
     tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
     device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
+  json:
+    # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
+    type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
   # Local HTTP transport parameters
   http:
     enabled: "${HTTP_ENABLED:true}"
@@ -443,7 +446,3 @@ transport:
     bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
     bind_port: "${COAP_BIND_PORT:5683}"
     timeout: "${COAP_TIMEOUT:10000}"
-
-json:
-  # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
-  type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:false}"
\ No newline at end of file
diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/adaptor/JsonConverterConfig.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/adaptor/JsonConverterConfig.java
index cc41fe0..ac3f4dc 100644
--- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/adaptor/JsonConverterConfig.java
+++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/adaptor/JsonConverterConfig.java
@@ -23,7 +23,7 @@ import org.springframework.context.annotation.Configuration;
 @Slf4j
 public class JsonConverterConfig {
 
-    @Value("${json.type_cast_enabled}")
+    @Value("${transport.json.type_cast_enabled:true}")
     public void setIsJsonTypeCastEnabled(boolean jsonTypeCastEnabled) {
         JsonConverter.setTypeCastEnabled(jsonTypeCastEnabled);
         log.info("JSON type cast enabled = {}", jsonTypeCastEnabled);
diff --git a/transport/coap/src/main/resources/tb-coap-transport.yml b/transport/coap/src/main/resources/tb-coap-transport.yml
index d20bc79..95e7b75 100644
--- a/transport/coap/src/main/resources/tb-coap-transport.yml
+++ b/transport/coap/src/main/resources/tb-coap-transport.yml
@@ -30,6 +30,9 @@ transport:
     enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
     tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
     device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
+  json:
+    # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
+    type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
 
 kafka:
   enabled: true
@@ -52,7 +55,3 @@ kafka:
     topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
     poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
     auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
-
-json:
-  # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
-  type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
\ No newline at end of file
diff --git a/transport/http/src/main/resources/tb-http-transport.yml b/transport/http/src/main/resources/tb-http-transport.yml
index f5f7855..bb1d3c4 100644
--- a/transport/http/src/main/resources/tb-http-transport.yml
+++ b/transport/http/src/main/resources/tb-http-transport.yml
@@ -31,6 +31,9 @@ transport:
     enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
     tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
     device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
+  json:
+    # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
+    type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
 
 kafka:
   enabled: true
@@ -53,7 +56,3 @@ kafka:
     topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
     poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
     auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
-
-json:
-  # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
-  type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
\ No newline at end of file
diff --git a/transport/mqtt/src/main/resources/tb-mqtt-transport.yml b/transport/mqtt/src/main/resources/tb-mqtt-transport.yml
index af1b6f0..719530c 100644
--- a/transport/mqtt/src/main/resources/tb-mqtt-transport.yml
+++ b/transport/mqtt/src/main/resources/tb-mqtt-transport.yml
@@ -50,6 +50,9 @@ transport:
     enabled: "${TB_TRANSPORT_RATE_LIMITS_ENABLED:false}"
     tenant: "${TB_TRANSPORT_RATE_LIMITS_TENANT:1000:1,20000:60}"
     device: "${TB_TRANSPORT_RATE_LIMITS_DEVICE:10:1,300:60}"
+  json:
+    # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
+    type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
 
 kafka:
   enabled: true
@@ -72,7 +75,3 @@ kafka:
     topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
     poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
     auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
-
-json:
-  # Cast String data types to Numeric if possible when processing Telemetry/Attributes JSON
-  type_cast_enabled: "${JSON_TYPE_CAST_ENABLED:true}"
\ No newline at end of file