Browse Source

Merge branch 'master' into alarmScheduleDynamicValues

# Conflicts:
#	rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmRuleState.java
#	ui-ngx/src/app/modules/home/components/home-components.module.ts
pull/5818/head
desoliture 5 years ago
parent
commit
e6053e8e7d
  1. 3
      .gitignore
  2. 2
      application/pom.xml
  3. 2
      application/src/main/conf/logback.xml
  4. 2
      application/src/main/conf/thingsboard.conf
  5. 20
      application/src/main/data/json/system/widget_bundles/cards.json
  6. 18
      application/src/main/data/json/system/widget_bundles/control_widgets.json
  7. 18
      application/src/main/data/json/system/widget_bundles/input_widgets.json
  8. 2
      application/src/main/data/upgrade/1.3.0/schema_update.cql
  9. 2
      application/src/main/data/upgrade/1.3.1/schema_update.sql
  10. 2
      application/src/main/data/upgrade/1.4.0/schema_update.cql
  11. 2
      application/src/main/data/upgrade/1.4.0/schema_update.sql
  12. 2
      application/src/main/data/upgrade/2.0.0/schema_update.cql
  13. 2
      application/src/main/data/upgrade/2.0.0/schema_update.sql
  14. 2
      application/src/main/data/upgrade/2.1.1/schema_update.cql
  15. 2
      application/src/main/data/upgrade/2.1.1/schema_update.sql
  16. 2
      application/src/main/data/upgrade/2.1.2/schema_update.cql
  17. 2
      application/src/main/data/upgrade/2.1.2/schema_update.sql
  18. 2
      application/src/main/data/upgrade/2.2.0/schema_update.sql
  19. 2
      application/src/main/data/upgrade/2.3.1/schema_update.sql
  20. 2
      application/src/main/data/upgrade/2.4.0/schema_update.sql
  21. 2
      application/src/main/data/upgrade/2.4.2/schema_update.sql
  22. 2
      application/src/main/data/upgrade/2.4.3/schema_update_psql_drop_partitions.sql
  23. 2
      application/src/main/data/upgrade/2.4.3/schema_update_psql_ts.sql
  24. 2
      application/src/main/data/upgrade/2.4.3/schema_update_timescale_ts.sql
  25. 2
      application/src/main/data/upgrade/2.4.3/schema_update_ttl.sql
  26. 2
      application/src/main/data/upgrade/3.0.1/schema_ts_latest.sql
  27. 2
      application/src/main/data/upgrade/3.0.1/schema_update_to_uuid.sql
  28. 2
      application/src/main/data/upgrade/3.1.0/schema_update.sql
  29. 2
      application/src/main/data/upgrade/3.1.1/schema_update_after.sql
  30. 2
      application/src/main/data/upgrade/3.1.1/schema_update_before.sql
  31. 2
      application/src/main/data/upgrade/3.2.1/schema_update.sql
  32. 2
      application/src/main/data/upgrade/3.2.1/schema_update_ttl.sql
  33. 2
      application/src/main/data/upgrade/3.2.2/schema_update.sql
  34. 2
      application/src/main/data/upgrade/3.2.2/schema_update_event.sql
  35. 2
      application/src/main/data/upgrade/3.2.2/schema_update_ttl.sql
  36. 2
      application/src/main/data/upgrade/3.3.2/schema_update.sql
  37. 53
      application/src/main/data/upgrade/3.3.2/schema_update_lwm2m_bootstrap.sql
  38. 2
      application/src/main/java/org/thingsboard/server/ThingsboardInstallApplication.java
  39. 2
      application/src/main/java/org/thingsboard/server/ThingsboardServerApplication.java
  40. 2
      application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java
  41. 2
      application/src/main/java/org/thingsboard/server/actors/TbEntityTypeActorIdPredicate.java
  42. 21
      application/src/main/java/org/thingsboard/server/actors/app/AppActor.java
  43. 2
      application/src/main/java/org/thingsboard/server/actors/app/AppInitMsg.java
  44. 2
      application/src/main/java/org/thingsboard/server/actors/device/DeviceActor.java
  45. 2
      application/src/main/java/org/thingsboard/server/actors/device/DeviceActorCreator.java
  46. 48
      application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java
  47. 2
      application/src/main/java/org/thingsboard/server/actors/device/SessionInfo.java
  48. 2
      application/src/main/java/org/thingsboard/server/actors/device/SessionInfoMetaData.java
  49. 2
      application/src/main/java/org/thingsboard/server/actors/device/SessionTimeoutCheckMsg.java
  50. 2
      application/src/main/java/org/thingsboard/server/actors/device/ToDeviceRpcRequestMetadata.java
  51. 2
      application/src/main/java/org/thingsboard/server/actors/device/ToServerRpcRequestMetadata.java
  52. 12
      application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java
  53. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainActor.java
  54. 30
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainActorMessageProcessor.java
  55. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainInputMsg.java
  56. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainManagerActor.java
  57. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainOutputMsg.java
  58. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainToRuleChainMsg.java
  59. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainToRuleNodeMsg.java
  60. 16
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeActor.java
  61. 6
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeActorMessageProcessor.java
  62. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeCtx.java
  63. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeRelation.java
  64. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeToRuleChainTellNextMsg.java
  65. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeToSelfMsg.java
  66. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/TbToRuleChainActorMsg.java
  67. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/TbToRuleNodeActorMsg.java
  68. 2
      application/src/main/java/org/thingsboard/server/actors/service/ActorService.java
  69. 2
      application/src/main/java/org/thingsboard/server/actors/service/ComponentActor.java
  70. 2
      application/src/main/java/org/thingsboard/server/actors/service/ContextAwareActor.java
  71. 2
      application/src/main/java/org/thingsboard/server/actors/service/ContextBasedCreator.java
  72. 2
      application/src/main/java/org/thingsboard/server/actors/service/DefaultActorService.java
  73. 6
      application/src/main/java/org/thingsboard/server/actors/shared/AbstractContextAwareMsgProcessor.java
  74. 2
      application/src/main/java/org/thingsboard/server/actors/shared/ActorTerminationMsg.java
  75. 14
      application/src/main/java/org/thingsboard/server/actors/shared/ComponentMsgProcessor.java
  76. 2
      application/src/main/java/org/thingsboard/server/actors/stats/StatsActor.java
  77. 2
      application/src/main/java/org/thingsboard/server/actors/stats/StatsPersistMsg.java
  78. 2
      application/src/main/java/org/thingsboard/server/actors/stats/StatsPersistTick.java
  79. 2
      application/src/main/java/org/thingsboard/server/actors/tenant/DebugTbRateLimits.java
  80. 6
      application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java
  81. 2
      application/src/main/java/org/thingsboard/server/config/AuditLogLevelProperties.java
  82. 2
      application/src/main/java/org/thingsboard/server/config/CustomOAuth2AuthorizationRequestResolver.java
  83. 2
      application/src/main/java/org/thingsboard/server/config/JwtSettings.java
  84. 2
      application/src/main/java/org/thingsboard/server/config/MvcCorsProperties.java
  85. 2
      application/src/main/java/org/thingsboard/server/config/RateLimitProcessingFilter.java
  86. 2
      application/src/main/java/org/thingsboard/server/config/SchedulingConfiguration.java
  87. 2
      application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java
  88. 2
      application/src/main/java/org/thingsboard/server/config/ThingsboardMessageConfiguration.java
  89. 2
      application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java
  90. 2
      application/src/main/java/org/thingsboard/server/config/WebConfig.java
  91. 2
      application/src/main/java/org/thingsboard/server/config/WebSocketConfiguration.java
  92. 2
      application/src/main/java/org/thingsboard/server/controller/AbstractRpcController.java
  93. 2
      application/src/main/java/org/thingsboard/server/controller/AdminController.java
  94. 4
      application/src/main/java/org/thingsboard/server/controller/AlarmController.java
  95. 2
      application/src/main/java/org/thingsboard/server/controller/AssetController.java
  96. 2
      application/src/main/java/org/thingsboard/server/controller/AuditLogController.java
  97. 2
      application/src/main/java/org/thingsboard/server/controller/AuthController.java
  98. 4
      application/src/main/java/org/thingsboard/server/controller/BaseController.java
  99. 2
      application/src/main/java/org/thingsboard/server/controller/ComponentDescriptorController.java
  100. 2
      application/src/main/java/org/thingsboard/server/controller/ControllerConstants.java

3
.gitignore

@ -30,9 +30,10 @@ pom.xml.versionsBackup
**/build **/build
**/target **/target
**/Californium.properties **/Californium.properties
**/Californium3.properties
**/.env **/.env
.instance_id .instance_id
rebuild-docker.sh rebuild-docker.sh
*/.run/** */.run/**
.run/** .run/**
.run .run

2
application/pom.xml

@ -1,6 +1,6 @@
<!-- <!--
Copyright © 2016-2021 The Thingsboard Authors Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

2
application/src/main/conf/logback.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- <!--
Copyright © 2016-2021 The Thingsboard Authors Copyright © 2016-2022 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

2
application/src/main/conf/thingsboard.conf

@ -1,5 +1,5 @@
# #
# Copyright © 2016-2021 The Thingsboard Authors # Copyright © 2016-2022 The Thingsboard Authors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

20
application/src/main/data/json/system/widget_bundles/cards.json

File diff suppressed because one or more lines are too long

18
application/src/main/data/json/system/widget_bundles/control_widgets.json

File diff suppressed because one or more lines are too long

18
application/src/main/data/json/system/widget_bundles/input_widgets.json

File diff suppressed because one or more lines are too long

2
application/src/main/data/upgrade/1.3.0/schema_update.cql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/1.3.1/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/1.4.0/schema_update.cql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/1.4.0/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.0.0/schema_update.cql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.0.0/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.1.1/schema_update.cql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.1.1/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.1.2/schema_update.cql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.1.2/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.2.0/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.3.1/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.4.0/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.4.2/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.4.3/schema_update_psql_drop_partitions.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.4.3/schema_update_psql_ts.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.4.3/schema_update_timescale_ts.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/2.4.3/schema_update_ttl.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.0.1/schema_ts_latest.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.0.1/schema_update_to_uuid.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.1.0/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.1.1/schema_update_after.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.1.1/schema_update_before.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.2.1/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.2.1/schema_update_ttl.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.2.2/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.2.2/schema_update_event.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.2.2/schema_update_ttl.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

2
application/src/main/data/upgrade/3.3.2/schema_update.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.

53
application/src/main/data/upgrade/3.3.2/schema_update_lwm2m_bootstrap.sql

@ -1,5 +1,5 @@
-- --
-- Copyright © 2016-2021 The Thingsboard Authors -- Copyright © 2016-2022 The Thingsboard Authors
-- --
-- Licensed under the Apache License, Version 2.0 (the "License"); -- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License. -- you may not use this file except in compliance with the License.
@ -14,6 +14,7 @@
-- limitations under the License. -- limitations under the License.
-- --
CREATE OR REPLACE PROCEDURE update_profile_bootstrap() CREATE OR REPLACE PROCEDURE update_profile_bootstrap()
LANGUAGE plpgsql AS LANGUAGE plpgsql AS
$$ $$
@ -25,9 +26,11 @@ BEGIN
profile_data, profile_data,
'{transportConfiguration}', '{transportConfiguration}',
get_bootstrap( get_bootstrap(
profile_data::jsonb #> '{transportConfiguration}', profile_data::jsonb #> '{transportConfiguration}',
subquery.publickey_bs, subquery.publickey_bs,
subquery.publickey_lw), subquery.publickey_lw,
profile_data::json #>> '{transportConfiguration, bootstrap, bootstrapServer, securityMode}',
profile_data::json #>> '{transportConfiguration, bootstrap, lwm2mServer, securityMode}'),
true) true)
FROM ( FROM (
SELECT id, SELECT id,
@ -48,7 +51,8 @@ END;
$$; $$;
CREATE OR REPLACE FUNCTION get_bootstrap(transport_configuration_in jsonb, publickey_bs text, CREATE OR REPLACE FUNCTION get_bootstrap(transport_configuration_in jsonb, publickey_bs text,
publickey_lw text) RETURNS jsonb AS publickey_lw text, security_mode_bs text,
security_mode_lw text) RETURNS jsonb AS
$$ $$
DECLARE DECLARE
@ -56,10 +60,19 @@ DECLARE
bootstrap_in jsonb; bootstrap_in jsonb;
BEGIN BEGIN
IF security_mode_lw IS NULL THEN
security_mode_lw := 'NO_SEC';
END IF;
IF security_mode_bs IS NULL THEN
security_mode_bs := 'NO_SEC';
END IF;
bootstrap_in := transport_configuration_in::jsonb #> '{bootstrap}'; bootstrap_in := transport_configuration_in::jsonb #> '{bootstrap}';
bootstrap_new := json_build_array( bootstrap_new := json_build_array(
json_build_object('shortServerId', bootstrap_in::json #> '{bootstrapServer}' -> 'serverId', json_build_object('shortServerId', bootstrap_in::json #> '{bootstrapServer}' -> 'serverId',
'securityMode', bootstrap_in::json #> '{bootstrapServer}' ->> 'securityMode', 'securityMode', security_mode_bs,
'binding', bootstrap_in::json #> '{servers}' ->> 'binding', 'binding', bootstrap_in::json #> '{servers}' ->> 'binding',
'lifetime', bootstrap_in::json #> '{servers}' -> 'lifetime', 'lifetime', bootstrap_in::json #> '{servers}' -> 'lifetime',
'notifIfDisabled', bootstrap_in::json #> '{servers}' -> 'notifIfDisabled', 'notifIfDisabled', bootstrap_in::json #> '{servers}' -> 'notifIfDisabled',
@ -73,7 +86,7 @@ BEGIN
bootstrap_in::json #> '{bootstrapServer}' -> 'bootstrapServerAccountTimeout' bootstrap_in::json #> '{bootstrapServer}' -> 'bootstrapServerAccountTimeout'
), ),
json_build_object('shortServerId', bootstrap_in::json #> '{lwm2mServer}' -> 'serverId', json_build_object('shortServerId', bootstrap_in::json #> '{lwm2mServer}' -> 'serverId',
'securityMode', bootstrap_in::json #> '{lwm2mServer}' ->> 'securityMode', 'securityMode', security_mode_lw,
'binding', bootstrap_in::json #> '{servers}' ->> 'binding', 'binding', bootstrap_in::json #> '{servers}' ->> 'binding',
'lifetime', bootstrap_in::json #> '{servers}' -> 'lifetime', 'lifetime', bootstrap_in::json #> '{servers}' -> 'lifetime',
'notifIfDisabled', bootstrap_in::json #> '{servers}' -> 'notifIfDisabled', 'notifIfDisabled', bootstrap_in::json #> '{servers}' -> 'notifIfDisabled',
@ -93,7 +106,7 @@ BEGIN
bootstrap_new, bootstrap_new,
true) || '{"bootstrapServerUpdateEnable": true}'; true) || '{"bootstrapServerUpdateEnable": true}';
END ; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
CREATE OR REPLACE PROCEDURE update_device_credentials_to_base64_and_bootstrap() CREATE OR REPLACE PROCEDURE update_device_credentials_to_base64_and_bootstrap()
@ -102,9 +115,9 @@ $$
BEGIN BEGIN
UPDATE device_credentials UPDATE device_credentials
SET credentials_value = get_device_and_bootstrap(credentials_value::text) SET credentials_value = get_device_and_bootstrap(credentials_value::text)
WHERE credentials_type = 'LWM2M_CREDENTIALS'; WHERE credentials_type = 'LWM2M_CREDENTIALS';
END; END;
$$; $$;
@ -112,7 +125,7 @@ CREATE OR REPLACE FUNCTION get_device_and_bootstrap(IN credentials_value text, O
LANGUAGE plpgsql AS LANGUAGE plpgsql AS
$$ $$
DECLARE DECLARE
client_secret_key text; client_secret_key text;
client_public_key_or_id text; client_public_key_or_id text;
client_key_value_object jsonb; client_key_value_object jsonb;
client_bootstrap_server_value_object jsonb; client_bootstrap_server_value_object jsonb;
@ -130,7 +143,7 @@ BEGIN
'key', client_public_key_or_id); 'key', client_public_key_or_id);
credentials_value_new := credentials_value_new :=
credentials_value_new::jsonb || json_build_object('client', client_key_value_object)::jsonb; credentials_value_new::jsonb || json_build_object('client', client_key_value_object)::jsonb;
END IF; END IF;
IF credentials_value::jsonb #> '{client}' ->> 'securityConfigClientMode' = 'X509' AND IF credentials_value::jsonb #> '{client}' ->> 'securityConfigClientMode' = 'X509' AND
NULLIF((credentials_value::jsonb #> '{client}' ->> 'cert' ~ '^[0-9a-fA-F]+$')::text, 'false') = 'true' THEN NULLIF((credentials_value::jsonb #> '{client}' ->> 'cert' ~ '^[0-9a-fA-F]+$')::text, 'false') = 'true' THEN
client_public_key_or_id := client_public_key_or_id :=
@ -141,8 +154,8 @@ END IF;
'cert', client_public_key_or_id); 'cert', client_public_key_or_id);
credentials_value_new := credentials_value_new :=
credentials_value_new::jsonb || json_build_object('client', client_key_value_object)::jsonb; credentials_value_new::jsonb || json_build_object('client', client_key_value_object)::jsonb;
END IF; END IF;
IF credentials_value::jsonb #> '{bootstrap,lwm2mServer}' ->> 'securityMode' = 'RPK' OR IF credentials_value::jsonb #> '{bootstrap,lwm2mServer}' ->> 'securityMode' = 'RPK' OR
credentials_value::jsonb #> '{bootstrap,lwm2mServer}' ->> 'securityMode' = 'X509' THEN credentials_value::jsonb #> '{bootstrap,lwm2mServer}' ->> 'securityMode' = 'X509' THEN
IF NULLIF((credentials_value::jsonb #> '{bootstrap,lwm2mServer}' ->> 'clientSecretKey' ~ '^[0-9a-fA-F]+$')::text, IF NULLIF((credentials_value::jsonb #> '{bootstrap,lwm2mServer}' ->> 'clientSecretKey' ~ '^[0-9a-fA-F]+$')::text,
@ -165,9 +178,9 @@ END IF;
client_bootstrap_object := credentials_value_new::jsonb #> '{bootstrap}' || client_bootstrap_server_object::jsonb; client_bootstrap_object := credentials_value_new::jsonb #> '{bootstrap}' || client_bootstrap_server_object::jsonb;
credentials_value_new := credentials_value_new :=
jsonb_set(credentials_value_new::jsonb, '{bootstrap}', client_bootstrap_object::jsonb, false)::jsonb; jsonb_set(credentials_value_new::jsonb, '{bootstrap}', client_bootstrap_object::jsonb, false)::jsonb;
END IF; END IF;
END IF; END IF;
IF credentials_value::jsonb #> '{bootstrap,bootstrapServer}' ->> 'securityMode' = 'RPK' OR IF credentials_value::jsonb #> '{bootstrap,bootstrapServer}' ->> 'securityMode' = 'RPK' OR
credentials_value::jsonb #> '{bootstrap,bootstrapServer}' ->> 'securityMode' = 'X509' THEN credentials_value::jsonb #> '{bootstrap,bootstrapServer}' ->> 'securityMode' = 'X509' THEN
IF NULLIF( IF NULLIF(
@ -193,8 +206,8 @@ END IF;
client_bootstrap_object := credentials_value_new::jsonb #> '{bootstrap}' || client_bootstrap_server_object::jsonb; client_bootstrap_object := credentials_value_new::jsonb #> '{bootstrap}' || client_bootstrap_server_object::jsonb;
credentials_value_new := credentials_value_new :=
jsonb_set(credentials_value_new::jsonb, '{bootstrap}', client_bootstrap_object::jsonb, false)::jsonb; jsonb_set(credentials_value_new::jsonb, '{bootstrap}', client_bootstrap_object::jsonb, false)::jsonb;
END IF; END IF;
END IF; END IF;
END; END;
$$; $$;

2
application/src/main/java/org/thingsboard/server/ThingsboardInstallApplication.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/ThingsboardServerApplication.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/TbEntityTypeActorIdPredicate.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

21
application/src/main/java/org/thingsboard/server/actors/app/AppActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,9 +18,12 @@ package org.thingsboard.server.actors.app;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.actors.ActorSystemContext;
import org.thingsboard.server.actors.TbActor; import org.thingsboard.server.actors.TbActor;
import org.thingsboard.server.actors.TbActorCtx;
import org.thingsboard.server.actors.TbActorException;
import org.thingsboard.server.actors.TbActorId; import org.thingsboard.server.actors.TbActorId;
import org.thingsboard.server.actors.TbActorRef; import org.thingsboard.server.actors.TbActorRef;
import org.thingsboard.server.actors.TbEntityActorId; import org.thingsboard.server.actors.TbEntityActorId;
import org.thingsboard.server.actors.device.SessionTimeoutCheckMsg;
import org.thingsboard.server.actors.service.ContextAwareActor; import org.thingsboard.server.actors.service.ContextAwareActor;
import org.thingsboard.server.actors.service.ContextBasedCreator; import org.thingsboard.server.actors.service.ContextBasedCreator;
import org.thingsboard.server.actors.service.DefaultActorService; import org.thingsboard.server.actors.service.DefaultActorService;
@ -64,6 +67,15 @@ public class AppActor extends ContextAwareActor {
this.deletedTenants = new HashSet<>(); this.deletedTenants = new HashSet<>();
} }
@Override
public void init(TbActorCtx ctx) throws TbActorException {
super.init(ctx);
if (systemContext.getServiceInfoProvider().isService(ServiceType.TB_CORE)) {
systemContext.schedulePeriodicMsgWithDelay(ctx, SessionTimeoutCheckMsg.instance(),
systemContext.getSessionReportTimeout(), systemContext.getSessionReportTimeout());
}
}
@Override @Override
protected boolean doProcess(TbActorMsg msg) { protected boolean doProcess(TbActorMsg msg) {
if (!ruleChainsInitialized) { if (!ruleChainsInitialized) {
@ -101,6 +113,9 @@ public class AppActor extends ContextAwareActor {
case EDGE_EVENT_UPDATE_TO_EDGE_SESSION_MSG: case EDGE_EVENT_UPDATE_TO_EDGE_SESSION_MSG:
onToTenantActorMsg((EdgeEventUpdateMsg) msg); onToTenantActorMsg((EdgeEventUpdateMsg) msg);
break; break;
case SESSION_TIMEOUT_MSG:
ctx.broadcastToChildrenByType(msg, EntityType.TENANT);
break;
default: default:
return false; return false;
} }
@ -160,7 +175,7 @@ public class AppActor extends ContextAwareActor {
} }
} else { } else {
if (EntityType.TENANT.equals(msg.getEntityId().getEntityType())) { if (EntityType.TENANT.equals(msg.getEntityId().getEntityType())) {
TenantId tenantId = new TenantId(msg.getEntityId().getId()); TenantId tenantId = TenantId.fromUUID(msg.getEntityId().getId());
if (msg.getEvent() == ComponentLifecycleEvent.DELETED) { if (msg.getEvent() == ComponentLifecycleEvent.DELETED) {
log.info("[{}] Handling tenant deleted notification: {}", msg.getTenantId(), msg); log.info("[{}] Handling tenant deleted notification: {}", msg.getTenantId(), msg);
deletedTenants.add(tenantId); deletedTenants.add(tenantId);
@ -222,7 +237,7 @@ public class AppActor extends ContextAwareActor {
@Override @Override
public TbActorId createActorId() { public TbActorId createActorId() {
return new TbEntityActorId(new TenantId(EntityId.NULL_UUID)); return new TbEntityActorId(TenantId.SYS_TENANT_ID);
} }
@Override @Override

2
application/src/main/java/org/thingsboard/server/actors/app/AppInitMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/device/DeviceActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/device/DeviceActorCreator.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

48
application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -97,6 +97,7 @@ import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -116,6 +117,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor { class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor {
static final String SESSION_TIMEOUT_MESSAGE = "session timeout!";
final TenantId tenantId; final TenantId tenantId;
final DeviceId deviceId; final DeviceId deviceId;
final LinkedHashMapRemoveEldest<UUID, SessionInfoMetaData> sessions; final LinkedHashMapRemoveEldest<UUID, SessionInfoMetaData> sessions;
@ -450,6 +452,7 @@ class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor {
.setRequestId(requestId) .setRequestId(requestId)
.setSharedStateMsg(true) .setSharedStateMsg(true)
.addAllSharedAttributeList(toTsKvProtos(result)) .addAllSharedAttributeList(toTsKvProtos(result))
.setIsMultipleAttributesRequest(request.getSharedAttributeNamesCount() > 1)
.build(); .build();
sendToTransport(responseMsg, sessionInfo); sendToTransport(responseMsg, sessionInfo);
} }
@ -471,6 +474,8 @@ class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor {
.setRequestId(requestId) .setRequestId(requestId)
.addAllClientAttributeList(toTsKvProtos(result.get(0))) .addAllClientAttributeList(toTsKvProtos(result.get(0)))
.addAllSharedAttributeList(toTsKvProtos(result.get(1))) .addAllSharedAttributeList(toTsKvProtos(result.get(1)))
.setIsMultipleAttributesRequest(
request.getSharedAttributeNamesCount() + request.getClientAttributeNamesCount() > 1)
.build(); .build();
sendToTransport(responseMsg, sessionInfo); sendToTransport(responseMsg, sessionInfo);
} }
@ -939,7 +944,6 @@ class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor {
} }
void init(TbActorCtx ctx) { void init(TbActorCtx ctx) {
schedulePeriodicMsgWithDelay(ctx, SessionTimeoutCheckMsg.instance(), systemContext.getSessionReportTimeout(), systemContext.getSessionReportTimeout());
PageLink pageLink = new PageLink(1024, 0, null, new SortOrder("createdTime")); PageLink pageLink = new PageLink(1024, 0, null, new SortOrder("createdTime"));
PageData<Rpc> pageData; PageData<Rpc> pageData;
do { do {
@ -961,19 +965,35 @@ class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor {
} }
void checkSessionsTimeout() { void checkSessionsTimeout() {
log.debug("[{}] checkSessionsTimeout started. Size before check {}", deviceId, sessions.size()); final long expTime = System.currentTimeMillis() - systemContext.getSessionInactivityTimeout();
long expTime = System.currentTimeMillis() - systemContext.getSessionInactivityTimeout(); List<UUID> expiredIds = null;
Map<UUID, SessionInfoMetaData> sessionsToRemove = sessions.entrySet().stream().filter(kv -> kv.getValue().getLastActivityTime() < expTime).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
sessionsToRemove.forEach((sessionId, sessionMD) -> { for (Map.Entry<UUID, SessionInfoMetaData> kv : sessions.entrySet()) { //entry set are cached for stable sessions
sessions.remove(sessionId); if (kv.getValue().getLastActivityTime() < expTime) {
rpcSubscriptions.remove(sessionId); final UUID id = kv.getKey();
attributeSubscriptions.remove(sessionId); if (expiredIds == null) {
notifyTransportAboutClosedSession(sessionId, sessionMD, "session timeout!"); expiredIds = new ArrayList<>(1); //most of the expired sessions is a single event
}); }
if (!sessionsToRemove.isEmpty()) { expiredIds.add(id);
dumpSessions(); }
} }
log.debug("[{}] checkSessionsTimeout finished. Size after check {}", deviceId, sessions.size());
if (expiredIds != null) {
int removed = 0;
for (UUID id : expiredIds) {
final SessionInfoMetaData session = sessions.remove(id);
rpcSubscriptions.remove(id);
attributeSubscriptions.remove(id);
if (session != null) {
removed++;
notifyTransportAboutClosedSession(id, session, SESSION_TIMEOUT_MESSAGE);
}
}
if (removed != 0) {
dumpSessions();
}
}
} }
} }

2
application/src/main/java/org/thingsboard/server/actors/device/SessionInfo.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/device/SessionInfoMetaData.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/device/SessionTimeoutCheckMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/device/ToDeviceRpcRequestMetadata.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/device/ToServerRpcRequestMetadata.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

12
application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -167,6 +167,11 @@ class DefaultTbContext implements TbContext {
} }
private void enqueue(TopicPartitionInfo tpi, TbMsg tbMsg, Consumer<Throwable> onFailure, Runnable onSuccess) { private void enqueue(TopicPartitionInfo tpi, TbMsg tbMsg, Consumer<Throwable> onFailure, Runnable onSuccess) {
if (!tbMsg.isValid()) {
log.trace("[{}] Skip invalid message: {}", getTenantId(), tbMsg);
onFailure.accept(new IllegalArgumentException("Source message is no longer valid!"));
return;
}
TransportProtos.ToRuleEngineMsg msg = TransportProtos.ToRuleEngineMsg.newBuilder() TransportProtos.ToRuleEngineMsg msg = TransportProtos.ToRuleEngineMsg.newBuilder()
.setTenantIdMSB(getTenantId().getId().getMostSignificantBits()) .setTenantIdMSB(getTenantId().getId().getMostSignificantBits())
.setTenantIdLSB(getTenantId().getId().getLeastSignificantBits()) .setTenantIdLSB(getTenantId().getId().getLeastSignificantBits())
@ -235,6 +240,11 @@ class DefaultTbContext implements TbContext {
} }
private void enqueueForTellNext(TopicPartitionInfo tpi, String queueName, TbMsg source, Set<String> relationTypes, String failureMessage, Runnable onSuccess, Consumer<Throwable> onFailure) { private void enqueueForTellNext(TopicPartitionInfo tpi, String queueName, TbMsg source, Set<String> relationTypes, String failureMessage, Runnable onSuccess, Consumer<Throwable> onFailure) {
if (!source.isValid()) {
log.trace("[{}] Skip invalid message: {}", getTenantId(), source);
onFailure.accept(new IllegalArgumentException("Source message is no longer valid!"));
return;
}
RuleChainId ruleChainId = nodeCtx.getSelf().getRuleChainId(); RuleChainId ruleChainId = nodeCtx.getSelf().getRuleChainId();
RuleNodeId ruleNodeId = nodeCtx.getSelf().getId(); RuleNodeId ruleNodeId = nodeCtx.getSelf().getId();
TbMsg tbMsg = TbMsg.newMsg(source, queueName, ruleChainId, ruleNodeId); TbMsg tbMsg = TbMsg.newMsg(source, queueName, ruleChainId, ruleNodeId);

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

30
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainActorMessageProcessor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -200,17 +200,20 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
void onQueueToRuleEngineMsg(QueueToRuleEngineMsg envelope) { void onQueueToRuleEngineMsg(QueueToRuleEngineMsg envelope) {
TbMsg msg = envelope.getMsg(); TbMsg msg = envelope.getMsg();
if (!checkMsgValid(msg)) {
return;
}
log.trace("[{}][{}] Processing message [{}]: {}", entityId, firstId, msg.getId(), msg); log.trace("[{}][{}] Processing message [{}]: {}", entityId, firstId, msg.getId(), msg);
if (envelope.getRelationTypes() == null || envelope.getRelationTypes().isEmpty()) { if (envelope.getRelationTypes() == null || envelope.getRelationTypes().isEmpty()) {
onTellNext(msg, true); onTellNext(msg, true);
} else { } else {
onTellNext(envelope.getMsg(), envelope.getMsg().getRuleNodeId(), envelope.getRelationTypes(), envelope.getFailureMessage()); onTellNext(msg, envelope.getMsg().getRuleNodeId(), envelope.getRelationTypes(), envelope.getFailureMessage());
} }
} }
private void onTellNext(TbMsg msg, boolean useRuleNodeIdFromMsg) { private void onTellNext(TbMsg msg, boolean useRuleNodeIdFromMsg) {
try { try {
checkActive(msg); checkComponentStateActive(msg);
RuleNodeId targetId = useRuleNodeIdFromMsg ? msg.getRuleNodeId() : null; RuleNodeId targetId = useRuleNodeIdFromMsg ? msg.getRuleNodeId() : null;
RuleNodeCtx targetCtx; RuleNodeCtx targetCtx;
if (targetId == null) { if (targetId == null) {
@ -234,6 +237,10 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
} }
public void onRuleChainInputMsg(RuleChainInputMsg envelope) { public void onRuleChainInputMsg(RuleChainInputMsg envelope) {
var msg = envelope.getMsg();
if (!checkMsgValid(msg)) {
return;
}
if (entityId.equals(envelope.getRuleChainId())) { if (entityId.equals(envelope.getRuleChainId())) {
onTellNext(envelope.getMsg(), false); onTellNext(envelope.getMsg(), false);
} else { } else {
@ -242,6 +249,10 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
} }
public void onRuleChainOutputMsg(RuleChainOutputMsg envelope) { public void onRuleChainOutputMsg(RuleChainOutputMsg envelope) {
var msg = envelope.getMsg();
if (!checkMsgValid(msg)) {
return;
}
if (entityId.equals(envelope.getRuleChainId())) { if (entityId.equals(envelope.getRuleChainId())) {
var originatorNodeId = envelope.getTargetRuleNodeId(); var originatorNodeId = envelope.getTargetRuleNodeId();
RuleNodeCtx ruleNodeCtx = nodeActors.get(originatorNodeId); RuleNodeCtx ruleNodeCtx = nodeActors.get(originatorNodeId);
@ -255,8 +266,12 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
} }
void onRuleChainToRuleChainMsg(RuleChainToRuleChainMsg envelope) { void onRuleChainToRuleChainMsg(RuleChainToRuleChainMsg envelope) {
var msg = envelope.getMsg();
if (!checkMsgValid(msg)) {
return;
}
try { try {
checkActive(envelope.getMsg()); checkComponentStateActive(envelope.getMsg());
if (firstNode != null) { if (firstNode != null) {
pushMsgToNode(firstNode, envelope.getMsg(), envelope.getFromRelationType()); pushMsgToNode(firstNode, envelope.getMsg(), envelope.getFromRelationType());
} else { } else {
@ -268,12 +283,15 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
} }
void onTellNext(RuleNodeToRuleChainTellNextMsg envelope) { void onTellNext(RuleNodeToRuleChainTellNextMsg envelope) {
onTellNext(envelope.getMsg(), envelope.getOriginator(), envelope.getRelationTypes(), envelope.getFailureMessage()); var msg = envelope.getMsg();
if (checkMsgValid(msg)) {
onTellNext(msg, envelope.getOriginator(), envelope.getRelationTypes(), envelope.getFailureMessage());
}
} }
private void onTellNext(TbMsg msg, RuleNodeId originatorNodeId, Set<String> relationTypes, String failureMessage) { private void onTellNext(TbMsg msg, RuleNodeId originatorNodeId, Set<String> relationTypes, String failureMessage) {
try { try {
checkActive(msg); checkComponentStateActive(msg);
EntityId entityId = msg.getOriginator(); EntityId entityId = msg.getOriginator();
TopicPartitionInfo tpi = systemContext.resolve(ServiceType.TB_RULE_ENGINE, msg.getQueueName(), tenantId, entityId); TopicPartitionInfo tpi = systemContext.resolve(ServiceType.TB_RULE_ENGINE, msg.getQueueName(), tenantId, entityId);

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainInputMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainManagerActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainOutputMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainToRuleChainMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleChainToRuleNodeMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

16
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,6 +27,7 @@ import org.thingsboard.server.common.data.id.RuleChainId;
import org.thingsboard.server.common.data.id.RuleNodeId; import org.thingsboard.server.common.data.id.RuleNodeId;
import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.msg.TbActorMsg; import org.thingsboard.server.common.msg.TbActorMsg;
import org.thingsboard.server.common.msg.TbMsg;
import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg;
import org.thingsboard.server.common.msg.queue.PartitionChangeMsg; import org.thingsboard.server.common.msg.queue.PartitionChangeMsg;
@ -86,12 +87,19 @@ public class RuleNodeActor extends ComponentActor<RuleNodeId, RuleNodeActorMessa
} }
} }
private void onRuleChainToRuleNodeMsg(RuleChainToRuleNodeMsg msg) { private void onRuleChainToRuleNodeMsg(RuleChainToRuleNodeMsg envelope) {
TbMsg msg = envelope.getMsg();
if (!msg.isValid()) {
if (log.isTraceEnabled()) {
log.trace("Skip processing of message: {} because it is no longer valid!", msg);
}
return;
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("[{}][{}][{}] Going to process rule msg: {}", ruleChainId, id, processor.getComponentName(), msg.getMsg()); log.debug("[{}][{}][{}] Going to process rule engine msg: {}", ruleChainId, id, processor.getComponentName(), msg);
} }
try { try {
processor.onRuleChainToRuleNodeMsg(msg); processor.onRuleChainToRuleNodeMsg(envelope);
increaseMessagesProcessedCount(); increaseMessagesProcessedCount();
} catch (Exception e) { } catch (Exception e) {
logAndPersist("onRuleMsg", e); logAndPersist("onRuleMsg", e);

6
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeActorMessageProcessor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -101,7 +101,7 @@ public class RuleNodeActorMessageProcessor extends ComponentMsgProcessor<RuleNod
} }
public void onRuleToSelfMsg(RuleNodeToSelfMsg msg) throws Exception { public void onRuleToSelfMsg(RuleNodeToSelfMsg msg) throws Exception {
checkActive(msg.getMsg()); checkComponentStateActive(msg.getMsg());
TbMsg tbMsg = msg.getMsg(); TbMsg tbMsg = msg.getMsg();
int ruleNodeCount = tbMsg.getAndIncrementRuleNodeCounter(); int ruleNodeCount = tbMsg.getAndIncrementRuleNodeCounter();
int maxRuleNodeExecutionsPerMessage = getTenantProfileConfiguration().getMaxRuleNodeExecsPerMessage(); int maxRuleNodeExecutionsPerMessage = getTenantProfileConfiguration().getMaxRuleNodeExecsPerMessage();
@ -122,7 +122,7 @@ public class RuleNodeActorMessageProcessor extends ComponentMsgProcessor<RuleNod
void onRuleChainToRuleNodeMsg(RuleChainToRuleNodeMsg msg) throws Exception { void onRuleChainToRuleNodeMsg(RuleChainToRuleNodeMsg msg) throws Exception {
msg.getMsg().getCallback().onProcessingStart(info); msg.getMsg().getCallback().onProcessingStart(info);
checkActive(msg.getMsg()); checkComponentStateActive(msg.getMsg());
TbMsg tbMsg = msg.getMsg(); TbMsg tbMsg = msg.getMsg();
int ruleNodeCount = tbMsg.getAndIncrementRuleNodeCounter(); int ruleNodeCount = tbMsg.getAndIncrementRuleNodeCounter();
int maxRuleNodeExecutionsPerMessage = getTenantProfileConfiguration().getMaxRuleNodeExecsPerMessage(); int maxRuleNodeExecutionsPerMessage = getTenantProfileConfiguration().getMaxRuleNodeExecsPerMessage();

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeCtx.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeRelation.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeToRuleChainTellNextMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/RuleNodeToSelfMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/TbToRuleChainActorMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/TbToRuleNodeActorMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/service/ActorService.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/service/ComponentActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/service/ContextAwareActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/service/ContextBasedCreator.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/service/DefaultActorService.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

6
application/src/main/java/org/thingsboard/server/actors/shared/AbstractContextAwareMsgProcessor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,13 +22,13 @@ import org.thingsboard.server.actors.TbActorCtx;
import org.thingsboard.server.common.msg.TbActorMsg; import org.thingsboard.server.common.msg.TbActorMsg;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
public abstract class AbstractContextAwareMsgProcessor { public abstract class AbstractContextAwareMsgProcessor {
protected final static ObjectMapper mapper = new ObjectMapper();
protected final ActorSystemContext systemContext; protected final ActorSystemContext systemContext;
protected final ObjectMapper mapper = new ObjectMapper();
protected AbstractContextAwareMsgProcessor(ActorSystemContext systemContext) { protected AbstractContextAwareMsgProcessor(ActorSystemContext systemContext) {
super(); super();

2
application/src/main/java/org/thingsboard/server/actors/shared/ActorTerminationMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

14
application/src/main/java/org/thingsboard/server/actors/shared/ComponentMsgProcessor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -82,7 +82,17 @@ public abstract class ComponentMsgProcessor<T extends EntityId> extends Abstract
schedulePeriodicMsgWithDelay(context, new StatsPersistTick(), statsPersistFrequency, statsPersistFrequency); schedulePeriodicMsgWithDelay(context, new StatsPersistTick(), statsPersistFrequency, statsPersistFrequency);
} }
protected void checkActive(TbMsg tbMsg) throws RuleNodeException { protected boolean checkMsgValid(TbMsg tbMsg) {
var valid = tbMsg.isValid();
if (!valid) {
if (log.isTraceEnabled()) {
log.trace("Skip processing of message: {} because it is no longer valid!", tbMsg);
}
}
return valid;
}
protected void checkComponentStateActive(TbMsg tbMsg) throws RuleNodeException {
if (state != ComponentLifecycleState.ACTIVE) { if (state != ComponentLifecycleState.ACTIVE) {
log.debug("Component is not active. Current state [{}] for processor [{}][{}] tenant [{}]", state, entityId.getEntityType(), entityId, tenantId); log.debug("Component is not active. Current state [{}] for processor [{}][{}] tenant [{}]", state, entityId.getEntityType(), entityId, tenantId);
RuleNodeException ruleNodeException = getInactiveException(); RuleNodeException ruleNodeException = getInactiveException();

2
application/src/main/java/org/thingsboard/server/actors/stats/StatsActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/stats/StatsPersistMsg.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/stats/StatsPersistTick.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/actors/tenant/DebugTbRateLimits.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

6
application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,6 +26,7 @@ import org.thingsboard.server.actors.TbActorRef;
import org.thingsboard.server.actors.TbEntityActorId; import org.thingsboard.server.actors.TbEntityActorId;
import org.thingsboard.server.actors.TbEntityTypeActorIdPredicate; import org.thingsboard.server.actors.TbEntityTypeActorIdPredicate;
import org.thingsboard.server.actors.device.DeviceActorCreator; import org.thingsboard.server.actors.device.DeviceActorCreator;
import org.thingsboard.server.actors.device.SessionTimeoutCheckMsg;
import org.thingsboard.server.actors.ruleChain.RuleChainInputMsg; import org.thingsboard.server.actors.ruleChain.RuleChainInputMsg;
import org.thingsboard.server.actors.ruleChain.RuleChainManagerActor; import org.thingsboard.server.actors.ruleChain.RuleChainManagerActor;
import org.thingsboard.server.actors.ruleChain.RuleChainOutputMsg; import org.thingsboard.server.actors.ruleChain.RuleChainOutputMsg;
@ -170,6 +171,9 @@ public class TenantActor extends RuleChainManagerActor {
case REMOVE_RPC_TO_DEVICE_ACTOR_MSG: case REMOVE_RPC_TO_DEVICE_ACTOR_MSG:
onToDeviceActorMsg((DeviceAwareMsg) msg, true); onToDeviceActorMsg((DeviceAwareMsg) msg, true);
break; break;
case SESSION_TIMEOUT_MSG:
ctx.broadcastToChildrenByType(msg, EntityType.DEVICE);
break;
case RULE_CHAIN_INPUT_MSG: case RULE_CHAIN_INPUT_MSG:
case RULE_CHAIN_OUTPUT_MSG: case RULE_CHAIN_OUTPUT_MSG:
case RULE_CHAIN_TO_RULE_CHAIN_MSG: case RULE_CHAIN_TO_RULE_CHAIN_MSG:

2
application/src/main/java/org/thingsboard/server/config/AuditLogLevelProperties.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/CustomOAuth2AuthorizationRequestResolver.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/JwtSettings.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/MvcCorsProperties.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/RateLimitProcessingFilter.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/SchedulingConfiguration.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/ThingsboardMessageConfiguration.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/WebConfig.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/config/WebSocketConfiguration.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/controller/AbstractRpcController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/controller/AdminController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

4
application/src/main/java/org/thingsboard/server/controller/AlarmController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -229,7 +229,7 @@ public class AlarmController extends BaseController {
@ApiOperation(value = "Get Alarms (getAlarms)", @ApiOperation(value = "Get Alarms (getAlarms)",
notes = "Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " + notes = "Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " +
PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE) PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/alarm/{entityType}/{entityId}", method = RequestMethod.GET) @RequestMapping(value = "/alarm/{entityType}/{entityId}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public PageData<AlarmInfo> getAlarms( public PageData<AlarmInfo> getAlarms(

2
application/src/main/java/org/thingsboard/server/controller/AssetController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/controller/AuditLogController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/controller/AuthController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

4
application/src/main/java/org/thingsboard/server/controller/BaseController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -482,7 +482,7 @@ public abstract class BaseController {
checkCustomerId(new CustomerId(entityId.getId()), operation); checkCustomerId(new CustomerId(entityId.getId()), operation);
return; return;
case TENANT: case TENANT:
checkTenantId(new TenantId(entityId.getId()), operation); checkTenantId(TenantId.fromUUID(entityId.getId()), operation);
return; return;
case TENANT_PROFILE: case TENANT_PROFILE:
checkTenantProfileId(new TenantProfileId(entityId.getId()), operation); checkTenantProfileId(new TenantProfileId(entityId.getId()), operation);

2
application/src/main/java/org/thingsboard/server/controller/ComponentDescriptorController.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
application/src/main/java/org/thingsboard/server/controller/ControllerConstants.java

@ -1,5 +1,5 @@
/** /**
* Copyright © 2016-2021 The Thingsboard Authors * Copyright © 2016-2022 The Thingsboard Authors
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save