From 3ccf0b0d3d1599f57cb41d2013cdbabd763b431c Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Wed, 18 Dec 2024 15:38:20 +0200 Subject: [PATCH 001/100] Refactor edge: remove deprecated proto usage --- .../service/edge/EdgeContextComponent.java | 138 +++-- .../service/edge/EdgeMsgConstructorUtils.java | 544 ++++++++++++++++++ .../service/edge/rpc/EdgeGrpcService.java | 2 +- .../service/edge/rpc/EdgeGrpcSession.java | 103 +--- .../BaseMsgConstructorFactory.java | 40 -- .../edge/rpc/constructor/MsgConstructor.java | 20 - .../alarm/AlarmMsgConstructor.java | 30 - .../alarm/AlarmMsgConstructorFactory.java | 26 - .../alarm/AlarmMsgConstructorV1.java | 50 -- .../alarm/AlarmMsgConstructorV2.java | 36 -- .../asset/AssetMsgConstructor.java | 36 -- .../asset/AssetMsgConstructorFactory.java | 26 - .../asset/AssetMsgConstructorV1.java | 94 --- .../asset/AssetMsgConstructorV2.java | 44 -- .../asset/BaseAssetMsgConstructor.java | 41 -- .../customer/BaseCustomerMsgConstructor.java | 31 - .../customer/CustomerMsgConstructor.java | 29 - .../CustomerMsgConstructorFactory.java | 26 - .../customer/CustomerMsgConstructorV1.java | 65 --- .../customer/CustomerMsgConstructorV2.java | 35 -- .../BaseDashboardMsgConstructor.java | 32 -- .../dashboard/DashboardMsgConstructor.java | 30 - .../DashboardMsgConstructorFactory.java | 26 - .../dashboard/DashboardMsgConstructorV1.java | 57 -- .../dashboard/DashboardMsgConstructorV2.java | 36 -- .../device/BaseDeviceMsgConstructor.java | 102 ---- .../device/DeviceMsgConstructor.java | 47 -- .../device/DeviceMsgConstructorFactory.java | 26 - .../device/DeviceMsgConstructorV1.java | 141 ----- .../device/DeviceMsgConstructorV2.java | 52 -- .../constructor/edge/EdgeMsgConstructor.java | 47 -- .../BaseEntityViewMsgConstructor.java | 32 -- .../entityview/EntityViewMsgConstructor.java | 30 - .../EntityViewMsgConstructorFactory.java | 26 - .../EntityViewMsgConstructorV1.java | 61 -- .../EntityViewMsgConstructorV2.java | 36 -- .../NotificationMsgConstructor.java | 43 -- .../NotificationMsgConstructorImpl.java | 75 --- .../oauth2/OAuth2MsgConstructor.java | 60 -- .../ota/BaseOtaPackageMsgConstructor.java | 31 - .../ota/OtaPackageMsgConstructor.java | 29 - .../ota/OtaPackageMsgConstructorFactory.java | 26 - .../ota/OtaPackageMsgConstructorV1.java | 72 --- .../ota/OtaPackageMsgConstructorV2.java | 35 -- .../queue/BaseQueueMsgConstructor.java | 31 - .../queue/QueueMsgConstructor.java | 29 - .../queue/QueueMsgConstructorFactory.java | 26 - .../queue/QueueMsgConstructorV1.java | 74 --- .../queue/QueueMsgConstructorV2.java | 35 -- .../relation/RelationMsgConstructor.java | 26 - .../RelationMsgConstructorFactory.java | 26 - .../relation/RelationMsgConstructorV1.java | 48 -- .../relation/RelationMsgConstructorV2.java | 34 -- .../resource/BaseResourceMsgConstructor.java | 31 - .../resource/ResourceMsgConstructor.java | 29 - .../ResourceMsgConstructorFactory.java | 26 - .../resource/ResourceMsgConstructorV1.java | 56 -- .../resource/ResourceMsgConstructorV2.java | 35 -- .../BaseRuleChainMetadataConstructor.java | 133 ----- .../rule/BaseRuleChainMsgConstructor.java | 44 -- .../rule/RuleChainMetadataConstructor.java | 30 - .../RuleChainMetadataConstructorFactory.java | 36 -- .../RuleChainMetadataConstructorV330.java | 166 ------ .../RuleChainMetadataConstructorV340.java | 43 -- .../RuleChainMetadataConstructorV362.java | 29 - .../rule/RuleChainMsgConstructor.java | 38 -- .../rule/RuleChainMsgConstructorFactory.java | 26 - .../rule/RuleChainMsgConstructorV1.java | 45 -- .../rule/RuleChainMsgConstructorV2.java | 39 -- .../settings/AdminSettingsMsgConstructor.java | 25 - .../AdminSettingsMsgConstructorFactory.java | 26 - .../AdminSettingsMsgConstructorV1.java | 39 -- .../AdminSettingsMsgConstructorV2.java | 32 -- .../telemetry/EntityDataMsgConstructor.java | 110 ---- .../tenant/TenantMsgConstructor.java | 31 - .../tenant/TenantMsgConstructorFactory.java | 26 - .../tenant/TenantMsgConstructorV1.java | 111 ---- .../tenant/TenantMsgConstructorV2.java | 42 -- .../user/BaseUserMsgConstructor.java | 31 - .../constructor/user/UserMsgConstructor.java | 33 -- .../user/UserMsgConstructorFactory.java | 26 - .../user/UserMsgConstructorV1.java | 63 -- .../user/UserMsgConstructorV2.java | 42 -- .../widget/BaseWidgetMsgConstructor.java | 43 -- .../widget/WidgetMsgConstructor.java | 39 -- .../widget/WidgetMsgConstructorFactory.java | 26 - .../widget/WidgetMsgConstructorV1.java | 115 ---- .../widget/WidgetMsgConstructorV2.java | 48 -- .../edge/rpc/processor/BaseEdgeProcessor.java | 3 +- .../processor/BaseEdgeProcessorFactory.java | 40 -- .../edge/rpc/processor/EdgeProcessor.java | 13 + .../processor/alarm/AlarmEdgeProcessor.java | 105 +--- .../alarm/AlarmEdgeProcessorFactory.java | 26 - .../processor/alarm/AlarmEdgeProcessorV1.java | 69 --- .../processor/alarm/AlarmEdgeProcessorV2.java | 44 -- .../rpc/processor/alarm/AlarmProcessor.java | 10 - .../processor/alarm/BaseAlarmProcessor.java | 29 +- .../comment/AlarmCommentEdgeProcessor.java | 93 +++ .../alarm/comment/AlarmCommentProcessor.java} | 17 +- .../processor/asset/AssetEdgeProcessor.java | 25 +- .../asset/AssetEdgeProcessorFactory.java | 26 - .../processor/asset/AssetEdgeProcessorV1.java | 60 -- .../processor/asset/AssetEdgeProcessorV2.java | 44 -- .../rpc/processor/asset/AssetProcessor.java | 5 - .../processor/asset/BaseAssetProcessor.java | 5 +- .../profile/AssetProfileEdgeProcessor.java | 36 +- .../AssetProfileEdgeProcessorFactory.java | 26 - .../profile/AssetProfileEdgeProcessorV1.java | 65 --- .../profile/AssetProfileEdgeProcessorV2.java | 57 -- .../asset/profile/AssetProfileProcessor.java | 5 - .../profile/BaseAssetProfileProcessor.java | 5 +- .../customer/CustomerEdgeProcessor.java | 21 +- .../dashboard/BaseDashboardProcessor.java | 5 +- .../dashboard/DashboardEdgeProcessor.java | 21 +- .../DashboardEdgeProcessorFactory.java | 26 - .../dashboard/DashboardEdgeProcessorV1.java | 54 -- .../dashboard/DashboardEdgeProcessorV2.java | 37 -- .../dashboard/DashboardProcessor.java | 4 - .../processor/device/BaseDeviceProcessor.java | 9 +- .../processor/device/DeviceEdgeProcessor.java | 31 +- .../device/DeviceEdgeProcessorFactory.java | 26 - .../device/DeviceEdgeProcessorV1.java | 79 --- .../device/DeviceEdgeProcessorV2.java | 50 -- .../rpc/processor/device/DeviceProcessor.java | 5 - .../profile/BaseDeviceProfileProcessor.java | 5 +- .../profile/DeviceProfileEdgeProcessor.java | 50 +- .../DeviceProfileEdgeProcessorFactory.java | 26 - .../profile/DeviceProfileEdgeProcessorV1.java | 89 --- .../profile/DeviceProfileEdgeProcessorV2.java | 57 -- .../profile/DeviceProfileProcessor.java | 5 - ...rocessor.java => EdgeEntityProcessor.java} | 41 +- .../entityview/BaseEntityViewProcessor.java | 5 +- .../entityview/EntityViewEdgeProcessor.java | 29 +- .../entityview/EntityViewProcessor.java | 5 - .../EntityViewProcessorFactory.java | 26 - .../entityview/EntityViewProcessorV1.java | 66 --- .../entityview/EntityViewProcessorV2.java | 44 -- .../NotificationEdgeProcessor.java | 136 ----- .../NotificationRuleEdgeProcessor.java | 68 +++ .../NotificationTargetEdgeProcessor.java | 68 +++ .../NotificationTemplateEdgeProcessor.java | 68 +++ ...rocessor.java => DomainEdgeProcessor.java} | 56 +- .../oauth2/OAuth2ClientEdgeProcessor.java | 67 +++ .../ota/OtaPackageEdgeProcessor.java | 18 +- .../processor/queue/QueueEdgeProcessor.java | 16 +- .../relation/BaseRelationProcessor.java | 5 +- .../relation/RelationEdgeProcessor.java | 38 +- .../RelationEdgeProcessorFactory.java | 26 - .../relation/RelationEdgeProcessorV1.java | 53 -- .../relation/RelationEdgeProcessorV2.java | 35 -- .../processor/relation/RelationProcessor.java | 5 - .../resource/BaseResourceProcessor.java | 5 +- .../resource/ResourceEdgeProcessor.java | 25 +- .../ResourceEdgeProcessorFactory.java | 26 - .../resource/ResourceEdgeProcessorV1.java | 49 -- .../resource/ResourceEdgeProcessorV2.java | 37 -- .../processor/resource/ResourceProcessor.java | 5 - .../rule/RuleChainEdgeProcessor.java | 43 +- .../rule/RuleChainMetadataEdgeProcessor.java | 54 ++ .../settings/AdminSettingsEdgeProcessor.java | 15 +- .../telemetry/BaseTelemetryProcessor.java | 8 +- .../processor/tenant/TenantEdgeProcessor.java | 16 +- .../tenant/TenantProfileEdgeProcessor.java | 14 +- .../rpc/processor/user/UserEdgeProcessor.java | 20 +- .../widget/WidgetBundleEdgeProcessor.java | 16 +- .../widget/WidgetTypeEdgeProcessor.java | 16 +- .../queue/DefaultTbEdgeConsumerService.java | 31 +- .../thingsboard/edge/rpc/EdgeGrpcClient.java | 2 +- common/edge-api/src/main/proto/edge.proto | 262 +-------- 169 files changed, 1396 insertions(+), 6142 deletions(-) create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/BaseMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/MsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/BaseAssetMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/BaseCustomerMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/BaseDashboardMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/BaseDeviceMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/edge/EdgeMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/BaseEntityViewMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructorImpl.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/oauth2/OAuth2MsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/BaseOtaPackageMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/BaseQueueMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/BaseResourceMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMetadataConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV330.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV340.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV362.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/BaseUserMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/BaseWidgetMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV2.java create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java rename application/src/main/java/org/thingsboard/server/service/edge/rpc/{constructor/alarm/BaseAlarmMsgConstructor.java => processor/alarm/comment/AlarmCommentProcessor.java} (54%) delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV2.java rename application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/{EdgeProcessor.java => EdgeEntityProcessor.java} (93%) delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationEdgeProcessor.java create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java rename application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/{OAuth2EdgeProcessor.java => DomainEdgeProcessor.java} (53%) create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV2.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorFactory.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV1.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV2.java create mode 100644 application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java index ee50bbb4a3..ce0725a627 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java @@ -17,11 +17,11 @@ package org.thingsboard.server.service.edge; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import org.thingsboard.server.cache.limits.RateLimitService; import org.thingsboard.server.cluster.TbClusterService; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; import org.thingsboard.server.dao.alarm.AlarmCommentService; import org.thingsboard.server.dao.alarm.AlarmService; @@ -55,34 +55,28 @@ import org.thingsboard.server.dao.widget.WidgetsBundleService; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.rpc.EdgeEventStorageSettings; import org.thingsboard.server.service.edge.rpc.EdgeRpcService; -import org.thingsboard.server.service.edge.rpc.constructor.asset.AssetMsgConstructorFactory; -import org.thingsboard.server.service.edge.rpc.constructor.device.DeviceMsgConstructorFactory; -import org.thingsboard.server.service.edge.rpc.constructor.edge.EdgeMsgConstructor; -import org.thingsboard.server.service.edge.rpc.processor.alarm.AlarmEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.alarm.AlarmEdgeProcessorFactory; +import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.alarm.AlarmProcessor; +import org.thingsboard.server.service.edge.rpc.processor.alarm.comment.AlarmCommentProcessor; import org.thingsboard.server.service.edge.rpc.processor.asset.AssetEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.asset.AssetEdgeProcessorFactory; import org.thingsboard.server.service.edge.rpc.processor.asset.profile.AssetProfileEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.asset.profile.AssetProfileEdgeProcessorFactory; import org.thingsboard.server.service.edge.rpc.processor.customer.CustomerEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.dashboard.DashboardEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.dashboard.DashboardEdgeProcessorFactory; import org.thingsboard.server.service.edge.rpc.processor.device.DeviceEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.device.DeviceEdgeProcessorFactory; import org.thingsboard.server.service.edge.rpc.processor.device.profile.DeviceProfileEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.device.profile.DeviceProfileEdgeProcessorFactory; -import org.thingsboard.server.service.edge.rpc.processor.edge.EdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.edge.EdgeEntityProcessor; import org.thingsboard.server.service.edge.rpc.processor.entityview.EntityViewEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.entityview.EntityViewProcessorFactory; -import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.oauth2.OAuth2EdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationRuleEdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationTargetEdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationTemplateEdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.oauth2.DomainEdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.oauth2.OAuth2ClientEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.ota.OtaPackageEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.queue.QueueEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.relation.RelationEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.relation.RelationEdgeProcessorFactory; import org.thingsboard.server.service.edge.rpc.processor.resource.ResourceEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.resource.ResourceEdgeProcessorFactory; import org.thingsboard.server.service.edge.rpc.processor.rule.RuleChainEdgeProcessor; +import org.thingsboard.server.service.edge.rpc.processor.rule.RuleChainMetadataEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.settings.AdminSettingsEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.telemetry.TelemetryEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.tenant.TenantEdgeProcessor; @@ -93,12 +87,51 @@ import org.thingsboard.server.service.edge.rpc.processor.widget.WidgetTypeEdgePr import org.thingsboard.server.service.edge.rpc.sync.EdgeRequestsService; import org.thingsboard.server.service.executors.GrpcCallbackExecutorService; +import javax.annotation.PostConstruct; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + @Lazy @Data @Component @TbCoreComponent public class EdgeContextComponent { + private Map processorMap; + + @PostConstruct + private void initProcessorMap() { + Map map = new HashMap<>(); + map.put(EdgeEventType.ADMIN_SETTINGS, adminSettingsProcessor); + map.put(EdgeEventType.ALARM, alarmProcessor); + map.put(EdgeEventType.ALARM_COMMENT, alarmCommentProcessor); + map.put(EdgeEventType.ASSET, assetProcessor); + map.put(EdgeEventType.ASSET_PROFILE, assetProfileProcessor); + map.put(EdgeEventType.CUSTOMER, customerProcessor); + map.put(EdgeEventType.DASHBOARD, dashboardProcessor); + map.put(EdgeEventType.DEVICE, deviceProcessor); + map.put(EdgeEventType.DEVICE_PROFILE, deviceProfileProcessor); + map.put(EdgeEventType.DOMAIN, domainProcessor); + map.put(EdgeEventType.EDGE, edgeEntityProcessor); + map.put(EdgeEventType.ENTITY_VIEW, entityViewProcessor); + map.put(EdgeEventType.NOTIFICATION_RULE, notificationRuleProcessor); + map.put(EdgeEventType.NOTIFICATION_TARGET, notificationTargetProcessor); + map.put(EdgeEventType.NOTIFICATION_TEMPLATE, notificationTemplateProcessor); + map.put(EdgeEventType.OTA_PACKAGE, otaPackageProcessor); + map.put(EdgeEventType.QUEUE, queueProcessor); + map.put(EdgeEventType.RELATION, relationProcessor); + map.put(EdgeEventType.RULE_CHAIN, ruleChainProcessor); + map.put(EdgeEventType.RULE_CHAIN_METADATA, ruleChainMetadataProcessor); + map.put(EdgeEventType.TB_RESOURCE, resourceProcessor); + map.put(EdgeEventType.TENANT, tenantProcessor); + map.put(EdgeEventType.TENANT_PROFILE, tenantProfileProcessor); + map.put(EdgeEventType.USER, userProcessor); + map.put(EdgeEventType.WIDGETS_BUNDLE, widgetBundleProcessor); + map.put(EdgeEventType.WIDGET_TYPE, widgetTypeProcessor); + this.processorMap = Collections.unmodifiableMap(map); + } + // services @Autowired private AdminSettingsService adminSettingsService; @@ -205,7 +238,10 @@ public class EdgeContextComponent { private AdminSettingsEdgeProcessor adminSettingsProcessor; @Autowired - private AlarmEdgeProcessor alarmProcessor; + private AlarmProcessor alarmProcessor; + + @Autowired + private AlarmCommentProcessor alarmCommentProcessor; @Autowired private AssetEdgeProcessor assetProcessor; @@ -226,19 +262,28 @@ public class EdgeContextComponent { private DeviceProfileEdgeProcessor deviceProfileProcessor; @Autowired - private EdgeProcessor edgeProcessor; + private EdgeEntityProcessor edgeEntityProcessor; @Autowired private EntityViewEdgeProcessor entityViewProcessor; @Autowired - private NotificationEdgeProcessor notificationEdgeProcessor; + private NotificationRuleProcessor ruleProcessor; + + @Autowired + private NotificationRuleEdgeProcessor notificationRuleProcessor; + + @Autowired + private NotificationTargetEdgeProcessor notificationTargetProcessor; + + @Autowired + private NotificationTemplateEdgeProcessor notificationTemplateProcessor; @Autowired - private NotificationRuleProcessor notificationRuleProcessor; + private DomainEdgeProcessor domainProcessor; @Autowired - private OAuth2EdgeProcessor oAuth2EdgeProcessor; + private OAuth2ClientEdgeProcessor oAuth2ClientProcessor; @Autowired private OtaPackageEdgeProcessor otaPackageProcessor; @@ -255,6 +300,9 @@ public class EdgeContextComponent { @Autowired private RuleChainEdgeProcessor ruleChainProcessor; + @Autowired + private RuleChainMetadataEdgeProcessor ruleChainMetadataProcessor; + @Autowired private TelemetryEdgeProcessor telemetryProcessor; @@ -273,44 +321,6 @@ public class EdgeContextComponent { @Autowired private WidgetTypeEdgeProcessor widgetTypeProcessor; - // msg constructors - @Autowired - private EdgeMsgConstructor edgeMsgConstructor; - - // factories - @Autowired - private AlarmEdgeProcessorFactory alarmEdgeProcessorFactory; - - @Autowired - private AssetEdgeProcessorFactory assetEdgeProcessorFactory; - - @Autowired - private AssetMsgConstructorFactory assetMsgConstructorFactory; - - @Autowired - private AssetProfileEdgeProcessorFactory assetProfileEdgeProcessorFactory; - - @Autowired - private DashboardEdgeProcessorFactory dashboardEdgeProcessorFactory; - - @Autowired - private DeviceEdgeProcessorFactory deviceEdgeProcessorFactory; - - @Autowired - private DeviceMsgConstructorFactory deviceMsgConstructorFactory; - - @Autowired - private DeviceProfileEdgeProcessorFactory deviceProfileEdgeProcessorFactory; - - @Autowired - private EntityViewProcessorFactory entityViewProcessorFactory; - - @Autowired - private RelationEdgeProcessorFactory relationEdgeProcessorFactory; - - @Autowired - private ResourceEdgeProcessorFactory resourceEdgeProcessorFactory; - // config @Autowired private EdgeEventStorageSettings edgeEventStorageSettings; @@ -319,4 +329,12 @@ public class EdgeContextComponent { @Autowired private GrpcCallbackExecutorService grpcCallbackExecutorService; + public EdgeProcessor getProcessor(EdgeEventType edgeEventType) { + EdgeProcessor processor = processorMap.get(edgeEventType); + if (processor == null) { + throw new UnsupportedOperationException("No processor found for EdgeEventType: " + edgeEventType); + } + return processor; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java new file mode 100644 index 0000000000..6e0419ee5f --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java @@ -0,0 +1,544 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge; + +import com.fasterxml.jackson.databind.JsonNode; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.google.gson.reflect.TypeToken; +import lombok.extern.slf4j.Slf4j; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.adaptor.JsonConverter; +import org.thingsboard.server.common.data.Customer; +import org.thingsboard.server.common.data.Dashboard; +import org.thingsboard.server.common.data.DataConstants; +import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.DeviceProfile; +import org.thingsboard.server.common.data.EntityView; +import org.thingsboard.server.common.data.OtaPackage; +import org.thingsboard.server.common.data.StringUtils; +import org.thingsboard.server.common.data.TbResource; +import org.thingsboard.server.common.data.Tenant; +import org.thingsboard.server.common.data.TenantProfile; +import org.thingsboard.server.common.data.User; +import org.thingsboard.server.common.data.alarm.Alarm; +import org.thingsboard.server.common.data.alarm.AlarmComment; +import org.thingsboard.server.common.data.asset.Asset; +import org.thingsboard.server.common.data.asset.AssetProfile; +import org.thingsboard.server.common.data.domain.DomainInfo; +import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.edge.EdgeEventActionType; +import org.thingsboard.server.common.data.id.AssetId; +import org.thingsboard.server.common.data.id.AssetProfileId; +import org.thingsboard.server.common.data.id.CustomerId; +import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.DeviceId; +import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.DomainId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.EntityViewId; +import org.thingsboard.server.common.data.id.NotificationRuleId; +import org.thingsboard.server.common.data.id.NotificationTargetId; +import org.thingsboard.server.common.data.id.NotificationTemplateId; +import org.thingsboard.server.common.data.id.OAuth2ClientId; +import org.thingsboard.server.common.data.id.OtaPackageId; +import org.thingsboard.server.common.data.id.QueueId; +import org.thingsboard.server.common.data.id.RuleChainId; +import org.thingsboard.server.common.data.id.TbResourceId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.id.UserId; +import org.thingsboard.server.common.data.id.WidgetTypeId; +import org.thingsboard.server.common.data.id.WidgetsBundleId; +import org.thingsboard.server.common.data.notification.rule.NotificationRule; +import org.thingsboard.server.common.data.notification.targets.NotificationTarget; +import org.thingsboard.server.common.data.notification.template.NotificationTemplate; +import org.thingsboard.server.common.data.oauth2.OAuth2Client; +import org.thingsboard.server.common.data.queue.Queue; +import org.thingsboard.server.common.data.relation.EntityRelation; +import org.thingsboard.server.common.data.rule.RuleChain; +import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.security.DeviceCredentials; +import org.thingsboard.server.common.data.security.UserCredentials; +import org.thingsboard.server.common.data.widget.WidgetTypeDetails; +import org.thingsboard.server.common.data.widget.WidgetsBundle; +import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; +import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; +import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; +import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; +import org.thingsboard.server.gen.edge.v1.AttributeDeleteMsg; +import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; +import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; +import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; +import org.thingsboard.server.gen.edge.v1.EntityDataProto; +import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; +import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; +import org.thingsboard.server.gen.edge.v1.NotificationTargetUpdateMsg; +import org.thingsboard.server.gen.edge.v1.NotificationTemplateUpdateMsg; +import org.thingsboard.server.gen.edge.v1.OAuth2ClientUpdateMsg; +import org.thingsboard.server.gen.edge.v1.OAuth2DomainUpdateMsg; +import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; +import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; +import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; +import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; +import org.thingsboard.server.gen.edge.v1.RpcRequestMsg; +import org.thingsboard.server.gen.edge.v1.RpcResponseMsg; +import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; +import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; +import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; +import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; +import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; +import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; +import org.thingsboard.server.gen.transport.TransportProtos; + +import java.util.List; +import java.util.UUID; + +@Slf4j +public class EdgeMsgConstructorUtils { + + public static AlarmUpdateMsg constructAlarmUpdatedMsg(UpdateMsgType msgType, Alarm alarm) { + return AlarmUpdateMsg.newBuilder().setMsgType(msgType) + .setEntity(JacksonUtil.toString(alarm)) + .setIdMSB(alarm.getId().getId().getMostSignificantBits()) + .setIdLSB(alarm.getId().getId().getLeastSignificantBits()).build(); + } + + public static AlarmCommentUpdateMsg constructAlarmCommentUpdatedMsg(UpdateMsgType msgType, AlarmComment alarmComment) { + return AlarmCommentUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(alarmComment)).build(); + } + + public static AssetUpdateMsg constructAssetUpdatedMsg(UpdateMsgType msgType, Asset asset) { + return AssetUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(asset)) + .setIdMSB(asset.getUuidId().getMostSignificantBits()) + .setIdLSB(asset.getUuidId().getLeastSignificantBits()).build(); + } + + public static AssetUpdateMsg constructAssetDeleteMsg(AssetId assetId) { + return AssetUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(assetId.getId().getMostSignificantBits()) + .setIdLSB(assetId.getId().getLeastSignificantBits()).build(); + } + + public static AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile) { + return AssetProfileUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(assetProfile)) + .setIdMSB(assetProfile.getId().getId().getMostSignificantBits()) + .setIdLSB(assetProfile.getId().getId().getLeastSignificantBits()).build(); + } + + public static AssetProfileUpdateMsg constructAssetProfileDeleteMsg(AssetProfileId assetProfileId) { + return AssetProfileUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(assetProfileId.getId().getMostSignificantBits()) + .setIdLSB(assetProfileId.getId().getLeastSignificantBits()).build(); + } + + public static CustomerUpdateMsg constructCustomerUpdatedMsg(UpdateMsgType msgType, Customer customer) { + return CustomerUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(customer)) + .setIdMSB(customer.getId().getId().getMostSignificantBits()) + .setIdLSB(customer.getId().getId().getLeastSignificantBits()).build(); + } + + public static CustomerUpdateMsg constructCustomerDeleteMsg(CustomerId customerId) { + return CustomerUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(customerId.getId().getMostSignificantBits()) + .setIdLSB(customerId.getId().getLeastSignificantBits()).build(); + } + + public static DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard) { + return DashboardUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(dashboard)) + .setIdMSB(dashboard.getId().getId().getMostSignificantBits()) + .setIdLSB(dashboard.getId().getId().getLeastSignificantBits()).build(); + } + + public static DashboardUpdateMsg constructDashboardDeleteMsg(DashboardId dashboardId) { + return DashboardUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(dashboardId.getId().getMostSignificantBits()) + .setIdLSB(dashboardId.getId().getLeastSignificantBits()).build(); + } + + public static DeviceUpdateMsg constructDeviceUpdatedMsg(UpdateMsgType msgType, Device device) { + return DeviceUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(device)) + .setIdMSB(device.getId().getId().getMostSignificantBits()) + .setIdLSB(device.getId().getId().getLeastSignificantBits()).build(); + } + + public static DeviceUpdateMsg constructDeviceDeleteMsg(DeviceId deviceId) { + return DeviceUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(deviceId.getId().getMostSignificantBits()) + .setIdLSB(deviceId.getId().getLeastSignificantBits()).build(); + } + + public static DeviceCredentialsUpdateMsg constructDeviceCredentialsUpdatedMsg(DeviceCredentials deviceCredentials) { + return DeviceCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(deviceCredentials)).build(); + } + + public static DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile) { + return DeviceProfileUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(deviceProfile)) + .setIdMSB(deviceProfile.getId().getId().getMostSignificantBits()) + .setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits()).build(); + } + + public static DeviceProfileUpdateMsg constructDeviceProfileDeleteMsg(DeviceProfileId deviceProfileId) { + return DeviceProfileUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(deviceProfileId.getId().getMostSignificantBits()) + .setIdLSB(deviceProfileId.getId().getLeastSignificantBits()).build(); + } + + public static DeviceRpcCallMsg constructDeviceRpcCallMsg(UUID deviceId, JsonNode body) { + DeviceRpcCallMsg.Builder builder = constructDeviceRpcMsg(deviceId, body); + if (body.has("error") || body.has("response")) { + RpcResponseMsg.Builder responseBuilder = RpcResponseMsg.newBuilder(); + if (body.has("error")) { + responseBuilder.setError(body.get("error").asText()); + } else { + responseBuilder.setResponse(body.get("response").asText()); + } + builder.setResponseMsg(responseBuilder.build()); + } else { + RpcRequestMsg.Builder requestBuilder = RpcRequestMsg.newBuilder(); + requestBuilder.setMethod(body.get("method").asText()); + requestBuilder.setParams(body.get("params").asText()); + builder.setRequestMsg(requestBuilder.build()); + } + return builder.build(); + } + + private static DeviceRpcCallMsg.Builder constructDeviceRpcMsg(UUID deviceId, JsonNode body) { + DeviceRpcCallMsg.Builder builder = DeviceRpcCallMsg.newBuilder() + .setDeviceIdMSB(deviceId.getMostSignificantBits()) + .setDeviceIdLSB(deviceId.getLeastSignificantBits()) + .setRequestId(body.get("requestId").asInt()); + if (body.get("oneway") != null) { + builder.setOneway(body.get("oneway").asBoolean()); + } + if (body.get("requestUUID") != null) { + UUID requestUUID = UUID.fromString(body.get("requestUUID").asText()); + builder.setRequestUuidMSB(requestUUID.getMostSignificantBits()) + .setRequestUuidLSB(requestUUID.getLeastSignificantBits()); + } + if (body.get("expirationTime") != null) { + builder.setExpirationTime(body.get("expirationTime").asLong()); + } + if (body.get("persisted") != null) { + builder.setPersisted(body.get("persisted").asBoolean()); + } + if (body.get("retries") != null) { + builder.setRetries(body.get("retries").asInt()); + } + if (body.get("additionalInfo") != null) { + builder.setAdditionalInfo(JacksonUtil.toString(body.get("additionalInfo"))); + } + if (body.get("serviceId") != null) { + builder.setServiceId(body.get("serviceId").asText()); + } + if (body.get("sessionId") != null) { + builder.setSessionId(body.get("sessionId").asText()); + } + return builder; + } + + public static EdgeConfiguration constructEdgeConfiguration(Edge edge) { + EdgeConfiguration.Builder builder = EdgeConfiguration.newBuilder() + .setEdgeIdMSB(edge.getId().getId().getMostSignificantBits()) + .setEdgeIdLSB(edge.getId().getId().getLeastSignificantBits()) + .setTenantIdMSB(edge.getTenantId().getId().getMostSignificantBits()) + .setTenantIdLSB(edge.getTenantId().getId().getLeastSignificantBits()) + .setName(edge.getName()) + .setType(edge.getType()) + .setRoutingKey(edge.getRoutingKey()) + .setSecret(edge.getSecret()) + .setAdditionalInfo(JacksonUtil.toString(edge.getAdditionalInfo())) + .setCloudType("CE"); + if (edge.getCustomerId() != null) { + builder.setCustomerIdMSB(edge.getCustomerId().getId().getMostSignificantBits()) + .setCustomerIdLSB(edge.getCustomerId().getId().getLeastSignificantBits()); + } + return builder.build(); + } + + public static EntityViewUpdateMsg constructEntityViewUpdatedMsg(UpdateMsgType msgType, EntityView entityView) { + return EntityViewUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(entityView)) + .setIdMSB(entityView.getId().getId().getMostSignificantBits()) + .setIdLSB(entityView.getId().getId().getLeastSignificantBits()).build(); + } + + public static EntityViewUpdateMsg constructEntityViewDeleteMsg(EntityViewId entityViewId) { + return EntityViewUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(entityViewId.getId().getMostSignificantBits()) + .setIdLSB(entityViewId.getId().getLeastSignificantBits()).build(); + } + + public static NotificationRuleUpdateMsg constructNotificationRuleUpdateMsg(UpdateMsgType msgType, NotificationRule notificationRule) { + return NotificationRuleUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(notificationRule)).build(); + } + + public static NotificationRuleUpdateMsg constructNotificationRuleDeleteMsg(NotificationRuleId notificationRuleId) { + return NotificationRuleUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(notificationRuleId.getId().getMostSignificantBits()) + .setIdLSB(notificationRuleId.getId().getLeastSignificantBits()).build(); + } + + public static NotificationTargetUpdateMsg constructNotificationTargetUpdateMsg(UpdateMsgType msgType, NotificationTarget notificationTarget) { + return NotificationTargetUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(notificationTarget)).build(); + } + + public static NotificationTargetUpdateMsg constructNotificationTargetDeleteMsg(NotificationTargetId notificationTargetId) { + return NotificationTargetUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(notificationTargetId.getId().getMostSignificantBits()) + .setIdLSB(notificationTargetId.getId().getLeastSignificantBits()).build(); + } + + public static NotificationTemplateUpdateMsg constructNotificationTemplateUpdateMsg(UpdateMsgType msgType, NotificationTemplate notificationTemplate) { + return NotificationTemplateUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(notificationTemplate)).build(); + } + + public static NotificationTemplateUpdateMsg constructNotificationTemplateDeleteMsg(NotificationTemplateId notificationTemplateId) { + return NotificationTemplateUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(notificationTemplateId.getId().getMostSignificantBits()) + .setIdLSB(notificationTemplateId.getId().getLeastSignificantBits()).build(); + } + + public static OAuth2ClientUpdateMsg constructOAuth2ClientUpdateMsg(UpdateMsgType msgType, OAuth2Client oAuth2Client) { + return OAuth2ClientUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(oAuth2Client)) + .setIdMSB(oAuth2Client.getId().getId().getMostSignificantBits()) + .setIdLSB(oAuth2Client.getId().getId().getLeastSignificantBits()).build(); + } + + public static OAuth2ClientUpdateMsg constructOAuth2ClientDeleteMsg(OAuth2ClientId oAuth2ClientId) { + return OAuth2ClientUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(oAuth2ClientId.getId().getMostSignificantBits()) + .setIdLSB(oAuth2ClientId.getId().getLeastSignificantBits()).build(); + } + + public static OAuth2DomainUpdateMsg constructOAuth2DomainUpdateMsg(UpdateMsgType msgType, DomainInfo domainInfo) { + return OAuth2DomainUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(domainInfo)) + .setIdMSB(domainInfo.getId().getId().getMostSignificantBits()) + .setIdLSB(domainInfo.getId().getId().getLeastSignificantBits()).build(); + } + + public static OAuth2DomainUpdateMsg constructOAuth2DomainDeleteMsg(DomainId domainId) { + return OAuth2DomainUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(domainId.getId().getMostSignificantBits()) + .setIdLSB(domainId.getId().getLeastSignificantBits()) + .build(); + } + + public static OtaPackageUpdateMsg constructOtaPackageUpdatedMsg(UpdateMsgType msgType, OtaPackage otaPackage) { + return OtaPackageUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(otaPackage)) + .setIdMSB(otaPackage.getId().getId().getMostSignificantBits()) + .setIdLSB(otaPackage.getId().getId().getLeastSignificantBits()).build(); + } + + public static OtaPackageUpdateMsg constructOtaPackageDeleteMsg(OtaPackageId otaPackageId) { + return OtaPackageUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(otaPackageId.getId().getMostSignificantBits()) + .setIdLSB(otaPackageId.getId().getLeastSignificantBits()).build(); + } + + public static QueueUpdateMsg constructQueueUpdatedMsg(UpdateMsgType msgType, Queue queue) { + return QueueUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(queue)) + .setIdMSB(queue.getId().getId().getMostSignificantBits()) + .setIdLSB(queue.getId().getId().getLeastSignificantBits()).build(); + } + + public static QueueUpdateMsg constructQueueDeleteMsg(QueueId queueId) { + return QueueUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(queueId.getId().getMostSignificantBits()) + .setIdLSB(queueId.getId().getLeastSignificantBits()).build(); + } + + public static RelationUpdateMsg constructRelationUpdatedMsg(UpdateMsgType msgType, EntityRelation entityRelation) { + return RelationUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(entityRelation)).build(); + } + + public static ResourceUpdateMsg constructResourceUpdatedMsg(UpdateMsgType msgType, TbResource tbResource) { + return ResourceUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(tbResource)) + .setIdMSB(tbResource.getId().getId().getMostSignificantBits()) + .setIdLSB(tbResource.getId().getId().getLeastSignificantBits()).build(); + } + + public static ResourceUpdateMsg constructResourceDeleteMsg(TbResourceId tbResourceId) { + return ResourceUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(tbResourceId.getId().getMostSignificantBits()) + .setIdLSB(tbResourceId.getId().getLeastSignificantBits()).build(); + } + + public static RuleChainUpdateMsg constructRuleChainUpdatedMsg(UpdateMsgType msgType, RuleChain ruleChain, boolean isRoot) { + boolean isTemplateRoot = ruleChain.isRoot(); + ruleChain.setRoot(isRoot); + RuleChainUpdateMsg result = RuleChainUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(ruleChain)) + .setIdMSB(ruleChain.getId().getId().getMostSignificantBits()) + .setIdLSB(ruleChain.getId().getId().getLeastSignificantBits()).build(); + ruleChain.setRoot(isTemplateRoot); + return result; + } + + public static RuleChainUpdateMsg constructRuleChainDeleteMsg(RuleChainId ruleChainId) { + return RuleChainUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(ruleChainId.getId().getMostSignificantBits()) + .setIdLSB(ruleChainId.getId().getLeastSignificantBits()).build(); + } + + public static RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(UpdateMsgType msgType, RuleChainMetaData ruleChainMetaData) { + return RuleChainMetadataUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(ruleChainMetaData)).build(); + } + + public static EntityDataProto constructEntityDataMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType actionType, JsonElement entityData) { + EntityDataProto.Builder builder = EntityDataProto.newBuilder() + .setEntityIdMSB(entityId.getId().getMostSignificantBits()) + .setEntityIdLSB(entityId.getId().getLeastSignificantBits()) + .setEntityType(entityId.getEntityType().name()); + switch (actionType) { + case TIMESERIES_UPDATED: + try { + JsonObject data = entityData.getAsJsonObject(); + long ts; + if (data.get("ts") != null && !data.get("ts").isJsonNull()) { + ts = data.getAsJsonPrimitive("ts").getAsLong(); + } else { + ts = System.currentTimeMillis(); + } + builder.setPostTelemetryMsg(JsonConverter.convertToTelemetryProto(data.getAsJsonObject("data"), ts)); + } catch (Exception e) { + log.warn("[{}][{}] Can't convert to telemetry proto, entityData [{}]", tenantId, entityId, entityData, e); + } + break; + case ATTRIBUTES_UPDATED: + try { + JsonObject data = entityData.getAsJsonObject(); + TransportProtos.PostAttributeMsg attributesUpdatedMsg = JsonConverter.convertToAttributesProto(data.getAsJsonObject("kv")); + builder.setAttributesUpdatedMsg(attributesUpdatedMsg); + builder.setPostAttributeScope(getScopeOfDefault(data)); + } catch (Exception e) { + log.warn("[{}][{}] Can't convert to AttributesUpdatedMsg proto, entityData [{}]", tenantId, entityId, entityData, e); + } + break; + case POST_ATTRIBUTES: + try { + JsonObject data = entityData.getAsJsonObject(); + TransportProtos.PostAttributeMsg postAttributesMsg = JsonConverter.convertToAttributesProto(data.getAsJsonObject("kv")); + builder.setPostAttributesMsg(postAttributesMsg); + builder.setPostAttributeScope(getScopeOfDefault(data)); + } catch (Exception e) { + log.warn("[{}][{}] Can't convert to PostAttributesMsg, entityData [{}]", tenantId, entityId, entityData, e); + } + break; + case ATTRIBUTES_DELETED: + try { + AttributeDeleteMsg.Builder attributeDeleteMsg = AttributeDeleteMsg.newBuilder(); + attributeDeleteMsg.setScope(entityData.getAsJsonObject().getAsJsonPrimitive("scope").getAsString()); + JsonArray jsonArray = entityData.getAsJsonObject().getAsJsonArray("keys"); + List keys = new Gson().fromJson(jsonArray.toString(), new TypeToken<>(){}.getType()); + attributeDeleteMsg.addAllAttributeNames(keys); + attributeDeleteMsg.build(); + builder.setAttributeDeleteMsg(attributeDeleteMsg); + } catch (Exception e) { + log.warn("[{}][{}] Can't convert to AttributeDeleteMsg proto, entityData [{}]", tenantId, entityId, entityData, e); + } + break; + } + return builder.build(); + } + + private static String getScopeOfDefault(JsonObject data) { + JsonPrimitive scope = data.getAsJsonPrimitive("scope"); + String result = DataConstants.SERVER_SCOPE; + if (scope != null && StringUtils.isNotBlank(scope.getAsString())) { + result = scope.getAsString(); + } + return result; + } + + public static TenantUpdateMsg constructTenantUpdateMsg(UpdateMsgType msgType, Tenant tenant) { + return TenantUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(tenant)).build(); + } + + public static TenantProfileUpdateMsg constructTenantProfileUpdateMsg(UpdateMsgType msgType, TenantProfile tenantProfile) { + return TenantProfileUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(tenantProfile)).build(); + } + + public static UserUpdateMsg constructUserUpdatedMsg(UpdateMsgType msgType, User user) { + return UserUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(user)) + .setIdMSB(user.getId().getId().getMostSignificantBits()) + .setIdLSB(user.getId().getId().getLeastSignificantBits()).build(); + } + + public static UserUpdateMsg constructUserDeleteMsg(UserId userId) { + return UserUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(userId.getId().getMostSignificantBits()) + .setIdLSB(userId.getId().getLeastSignificantBits()).build(); + } + + public static UserCredentialsUpdateMsg constructUserCredentialsUpdatedMsg(UserCredentials userCredentials) { + return UserCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(userCredentials)).build(); + } + + public static WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List widgets) { + return WidgetsBundleUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(widgetsBundle)) + .setWidgets(JacksonUtil.toString(widgets)) + .setIdMSB(widgetsBundle.getId().getId().getMostSignificantBits()) + .setIdLSB(widgetsBundle.getId().getId().getLeastSignificantBits()).build(); + } + + public static WidgetsBundleUpdateMsg constructWidgetsBundleDeleteMsg(WidgetsBundleId widgetsBundleId) { + return WidgetsBundleUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(widgetsBundleId.getId().getMostSignificantBits()) + .setIdLSB(widgetsBundleId.getId().getLeastSignificantBits()) + .build(); + } + + public static WidgetTypeUpdateMsg constructWidgetTypeUpdateMsg(UpdateMsgType msgType, WidgetTypeDetails widgetTypeDetails) { + return WidgetTypeUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(widgetTypeDetails)) + .setIdMSB(widgetTypeDetails.getId().getId().getMostSignificantBits()) + .setIdLSB(widgetTypeDetails.getId().getId().getLeastSignificantBits()).build(); + } + + public static WidgetTypeUpdateMsg constructWidgetTypeDeleteMsg(WidgetTypeId widgetTypeId) { + return WidgetTypeUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(widgetTypeId.getId().getMostSignificantBits()) + .setIdLSB(widgetTypeId.getId().getLeastSignificantBits()) + .build(); + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java index 2e9465fc9d..15a4bcaa0f 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java @@ -564,7 +564,7 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i edgeState.put(ACTIVITY_STATE, false); edgeState.put(LAST_DISCONNECT_TIME, ts); } - ctx.getNotificationRuleProcessor().process(EdgeConnectionTrigger.builder() + ctx.getRuleProcessor().process(EdgeConnectionTrigger.builder() .tenantId(tenantId) .customerId(edge.getCustomerId()) .edgeId(edgeId) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index 42a6a60c2d..96ecd78bec 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -30,6 +30,7 @@ import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; @@ -78,17 +79,10 @@ import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsRequestMsg; import org.thingsboard.server.gen.edge.v1.WidgetBundleTypesRequestMsg; import org.thingsboard.server.service.edge.EdgeContextComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.fetch.EdgeEventFetcher; import org.thingsboard.server.service.edge.rpc.fetch.GeneralEdgeEventFetcher; -import org.thingsboard.server.service.edge.rpc.processor.alarm.AlarmProcessor; -import org.thingsboard.server.service.edge.rpc.processor.asset.AssetProcessor; -import org.thingsboard.server.service.edge.rpc.processor.asset.profile.AssetProfileProcessor; -import org.thingsboard.server.service.edge.rpc.processor.dashboard.DashboardProcessor; -import org.thingsboard.server.service.edge.rpc.processor.device.DeviceProcessor; -import org.thingsboard.server.service.edge.rpc.processor.device.profile.DeviceProfileProcessor; -import org.thingsboard.server.service.edge.rpc.processor.entityview.EntityViewProcessor; -import org.thingsboard.server.service.edge.rpc.processor.relation.RelationProcessor; -import org.thingsboard.server.service.edge.rpc.processor.resource.ResourceProcessor; +import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; import java.io.Closeable; import java.util.ArrayList; @@ -238,7 +232,7 @@ public abstract class EdgeGrpcSession implements Closeable { this.tenantId = edge.getTenantId(); this.edge = edge; EdgeUpdateMsg edgeConfig = EdgeUpdateMsg.newBuilder() - .setConfiguration(ctx.getEdgeMsgConstructor().constructEdgeConfiguration(edge)).build(); + .setConfiguration(EdgeMsgConstructorUtils.constructEdgeConfiguration(edge)).build(); ResponseMsg edgeConfigMsg = ResponseMsg.newBuilder() .setEdgeUpdateMsg(edgeConfig) .build(); @@ -352,13 +346,13 @@ public abstract class EdgeGrpcSession implements Closeable { return ConnectResponseMsg.newBuilder() .setResponseCode(ConnectResponseCode.ACCEPTED) .setErrorMsg("") - .setConfiguration(ctx.getEdgeMsgConstructor().constructEdgeConfiguration(edge)) + .setConfiguration(EdgeMsgConstructorUtils.constructEdgeConfiguration(edge)) .setMaxInboundMessageSize(maxInboundMessageSize) .build(); } String error = "Failed to validate the edge!"; String failureMsg = String.format("%s Provided request secret: %s", error, request.getEdgeSecret()); - ctx.getNotificationRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) + ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(error).build()); return ConnectResponseMsg.newBuilder() .setResponseCode(ConnectResponseCode.BAD_CREDENTIALS) @@ -366,7 +360,7 @@ public abstract class EdgeGrpcSession implements Closeable { .setConfiguration(EdgeConfiguration.getDefaultInstance()).build(); } catch (Exception e) { String failureMsg = "Failed to process edge connection!"; - ctx.getNotificationRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) + ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(e.getMessage()).build()); log.error(failureMsg, e); return ConnectResponseMsg.newBuilder() @@ -451,7 +445,7 @@ public abstract class EdgeGrpcSession implements Closeable { if (attempt == 2) { // Send a failure notification only on the second attempt. // This ensures that failure alerts are sent just once to avoid redundant notifications. - ctx.getNotificationRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId) + ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId) .edgeId(edge.getId()).customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(error).build()); } log.warn("[{}][{}] {}, attempt: {}", tenantId, sessionId, failureMsg, attempt); @@ -464,7 +458,7 @@ public abstract class EdgeGrpcSession implements Closeable { String message = String.format("Downlink msg size %s exceeds client max inbound message size %s. " + "Please increase value of CLOUD_RPC_MAX_INBOUND_MESSAGE_SIZE env variable on the edge and restart it.", downlinkMsg.getSerializedSize(), clientMaxInboundMessageSize); log.error("[{}][{}][{}] {} Message {}", tenantId, edge.getId(), sessionId, message, downlinkMsg); - ctx.getNotificationRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId) + ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId) .edgeId(edge.getId()).customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(message).error(error).build()); sessionState.getPendingMsgsMap().remove(downlinkMsg.getDownlinkMsgId()); } else { @@ -479,7 +473,7 @@ public abstract class EdgeGrpcSession implements Closeable { String failureMsg = String.format("Failed to deliver messages: %s", copy); log.warn("[{}][{}] Failed to deliver the batch after {} attempts. Next messages are going to be discarded {}", tenantId, sessionId, MAX_DOWNLINK_ATTEMPTS, copy); - ctx.getNotificationRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) + ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg) .error("Failed to deliver messages after " + MAX_DOWNLINK_ATTEMPTS + " attempts").build()); stopCurrentSendDownlinkMsgsTask(false); @@ -752,39 +746,12 @@ public abstract class EdgeGrpcSession implements Closeable { protected DownlinkMsg convertEntityEventToDownlink(EdgeEvent edgeEvent) { log.trace("[{}] Executing convertEntityEventToDownlink, edgeEvent [{}], action [{}]", edgeEvent.getTenantId(), edgeEvent, edgeEvent.getAction()); - return switch (edgeEvent.getType()) { - case EDGE -> ctx.getEdgeProcessor().convertEdgeEventToDownlink(edgeEvent); - case DEVICE -> ctx.getDeviceProcessor().convertDeviceEventToDownlink(edgeEvent, edgeVersion); - case DEVICE_PROFILE -> ctx.getDeviceProfileProcessor().convertDeviceProfileEventToDownlink(edgeEvent, edgeVersion); - case ASSET_PROFILE -> ctx.getAssetProfileProcessor().convertAssetProfileEventToDownlink(edgeEvent, edgeVersion); - case ASSET -> ctx.getAssetProcessor().convertAssetEventToDownlink(edgeEvent, edgeVersion); - case ENTITY_VIEW -> ctx.getEntityViewProcessor().convertEntityViewEventToDownlink(edgeEvent, edgeVersion); - case DASHBOARD -> ctx.getDashboardProcessor().convertDashboardEventToDownlink(edgeEvent, edgeVersion); - case CUSTOMER -> ctx.getCustomerProcessor().convertCustomerEventToDownlink(edgeEvent, edgeVersion); - case RULE_CHAIN -> ctx.getRuleChainProcessor().convertRuleChainEventToDownlink(edgeEvent, edgeVersion); - case RULE_CHAIN_METADATA -> ctx.getRuleChainProcessor().convertRuleChainMetadataEventToDownlink(edgeEvent, edgeVersion); - case ALARM -> ctx.getAlarmProcessor().convertAlarmEventToDownlink(edgeEvent, edgeVersion); - case ALARM_COMMENT -> ctx.getAlarmProcessor().convertAlarmCommentEventToDownlink(edgeEvent, edgeVersion); - case USER -> ctx.getUserProcessor().convertUserEventToDownlink(edgeEvent, edgeVersion); - case RELATION -> ctx.getRelationProcessor().convertRelationEventToDownlink(edgeEvent, edgeVersion); - case WIDGETS_BUNDLE -> ctx.getWidgetBundleProcessor().convertWidgetsBundleEventToDownlink(edgeEvent, edgeVersion); - case WIDGET_TYPE -> ctx.getWidgetTypeProcessor().convertWidgetTypeEventToDownlink(edgeEvent, edgeVersion); - case ADMIN_SETTINGS -> ctx.getAdminSettingsProcessor().convertAdminSettingsEventToDownlink(edgeEvent, edgeVersion); - case OTA_PACKAGE -> ctx.getOtaPackageProcessor().convertOtaPackageEventToDownlink(edgeEvent, edgeVersion); - case TB_RESOURCE -> ctx.getResourceProcessor().convertResourceEventToDownlink(edgeEvent, edgeVersion); - case QUEUE -> ctx.getQueueProcessor().convertQueueEventToDownlink(edgeEvent, edgeVersion); - case TENANT -> ctx.getTenantProcessor().convertTenantEventToDownlink(edgeEvent, edgeVersion); - case TENANT_PROFILE -> ctx.getTenantProfileProcessor().convertTenantProfileEventToDownlink(edgeEvent, edgeVersion); - case NOTIFICATION_RULE -> ctx.getNotificationEdgeProcessor().convertNotificationRuleToDownlink(edgeEvent); - case NOTIFICATION_TARGET -> ctx.getNotificationEdgeProcessor().convertNotificationTargetToDownlink(edgeEvent); - case NOTIFICATION_TEMPLATE -> ctx.getNotificationEdgeProcessor().convertNotificationTemplateToDownlink(edgeEvent); - case OAUTH2_CLIENT -> ctx.getOAuth2EdgeProcessor().convertOAuth2ClientEventToDownlink(edgeEvent, edgeVersion); - case DOMAIN -> ctx.getOAuth2EdgeProcessor().convertOAuth2DomainEventToDownlink(edgeEvent, edgeVersion); - default -> { - log.warn("[{}] Unsupported edge event type [{}]", edgeEvent.getTenantId(), edgeEvent); - yield null; - } - }; + if ((EdgeEventType.OAUTH2_CLIENT.equals(edgeEvent.getType()) || EdgeEventType.DOMAIN.equals(edgeEvent.getType())) && + (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0))) { + return null; + } + + return ctx.getProcessor(edgeEvent.getType()).convertEdgeEventToDownlink(edgeEvent); } public void addEventToHighPriorityQueue(EdgeEvent edgeEvent) { @@ -803,38 +770,32 @@ public abstract class EdgeGrpcSession implements Closeable { try { if (uplinkMsg.getDeviceProfileUpdateMsgCount() > 0) { for (DeviceProfileUpdateMsg deviceProfileUpdateMsg : uplinkMsg.getDeviceProfileUpdateMsgList()) { - result.add(((DeviceProfileProcessor) ctx.getDeviceProfileEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processDeviceProfileMsgFromEdge(edge.getTenantId(), edge, deviceProfileUpdateMsg)); + result.add(ctx.getDeviceProfileProcessor().processDeviceProfileMsgFromEdge(edge.getTenantId(), edge, deviceProfileUpdateMsg)); } } if (uplinkMsg.getDeviceUpdateMsgCount() > 0) { for (DeviceUpdateMsg deviceUpdateMsg : uplinkMsg.getDeviceUpdateMsgList()) { - result.add(((DeviceProcessor) ctx.getDeviceEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processDeviceMsgFromEdge(edge.getTenantId(), edge, deviceUpdateMsg)); + result.add(ctx.getDeviceProcessor().processDeviceMsgFromEdge(edge.getTenantId(), edge, deviceUpdateMsg)); } } if (uplinkMsg.getDeviceCredentialsUpdateMsgCount() > 0) { for (DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg : uplinkMsg.getDeviceCredentialsUpdateMsgList()) { - result.add(((DeviceProcessor) ctx.getDeviceEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processDeviceCredentialsMsgFromEdge(edge.getTenantId(), edge.getId(), deviceCredentialsUpdateMsg)); + result.add(ctx.getDeviceProcessor().processDeviceCredentialsMsgFromEdge(edge.getTenantId(), edge.getId(), deviceCredentialsUpdateMsg)); } } if (uplinkMsg.getAssetProfileUpdateMsgCount() > 0) { for (AssetProfileUpdateMsg assetProfileUpdateMsg : uplinkMsg.getAssetProfileUpdateMsgList()) { - result.add(((AssetProfileProcessor) ctx.getAssetProfileEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processAssetProfileMsgFromEdge(edge.getTenantId(), edge, assetProfileUpdateMsg)); + result.add(ctx.getAssetProfileProcessor().processAssetProfileMsgFromEdge(edge.getTenantId(), edge, assetProfileUpdateMsg)); } } if (uplinkMsg.getAssetUpdateMsgCount() > 0) { for (AssetUpdateMsg assetUpdateMsg : uplinkMsg.getAssetUpdateMsgList()) { - result.add(((AssetProcessor) ctx.getAssetEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processAssetMsgFromEdge(edge.getTenantId(), edge, assetUpdateMsg)); + result.add(ctx.getAssetProcessor().processAssetMsgFromEdge(edge.getTenantId(), edge, assetUpdateMsg)); } } if (uplinkMsg.getEntityViewUpdateMsgCount() > 0) { for (EntityViewUpdateMsg entityViewUpdateMsg : uplinkMsg.getEntityViewUpdateMsgList()) { - result.add(((EntityViewProcessor) ctx.getEntityViewProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processEntityViewMsgFromEdge(edge.getTenantId(), edge, entityViewUpdateMsg)); + result.add(ctx.getEntityViewProcessor().processEntityViewMsgFromEdge(edge.getTenantId(), edge, entityViewUpdateMsg)); } } if (uplinkMsg.getEntityDataCount() > 0) { @@ -844,32 +805,27 @@ public abstract class EdgeGrpcSession implements Closeable { } if (uplinkMsg.getAlarmUpdateMsgCount() > 0) { for (AlarmUpdateMsg alarmUpdateMsg : uplinkMsg.getAlarmUpdateMsgList()) { - result.add(((AlarmProcessor) ctx.getAlarmEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processAlarmMsgFromEdge(edge.getTenantId(), edge.getId(), alarmUpdateMsg)); + result.add(ctx.getAlarmProcessor().processAlarmMsgFromEdge(edge.getTenantId(), edge.getId(), alarmUpdateMsg)); } } if (uplinkMsg.getAlarmCommentUpdateMsgCount() > 0) { for (AlarmCommentUpdateMsg alarmCommentUpdateMsg : uplinkMsg.getAlarmCommentUpdateMsgList()) { - result.add(((AlarmProcessor) ctx.getAlarmEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processAlarmCommentMsgFromEdge(edge.getTenantId(), edge.getId(), alarmCommentUpdateMsg)); + result.add(ctx.getAlarmCommentProcessor().processAlarmCommentMsgFromEdge(edge.getTenantId(), edge.getId(), alarmCommentUpdateMsg)); } } if (uplinkMsg.getRelationUpdateMsgCount() > 0) { for (RelationUpdateMsg relationUpdateMsg : uplinkMsg.getRelationUpdateMsgList()) { - result.add(((RelationProcessor) ctx.getRelationEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processRelationMsgFromEdge(edge.getTenantId(), edge, relationUpdateMsg)); + result.add(ctx.getRelationProcessor().processRelationMsgFromEdge(edge.getTenantId(), edge, relationUpdateMsg)); } } if (uplinkMsg.getDashboardUpdateMsgCount() > 0) { for (DashboardUpdateMsg dashboardUpdateMsg : uplinkMsg.getDashboardUpdateMsgList()) { - result.add(((DashboardProcessor) ctx.getDashboardEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processDashboardMsgFromEdge(edge.getTenantId(), edge, dashboardUpdateMsg)); + result.add(ctx.getDashboardProcessor().processDashboardMsgFromEdge(edge.getTenantId(), edge, dashboardUpdateMsg)); } } if (uplinkMsg.getResourceUpdateMsgCount() > 0) { for (ResourceUpdateMsg resourceUpdateMsg : uplinkMsg.getResourceUpdateMsgList()) { - result.add(((ResourceProcessor) ctx.getResourceEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processResourceMsgFromEdge(edge.getTenantId(), edge, resourceUpdateMsg)); + result.add(ctx.getResourceProcessor().processResourceMsgFromEdge(edge.getTenantId(), edge, resourceUpdateMsg)); } } if (uplinkMsg.getRuleChainMetadataRequestMsgCount() > 0) { @@ -899,8 +855,7 @@ public abstract class EdgeGrpcSession implements Closeable { } if (uplinkMsg.getDeviceRpcCallMsgCount() > 0) { for (DeviceRpcCallMsg deviceRpcCallMsg : uplinkMsg.getDeviceRpcCallMsgList()) { - result.add(((DeviceProcessor) ctx.getDeviceEdgeProcessorFactory().getProcessorByEdgeVersion(edgeVersion)) - .processDeviceRpcCallFromEdge(edge.getTenantId(), edge, deviceRpcCallMsg)); + result.add(ctx.getDeviceProcessor().processDeviceRpcCallFromEdge(edge.getTenantId(), edge, deviceRpcCallMsg)); } } if (uplinkMsg.getWidgetBundleTypesRequestMsgCount() > 0) { @@ -916,7 +871,7 @@ public abstract class EdgeGrpcSession implements Closeable { } catch (Exception e) { String failureMsg = String.format("Can't process uplink msg [%s] from edge", uplinkMsg); log.error("[{}][{}] Can't process uplink msg [{}]", edge.getTenantId(), sessionId, uplinkMsg, e); - ctx.getNotificationRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(edge.getTenantId()).edgeId(edge.getId()) + ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(edge.getTenantId()).edgeId(edge.getId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(e.getMessage()).build()); return Futures.immediateFailedFuture(e); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/BaseMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/BaseMsgConstructorFactory.java deleted file mode 100644 index dd76f97d8f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/BaseMsgConstructorFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public abstract class BaseMsgConstructorFactory { - - @Autowired - protected T v1Constructor; - - @Autowired - protected U v2Constructor; - - public MsgConstructor getMsgConstructorByEdgeVersion(EdgeVersion edgeVersion) { - return switch (edgeVersion) { - case V_3_3_0, V_3_3_3, V_3_4_0, V_3_6_0, V_3_6_1 -> v1Constructor; - default -> v2Constructor; - }; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/MsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/MsgConstructor.java deleted file mode 100644 index c751c6259c..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/MsgConstructor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor; - -public interface MsgConstructor { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructor.java deleted file mode 100644 index b5a0f20d6b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructor.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.alarm; - -import org.thingsboard.server.common.data.alarm.Alarm; -import org.thingsboard.server.common.data.alarm.AlarmComment; -import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; -import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface AlarmMsgConstructor extends MsgConstructor { - - AlarmUpdateMsg constructAlarmUpdatedMsg(UpdateMsgType msgType, Alarm alarm, String entityName); - - AlarmCommentUpdateMsg constructAlarmCommentUpdatedMsg(UpdateMsgType msgType, AlarmComment alarmComment); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorFactory.java deleted file mode 100644 index ec2e36d431..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.alarm; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class AlarmMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV1.java deleted file mode 100644 index 81a489671f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV1.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.alarm; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.alarm.Alarm; -import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class AlarmMsgConstructorV1 extends BaseAlarmMsgConstructor { - - @Override - public AlarmUpdateMsg constructAlarmUpdatedMsg(UpdateMsgType msgType, Alarm alarm, String entityName) { - return AlarmUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(alarm.getId().getId().getMostSignificantBits()) - .setIdLSB(alarm.getId().getId().getLeastSignificantBits()) - .setName(alarm.getName()) - .setType(alarm.getType()) - .setOriginatorName(entityName) - .setOriginatorType(alarm.getOriginator().getEntityType().name()) - .setSeverity(alarm.getSeverity().name()) - .setStatus(alarm.getStatus().name()) - .setStartTs(alarm.getStartTs()) - .setEndTs(alarm.getEndTs()) - .setAckTs(alarm.getAckTs()) - .setClearTs(alarm.getClearTs()) - .setDetails(JacksonUtil.toString(alarm.getDetails())) - .setPropagate(alarm.isPropagate()) - .setPropagateToOwner(alarm.isPropagateToOwner()) - .setPropagateToTenant(alarm.isPropagateToTenant()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV2.java deleted file mode 100644 index 143a41b73c..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/AlarmMsgConstructorV2.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.alarm; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.alarm.Alarm; -import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class AlarmMsgConstructorV2 extends BaseAlarmMsgConstructor { - - @Override - public AlarmUpdateMsg constructAlarmUpdatedMsg(UpdateMsgType msgType, Alarm alarm, String entityName) { - return AlarmUpdateMsg.newBuilder().setMsgType(msgType) - .setEntity(JacksonUtil.toString(alarm)) - .setIdMSB(alarm.getId().getId().getMostSignificantBits()) - .setIdLSB(alarm.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructor.java deleted file mode 100644 index ba7b2a81ef..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructor.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.asset; - -import org.thingsboard.server.common.data.asset.Asset; -import org.thingsboard.server.common.data.asset.AssetProfile; -import org.thingsboard.server.common.data.id.AssetId; -import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface AssetMsgConstructor extends MsgConstructor { - - AssetUpdateMsg constructAssetUpdatedMsg(UpdateMsgType msgType, Asset asset); - - AssetUpdateMsg constructAssetDeleteMsg(AssetId assetId); - - AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile); - - AssetProfileUpdateMsg constructAssetProfileDeleteMsg(AssetProfileId assetProfileId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorFactory.java deleted file mode 100644 index 1d236fce00..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.asset; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class AssetMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV1.java deleted file mode 100644 index 524edbb5a5..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV1.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.asset; - -import com.google.protobuf.ByteString; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.asset.Asset; -import org.thingsboard.server.common.data.asset.AssetProfile; -import org.thingsboard.server.dao.resource.ImageService; -import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.nio.charset.StandardCharsets; - -@Component -@TbCoreComponent -public class AssetMsgConstructorV1 extends BaseAssetMsgConstructor { - - @Autowired - private ImageService imageService; - - @Override - public AssetUpdateMsg constructAssetUpdatedMsg(UpdateMsgType msgType, Asset asset) { - AssetUpdateMsg.Builder builder = AssetUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(asset.getUuidId().getMostSignificantBits()) - .setIdLSB(asset.getUuidId().getLeastSignificantBits()) - .setName(asset.getName()) - .setType(asset.getType()); - if (asset.getLabel() != null) { - builder.setLabel(asset.getLabel()); - } - if (asset.getCustomerId() != null) { - builder.setCustomerIdMSB(asset.getCustomerId().getId().getMostSignificantBits()); - builder.setCustomerIdLSB(asset.getCustomerId().getId().getLeastSignificantBits()); - } - if (asset.getAssetProfileId() != null) { - builder.setAssetProfileIdMSB(asset.getAssetProfileId().getId().getMostSignificantBits()); - builder.setAssetProfileIdLSB(asset.getAssetProfileId().getId().getLeastSignificantBits()); - } - if (asset.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(asset.getAdditionalInfo())); - } - return builder.build(); - } - - @Override - public AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile) { - assetProfile = JacksonUtil.clone(assetProfile); - imageService.inlineImageForEdge(assetProfile); - AssetProfileUpdateMsg.Builder builder = AssetProfileUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(assetProfile.getId().getId().getMostSignificantBits()) - .setIdLSB(assetProfile.getId().getId().getLeastSignificantBits()) - .setName(assetProfile.getName()) - .setDefault(assetProfile.isDefault()); - if (assetProfile.getDefaultDashboardId() != null) { - builder.setDefaultDashboardIdMSB(assetProfile.getDefaultDashboardId().getId().getMostSignificantBits()) - .setDefaultDashboardIdLSB(assetProfile.getDefaultDashboardId().getId().getLeastSignificantBits()); - } - if (assetProfile.getDefaultQueueName() != null) { - builder.setDefaultQueueName(assetProfile.getDefaultQueueName()); - } - if (assetProfile.getDescription() != null) { - builder.setDescription(assetProfile.getDescription()); - } - if (assetProfile.getImage() != null) { - builder.setImage(ByteString.copyFrom(assetProfile.getImage().getBytes(StandardCharsets.UTF_8))); - } - if (assetProfile.getDefaultEdgeRuleChainId() != null) { - builder.setDefaultRuleChainIdMSB(assetProfile.getDefaultEdgeRuleChainId().getId().getMostSignificantBits()) - .setDefaultRuleChainIdLSB(assetProfile.getDefaultEdgeRuleChainId().getId().getLeastSignificantBits()); - } - return builder.build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV2.java deleted file mode 100644 index b48cacb3ee..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/AssetMsgConstructorV2.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.asset; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.asset.Asset; -import org.thingsboard.server.common.data.asset.AssetProfile; -import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class AssetMsgConstructorV2 extends BaseAssetMsgConstructor { - - @Override - public AssetUpdateMsg constructAssetUpdatedMsg(UpdateMsgType msgType, Asset asset) { - return AssetUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(asset)) - .setIdMSB(asset.getUuidId().getMostSignificantBits()) - .setIdLSB(asset.getUuidId().getLeastSignificantBits()).build(); - } - - @Override - public AssetProfileUpdateMsg constructAssetProfileUpdatedMsg(UpdateMsgType msgType, AssetProfile assetProfile) { - return AssetProfileUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(assetProfile)) - .setIdMSB(assetProfile.getId().getId().getMostSignificantBits()) - .setIdLSB(assetProfile.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/BaseAssetMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/BaseAssetMsgConstructor.java deleted file mode 100644 index a067d59ab4..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/asset/BaseAssetMsgConstructor.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.asset; - -import org.thingsboard.server.common.data.id.AssetId; -import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseAssetMsgConstructor implements AssetMsgConstructor { - - @Override - public AssetUpdateMsg constructAssetDeleteMsg(AssetId assetId) { - return AssetUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(assetId.getId().getMostSignificantBits()) - .setIdLSB(assetId.getId().getLeastSignificantBits()).build(); - } - - @Override - public AssetProfileUpdateMsg constructAssetProfileDeleteMsg(AssetProfileId assetProfileId) { - return AssetProfileUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(assetProfileId.getId().getMostSignificantBits()) - .setIdLSB(assetProfileId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/BaseCustomerMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/BaseCustomerMsgConstructor.java deleted file mode 100644 index 5e02200a16..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/BaseCustomerMsgConstructor.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.customer; - -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseCustomerMsgConstructor implements CustomerMsgConstructor { - - @Override - public CustomerUpdateMsg constructCustomerDeleteMsg(CustomerId customerId) { - return CustomerUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(customerId.getId().getMostSignificantBits()) - .setIdLSB(customerId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructor.java deleted file mode 100644 index 289056fadf..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructor.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.customer; - -import org.thingsboard.server.common.data.Customer; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface CustomerMsgConstructor extends MsgConstructor { - - CustomerUpdateMsg constructCustomerUpdatedMsg(UpdateMsgType msgType, Customer customer); - - CustomerUpdateMsg constructCustomerDeleteMsg(CustomerId customerId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorFactory.java deleted file mode 100644 index 01df167527..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.customer; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class CustomerMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV1.java deleted file mode 100644 index 1018997f47..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV1.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.customer; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Customer; -import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class CustomerMsgConstructorV1 extends BaseCustomerMsgConstructor { - - @Override - public CustomerUpdateMsg constructCustomerUpdatedMsg(UpdateMsgType msgType, Customer customer) { - CustomerUpdateMsg.Builder builder = CustomerUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(customer.getId().getId().getMostSignificantBits()) - .setIdLSB(customer.getId().getId().getLeastSignificantBits()) - .setTitle(customer.getTitle()); - if (customer.getCountry() != null) { - builder.setCountry(customer.getCountry()); - } - if (customer.getState() != null) { - builder.setState(customer.getState()); - } - if (customer.getCity() != null) { - builder.setCity(customer.getCity()); - } - if (customer.getAddress() != null) { - builder.setAddress(customer.getAddress()); - } - if (customer.getAddress2() != null) { - builder.setAddress2(customer.getAddress2()); - } - if (customer.getZip() != null) { - builder.setZip(customer.getZip()); - } - if (customer.getPhone() != null) { - builder.setPhone(customer.getPhone()); - } - if (customer.getEmail() != null) { - builder.setEmail(customer.getEmail()); - } - if (customer.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(customer.getAdditionalInfo())); - } - return builder.build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV2.java deleted file mode 100644 index 8f5a99f2ca..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/customer/CustomerMsgConstructorV2.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.customer; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Customer; -import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class CustomerMsgConstructorV2 extends BaseCustomerMsgConstructor { - - @Override - public CustomerUpdateMsg constructCustomerUpdatedMsg(UpdateMsgType msgType, Customer customer) { - return CustomerUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(customer)) - .setIdMSB(customer.getId().getId().getMostSignificantBits()) - .setIdLSB(customer.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/BaseDashboardMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/BaseDashboardMsgConstructor.java deleted file mode 100644 index f1314d9587..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/BaseDashboardMsgConstructor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.dashboard; - -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseDashboardMsgConstructor implements DashboardMsgConstructor { - - @Override - public DashboardUpdateMsg constructDashboardDeleteMsg(DashboardId dashboardId) { - return DashboardUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(dashboardId.getId().getMostSignificantBits()) - .setIdLSB(dashboardId.getId().getLeastSignificantBits()).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructor.java deleted file mode 100644 index bdf4968692..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructor.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.dashboard; - -import org.thingsboard.server.common.data.Dashboard; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface DashboardMsgConstructor extends MsgConstructor { - - DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard); - - DashboardUpdateMsg constructDashboardDeleteMsg(DashboardId dashboardId); - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorFactory.java deleted file mode 100644 index b2d1e789d9..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.dashboard; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class DashboardMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV1.java deleted file mode 100644 index ec2d216a03..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV1.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.dashboard; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Dashboard; -import org.thingsboard.server.dao.resource.ImageService; -import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class DashboardMsgConstructorV1 extends BaseDashboardMsgConstructor { - - @Autowired - private ImageService imageService; - - @Override - public DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard) { - dashboard = JacksonUtil.clone(dashboard); - imageService.inlineImagesForEdge(dashboard); - DashboardUpdateMsg.Builder builder = DashboardUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(dashboard.getId().getId().getMostSignificantBits()) - .setIdLSB(dashboard.getId().getId().getLeastSignificantBits()) - .setTitle(dashboard.getTitle()) - .setConfiguration(JacksonUtil.toString(dashboard.getConfiguration())) - .setMobileHide(dashboard.isMobileHide()); - if (dashboard.getAssignedCustomers() != null) { - builder.setAssignedCustomers(JacksonUtil.toString(dashboard.getAssignedCustomers())); - } - if (dashboard.getImage() != null) { - builder.setImage(dashboard.getImage()); - } - if (dashboard.getMobileOrder() != null) { - builder.setMobileOrder(dashboard.getMobileOrder()); - } - return builder.build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV2.java deleted file mode 100644 index d1fb5ae703..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/dashboard/DashboardMsgConstructorV2.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.dashboard; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Dashboard; -import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class DashboardMsgConstructorV2 extends BaseDashboardMsgConstructor { - - @Override - public DashboardUpdateMsg constructDashboardUpdatedMsg(UpdateMsgType msgType, Dashboard dashboard) { - return DashboardUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(dashboard)) - .setIdMSB(dashboard.getId().getId().getMostSignificantBits()) - .setIdLSB(dashboard.getId().getId().getLeastSignificantBits()).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/BaseDeviceMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/BaseDeviceMsgConstructor.java deleted file mode 100644 index b875e1c947..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/BaseDeviceMsgConstructor.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.device; - -import com.fasterxml.jackson.databind.JsonNode; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.DeviceProfileId; -import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; -import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.RpcRequestMsg; -import org.thingsboard.server.gen.edge.v1.RpcResponseMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -import java.util.UUID; - -public abstract class BaseDeviceMsgConstructor implements DeviceMsgConstructor { - - @Override - public DeviceUpdateMsg constructDeviceDeleteMsg(DeviceId deviceId) { - return DeviceUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(deviceId.getId().getMostSignificantBits()) - .setIdLSB(deviceId.getId().getLeastSignificantBits()).build(); - } - - @Override - public DeviceProfileUpdateMsg constructDeviceProfileDeleteMsg(DeviceProfileId deviceProfileId) { - return DeviceProfileUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(deviceProfileId.getId().getMostSignificantBits()) - .setIdLSB(deviceProfileId.getId().getLeastSignificantBits()).build(); - } - - @Override - public DeviceRpcCallMsg constructDeviceRpcCallMsg(UUID deviceId, JsonNode body) { - DeviceRpcCallMsg.Builder builder = constructDeviceRpcMsg(deviceId, body); - if (body.has("error") || body.has("response")) { - RpcResponseMsg.Builder responseBuilder = RpcResponseMsg.newBuilder(); - if (body.has("error")) { - responseBuilder.setError(body.get("error").asText()); - } else { - responseBuilder.setResponse(body.get("response").asText()); - } - builder.setResponseMsg(responseBuilder.build()); - } else { - RpcRequestMsg.Builder requestBuilder = RpcRequestMsg.newBuilder(); - requestBuilder.setMethod(body.get("method").asText()); - requestBuilder.setParams(body.get("params").asText()); - builder.setRequestMsg(requestBuilder.build()); - } - return builder.build(); - } - - private DeviceRpcCallMsg.Builder constructDeviceRpcMsg(UUID deviceId, JsonNode body) { - DeviceRpcCallMsg.Builder builder = DeviceRpcCallMsg.newBuilder() - .setDeviceIdMSB(deviceId.getMostSignificantBits()) - .setDeviceIdLSB(deviceId.getLeastSignificantBits()) - .setRequestId(body.get("requestId").asInt()); - if (body.get("oneway") != null) { - builder.setOneway(body.get("oneway").asBoolean()); - } - if (body.get("requestUUID") != null) { - UUID requestUUID = UUID.fromString(body.get("requestUUID").asText()); - builder.setRequestUuidMSB(requestUUID.getMostSignificantBits()) - .setRequestUuidLSB(requestUUID.getLeastSignificantBits()); - } - if (body.get("expirationTime") != null) { - builder.setExpirationTime(body.get("expirationTime").asLong()); - } - if (body.get("persisted") != null) { - builder.setPersisted(body.get("persisted").asBoolean()); - } - if (body.get("retries") != null) { - builder.setRetries(body.get("retries").asInt()); - } - if (body.get("additionalInfo") != null) { - builder.setAdditionalInfo(JacksonUtil.toString(body.get("additionalInfo"))); - } - if (body.get("serviceId") != null) { - builder.setServiceId(body.get("serviceId").asText()); - } - if (body.get("sessionId") != null) { - builder.setSessionId(body.get("sessionId").asText()); - } - return builder; - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructor.java deleted file mode 100644 index 854d0c80a8..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructor.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.device; - -import com.fasterxml.jackson.databind.JsonNode; -import org.thingsboard.server.common.data.Device; -import org.thingsboard.server.common.data.DeviceProfile; -import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.DeviceProfileId; -import org.thingsboard.server.common.data.security.DeviceCredentials; -import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; -import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -import java.util.UUID; - -public interface DeviceMsgConstructor extends MsgConstructor { - - DeviceUpdateMsg constructDeviceUpdatedMsg(UpdateMsgType msgType, Device device); - - DeviceUpdateMsg constructDeviceDeleteMsg(DeviceId deviceId); - - DeviceCredentialsUpdateMsg constructDeviceCredentialsUpdatedMsg(DeviceCredentials deviceCredentials); - - DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile); - - DeviceProfileUpdateMsg constructDeviceProfileDeleteMsg(DeviceProfileId deviceProfileId); - - DeviceRpcCallMsg constructDeviceRpcCallMsg(UUID deviceId, JsonNode body); - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorFactory.java deleted file mode 100644 index 536e8db45b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.device; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class DeviceMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV1.java deleted file mode 100644 index 7b59bab3ba..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV1.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.device; - -import com.google.protobuf.ByteString; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Device; -import org.thingsboard.server.common.data.DeviceProfile; -import org.thingsboard.server.common.data.security.DeviceCredentials; -import org.thingsboard.server.dao.resource.ImageService; -import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.nio.charset.StandardCharsets; - -@Component -@TbCoreComponent -public class DeviceMsgConstructorV1 extends BaseDeviceMsgConstructor { - - @Autowired - private ImageService imageService; - - @Override - public DeviceUpdateMsg constructDeviceUpdatedMsg(UpdateMsgType msgType, Device device) { - DeviceUpdateMsg.Builder builder = DeviceUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(device.getId().getId().getMostSignificantBits()) - .setIdLSB(device.getId().getId().getLeastSignificantBits()) - .setName(device.getName()) - .setType(device.getType()); - if (device.getLabel() != null) { - builder.setLabel(device.getLabel()); - } - if (device.getCustomerId() != null) { - builder.setCustomerIdMSB(device.getCustomerId().getId().getMostSignificantBits()); - builder.setCustomerIdLSB(device.getCustomerId().getId().getLeastSignificantBits()); - } - if (device.getDeviceProfileId() != null) { - builder.setDeviceProfileIdMSB(device.getDeviceProfileId().getId().getMostSignificantBits()); - builder.setDeviceProfileIdLSB(device.getDeviceProfileId().getId().getLeastSignificantBits()); - } - if (device.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(device.getAdditionalInfo())); - } - if (device.getFirmwareId() != null) { - builder.setFirmwareIdMSB(device.getFirmwareId().getId().getMostSignificantBits()) - .setFirmwareIdLSB(device.getFirmwareId().getId().getLeastSignificantBits()); - } - if (device.getSoftwareId() != null) { - builder.setSoftwareIdMSB(device.getSoftwareId().getId().getMostSignificantBits()) - .setSoftwareIdLSB(device.getSoftwareId().getId().getLeastSignificantBits()); - } - if (device.getDeviceData() != null) { - builder.setDeviceDataBytes(ByteString.copyFrom(device.getDeviceDataBytes())); - } - return builder.build(); - } - - @Override - public DeviceCredentialsUpdateMsg constructDeviceCredentialsUpdatedMsg(DeviceCredentials deviceCredentials) { - DeviceCredentialsUpdateMsg.Builder builder = DeviceCredentialsUpdateMsg.newBuilder() - .setDeviceIdMSB(deviceCredentials.getDeviceId().getId().getMostSignificantBits()) - .setDeviceIdLSB(deviceCredentials.getDeviceId().getId().getLeastSignificantBits()); - if (deviceCredentials.getCredentialsType() != null) { - builder.setCredentialsType(deviceCredentials.getCredentialsType().name()) - .setCredentialsId(deviceCredentials.getCredentialsId()); - } - if (deviceCredentials.getCredentialsValue() != null) { - builder.setCredentialsValue(deviceCredentials.getCredentialsValue()); - } - return builder.build(); - } - - @Override - public DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile) { - deviceProfile = JacksonUtil.clone(deviceProfile); - imageService.inlineImageForEdge(deviceProfile); - DeviceProfileUpdateMsg.Builder builder = DeviceProfileUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(deviceProfile.getId().getId().getMostSignificantBits()) - .setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits()) - .setName(deviceProfile.getName()) - .setDefault(deviceProfile.isDefault()) - .setType(deviceProfile.getType().name()) - .setProfileDataBytes(ByteString.copyFrom(deviceProfile.getProfileDataBytes())); - if (deviceProfile.getDefaultQueueName() != null) { - builder.setDefaultQueueName(deviceProfile.getDefaultQueueName()); - } - if (deviceProfile.getDescription() != null) { - builder.setDescription(deviceProfile.getDescription()); - } - if (deviceProfile.getTransportType() != null) { - builder.setTransportType(deviceProfile.getTransportType().name()); - } - if (deviceProfile.getProvisionType() != null) { - builder.setProvisionType(deviceProfile.getProvisionType().name()); - } - if (deviceProfile.getProvisionDeviceKey() != null) { - builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey()); - } - if (deviceProfile.getImage() != null) { - builder.setImage(ByteString.copyFrom(deviceProfile.getImage().getBytes(StandardCharsets.UTF_8))); - } - if (deviceProfile.getFirmwareId() != null) { - builder.setFirmwareIdMSB(deviceProfile.getFirmwareId().getId().getMostSignificantBits()) - .setFirmwareIdLSB(deviceProfile.getFirmwareId().getId().getLeastSignificantBits()); - } - if (deviceProfile.getSoftwareId() != null) { - builder.setSoftwareIdMSB(deviceProfile.getSoftwareId().getId().getMostSignificantBits()) - .setSoftwareIdLSB(deviceProfile.getSoftwareId().getId().getLeastSignificantBits()); - } - if (deviceProfile.getDefaultEdgeRuleChainId() != null) { - builder.setDefaultRuleChainIdMSB(deviceProfile.getDefaultEdgeRuleChainId().getId().getMostSignificantBits()) - .setDefaultRuleChainIdLSB(deviceProfile.getDefaultEdgeRuleChainId().getId().getLeastSignificantBits()); - } - if (deviceProfile.getDefaultDashboardId() != null) { - builder.setDefaultDashboardIdMSB(deviceProfile.getDefaultDashboardId().getId().getMostSignificantBits()) - .setDefaultDashboardIdLSB(deviceProfile.getDefaultDashboardId().getId().getLeastSignificantBits()); - } - return builder.build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV2.java deleted file mode 100644 index cf951e39a9..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/device/DeviceMsgConstructorV2.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.device; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Device; -import org.thingsboard.server.common.data.DeviceProfile; -import org.thingsboard.server.common.data.security.DeviceCredentials; -import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class DeviceMsgConstructorV2 extends BaseDeviceMsgConstructor { - - @Override - public DeviceUpdateMsg constructDeviceUpdatedMsg(UpdateMsgType msgType, Device device) { - return DeviceUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(device)) - .setIdMSB(device.getId().getId().getMostSignificantBits()) - .setIdLSB(device.getId().getId().getLeastSignificantBits()).build(); - } - - @Override - public DeviceCredentialsUpdateMsg constructDeviceCredentialsUpdatedMsg(DeviceCredentials deviceCredentials) { - return DeviceCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(deviceCredentials)).build(); - } - - @Override - public DeviceProfileUpdateMsg constructDeviceProfileUpdatedMsg(UpdateMsgType msgType, DeviceProfile deviceProfile) { - return DeviceProfileUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(deviceProfile)) - .setIdMSB(deviceProfile.getId().getId().getMostSignificantBits()) - .setIdLSB(deviceProfile.getId().getId().getLeastSignificantBits()).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/edge/EdgeMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/edge/EdgeMsgConstructor.java deleted file mode 100644 index 4b45b0427f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/edge/EdgeMsgConstructor.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.edge; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class EdgeMsgConstructor { - - public EdgeConfiguration constructEdgeConfiguration(Edge edge) { - EdgeConfiguration.Builder builder = EdgeConfiguration.newBuilder() - .setEdgeIdMSB(edge.getId().getId().getMostSignificantBits()) - .setEdgeIdLSB(edge.getId().getId().getLeastSignificantBits()) - .setTenantIdMSB(edge.getTenantId().getId().getMostSignificantBits()) - .setTenantIdLSB(edge.getTenantId().getId().getLeastSignificantBits()) - .setName(edge.getName()) - .setType(edge.getType()) - .setRoutingKey(edge.getRoutingKey()) - .setSecret(edge.getSecret()) - .setAdditionalInfo(JacksonUtil.toString(edge.getAdditionalInfo())) - .setCloudType("CE"); - if (edge.getCustomerId() != null) { - builder.setCustomerIdMSB(edge.getCustomerId().getId().getMostSignificantBits()) - .setCustomerIdLSB(edge.getCustomerId().getId().getLeastSignificantBits()); - } - return builder.build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/BaseEntityViewMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/BaseEntityViewMsgConstructor.java deleted file mode 100644 index 7fa4a03c3e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/BaseEntityViewMsgConstructor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.entityview; - -import org.thingsboard.server.common.data.id.EntityViewId; -import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseEntityViewMsgConstructor implements EntityViewMsgConstructor { - - @Override - public EntityViewUpdateMsg constructEntityViewDeleteMsg(EntityViewId entityViewId) { - return EntityViewUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(entityViewId.getId().getMostSignificantBits()) - .setIdLSB(entityViewId.getId().getLeastSignificantBits()).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructor.java deleted file mode 100644 index bec1d416d3..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructor.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.entityview; - -import org.thingsboard.server.common.data.EntityView; -import org.thingsboard.server.common.data.id.EntityViewId; -import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface EntityViewMsgConstructor extends MsgConstructor { - - EntityViewUpdateMsg constructEntityViewUpdatedMsg(UpdateMsgType msgType, EntityView entityView); - - EntityViewUpdateMsg constructEntityViewDeleteMsg(EntityViewId entityViewId); - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorFactory.java deleted file mode 100644 index 2754622a67..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.entityview; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class EntityViewMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV1.java deleted file mode 100644 index 1b3bba22c0..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV1.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.entityview; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityType; -import org.thingsboard.server.common.data.EntityView; -import org.thingsboard.server.gen.edge.v1.EdgeEntityType; -import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class EntityViewMsgConstructorV1 extends BaseEntityViewMsgConstructor { - - @Override - public EntityViewUpdateMsg constructEntityViewUpdatedMsg(UpdateMsgType msgType, EntityView entityView) { - EdgeEntityType edgeEntityType = checkEntityType(entityView.getEntityId().getEntityType()); - EntityViewUpdateMsg.Builder builder = EntityViewUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(entityView.getId().getId().getMostSignificantBits()) - .setIdLSB(entityView.getId().getId().getLeastSignificantBits()) - .setName(entityView.getName()) - .setType(entityView.getType()) - .setEntityIdMSB(entityView.getEntityId().getId().getMostSignificantBits()) - .setEntityIdLSB(entityView.getEntityId().getId().getLeastSignificantBits()) - .setEntityType(edgeEntityType); - if (entityView.getCustomerId() != null) { - builder.setCustomerIdMSB(entityView.getCustomerId().getId().getMostSignificantBits()); - builder.setCustomerIdLSB(entityView.getCustomerId().getId().getLeastSignificantBits()); - } - if (entityView.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(entityView.getAdditionalInfo())); - } - return builder.build(); - } - - private EdgeEntityType checkEntityType(EntityType entityType) { - return switch (entityType) { - case DEVICE -> EdgeEntityType.DEVICE; - case ASSET -> EdgeEntityType.ASSET; - default -> throw new RuntimeException("Unsupported entity type [" + entityType + "]"); - }; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV2.java deleted file mode 100644 index 6db4818688..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/entityview/EntityViewMsgConstructorV2.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.entityview; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityView; -import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class EntityViewMsgConstructorV2 extends BaseEntityViewMsgConstructor { - - @Override - public EntityViewUpdateMsg constructEntityViewUpdatedMsg(UpdateMsgType msgType, EntityView entityView) { - return EntityViewUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(entityView)) - .setIdMSB(entityView.getId().getId().getMostSignificantBits()) - .setIdLSB(entityView.getId().getId().getLeastSignificantBits()).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructor.java deleted file mode 100644 index 9c8f5a37e6..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructor.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.notification; - -import org.thingsboard.server.common.data.id.NotificationRuleId; -import org.thingsboard.server.common.data.id.NotificationTargetId; -import org.thingsboard.server.common.data.id.NotificationTemplateId; -import org.thingsboard.server.common.data.notification.rule.NotificationRule; -import org.thingsboard.server.common.data.notification.targets.NotificationTarget; -import org.thingsboard.server.common.data.notification.template.NotificationTemplate; -import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; -import org.thingsboard.server.gen.edge.v1.NotificationTargetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.NotificationTemplateUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public interface NotificationMsgConstructor { - - NotificationRuleUpdateMsg constructNotificationRuleUpdateMsg(UpdateMsgType msgType, NotificationRule notificationRule); - - NotificationRuleUpdateMsg constructNotificationRuleDeleteMsg(NotificationRuleId notificationRuleId); - - NotificationTargetUpdateMsg constructNotificationTargetUpdateMsg(UpdateMsgType msgType, NotificationTarget notificationTarget); - - NotificationTargetUpdateMsg constructNotificationTargetDeleteMsg(NotificationTargetId notificationTargetId); - - NotificationTemplateUpdateMsg constructNotificationTemplateUpdateMsg(UpdateMsgType msgType, NotificationTemplate notificationTemplate); - - NotificationTemplateUpdateMsg constructNotificationTemplateDeleteMsg(NotificationTemplateId notificationTemplateId); - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructorImpl.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructorImpl.java deleted file mode 100644 index 8340bee693..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/notification/NotificationMsgConstructorImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.notification; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.id.NotificationRuleId; -import org.thingsboard.server.common.data.id.NotificationTargetId; -import org.thingsboard.server.common.data.id.NotificationTemplateId; -import org.thingsboard.server.common.data.notification.rule.NotificationRule; -import org.thingsboard.server.common.data.notification.targets.NotificationTarget; -import org.thingsboard.server.common.data.notification.template.NotificationTemplate; -import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; -import org.thingsboard.server.gen.edge.v1.NotificationTargetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.NotificationTemplateUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class NotificationMsgConstructorImpl implements NotificationMsgConstructor { - - @Override - public NotificationRuleUpdateMsg constructNotificationRuleUpdateMsg(UpdateMsgType msgType, NotificationRule notificationRule) { - return NotificationRuleUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(notificationRule)).build(); - } - - @Override - public NotificationRuleUpdateMsg constructNotificationRuleDeleteMsg(NotificationRuleId notificationRuleId) { - return NotificationRuleUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(notificationRuleId.getId().getMostSignificantBits()) - .setIdLSB(notificationRuleId.getId().getLeastSignificantBits()).build(); - } - - @Override - public NotificationTargetUpdateMsg constructNotificationTargetUpdateMsg(UpdateMsgType msgType, NotificationTarget notificationTarget) { - return NotificationTargetUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(notificationTarget)).build(); - } - - @Override - public NotificationTargetUpdateMsg constructNotificationTargetDeleteMsg(NotificationTargetId notificationTargetId) { - return NotificationTargetUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(notificationTargetId.getId().getMostSignificantBits()) - .setIdLSB(notificationTargetId.getId().getLeastSignificantBits()).build(); - } - - @Override - public NotificationTemplateUpdateMsg constructNotificationTemplateUpdateMsg(UpdateMsgType msgType, NotificationTemplate notificationTemplate) { - return NotificationTemplateUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(notificationTemplate)).build(); - } - - @Override - public NotificationTemplateUpdateMsg constructNotificationTemplateDeleteMsg(NotificationTemplateId notificationTemplateId) { - return NotificationTemplateUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(notificationTemplateId.getId().getMostSignificantBits()) - .setIdLSB(notificationTemplateId.getId().getLeastSignificantBits()).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/oauth2/OAuth2MsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/oauth2/OAuth2MsgConstructor.java deleted file mode 100644 index 7ed25924b6..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/oauth2/OAuth2MsgConstructor.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.oauth2; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.domain.DomainInfo; -import org.thingsboard.server.common.data.id.DomainId; -import org.thingsboard.server.common.data.id.OAuth2ClientId; -import org.thingsboard.server.common.data.oauth2.OAuth2Client; -import org.thingsboard.server.gen.edge.v1.OAuth2ClientUpdateMsg; -import org.thingsboard.server.gen.edge.v1.OAuth2DomainUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class OAuth2MsgConstructor { - - public OAuth2ClientUpdateMsg constructOAuth2ClientUpdateMsg(UpdateMsgType msgType, OAuth2Client oAuth2Client) { - return OAuth2ClientUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(oAuth2Client)) - .setIdMSB(oAuth2Client.getId().getId().getMostSignificantBits()) - .setIdLSB(oAuth2Client.getId().getId().getLeastSignificantBits()).build(); - } - - public OAuth2ClientUpdateMsg constructOAuth2ClientDeleteMsg(OAuth2ClientId oAuth2ClientId) { - return OAuth2ClientUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(oAuth2ClientId.getId().getMostSignificantBits()) - .setIdLSB(oAuth2ClientId.getId().getLeastSignificantBits()).build(); - } - - public OAuth2DomainUpdateMsg constructOAuth2DomainUpdateMsg(UpdateMsgType msgType, DomainInfo domainInfo) { - return OAuth2DomainUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(domainInfo)) - .setIdMSB(domainInfo.getId().getId().getMostSignificantBits()) - .setIdLSB(domainInfo.getId().getId().getLeastSignificantBits()).build(); - } - - public OAuth2DomainUpdateMsg constructOAuth2DomainDeleteMsg(DomainId domainId) { - return OAuth2DomainUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(domainId.getId().getMostSignificantBits()) - .setIdLSB(domainId.getId().getLeastSignificantBits()) - .build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/BaseOtaPackageMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/BaseOtaPackageMsgConstructor.java deleted file mode 100644 index c06d6adc4b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/BaseOtaPackageMsgConstructor.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.ota; - -import org.thingsboard.server.common.data.id.OtaPackageId; -import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseOtaPackageMsgConstructor implements OtaPackageMsgConstructor { - - @Override - public OtaPackageUpdateMsg constructOtaPackageDeleteMsg(OtaPackageId otaPackageId) { - return OtaPackageUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(otaPackageId.getId().getMostSignificantBits()) - .setIdLSB(otaPackageId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructor.java deleted file mode 100644 index 247043eb20..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructor.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.ota; - -import org.thingsboard.server.common.data.OtaPackage; -import org.thingsboard.server.common.data.id.OtaPackageId; -import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface OtaPackageMsgConstructor extends MsgConstructor { - - OtaPackageUpdateMsg constructOtaPackageUpdatedMsg(UpdateMsgType msgType, OtaPackage otaPackage); - - OtaPackageUpdateMsg constructOtaPackageDeleteMsg(OtaPackageId otaPackageId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorFactory.java deleted file mode 100644 index 664ec1d60b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.ota; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class OtaPackageMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV1.java deleted file mode 100644 index 3c743a4200..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV1.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.ota; - -import com.google.protobuf.ByteString; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.OtaPackage; -import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class OtaPackageMsgConstructorV1 extends BaseOtaPackageMsgConstructor { - - @Override - public OtaPackageUpdateMsg constructOtaPackageUpdatedMsg(UpdateMsgType msgType, OtaPackage otaPackage) { - OtaPackageUpdateMsg.Builder builder = OtaPackageUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(otaPackage.getId().getId().getMostSignificantBits()) - .setIdLSB(otaPackage.getId().getId().getLeastSignificantBits()) - .setType(otaPackage.getType().name()) - .setTitle(otaPackage.getTitle()) - .setVersion(otaPackage.getVersion()) - .setTag(otaPackage.getTag()); - - if (otaPackage.getDeviceProfileId() != null) { - builder.setDeviceProfileIdMSB(otaPackage.getDeviceProfileId().getId().getMostSignificantBits()) - .setDeviceProfileIdLSB(otaPackage.getDeviceProfileId().getId().getLeastSignificantBits()); - } - - if (otaPackage.getUrl() != null) { - builder.setUrl(otaPackage.getUrl()); - } - if (otaPackage.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(otaPackage.getAdditionalInfo())); - } - if (otaPackage.getFileName() != null) { - builder.setFileName(otaPackage.getFileName()); - } - if (otaPackage.getContentType() != null) { - builder.setContentType(otaPackage.getContentType()); - } - if (otaPackage.getChecksumAlgorithm() != null) { - builder.setChecksumAlgorithm(otaPackage.getChecksumAlgorithm().name()); - } - if (otaPackage.getChecksum() != null) { - builder.setChecksum(otaPackage.getChecksum()); - } - if (otaPackage.getDataSize() != null) { - builder.setDataSize(otaPackage.getDataSize()); - } - if (otaPackage.getData() != null) { - builder.setData(ByteString.copyFrom(otaPackage.getData().array())); - } - return builder.build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV2.java deleted file mode 100644 index c3c7eac9a4..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/ota/OtaPackageMsgConstructorV2.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.ota; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.OtaPackage; -import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class OtaPackageMsgConstructorV2 extends BaseOtaPackageMsgConstructor { - - @Override - public OtaPackageUpdateMsg constructOtaPackageUpdatedMsg(UpdateMsgType msgType, OtaPackage otaPackage) { - return OtaPackageUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(otaPackage)) - .setIdMSB(otaPackage.getId().getId().getMostSignificantBits()) - .setIdLSB(otaPackage.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/BaseQueueMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/BaseQueueMsgConstructor.java deleted file mode 100644 index ce68ef8bcb..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/BaseQueueMsgConstructor.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.queue; - -import org.thingsboard.server.common.data.id.QueueId; -import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseQueueMsgConstructor implements QueueMsgConstructor { - - @Override - public QueueUpdateMsg constructQueueDeleteMsg(QueueId queueId) { - return QueueUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(queueId.getId().getMostSignificantBits()) - .setIdLSB(queueId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructor.java deleted file mode 100644 index 1aad30fb8f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructor.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.queue; - -import org.thingsboard.server.common.data.id.QueueId; -import org.thingsboard.server.common.data.queue.Queue; -import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface QueueMsgConstructor extends MsgConstructor { - - QueueUpdateMsg constructQueueUpdatedMsg(UpdateMsgType msgType, Queue queue); - - QueueUpdateMsg constructQueueDeleteMsg(QueueId queueId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorFactory.java deleted file mode 100644 index 5549a2fdba..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.queue; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class QueueMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV1.java deleted file mode 100644 index 78cdc0f7e4..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV1.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.queue; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.data.id.QueueId; -import org.thingsboard.server.common.data.queue.ProcessingStrategy; -import org.thingsboard.server.common.data.queue.Queue; -import org.thingsboard.server.common.data.queue.SubmitStrategy; -import org.thingsboard.server.gen.edge.v1.ProcessingStrategyProto; -import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; -import org.thingsboard.server.gen.edge.v1.SubmitStrategyProto; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class QueueMsgConstructorV1 extends BaseQueueMsgConstructor { - - @Override - public QueueUpdateMsg constructQueueUpdatedMsg(UpdateMsgType msgType, Queue queue) { - return QueueUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(queue.getId().getId().getMostSignificantBits()) - .setIdLSB(queue.getId().getId().getLeastSignificantBits()) - .setTenantIdMSB(queue.getTenantId().getId().getMostSignificantBits()) - .setTenantIdLSB(queue.getTenantId().getId().getLeastSignificantBits()) - .setName(queue.getName()) - .setTopic(queue.getTopic()) - .setPollInterval(queue.getPollInterval()) - .setPartitions(queue.getPartitions()) - .setConsumerPerPartition(queue.isConsumerPerPartition()) - .setPackProcessingTimeout(queue.getPackProcessingTimeout()) - .setSubmitStrategy(createSubmitStrategyProto(queue.getSubmitStrategy())) - .setProcessingStrategy(createProcessingStrategyProto(queue.getProcessingStrategy())).build(); - } - - private ProcessingStrategyProto createProcessingStrategyProto(ProcessingStrategy processingStrategy) { - return ProcessingStrategyProto.newBuilder() - .setType(processingStrategy.getType().name()) - .setRetries(processingStrategy.getRetries()) - .setFailurePercentage(processingStrategy.getFailurePercentage()) - .setPauseBetweenRetries(processingStrategy.getPauseBetweenRetries()) - .setMaxPauseBetweenRetries(processingStrategy.getMaxPauseBetweenRetries()) - .build(); - } - - private SubmitStrategyProto createSubmitStrategyProto(SubmitStrategy submitStrategy) { - return SubmitStrategyProto.newBuilder() - .setType(submitStrategy.getType().name()) - .setBatchSize(submitStrategy.getBatchSize()) - .build(); - } - - public QueueUpdateMsg constructQueueDeleteMsg(QueueId queueId) { - return QueueUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(queueId.getId().getMostSignificantBits()) - .setIdLSB(queueId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV2.java deleted file mode 100644 index 9df94b957e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/queue/QueueMsgConstructorV2.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.queue; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.queue.Queue; -import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class QueueMsgConstructorV2 extends BaseQueueMsgConstructor { - - @Override - public QueueUpdateMsg constructQueueUpdatedMsg(UpdateMsgType msgType, Queue queue) { - return QueueUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(queue)) - .setIdMSB(queue.getId().getId().getMostSignificantBits()) - .setIdLSB(queue.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructor.java deleted file mode 100644 index 4dc1cd6777..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.relation; - -import org.thingsboard.server.common.data.relation.EntityRelation; -import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface RelationMsgConstructor extends MsgConstructor { - - RelationUpdateMsg constructRelationUpdatedMsg(UpdateMsgType msgType, EntityRelation entityRelation); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorFactory.java deleted file mode 100644 index dd1642c6a0..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.relation; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class RelationMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV1.java deleted file mode 100644 index f5b9ae59f3..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV1.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.relation; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.relation.EntityRelation; -import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class RelationMsgConstructorV1 implements RelationMsgConstructor { - - @Override - public RelationUpdateMsg constructRelationUpdatedMsg(UpdateMsgType msgType, EntityRelation entityRelation) { - RelationUpdateMsg.Builder builder = RelationUpdateMsg.newBuilder() - .setMsgType(msgType) - .setFromIdMSB(entityRelation.getFrom().getId().getMostSignificantBits()) - .setFromIdLSB(entityRelation.getFrom().getId().getLeastSignificantBits()) - .setFromEntityType(entityRelation.getFrom().getEntityType().name()) - .setToIdMSB(entityRelation.getTo().getId().getMostSignificantBits()) - .setToIdLSB(entityRelation.getTo().getId().getLeastSignificantBits()) - .setToEntityType(entityRelation.getTo().getEntityType().name()) - .setType(entityRelation.getType()); - if (entityRelation.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(entityRelation.getAdditionalInfo())); - } - if (entityRelation.getTypeGroup() != null) { - builder.setTypeGroup(entityRelation.getTypeGroup().name()); - } - return builder.build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV2.java deleted file mode 100644 index 9a52b0b29b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/relation/RelationMsgConstructorV2.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.relation; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.relation.EntityRelation; -import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class RelationMsgConstructorV2 implements RelationMsgConstructor { - - - @Override - public RelationUpdateMsg constructRelationUpdatedMsg(UpdateMsgType msgType, EntityRelation entityRelation) { - return RelationUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(entityRelation)).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/BaseResourceMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/BaseResourceMsgConstructor.java deleted file mode 100644 index 0a9d34fb85..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/BaseResourceMsgConstructor.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.resource; - -import org.thingsboard.server.common.data.id.TbResourceId; -import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseResourceMsgConstructor implements ResourceMsgConstructor { - - @Override - public ResourceUpdateMsg constructResourceDeleteMsg(TbResourceId tbResourceId) { - return ResourceUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(tbResourceId.getId().getMostSignificantBits()) - .setIdLSB(tbResourceId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructor.java deleted file mode 100644 index 9b002237fb..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructor.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.resource; - -import org.thingsboard.server.common.data.TbResource; -import org.thingsboard.server.common.data.id.TbResourceId; -import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface ResourceMsgConstructor extends MsgConstructor { - - ResourceUpdateMsg constructResourceUpdatedMsg(UpdateMsgType msgType, TbResource tbResource); - - ResourceUpdateMsg constructResourceDeleteMsg(TbResourceId tbResourceId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorFactory.java deleted file mode 100644 index e2e3970b41..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.resource; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class ResourceMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV1.java deleted file mode 100644 index e1cf75ea56..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV1.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.resource; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.data.ResourceType; -import org.thingsboard.server.common.data.TbResource; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class ResourceMsgConstructorV1 extends BaseResourceMsgConstructor { - - @Override - public ResourceUpdateMsg constructResourceUpdatedMsg(UpdateMsgType msgType, TbResource tbResource) { - if (ResourceType.IMAGE.equals(tbResource.getResourceType())) { - // Exclude support for a recently added resource type when dealing with older Edges - // to maintain compatibility and avoid potential issues. - return null; - } - ResourceUpdateMsg.Builder builder = ResourceUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(tbResource.getId().getId().getMostSignificantBits()) - .setIdLSB(tbResource.getId().getId().getLeastSignificantBits()) - .setTitle(tbResource.getTitle()) - .setResourceKey(tbResource.getResourceKey()) - .setResourceType(tbResource.getResourceType().name()) - .setFileName(tbResource.getFileName()); - if (tbResource.getData() != null) { - builder.setData(tbResource.getEncodedData()); - } - if (tbResource.getEtag() != null) { - builder.setEtag(tbResource.getEtag()); - } - if (TenantId.SYS_TENANT_ID.equals(tbResource.getTenantId())) { - builder.setIsSystem(true); - } - return builder.build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV2.java deleted file mode 100644 index 85aaa61def..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/resource/ResourceMsgConstructorV2.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.resource; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.TbResource; -import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class ResourceMsgConstructorV2 extends BaseResourceMsgConstructor { - - @Override - public ResourceUpdateMsg constructResourceUpdatedMsg(UpdateMsgType msgType, TbResource tbResource) { - return ResourceUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(tbResource)) - .setIdMSB(tbResource.getId().getId().getMostSignificantBits()) - .setIdLSB(tbResource.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMetadataConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMetadataConstructor.java deleted file mode 100644 index efa541ca54..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMetadataConstructor.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.NodeConnectionInfo; -import org.thingsboard.server.common.data.rule.RuleChainConnectionInfo; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.common.data.rule.RuleNode; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.NodeConnectionInfoProto; -import org.thingsboard.server.gen.edge.v1.RuleChainConnectionInfoProto; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; -import org.thingsboard.server.gen.edge.v1.RuleNodeProto; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -import java.util.ArrayList; -import java.util.List; -import java.util.NavigableSet; - -@Slf4j -@AllArgsConstructor -public abstract class BaseRuleChainMetadataConstructor implements RuleChainMetadataConstructor { - - @Override - public RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - UpdateMsgType msgType, - RuleChainMetaData ruleChainMetaData, - EdgeVersion edgeVersion) { - RuleChainMetadataUpdateMsg.Builder builder = RuleChainMetadataUpdateMsg.newBuilder(); - constructRuleChainMetadataUpdatedMsg(tenantId, builder, ruleChainMetaData); - builder.setMsgType(msgType); - return builder.build(); - } - - protected abstract void constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - RuleChainMetadataUpdateMsg.Builder builder, - RuleChainMetaData ruleChainMetaData); - - protected List constructConnections(List connections) { - List result = new ArrayList<>(); - if (connections != null && !connections.isEmpty()) { - for (NodeConnectionInfo connection : connections) { - result.add(constructConnection(connection)); - } - } - return result; - } - - private NodeConnectionInfoProto constructConnection(NodeConnectionInfo connection) { - return NodeConnectionInfoProto.newBuilder() - .setFromIndex(connection.getFromIndex()) - .setToIndex(connection.getToIndex()) - .setType(connection.getType()) - .build(); - } - - protected List constructNodes(List nodes) { - List result = new ArrayList<>(); - if (nodes != null && !nodes.isEmpty()) { - for (RuleNode node : nodes) { - result.add(constructNode(node)); - } - } - return result; - } - - private RuleNodeProto constructNode(RuleNode node) { - return RuleNodeProto.newBuilder() - .setIdMSB(node.getId().getId().getMostSignificantBits()) - .setIdLSB(node.getId().getId().getLeastSignificantBits()) - .setType(node.getType()) - .setName(node.getName()) - .setDebugSettings(JacksonUtil.toString(node.getDebugSettings())) - .setConfiguration(JacksonUtil.toString(node.getConfiguration())) - .setAdditionalInfo(JacksonUtil.toString(node.getAdditionalInfo())) - .setSingletonMode(node.isSingletonMode()) - .setConfigurationVersion(node.getConfigurationVersion()) - .build(); - } - - protected List constructRuleChainConnections(List ruleChainConnections, - NavigableSet removedNodeIndexes) { - List result = new ArrayList<>(); - if (ruleChainConnections != null && !ruleChainConnections.isEmpty()) { - for (RuleChainConnectionInfo ruleChainConnectionInfo : ruleChainConnections) { - if (!removedNodeIndexes.isEmpty()) { // 3_3_0 only - int fromIndex = ruleChainConnectionInfo.getFromIndex(); - // decrease index because of removed nodes - for (Integer removedIndex : removedNodeIndexes) { - if (fromIndex > removedIndex) { - fromIndex = fromIndex - 1; - } - } - ruleChainConnectionInfo.setFromIndex(fromIndex); - ObjectNode additionalInfo = (ObjectNode) ruleChainConnectionInfo.getAdditionalInfo(); - if (additionalInfo.get("ruleChainNodeId") == null) { - additionalInfo.put("ruleChainNodeId", "rule-chain-node-UNDEFINED"); - } - } - result.add(constructRuleChainConnection(ruleChainConnectionInfo)); - } - } - return result; - } - - private RuleChainConnectionInfoProto constructRuleChainConnection(RuleChainConnectionInfo ruleChainConnectionInfo) { - return RuleChainConnectionInfoProto.newBuilder() - .setFromIndex(ruleChainConnectionInfo.getFromIndex()) - .setTargetRuleChainIdMSB(ruleChainConnectionInfo.getTargetRuleChainId().getId().getMostSignificantBits()) - .setTargetRuleChainIdLSB(ruleChainConnectionInfo.getTargetRuleChainId().getId().getLeastSignificantBits()) - .setType(ruleChainConnectionInfo.getType()) - .setAdditionalInfo(JacksonUtil.toString(ruleChainConnectionInfo.getAdditionalInfo())) - .build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMsgConstructor.java deleted file mode 100644 index 89ac4123a4..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/BaseRuleChainMsgConstructor.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; -import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public abstract class BaseRuleChainMsgConstructor implements RuleChainMsgConstructor { - - @Override - public RuleChainUpdateMsg constructRuleChainDeleteMsg(RuleChainId ruleChainId) { - return RuleChainUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(ruleChainId.getId().getMostSignificantBits()) - .setIdLSB(ruleChainId.getId().getLeastSignificantBits()).build(); - } - - @Override - public RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - UpdateMsgType msgType, - RuleChainMetaData ruleChainMetaData, - EdgeVersion edgeVersion) { - RuleChainMetadataConstructor ruleChainMetadataConstructor = RuleChainMetadataConstructorFactory.getByEdgeVersion(edgeVersion); - return ruleChainMetadataConstructor.constructRuleChainMetadataUpdatedMsg(tenantId, msgType, ruleChainMetaData, edgeVersion); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructor.java deleted file mode 100644 index 43b103cb8a..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructor.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; - -public interface RuleChainMetadataConstructor { - - RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - UpdateMsgType msgType, - RuleChainMetaData ruleChainMetaData, - EdgeVersion edgeVersion); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorFactory.java deleted file mode 100644 index 22c36e47a6..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.thingsboard.server.gen.edge.v1.EdgeVersion; - -public final class RuleChainMetadataConstructorFactory { - - public static RuleChainMetadataConstructor getByEdgeVersion(EdgeVersion edgeVersion) { - switch (edgeVersion) { - case V_3_3_0: - return new RuleChainMetadataConstructorV330(); - case V_3_3_3: - case V_3_4_0: - case V_3_6_0: - case V_3_6_1: - return new RuleChainMetadataConstructorV340(); - case V_3_6_2: - default: - return new RuleChainMetadataConstructorV362(); - } - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV330.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV330.java deleted file mode 100644 index fe24a8267a..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV330.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import lombok.extern.slf4j.Slf4j; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.rule.engine.flow.TbRuleChainInputNode; -import org.thingsboard.rule.engine.flow.TbRuleChainInputNodeConfiguration; -import org.thingsboard.rule.engine.flow.TbRuleChainOutputNode; -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.NodeConnectionInfo; -import org.thingsboard.server.common.data.rule.RuleChainConnectionInfo; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.common.data.rule.RuleNode; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; - -import java.util.ArrayList; -import java.util.List; -import java.util.NavigableSet; -import java.util.TreeSet; -import java.util.UUID; -import java.util.stream.Collectors; - -@Slf4j -public class RuleChainMetadataConstructorV330 extends BaseRuleChainMetadataConstructor { - - private static final String RULE_CHAIN_INPUT_NODE = TbRuleChainInputNode.class.getName(); - private static final String TB_RULE_CHAIN_OUTPUT_NODE = TbRuleChainOutputNode.class.getName(); - - @Override - protected void constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - RuleChainMetadataUpdateMsg.Builder builder, - RuleChainMetaData ruleChainMetaData) { - builder.setRuleChainIdMSB(ruleChainMetaData.getRuleChainId().getId().getMostSignificantBits()) - .setRuleChainIdLSB(ruleChainMetaData.getRuleChainId().getId().getLeastSignificantBits()); - List supportedNodes = filterNodes(ruleChainMetaData.getNodes()); - - NavigableSet removedNodeIndexes = getRemovedNodeIndexes(ruleChainMetaData.getNodes(), ruleChainMetaData.getConnections()); - List connections = filterConnections(ruleChainMetaData.getNodes(), ruleChainMetaData.getConnections(), removedNodeIndexes); - - List ruleChainConnections = new ArrayList<>(); - if (ruleChainMetaData.getRuleChainConnections() != null) { - ruleChainConnections.addAll(ruleChainMetaData.getRuleChainConnections()); - } - ruleChainConnections.addAll(addRuleChainConnections(ruleChainMetaData.getNodes(), ruleChainMetaData.getConnections())); - builder.addAllNodes(constructNodes(supportedNodes)) - .addAllConnections(constructConnections(connections)) - .addAllRuleChainConnections(constructRuleChainConnections(ruleChainConnections, removedNodeIndexes)); - if (ruleChainMetaData.getFirstNodeIndex() != null) { - Integer firstNodeIndex = ruleChainMetaData.getFirstNodeIndex(); - // decrease index because of removed nodes - for (Integer removedIndex : removedNodeIndexes) { - if (firstNodeIndex > removedIndex) { - firstNodeIndex = firstNodeIndex - 1; - } - } - builder.setFirstNodeIndex(firstNodeIndex); - } else { - builder.setFirstNodeIndex(-1); - } - } - - private NavigableSet getRemovedNodeIndexes(List nodes, List connections) { - TreeSet removedIndexes = new TreeSet<>(); - for (NodeConnectionInfo connection : connections) { - for (int i = 0; i < nodes.size(); i++) { - RuleNode node = nodes.get(i); - if (node.getType().equalsIgnoreCase(RULE_CHAIN_INPUT_NODE) - || node.getType().equalsIgnoreCase(TB_RULE_CHAIN_OUTPUT_NODE)) { - if (connection.getFromIndex() == i || connection.getToIndex() == i) { - removedIndexes.add(i); - } - } - } - } - return removedIndexes.descendingSet(); - } - - private List filterConnections(List nodes, - List connections, - NavigableSet removedNodeIndexes) { - List result = new ArrayList<>(); - if (connections != null) { - result = connections.stream().filter(conn -> { - for (int i = 0; i < nodes.size(); i++) { - RuleNode node = nodes.get(i); - if (node.getType().equalsIgnoreCase(RULE_CHAIN_INPUT_NODE) - || node.getType().equalsIgnoreCase(TB_RULE_CHAIN_OUTPUT_NODE)) { - if (conn.getFromIndex() == i || conn.getToIndex() == i) { - return false; - } - } - } - return true; - }).map(conn -> { - NodeConnectionInfo newConn = new NodeConnectionInfo(); - newConn.setFromIndex(conn.getFromIndex()); - newConn.setToIndex(conn.getToIndex()); - newConn.setType(conn.getType()); - return newConn; - }).collect(Collectors.toList()); - } - - // decrease index because of removed nodes - for (Integer removedIndex : removedNodeIndexes) { - for (NodeConnectionInfo newConn : result) { - if (newConn.getToIndex() > removedIndex) { - newConn.setToIndex(newConn.getToIndex() - 1); - } - if (newConn.getFromIndex() > removedIndex) { - newConn.setFromIndex(newConn.getFromIndex() - 1); - } - } - } - - return result; - } - - private List filterNodes(List nodes) { - List result = new ArrayList<>(); - for (RuleNode node : nodes) { - if (RULE_CHAIN_INPUT_NODE.equals(node.getType()) - || TB_RULE_CHAIN_OUTPUT_NODE.equals(node.getType())) { - log.trace("Skipping not supported rule node {}", node); - } else { - result.add(node); - } - } - return result; - } - - private List addRuleChainConnections(List nodes, List connections) { - List result = new ArrayList<>(); - for (int i = 0; i < nodes.size(); i++) { - RuleNode node = nodes.get(i); - if (node.getType().equalsIgnoreCase(RULE_CHAIN_INPUT_NODE)) { - for (NodeConnectionInfo connection : connections) { - if (connection.getToIndex() == i) { - RuleChainConnectionInfo e = new RuleChainConnectionInfo(); - e.setFromIndex(connection.getFromIndex()); - TbRuleChainInputNodeConfiguration configuration = JacksonUtil.treeToValue(node.getConfiguration(), TbRuleChainInputNodeConfiguration.class); - e.setTargetRuleChainId(new RuleChainId(UUID.fromString(configuration.getRuleChainId()))); - e.setAdditionalInfo(node.getAdditionalInfo()); - e.setType(connection.getType()); - result.add(e); - } - } - } - } - return result; - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV340.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV340.java deleted file mode 100644 index 087f3563b1..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV340.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import lombok.extern.slf4j.Slf4j; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; - -import java.util.TreeSet; - -@Slf4j -public class RuleChainMetadataConstructorV340 extends BaseRuleChainMetadataConstructor { - - @Override - protected void constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - RuleChainMetadataUpdateMsg.Builder builder, - RuleChainMetaData ruleChainMetaData) { - builder.setRuleChainIdMSB(ruleChainMetaData.getRuleChainId().getId().getMostSignificantBits()) - .setRuleChainIdLSB(ruleChainMetaData.getRuleChainId().getId().getLeastSignificantBits()); - builder.addAllNodes(constructNodes(ruleChainMetaData.getNodes())) - .addAllConnections(constructConnections(ruleChainMetaData.getConnections())) - .addAllRuleChainConnections(constructRuleChainConnections(ruleChainMetaData.getRuleChainConnections(), new TreeSet<>())); - if (ruleChainMetaData.getFirstNodeIndex() != null) { - builder.setFirstNodeIndex(ruleChainMetaData.getFirstNodeIndex()); - } else { - builder.setFirstNodeIndex(-1); - } - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV362.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV362.java deleted file mode 100644 index a62a275672..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMetadataConstructorV362.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; - -public class RuleChainMetadataConstructorV362 extends BaseRuleChainMetadataConstructor { - - @Override - protected void constructRuleChainMetadataUpdatedMsg(TenantId tenantId, RuleChainMetadataUpdateMsg.Builder builder, RuleChainMetaData ruleChainMetaData) { - builder.setEntity(JacksonUtil.toString(ruleChainMetaData)); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructor.java deleted file mode 100644 index 89cf21a08c..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructor.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.rule.RuleChain; -import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; -import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface RuleChainMsgConstructor extends MsgConstructor { - - RuleChainUpdateMsg constructRuleChainUpdatedMsg(UpdateMsgType msgType, RuleChain ruleChain, boolean isRoot); - - RuleChainUpdateMsg constructRuleChainDeleteMsg(RuleChainId ruleChainId); - - RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(TenantId tenantId, - UpdateMsgType msgType, - RuleChainMetaData ruleChainMetaData, - EdgeVersion edgeVersion); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorFactory.java deleted file mode 100644 index cb7b116ea1..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class RuleChainMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV1.java deleted file mode 100644 index c4e8871187..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV1.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.rule.RuleChain; -import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class RuleChainMsgConstructorV1 extends BaseRuleChainMsgConstructor { - - @Override - public RuleChainUpdateMsg constructRuleChainUpdatedMsg(UpdateMsgType msgType, RuleChain ruleChain, boolean isRoot) { - RuleChainUpdateMsg.Builder builder = RuleChainUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(ruleChain.getId().getId().getMostSignificantBits()) - .setIdLSB(ruleChain.getId().getId().getLeastSignificantBits()) - .setName(ruleChain.getName()) - .setRoot(isRoot) - .setDebugMode(ruleChain.isDebugMode()) - .setConfiguration(JacksonUtil.toString(ruleChain.getConfiguration())); - if (ruleChain.getFirstRuleNodeId() != null) { - builder.setFirstRuleNodeIdMSB(ruleChain.getFirstRuleNodeId().getId().getMostSignificantBits()) - .setFirstRuleNodeIdLSB(ruleChain.getFirstRuleNodeId().getId().getLeastSignificantBits()); - } - return builder.build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV2.java deleted file mode 100644 index fb03067ca0..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/rule/RuleChainMsgConstructorV2.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.rule; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.rule.RuleChain; -import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class RuleChainMsgConstructorV2 extends BaseRuleChainMsgConstructor { - - @Override - public RuleChainUpdateMsg constructRuleChainUpdatedMsg(UpdateMsgType msgType, RuleChain ruleChain, boolean isRoot) { - boolean isTemplateRoot = ruleChain.isRoot(); - ruleChain.setRoot(isRoot); - RuleChainUpdateMsg result = RuleChainUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(ruleChain)) - .setIdMSB(ruleChain.getId().getId().getMostSignificantBits()) - .setIdLSB(ruleChain.getId().getId().getLeastSignificantBits()).build(); - ruleChain.setRoot(isTemplateRoot); - return result; - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructor.java deleted file mode 100644 index a5fa5f3808..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructor.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.settings; - -import org.thingsboard.server.common.data.AdminSettings; -import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface AdminSettingsMsgConstructor extends MsgConstructor { - - AdminSettingsUpdateMsg constructAdminSettingsUpdateMsg(AdminSettings adminSettings); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorFactory.java deleted file mode 100644 index 472e582b52..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.settings; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class AdminSettingsMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV1.java deleted file mode 100644 index 1f3942542d..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV1.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.settings; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.AdminSettings; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class AdminSettingsMsgConstructorV1 implements AdminSettingsMsgConstructor { - - @Override - public AdminSettingsUpdateMsg constructAdminSettingsUpdateMsg(AdminSettings adminSettings) { - AdminSettingsUpdateMsg.Builder builder = AdminSettingsUpdateMsg.newBuilder() - .setKey(adminSettings.getKey()) - .setJsonValue(JacksonUtil.toString(adminSettings.getJsonValue())); - if (TenantId.SYS_TENANT_ID.equals(adminSettings.getTenantId())) { - builder.setIsSystem(true); - } - return builder.build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV2.java deleted file mode 100644 index d3cd44370b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/settings/AdminSettingsMsgConstructorV2.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.settings; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.AdminSettings; -import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class AdminSettingsMsgConstructorV2 implements AdminSettingsMsgConstructor { - - @Override - public AdminSettingsUpdateMsg constructAdminSettingsUpdateMsg(AdminSettings adminSettings) { - return AdminSettingsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(adminSettings)).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java deleted file mode 100644 index 6493f97f57..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.telemetry; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.reflect.TypeToken; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.adaptor.JsonConverter; -import org.thingsboard.server.common.data.DataConstants; -import org.thingsboard.server.common.data.StringUtils; -import org.thingsboard.server.common.data.edge.EdgeEventActionType; -import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AttributeDeleteMsg; -import org.thingsboard.server.gen.edge.v1.EntityDataProto; -import org.thingsboard.server.gen.transport.TransportProtos; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.List; - -@Slf4j -@Component -@TbCoreComponent -public class EntityDataMsgConstructor { - - public EntityDataProto constructEntityDataMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType actionType, JsonElement entityData) { - EntityDataProto.Builder builder = EntityDataProto.newBuilder() - .setEntityIdMSB(entityId.getId().getMostSignificantBits()) - .setEntityIdLSB(entityId.getId().getLeastSignificantBits()) - .setEntityType(entityId.getEntityType().name()); - switch (actionType) { - case TIMESERIES_UPDATED: - try { - JsonObject data = entityData.getAsJsonObject(); - long ts; - if (data.get("ts") != null && !data.get("ts").isJsonNull()) { - ts = data.getAsJsonPrimitive("ts").getAsLong(); - } else { - ts = System.currentTimeMillis(); - } - builder.setPostTelemetryMsg(JsonConverter.convertToTelemetryProto(data.getAsJsonObject("data"), ts)); - } catch (Exception e) { - log.warn("[{}][{}] Can't convert to telemetry proto, entityData [{}]", tenantId, entityId, entityData, e); - } - break; - case ATTRIBUTES_UPDATED: - try { - JsonObject data = entityData.getAsJsonObject(); - TransportProtos.PostAttributeMsg attributesUpdatedMsg = JsonConverter.convertToAttributesProto(data.getAsJsonObject("kv")); - builder.setAttributesUpdatedMsg(attributesUpdatedMsg); - builder.setPostAttributeScope(getScopeOfDefault(data)); - } catch (Exception e) { - log.warn("[{}][{}] Can't convert to AttributesUpdatedMsg proto, entityData [{}]", tenantId, entityId, entityData, e); - } - break; - case POST_ATTRIBUTES: - try { - JsonObject data = entityData.getAsJsonObject(); - TransportProtos.PostAttributeMsg postAttributesMsg = JsonConverter.convertToAttributesProto(data.getAsJsonObject("kv")); - builder.setPostAttributesMsg(postAttributesMsg); - builder.setPostAttributeScope(getScopeOfDefault(data)); - } catch (Exception e) { - log.warn("[{}][{}] Can't convert to PostAttributesMsg, entityData [{}]", tenantId, entityId, entityData, e); - } - break; - case ATTRIBUTES_DELETED: - try { - AttributeDeleteMsg.Builder attributeDeleteMsg = AttributeDeleteMsg.newBuilder(); - attributeDeleteMsg.setScope(entityData.getAsJsonObject().getAsJsonPrimitive("scope").getAsString()); - JsonArray jsonArray = entityData.getAsJsonObject().getAsJsonArray("keys"); - List keys = new Gson().fromJson(jsonArray.toString(), new TypeToken<>(){}.getType()); - attributeDeleteMsg.addAllAttributeNames(keys); - attributeDeleteMsg.build(); - builder.setAttributeDeleteMsg(attributeDeleteMsg); - } catch (Exception e) { - log.warn("[{}][{}] Can't convert to AttributeDeleteMsg proto, entityData [{}]", tenantId, entityId, entityData, e); - } - break; - } - return builder.build(); - } - - private String getScopeOfDefault(JsonObject data) { - JsonPrimitive scope = data.getAsJsonPrimitive("scope"); - String result = DataConstants.SERVER_SCOPE; - if (scope != null && StringUtils.isNotBlank(scope.getAsString())) { - result = scope.getAsString(); - } - return result; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructor.java deleted file mode 100644 index a1299b3f97..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructor.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.tenant; - -import org.thingsboard.server.common.data.Tenant; -import org.thingsboard.server.common.data.TenantProfile; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface TenantMsgConstructor extends MsgConstructor { - - TenantUpdateMsg constructTenantUpdateMsg(UpdateMsgType msgType, Tenant tenant); - - TenantProfileUpdateMsg constructTenantProfileUpdateMsg(UpdateMsgType msgType, TenantProfile tenantProfile, EdgeVersion edgeVersion); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorFactory.java deleted file mode 100644 index 09441d8e91..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.tenant; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class TenantMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV1.java deleted file mode 100644 index a9accf572d..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV1.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.tenant; - -import com.google.protobuf.ByteString; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Tenant; -import org.thingsboard.server.common.data.TenantProfile; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; - -@Component -@TbCoreComponent -public class TenantMsgConstructorV1 implements TenantMsgConstructor { - - @Override - public TenantUpdateMsg constructTenantUpdateMsg(UpdateMsgType msgType, Tenant tenant) { - TenantUpdateMsg.Builder builder = TenantUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(tenant.getId().getId().getMostSignificantBits()) - .setIdLSB(tenant.getId().getId().getLeastSignificantBits()) - .setTitle(tenant.getTitle()) - .setProfileIdMSB(tenant.getTenantProfileId().getId().getMostSignificantBits()) - .setProfileIdLSB(tenant.getTenantProfileId().getId().getLeastSignificantBits()) - .setRegion(tenant.getRegion()); - if (tenant.getCountry() != null) { - builder.setCountry(tenant.getCountry()); - } - if (tenant.getState() != null) { - builder.setState(tenant.getState()); - } - if (tenant.getCity() != null) { - builder.setCity(tenant.getCity()); - } - if (tenant.getAddress() != null) { - builder.setAddress(tenant.getAddress()); - } - if (tenant.getAddress2() != null) { - builder.setAddress2(tenant.getAddress2()); - } - if (tenant.getZip() != null) { - builder.setZip(tenant.getZip()); - } - if (tenant.getPhone() != null) { - builder.setPhone(tenant.getPhone()); - } - if (tenant.getEmail() != null) { - builder.setEmail(tenant.getEmail()); - } - if (tenant.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(tenant.getAdditionalInfo())); - } - return builder.build(); - } - - @Override - public TenantProfileUpdateMsg constructTenantProfileUpdateMsg(UpdateMsgType msgType, TenantProfile tenantProfile, EdgeVersion edgeVersion) { - tenantProfile = JacksonUtil.clone(tenantProfile); - // clear all config - var tenantProfileData = tenantProfile.getProfileData(); - var configuration = tenantProfile.getDefaultProfileConfiguration(); - configuration.setRpcTtlDays(0); - configuration.setMaxJSExecutions(0); - configuration.setMaxREExecutions(0); - configuration.setMaxDPStorageDays(0); - configuration.setMaxTbelExecutions(0); - configuration.setQueueStatsTtlDays(0); - configuration.setMaxTransportMessages(0); - configuration.setDefaultStorageTtlDays(0); - configuration.setMaxTransportDataPoints(0); - configuration.setRuleEngineExceptionsTtlDays(0); - configuration.setMaxRuleNodeExecutionsPerMessage(0); - configuration.setMaxDebugModeDurationMinutes(0); - tenantProfileData.setConfiguration(configuration); - tenantProfile.setProfileData(tenantProfileData); - - ByteString profileData = EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_6_2) ? - ByteString.empty() : ByteString.copyFrom(tenantProfile.getProfileDataBytes()); - TenantProfileUpdateMsg.Builder builder = TenantProfileUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(tenantProfile.getId().getId().getMostSignificantBits()) - .setIdLSB(tenantProfile.getId().getId().getLeastSignificantBits()) - .setName(tenantProfile.getName()) - .setDefault(tenantProfile.isDefault()) - .setIsolatedRuleChain(tenantProfile.isIsolatedTbRuleEngine()) - .setProfileDataBytes(profileData); - if (tenantProfile.getDescription() != null) { - builder.setDescription(tenantProfile.getDescription()); - } - return builder.build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV2.java deleted file mode 100644 index ee0c6a0d72..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/tenant/TenantMsgConstructorV2.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.tenant; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Tenant; -import org.thingsboard.server.common.data.TenantProfile; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class TenantMsgConstructorV2 implements TenantMsgConstructor { - - @Override - public TenantUpdateMsg constructTenantUpdateMsg(UpdateMsgType msgType, Tenant tenant) { - return TenantUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(tenant)).build(); - } - - @Override - public TenantProfileUpdateMsg constructTenantProfileUpdateMsg(UpdateMsgType msgType, TenantProfile tenantProfile, EdgeVersion edgeVersion) { - return TenantProfileUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(tenantProfile)).build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/BaseUserMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/BaseUserMsgConstructor.java deleted file mode 100644 index ab2e2dec14..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/BaseUserMsgConstructor.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.user; - -import org.thingsboard.server.common.data.id.UserId; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; - -public abstract class BaseUserMsgConstructor implements UserMsgConstructor { - - @Override - public UserUpdateMsg constructUserDeleteMsg(UserId userId) { - return UserUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(userId.getId().getMostSignificantBits()) - .setIdLSB(userId.getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructor.java deleted file mode 100644 index f0fb9bd8a5..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructor.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.user; - -import org.thingsboard.server.common.data.User; -import org.thingsboard.server.common.data.id.UserId; -import org.thingsboard.server.common.data.security.UserCredentials; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -public interface UserMsgConstructor extends MsgConstructor { - - UserUpdateMsg constructUserUpdatedMsg(UpdateMsgType msgType, User user); - - UserUpdateMsg constructUserDeleteMsg(UserId userId); - - UserCredentialsUpdateMsg constructUserCredentialsUpdatedMsg(UserCredentials userCredentials); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorFactory.java deleted file mode 100644 index f2e42a1dcc..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.user; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class UserMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV1.java deleted file mode 100644 index 309de42b1e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV1.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.user; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.User; -import org.thingsboard.server.common.data.security.UserCredentials; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class UserMsgConstructorV1 extends BaseUserMsgConstructor { - - @Override - public UserUpdateMsg constructUserUpdatedMsg(UpdateMsgType msgType, User user) { - UserUpdateMsg.Builder builder = UserUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(user.getId().getId().getMostSignificantBits()) - .setIdLSB(user.getId().getId().getLeastSignificantBits()) - .setEmail(user.getEmail()) - .setAuthority(user.getAuthority().name()); - if (user.getCustomerId() != null) { - builder.setCustomerIdMSB(user.getCustomerId().getId().getMostSignificantBits()); - builder.setCustomerIdLSB(user.getCustomerId().getId().getLeastSignificantBits()); - } - if (user.getFirstName() != null) { - builder.setFirstName(user.getFirstName()); - } - if (user.getLastName() != null) { - builder.setLastName(user.getLastName()); - } - if (user.getAdditionalInfo() != null) { - builder.setAdditionalInfo(JacksonUtil.toString(user.getAdditionalInfo())); - } - return builder.build(); - } - - @Override - public UserCredentialsUpdateMsg constructUserCredentialsUpdatedMsg(UserCredentials userCredentials) { - return UserCredentialsUpdateMsg.newBuilder() - .setUserIdMSB(userCredentials.getUserId().getId().getMostSignificantBits()) - .setUserIdLSB(userCredentials.getUserId().getId().getLeastSignificantBits()) - .setEnabled(userCredentials.isEnabled()) - .setPassword(userCredentials.getPassword()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV2.java deleted file mode 100644 index e26e085a3b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/user/UserMsgConstructorV2.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.user; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.User; -import org.thingsboard.server.common.data.security.UserCredentials; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class UserMsgConstructorV2 extends BaseUserMsgConstructor { - - @Override - public UserUpdateMsg constructUserUpdatedMsg(UpdateMsgType msgType, User user) { - return UserUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(user)) - .setIdMSB(user.getId().getId().getMostSignificantBits()) - .setIdLSB(user.getId().getId().getLeastSignificantBits()).build(); - } - - @Override - public UserCredentialsUpdateMsg constructUserCredentialsUpdatedMsg(UserCredentials userCredentials) { - return UserCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(userCredentials)).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/BaseWidgetMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/BaseWidgetMsgConstructor.java deleted file mode 100644 index 5ccf0cf85f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/BaseWidgetMsgConstructor.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.widget; - -import org.thingsboard.server.common.data.id.WidgetTypeId; -import org.thingsboard.server.common.data.id.WidgetsBundleId; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; -import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; - -public abstract class BaseWidgetMsgConstructor implements WidgetMsgConstructor { - - @Override - public WidgetsBundleUpdateMsg constructWidgetsBundleDeleteMsg(WidgetsBundleId widgetsBundleId) { - return WidgetsBundleUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(widgetsBundleId.getId().getMostSignificantBits()) - .setIdLSB(widgetsBundleId.getId().getLeastSignificantBits()) - .build(); - } - - @Override - public WidgetTypeUpdateMsg constructWidgetTypeDeleteMsg(WidgetTypeId widgetTypeId) { - return WidgetTypeUpdateMsg.newBuilder() - .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) - .setIdMSB(widgetTypeId.getId().getMostSignificantBits()) - .setIdLSB(widgetTypeId.getId().getLeastSignificantBits()) - .build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructor.java deleted file mode 100644 index b5f78026bd..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructor.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.widget; - -import org.thingsboard.server.common.data.id.WidgetTypeId; -import org.thingsboard.server.common.data.id.WidgetsBundleId; -import org.thingsboard.server.common.data.widget.WidgetTypeDetails; -import org.thingsboard.server.common.data.widget.WidgetsBundle; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; -import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; -import org.thingsboard.server.service.edge.rpc.constructor.MsgConstructor; - -import java.util.List; - -public interface WidgetMsgConstructor extends MsgConstructor { - - WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List widgets); - - WidgetsBundleUpdateMsg constructWidgetsBundleDeleteMsg(WidgetsBundleId widgetsBundleId); - - WidgetTypeUpdateMsg constructWidgetTypeUpdateMsg(UpdateMsgType msgType, WidgetTypeDetails widgetTypeDetails, EdgeVersion edgeVersion); - - WidgetTypeUpdateMsg constructWidgetTypeDeleteMsg(WidgetTypeId widgetTypeId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorFactory.java deleted file mode 100644 index 421523c3d8..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.widget; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.BaseMsgConstructorFactory; - -@Component -@TbCoreComponent -public class WidgetMsgConstructorFactory extends BaseMsgConstructorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV1.java deleted file mode 100644 index 0201f6276b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV1.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.widget; - -import com.google.protobuf.ByteString; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.widget.WidgetTypeDetails; -import org.thingsboard.server.common.data.widget.WidgetsBundle; -import org.thingsboard.server.dao.resource.ImageService; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; -import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; - -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.List; - -@Component -@TbCoreComponent -public class WidgetMsgConstructorV1 extends BaseWidgetMsgConstructor { - - @Autowired - private ImageService imageService; - - @Override - public WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List widgets) { - widgetsBundle = JacksonUtil.clone(widgetsBundle); - imageService.inlineImageForEdge(widgetsBundle); - WidgetsBundleUpdateMsg.Builder builder = WidgetsBundleUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(widgetsBundle.getId().getId().getMostSignificantBits()) - .setIdLSB(widgetsBundle.getId().getId().getLeastSignificantBits()) - .setTitle(widgetsBundle.getTitle()) - .setAlias(widgetsBundle.getAlias()); - if (widgetsBundle.getImage() != null) { - builder.setImage(ByteString.copyFrom(widgetsBundle.getImage().getBytes(StandardCharsets.UTF_8))); - } - if (widgetsBundle.getDescription() != null) { - builder.setDescription(widgetsBundle.getDescription()); - } - if (widgetsBundle.getOrder() != null) { - builder.setOrder(widgetsBundle.getOrder()); - } - if (widgetsBundle.getTenantId().equals(TenantId.SYS_TENANT_ID)) { - builder.setIsSystem(true); - } - builder.setWidgets(JacksonUtil.toString(widgets)); - return builder.build(); - } - - @Override - public WidgetTypeUpdateMsg constructWidgetTypeUpdateMsg(UpdateMsgType msgType, WidgetTypeDetails widgetTypeDetails, EdgeVersion edgeVersion) { - widgetTypeDetails = JacksonUtil.clone(widgetTypeDetails); - imageService.inlineImagesForEdge(widgetTypeDetails); - WidgetTypeUpdateMsg.Builder builder = WidgetTypeUpdateMsg.newBuilder() - .setMsgType(msgType) - .setIdMSB(widgetTypeDetails.getId().getId().getMostSignificantBits()) - .setIdLSB(widgetTypeDetails.getId().getId().getLeastSignificantBits()); - if (widgetTypeDetails.getFqn() != null) { - builder.setFqn(widgetTypeDetails.getFqn()); - if (widgetTypeDetails.getFqn().contains(".")) { - String[] aliases = widgetTypeDetails.getFqn().split("\\.", 2); - if (aliases.length == 2) { - builder.setBundleAlias(aliases[0]); - builder.setAlias(aliases[1]); - } - } - } - if (widgetTypeDetails.getName() != null) { - builder.setName(widgetTypeDetails.getName()); - } - if (widgetTypeDetails.getDescriptor() != null) { - builder.setDescriptorJson(JacksonUtil.toString(widgetTypeDetails.getDescriptor())); - } - if (widgetTypeDetails.getTenantId().equals(TenantId.SYS_TENANT_ID)) { - builder.setIsSystem(true); - } - if (widgetTypeDetails.getImage() != null) { - builder.setImage(widgetTypeDetails.getImage()); - } - if (widgetTypeDetails.getDescription() != null) { - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_6_0) && - widgetTypeDetails.getDescription().length() > 255) { - builder.setDescription(widgetTypeDetails.getDescription().substring(0, 254)); - } else { - builder.setDescription(widgetTypeDetails.getDescription()); - } - } - builder.setDeprecated(widgetTypeDetails.isDeprecated()); - if (widgetTypeDetails.getTags() != null) { - builder.addAllTags(Arrays.asList(widgetTypeDetails.getTags())); - } - return builder.build(); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV2.java deleted file mode 100644 index 1b1d7e246e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/widget/WidgetMsgConstructorV2.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.constructor.widget; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.widget.WidgetTypeDetails; -import org.thingsboard.server.common.data.widget.WidgetsBundle; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; -import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.List; - -@Component -@TbCoreComponent -public class WidgetMsgConstructorV2 extends BaseWidgetMsgConstructor { - - @Override - public WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List widgets) { - return WidgetsBundleUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(widgetsBundle)) - .setWidgets(JacksonUtil.toString(widgets)) - .setIdMSB(widgetsBundle.getId().getId().getMostSignificantBits()) - .setIdLSB(widgetsBundle.getId().getId().getLeastSignificantBits()).build(); - } - - @Override - public WidgetTypeUpdateMsg constructWidgetTypeUpdateMsg(UpdateMsgType msgType, WidgetTypeDetails widgetTypeDetails, EdgeVersion edgeVersion) { - return WidgetTypeUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(widgetTypeDetails)) - .setIdMSB(widgetTypeDetails.getId().getId().getMostSignificantBits()) - .setIdLSB(widgetTypeDetails.getId().getId().getLeastSignificantBits()).build(); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java index e448fbd937..c8647fb40a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java @@ -70,7 +70,7 @@ import java.util.concurrent.locks.ReentrantLock; import static org.thingsboard.server.dao.edge.BaseRelatedEdgesService.RELATED_EDGES_CACHE_ITEMS; @Slf4j -public abstract class BaseEdgeProcessor { +public abstract class BaseEdgeProcessor implements EdgeProcessor { protected static final Lock deviceCreationLock = new ReentrantLock(); protected static final Lock assetCreationLock = new ReentrantLock(); @@ -187,6 +187,7 @@ public abstract class BaseEdgeProcessor { }; } + @Override public ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { EdgeEventType type = EdgeEventType.valueOf(edgeNotificationMsg.getType()); EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessorFactory.java deleted file mode 100644 index a8ca885c7b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessorFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public abstract class BaseEdgeProcessorFactory { - - @Autowired - protected T v1Processor; - - @Autowired - protected U v2Processor; - - public EdgeProcessor getProcessorByEdgeVersion(EdgeVersion edgeVersion) { - return switch (edgeVersion) { - case V_3_3_0, V_3_3_3, V_3_4_0, V_3_6_0, V_3_6_1 -> v1Processor; - default -> v2Processor; - }; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java index dc2ea115ee..b4d4550966 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java @@ -15,5 +15,18 @@ */ package org.thingsboard.server.service.edge.rpc.processor; +import com.google.common.util.concurrent.ListenableFuture; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.transport.TransportProtos; + public interface EdgeProcessor { + + ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto msg); + + default DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + return null; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java index f0a8012660..6cfe5a6819 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java @@ -15,44 +15,35 @@ */ package org.thingsboard.server.service.edge.rpc.processor.alarm; -import com.fasterxml.jackson.databind.JsonNode; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.alarm.Alarm; -import org.thingsboard.server.common.data.alarm.AlarmComment; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.AlarmId; import org.thingsboard.server.common.data.id.EdgeId; -import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.page.PageDataIterableByTenantIdEntityId; import org.thingsboard.server.dao.entity.EntityService; -import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; -import org.thingsboard.server.service.edge.rpc.constructor.alarm.AlarmMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.alarm.AlarmMsgConstructorFactory; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; -import java.util.ArrayList; import java.util.List; import java.util.UUID; -import static org.thingsboard.server.dao.edge.BaseRelatedEdgesService.RELATED_EDGES_CACHE_ITEMS; - @Slf4j -public abstract class AlarmEdgeProcessor extends BaseAlarmProcessor implements AlarmProcessor { - - @Autowired - private AlarmMsgConstructorFactory alarmMsgConstructorFactory; +@Component +@TbCoreComponent +public class AlarmEdgeProcessor extends BaseAlarmProcessor implements AlarmProcessor { @Autowired private EntityService entityService; @@ -69,9 +60,8 @@ public abstract class AlarmEdgeProcessor extends BaseAlarmProcessor implements A } @Override - public DownlinkMsg convertAlarmEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { - AlarmUpdateMsg alarmUpdateMsg = convertAlarmEventToAlarmMsg(edgeEvent.getTenantId(), edgeEvent.getEntityId(), - edgeEvent.getAction(), edgeEvent.getBody(), edgeVersion); + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + AlarmUpdateMsg alarmUpdateMsg = convertAlarmEventToAlarmMsg(edgeEvent); if (alarmUpdateMsg != null) { return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) @@ -82,37 +72,7 @@ public abstract class AlarmEdgeProcessor extends BaseAlarmProcessor implements A } @Override - public ListenableFuture processAlarmCommentMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmCommentUpdateMsg alarmCommentUpdateMsg) { - log.trace("[{}] processAlarmCommentMsgFromEdge [{}]", tenantId, alarmCommentUpdateMsg); - try { - edgeSynchronizationManager.getEdgeId().set(edgeId); - return processAlarmCommentMsg(tenantId, alarmCommentUpdateMsg); - } finally { - edgeSynchronizationManager.getEdgeId().remove(); - } - } - - @Override - public DownlinkMsg convertAlarmCommentEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - var msgConstructor = (AlarmMsgConstructor) alarmMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); - switch (edgeEvent.getAction()) { - case ADDED_COMMENT: - case UPDATED_COMMENT: - case DELETED_COMMENT: - AlarmComment alarmComment = JacksonUtil.convertValue(edgeEvent.getBody(), AlarmComment.class); - if (alarmComment != null) { - return DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addAlarmCommentUpdateMsg(msgConstructor.constructAlarmCommentUpdatedMsg(msgType, alarmComment)) - .build(); - } - default: - return null; - } - } - - public ListenableFuture processAlarmNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { + public ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); AlarmId alarmId = new AlarmId(new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB())); EdgeId originatorEdgeId = safeGetEdgeId(edgeNotificationMsg.getOriginatorEdgeIdMSB(), edgeNotificationMsg.getOriginatorEdgeIdLSB()); @@ -140,51 +100,20 @@ public abstract class AlarmEdgeProcessor extends BaseAlarmProcessor implements A }, dbCallbackExecutorService); } - public ListenableFuture processAlarmCommentNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { - EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); - AlarmId alarmId = new AlarmId(new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB())); - EdgeId originatorEdgeId = safeGetEdgeId(edgeNotificationMsg.getOriginatorEdgeIdMSB(), edgeNotificationMsg.getOriginatorEdgeIdLSB()); - AlarmComment alarmComment = JacksonUtil.fromString(edgeNotificationMsg.getBody(), AlarmComment.class); - if (alarmComment == null) { - return Futures.immediateFuture(null); - } - Alarm alarmById = edgeCtx.getAlarmService().findAlarmById(tenantId, new AlarmId(alarmComment.getAlarmId().getId())); - List> delFutures = pushEventToAllRelatedEdges(tenantId, alarmById.getOriginator(), - alarmId, actionType, JacksonUtil.valueToTree(alarmComment), originatorEdgeId, EdgeEventType.ALARM_COMMENT); - return Futures.transform(Futures.allAsList(delFutures), voids -> null, dbCallbackExecutorService); - } - - private List> pushEventToAllRelatedEdges(TenantId tenantId, EntityId originatorId, AlarmId alarmId, - EdgeEventActionType actionType, JsonNode body, EdgeId sourceEdgeId, - EdgeEventType edgeEventType) { - List> futures = new ArrayList<>(); - PageDataIterableByTenantIdEntityId edgeIds = - new PageDataIterableByTenantIdEntityId<>(edgeCtx.getEdgeService()::findRelatedEdgeIdsByEntityId, tenantId, originatorId, RELATED_EDGES_CACHE_ITEMS); - for (EdgeId relatedEdgeId : edgeIds) { - if (!relatedEdgeId.equals(sourceEdgeId)) { - futures.add(saveEdgeEvent(tenantId, relatedEdgeId, edgeEventType, actionType, alarmId, body)); - } - } - return futures; - } - - private AlarmUpdateMsg convertAlarmEventToAlarmMsg(TenantId tenantId, UUID entityId, EdgeEventActionType actionType, JsonNode body, EdgeVersion edgeVersion) { - AlarmId alarmId = new AlarmId(entityId); - UpdateMsgType msgType = getUpdateMsgType(actionType); - var msgConstructor = (AlarmMsgConstructor) alarmMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); - switch (actionType) { + private AlarmUpdateMsg convertAlarmEventToAlarmMsg(EdgeEvent edgeEvent) { + AlarmId alarmId = new AlarmId(edgeEvent.getEntityId()); + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + switch (edgeEvent.getAction()) { case ADDED, UPDATED, ALARM_ACK, ALARM_CLEAR -> { - Alarm alarm = edgeCtx.getAlarmService().findAlarmById(tenantId, alarmId); + Alarm alarm = edgeCtx.getAlarmService().findAlarmById(edgeEvent.getTenantId(), alarmId); if (alarm != null) { - return msgConstructor.constructAlarmUpdatedMsg(msgType, alarm, - entityService.fetchEntityName(tenantId, alarm.getOriginator()).orElse(null)); + return EdgeMsgConstructorUtils.constructAlarmUpdatedMsg(msgType, alarm); } } case ALARM_DELETE, DELETED -> { - Alarm deletedAlarm = JacksonUtil.convertValue(body, Alarm.class); + Alarm deletedAlarm = JacksonUtil.convertValue(edgeEvent.getBody(), Alarm.class); if (deletedAlarm != null) { - return msgConstructor.constructAlarmUpdatedMsg(msgType, deletedAlarm, - entityService.fetchEntityName(tenantId, deletedAlarm.getOriginator()).orElse(null)); + return EdgeMsgConstructorUtils.constructAlarmUpdatedMsg(msgType, deletedAlarm); } } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorFactory.java deleted file mode 100644 index 6d98c01760..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.alarm; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class AlarmEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV1.java deleted file mode 100644 index 18e65e6bac..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV1.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.alarm; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityType; -import org.thingsboard.server.common.data.alarm.Alarm; -import org.thingsboard.server.common.data.alarm.AlarmSeverity; -import org.thingsboard.server.common.data.alarm.AlarmStatus; -import org.thingsboard.server.common.data.id.AlarmId; -import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class AlarmEdgeProcessorV1 extends AlarmEdgeProcessor { - - @Override - protected Alarm constructAlarmFromUpdateMsg(TenantId tenantId, AlarmId alarmId, EntityId originatorId, AlarmUpdateMsg alarmUpdateMsg) { - Alarm alarm = new Alarm(); - alarm.setId(alarmId); - alarm.setTenantId(tenantId); - alarm.setOriginator(originatorId); - alarm.setType(alarmUpdateMsg.getName()); - alarm.setSeverity(AlarmSeverity.valueOf(alarmUpdateMsg.getSeverity())); - alarm.setStartTs(alarmUpdateMsg.getStartTs()); - AlarmStatus alarmStatus = AlarmStatus.valueOf(alarmUpdateMsg.getStatus()); - alarm.setClearTs(alarmUpdateMsg.getClearTs()); - alarm.setPropagate(alarmUpdateMsg.getPropagate()); - alarm.setCleared(alarmStatus.isCleared()); - alarm.setAcknowledged(alarmStatus.isAck()); - alarm.setAckTs(alarmUpdateMsg.getAckTs()); - alarm.setEndTs(alarmUpdateMsg.getEndTs()); - alarm.setDetails(JacksonUtil.toJsonNode(alarmUpdateMsg.getDetails())); - return alarm; - } - - @Override - protected EntityId getAlarmOriginatorFromMsg(TenantId tenantId, AlarmUpdateMsg alarmUpdateMsg) { - return getAlarmOriginator(tenantId, alarmUpdateMsg.getOriginatorName(), - EntityType.valueOf(alarmUpdateMsg.getOriginatorType())); - } - - private EntityId getAlarmOriginator(TenantId tenantId, String entityName, EntityType entityType) { - return switch (entityType) { - case DEVICE -> edgeCtx.getDeviceService().findDeviceByTenantIdAndName(tenantId, entityName).getId(); - case ASSET -> edgeCtx.getAssetService().findAssetByTenantIdAndName(tenantId, entityName).getId(); - case ENTITY_VIEW -> edgeCtx.getEntityViewService().findEntityViewByTenantIdAndName(tenantId, entityName).getId(); - default -> null; - }; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV2.java deleted file mode 100644 index dd49af252d..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessorV2.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.alarm; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.alarm.Alarm; -import org.thingsboard.server.common.data.id.AlarmId; -import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class AlarmEdgeProcessorV2 extends AlarmEdgeProcessor { - - @Override - protected EntityId getAlarmOriginatorFromMsg(TenantId tenantId, AlarmUpdateMsg alarmUpdateMsg) { - Alarm alarm = JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); - return alarm != null ? alarm.getOriginator() : null; - } - - @Override - protected Alarm constructAlarmFromUpdateMsg(TenantId tenantId, AlarmId alarmId, EntityId originatorId, AlarmUpdateMsg alarmUpdateMsg) { - return JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmProcessor.java index d4f820b6c3..8d31c07960 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmProcessor.java @@ -16,23 +16,13 @@ package org.thingsboard.server.service.edge.rpc.processor.alarm; import com.google.common.util.concurrent.ListenableFuture; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; public interface AlarmProcessor extends EdgeProcessor { ListenableFuture processAlarmMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmUpdateMsg alarmUpdateMsg); - DownlinkMsg convertAlarmEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - - ListenableFuture processAlarmCommentMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmCommentUpdateMsg alarmCommentUpdateMsg); - - DownlinkMsg convertAlarmCommentEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java index 195b569ab4..d806049888 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java @@ -15,6 +15,7 @@ */ package org.thingsboard.server.service.edge.rpc.processor.alarm; +import com.fasterxml.jackson.databind.JsonNode; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; @@ -24,16 +25,24 @@ import org.thingsboard.server.common.data.alarm.Alarm; import org.thingsboard.server.common.data.alarm.AlarmComment; import org.thingsboard.server.common.data.alarm.AlarmCreateOrUpdateActiveRequest; import org.thingsboard.server.common.data.alarm.AlarmUpdateRequest; +import org.thingsboard.server.common.data.edge.EdgeEventActionType; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.AlarmId; +import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageDataIterableByTenantIdEntityId; import org.thingsboard.server.dao.alarm.AlarmCommentDao; import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; +import static org.thingsboard.server.dao.edge.BaseRelatedEdgesService.RELATED_EDGES_CACHE_ITEMS; + @Slf4j public abstract class BaseAlarmProcessor extends BaseEdgeProcessor { @@ -43,8 +52,7 @@ public abstract class BaseAlarmProcessor extends BaseEdgeProcessor { public ListenableFuture processAlarmMsg(TenantId tenantId, AlarmUpdateMsg alarmUpdateMsg) { log.trace("[{}] processAlarmMsg [{}]", tenantId, alarmUpdateMsg); AlarmId alarmId = new AlarmId(new UUID(alarmUpdateMsg.getIdMSB(), alarmUpdateMsg.getIdLSB())); - EntityId originatorId = getAlarmOriginatorFromMsg(tenantId, alarmUpdateMsg); - Alarm alarm = constructAlarmFromUpdateMsg(tenantId, alarmId, originatorId, alarmUpdateMsg); + Alarm alarm = JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); if (alarm == null) { throw new RuntimeException("[{" + tenantId + "}] alarmUpdateMsg {" + alarmUpdateMsg + "} cannot be converted to alarm"); } @@ -124,9 +132,18 @@ public abstract class BaseAlarmProcessor extends BaseEdgeProcessor { return Futures.immediateFuture(null); } - - protected abstract EntityId getAlarmOriginatorFromMsg(TenantId tenantId, AlarmUpdateMsg alarmUpdateMsg); - - protected abstract Alarm constructAlarmFromUpdateMsg(TenantId tenantId, AlarmId alarmId, EntityId originatorId, AlarmUpdateMsg alarmUpdateMsg); + protected List> pushEventToAllRelatedEdges(TenantId tenantId, EntityId originatorId, AlarmId alarmId, + EdgeEventActionType actionType, JsonNode body, EdgeId sourceEdgeId, + EdgeEventType edgeEventType) { + List> futures = new ArrayList<>(); + PageDataIterableByTenantIdEntityId edgeIds = + new PageDataIterableByTenantIdEntityId<>(edgeCtx.getEdgeService()::findRelatedEdgeIdsByEntityId, tenantId, originatorId, RELATED_EDGES_CACHE_ITEMS); + for (EdgeId relatedEdgeId : edgeIds) { + if (!relatedEdgeId.equals(sourceEdgeId)) { + futures.add(saveEdgeEvent(tenantId, relatedEdgeId, edgeEventType, actionType, alarmId, body)); + } + } + return futures; + } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java new file mode 100644 index 0000000000..ef13144ba8 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java @@ -0,0 +1,93 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge.rpc.processor.alarm.comment; + +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.alarm.Alarm; +import org.thingsboard.server.common.data.alarm.AlarmComment; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventActionType; +import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.id.AlarmId; +import org.thingsboard.server.common.data.id.EdgeId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.gen.transport.TransportProtos; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.rpc.processor.alarm.BaseAlarmProcessor; + +import java.util.List; +import java.util.UUID; + +@Slf4j +@Component +@TbCoreComponent +public class AlarmCommentEdgeProcessor extends BaseAlarmProcessor implements AlarmCommentProcessor { + + @Override + public ListenableFuture processAlarmCommentMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmCommentUpdateMsg alarmCommentUpdateMsg) { + log.trace("[{}] processAlarmCommentMsgFromEdge [{}]", tenantId, alarmCommentUpdateMsg); + try { + edgeSynchronizationManager.getEdgeId().set(edgeId); + return processAlarmCommentMsg(tenantId, alarmCommentUpdateMsg); + } finally { + edgeSynchronizationManager.getEdgeId().remove(); + } + } + + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + switch (edgeEvent.getAction()) { + case ADDED_COMMENT: + case UPDATED_COMMENT: + case DELETED_COMMENT: + AlarmComment alarmComment = JacksonUtil.convertValue(edgeEvent.getBody(), AlarmComment.class); + if (alarmComment != null) { + return DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addAlarmCommentUpdateMsg(EdgeMsgConstructorUtils.constructAlarmCommentUpdatedMsg(msgType, alarmComment)) + .build(); + } + default: + return null; + } + } + + @Override + public ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { + EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); + AlarmId alarmId = new AlarmId(new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB())); + EdgeId originatorEdgeId = safeGetEdgeId(edgeNotificationMsg.getOriginatorEdgeIdMSB(), edgeNotificationMsg.getOriginatorEdgeIdLSB()); + AlarmComment alarmComment = JacksonUtil.fromString(edgeNotificationMsg.getBody(), AlarmComment.class); + if (alarmComment == null) { + return Futures.immediateFuture(null); + } + Alarm alarmById = edgeCtx.getAlarmService().findAlarmById(tenantId, new AlarmId(alarmComment.getAlarmId().getId())); + List> delFutures = pushEventToAllRelatedEdges(tenantId, alarmById.getOriginator(), + alarmId, actionType, JacksonUtil.valueToTree(alarmComment), originatorEdgeId, EdgeEventType.ALARM_COMMENT); + return Futures.transform(Futures.allAsList(delFutures), voids -> null, dbCallbackExecutorService); + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/BaseAlarmMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentProcessor.java similarity index 54% rename from application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/BaseAlarmMsgConstructor.java rename to application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentProcessor.java index c9af86e8cc..5be3c0b806 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/alarm/BaseAlarmMsgConstructor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentProcessor.java @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.server.service.edge.rpc.constructor.alarm; +package org.thingsboard.server.service.edge.rpc.processor.alarm.comment; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.alarm.AlarmComment; +import com.google.common.util.concurrent.ListenableFuture; +import org.thingsboard.server.common.data.id.EdgeId; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; -public abstract class BaseAlarmMsgConstructor implements AlarmMsgConstructor { +public interface AlarmCommentProcessor extends EdgeProcessor { + + ListenableFuture processAlarmCommentMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmCommentUpdateMsg alarmCommentUpdateMsg); - @Override - public AlarmCommentUpdateMsg constructAlarmCommentUpdatedMsg(UpdateMsgType msgType, AlarmComment alarmComment) { - return AlarmCommentUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(alarmComment)).build(); - } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java index 56a4864763..81145a6195 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java @@ -19,6 +19,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; import org.springframework.data.util.Pair; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.asset.Asset; @@ -28,20 +29,23 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.AssetId; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.asset.AssetMsgConstructor; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; @Slf4j -public abstract class AssetEdgeProcessor extends BaseAssetProcessor implements AssetProcessor { +@Component +@TbCoreComponent +public class AssetEdgeProcessor extends BaseAssetProcessor implements AssetProcessor { @Override public ListenableFuture processAssetMsgFromEdge(TenantId tenantId, Edge edge, AssetUpdateMsg assetUpdateMsg) { @@ -103,21 +107,20 @@ public abstract class AssetEdgeProcessor extends BaseAssetProcessor implements A } @Override - public DownlinkMsg convertAssetEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { AssetId assetId = new AssetId(edgeEvent.getEntityId()); - var msgConstructor = (AssetMsgConstructor) edgeCtx.getAssetMsgConstructorFactory().getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE, ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { Asset asset = edgeCtx.getAssetService().findAssetById(edgeEvent.getTenantId(), assetId); if (asset != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - AssetUpdateMsg assetUpdateMsg = msgConstructor.constructAssetUpdatedMsg(msgType, asset); + AssetUpdateMsg assetUpdateMsg = EdgeMsgConstructorUtils.constructAssetUpdatedMsg(msgType, asset); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addAssetUpdateMsg(assetUpdateMsg); if (UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE.equals(msgType)) { AssetProfile assetProfile = edgeCtx.getAssetProfileService().findAssetProfileById(edgeEvent.getTenantId(), asset.getAssetProfileId()); - builder.addAssetProfileUpdateMsg(msgConstructor.constructAssetProfileUpdatedMsg(msgType, assetProfile)); + builder.addAssetProfileUpdateMsg(EdgeMsgConstructorUtils.constructAssetProfileUpdatedMsg(msgType, assetProfile)); } return builder.build(); } @@ -125,11 +128,17 @@ public abstract class AssetEdgeProcessor extends BaseAssetProcessor implements A case DELETED, UNASSIGNED_FROM_EDGE -> { return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addAssetUpdateMsg(msgConstructor.constructAssetDeleteMsg(assetId)) + .addAssetUpdateMsg(EdgeMsgConstructorUtils.constructAssetDeleteMsg(assetId)) .build(); } } return null; } + @Override + protected void setCustomerId(TenantId tenantId, CustomerId customerId, Asset asset, AssetUpdateMsg assetUpdateMsg) { + CustomerId customerUUID = asset.getCustomerId() != null ? asset.getCustomerId() : customerId; + asset.setCustomerId(customerUUID); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorFactory.java deleted file mode 100644 index 150d21d1d0..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.asset; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class AssetEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV1.java deleted file mode 100644 index 8cd2de1cab..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV1.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.asset; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.asset.Asset; -import org.thingsboard.server.common.data.id.AssetId; -import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.UUID; - -@Component -@TbCoreComponent -public class AssetEdgeProcessorV1 extends AssetEdgeProcessor { - - @Override - protected Asset constructAssetFromUpdateMsg(TenantId tenantId, AssetId assetId, AssetUpdateMsg assetUpdateMsg) { - Asset asset = new Asset(); - asset.setTenantId(tenantId); - asset.setName(assetUpdateMsg.getName()); - asset.setCreatedTime(Uuids.unixTimestamp(assetId.getId())); - asset.setType(assetUpdateMsg.getType()); - asset.setLabel(assetUpdateMsg.hasLabel() ? assetUpdateMsg.getLabel() : null); - asset.setAdditionalInfo(assetUpdateMsg.hasAdditionalInfo() - ? JacksonUtil.toJsonNode(assetUpdateMsg.getAdditionalInfo()) : null); - - UUID assetProfileUUID = safeGetUUID(assetUpdateMsg.getAssetProfileIdMSB(), assetUpdateMsg.getAssetProfileIdLSB()); - asset.setAssetProfileId(assetProfileUUID != null ? new AssetProfileId(assetProfileUUID) : null); - - CustomerId customerId = safeGetCustomerId(assetUpdateMsg.getCustomerIdMSB(), assetUpdateMsg.getCustomerIdLSB()); - asset.setCustomerId(customerId); - return asset; - } - - @Override - protected void setCustomerId(TenantId tenantId, CustomerId customerId, Asset asset, AssetUpdateMsg assetUpdateMsg) { - CustomerId customerUUID = safeGetCustomerId(assetUpdateMsg.getCustomerIdMSB(), assetUpdateMsg.getCustomerIdLSB()); - asset.setCustomerId(customerUUID != null ? customerUUID : customerId); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV2.java deleted file mode 100644 index 021507f5d7..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessorV2.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.asset; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.asset.Asset; -import org.thingsboard.server.common.data.id.AssetId; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class AssetEdgeProcessorV2 extends AssetEdgeProcessor { - - @Override - protected Asset constructAssetFromUpdateMsg(TenantId tenantId, AssetId assetId, AssetUpdateMsg assetUpdateMsg) { - return JacksonUtil.fromString(assetUpdateMsg.getEntity(), Asset.class, true); - } - - @Override - protected void setCustomerId(TenantId tenantId, CustomerId customerId, Asset asset, AssetUpdateMsg assetUpdateMsg) { - CustomerId customerUUID = asset.getCustomerId() != null ? asset.getCustomerId() : customerId; - asset.setCustomerId(customerUUID); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetProcessor.java index f6b015701c..0ae21df039 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetProcessor.java @@ -17,17 +17,12 @@ package org.thingsboard.server.service.edge.rpc.processor.asset; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; public interface AssetProcessor extends EdgeProcessor { ListenableFuture processAssetMsgFromEdge(TenantId tenantId, Edge edge, AssetUpdateMsg assetUpdateMsg); - DownlinkMsg convertAssetEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java index 9ebcd74888..7618a2287c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.asset; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.asset.Asset; import org.thingsboard.server.common.data.id.AssetId; @@ -38,7 +39,7 @@ public abstract class BaseAssetProcessor extends BaseEdgeProcessor { boolean assetNameUpdated = false; assetCreationLock.lock(); try { - Asset asset = constructAssetFromUpdateMsg(tenantId, assetId, assetUpdateMsg); + Asset asset = JacksonUtil.fromString(assetUpdateMsg.getEntity(), Asset.class, true); if (asset == null) { throw new RuntimeException("[{" + tenantId + "}] assetUpdateMsg {" + assetUpdateMsg + " } cannot be converted to asset"); } @@ -74,8 +75,6 @@ public abstract class BaseAssetProcessor extends BaseEdgeProcessor { return Pair.of(created, assetNameUpdated); } - protected abstract Asset constructAssetFromUpdateMsg(TenantId tenantId, AssetId assetId, AssetUpdateMsg assetUpdateMsg); - protected abstract void setCustomerId(TenantId tenantId, CustomerId customerId, Asset asset, AssetUpdateMsg assetUpdateMsg); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java index 1998def9fd..df3d74ceaa 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java @@ -19,6 +19,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; import org.springframework.data.util.Pair; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.asset.AssetProfile; @@ -27,21 +28,24 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.common.data.id.EdgeId; +import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.asset.AssetMsgConstructor; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; @Slf4j -public abstract class AssetProfileEdgeProcessor extends BaseAssetProfileProcessor implements AssetProfileProcessor { +@Component +@TbCoreComponent +public class AssetProfileEdgeProcessor extends BaseAssetProfileProcessor implements AssetProfileProcessor { @Override public ListenableFuture processAssetProfileMsgFromEdge(TenantId tenantId, Edge edge, AssetProfileUpdateMsg assetProfileUpdateMsg) { @@ -90,15 +94,14 @@ public abstract class AssetProfileEdgeProcessor extends BaseAssetProfileProcesso } @Override - public DownlinkMsg convertAssetProfileEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { AssetProfileId assetProfileId = new AssetProfileId(edgeEvent.getEntityId()); - var msgConstructor = (AssetMsgConstructor) edgeCtx.getAssetMsgConstructorFactory().getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { AssetProfile assetProfile = edgeCtx.getAssetProfileService().findAssetProfileById(edgeEvent.getTenantId(), assetProfileId); if (assetProfile != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - AssetProfileUpdateMsg assetProfileUpdateMsg = msgConstructor.constructAssetProfileUpdatedMsg(msgType, assetProfile); + AssetProfileUpdateMsg assetProfileUpdateMsg = EdgeMsgConstructorUtils.constructAssetProfileUpdatedMsg(msgType, assetProfile); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addAssetProfileUpdateMsg(assetProfileUpdateMsg) @@ -106,7 +109,7 @@ public abstract class AssetProfileEdgeProcessor extends BaseAssetProfileProcesso } } case DELETED -> { - AssetProfileUpdateMsg assetProfileUpdateMsg = msgConstructor.constructAssetProfileDeleteMsg(assetProfileId); + AssetProfileUpdateMsg assetProfileUpdateMsg = EdgeMsgConstructorUtils.constructAssetProfileDeleteMsg(assetProfileId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addAssetProfileUpdateMsg(assetProfileUpdateMsg) @@ -116,4 +119,21 @@ public abstract class AssetProfileEdgeProcessor extends BaseAssetProfileProcesso return null; } + @Override + protected void setDefaultRuleChainId(TenantId tenantId, AssetProfile assetProfile, RuleChainId ruleChainId) { + assetProfile.setDefaultRuleChainId(ruleChainId); + } + + @Override + protected void setDefaultEdgeRuleChainId(AssetProfile assetProfile, RuleChainId ruleChainId, AssetProfileUpdateMsg assetProfileUpdateMsg) { + UUID defaultEdgeRuleChainUUID = ruleChainId != null ? ruleChainId.getId() : null; + assetProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null); + } + + @Override + protected void setDefaultDashboardId(TenantId tenantId, DashboardId dashboardId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) { + UUID defaultDashboardUUID = assetProfile.getDefaultDashboardId() != null ? assetProfile.getDefaultDashboardId().getId() : (dashboardId != null ? dashboardId.getId() : null); + assetProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorFactory.java deleted file mode 100644 index 8d31a9d39c..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.asset.profile; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class AssetProfileEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV1.java deleted file mode 100644 index 510b5d834e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV1.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.asset.profile; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.data.asset.AssetProfile; -import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -@Component -@TbCoreComponent -public class AssetProfileEdgeProcessorV1 extends AssetProfileEdgeProcessor { - - @Override - protected AssetProfile constructAssetProfileFromUpdateMsg(TenantId tenantId, AssetProfileId assetProfileId, AssetProfileUpdateMsg assetProfileUpdateMsg) { - AssetProfile assetProfile = new AssetProfile(); - assetProfile.setTenantId(tenantId); - assetProfile.setName(assetProfileUpdateMsg.getName()); - assetProfile.setCreatedTime(Uuids.unixTimestamp(assetProfileId.getId())); - assetProfile.setDefault(assetProfileUpdateMsg.getDefault()); - assetProfile.setDefaultQueueName(assetProfileUpdateMsg.hasDefaultQueueName() ? assetProfileUpdateMsg.getDefaultQueueName() : null); - assetProfile.setDescription(assetProfileUpdateMsg.hasDescription() ? assetProfileUpdateMsg.getDescription() : null); - assetProfile.setImage(assetProfileUpdateMsg.hasImage() - ? new String(assetProfileUpdateMsg.getImage().toByteArray(), StandardCharsets.UTF_8) : null); - return assetProfile; - } - - @Override - protected void setDefaultRuleChainId(TenantId tenantId, AssetProfile assetProfile, RuleChainId ruleChainId) { - assetProfile.setDefaultRuleChainId(ruleChainId); - } - - @Override - protected void setDefaultEdgeRuleChainId(AssetProfile assetProfile, RuleChainId ruleChainId, AssetProfileUpdateMsg assetProfileUpdateMsg) { - UUID defaultEdgeRuleChainUUID = safeGetUUID(assetProfileUpdateMsg.getDefaultRuleChainIdMSB(), assetProfileUpdateMsg.getDefaultRuleChainIdLSB()); - assetProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : ruleChainId); - } - - @Override - protected void setDefaultDashboardId(TenantId tenantId, DashboardId dashboardId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) { - UUID defaultDashboardUUID = safeGetUUID(assetProfileUpdateMsg.getDefaultDashboardIdMSB(), assetProfileUpdateMsg.getDefaultDashboardIdLSB()); - assetProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : dashboardId); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV2.java deleted file mode 100644 index 9983026213..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessorV2.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.asset.profile; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.asset.AssetProfile; -import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.UUID; - -@Primary -@Component -@TbCoreComponent -public class AssetProfileEdgeProcessorV2 extends AssetProfileEdgeProcessor { - - @Override - protected AssetProfile constructAssetProfileFromUpdateMsg(TenantId tenantId, AssetProfileId assetProfileId, AssetProfileUpdateMsg assetProfileUpdateMsg) { - return JacksonUtil.fromString(assetProfileUpdateMsg.getEntity(), AssetProfile.class, true); - } - - @Override - protected void setDefaultRuleChainId(TenantId tenantId, AssetProfile assetProfile, RuleChainId ruleChainId) { - assetProfile.setDefaultRuleChainId(ruleChainId); - } - - @Override - protected void setDefaultEdgeRuleChainId(AssetProfile assetProfile, RuleChainId ruleChainId, AssetProfileUpdateMsg assetProfileUpdateMsg) { - UUID defaultEdgeRuleChainUUID = ruleChainId != null ? ruleChainId.getId() : null; - assetProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null); - } - - @Override - protected void setDefaultDashboardId(TenantId tenantId, DashboardId dashboardId, AssetProfile assetProfile, AssetProfileUpdateMsg assetProfileUpdateMsg) { - UUID defaultDashboardUUID = assetProfile.getDefaultDashboardId() != null ? assetProfile.getDefaultDashboardId().getId() : (dashboardId != null ? dashboardId.getId() : null); - assetProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileProcessor.java index 83051c519c..d5670924c9 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileProcessor.java @@ -17,17 +17,12 @@ package org.thingsboard.server.service.edge.rpc.processor.asset.profile; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; public interface AssetProfileProcessor extends EdgeProcessor { ListenableFuture processAssetProfileMsgFromEdge(TenantId tenantId, Edge edge, AssetProfileUpdateMsg assetProfileUpdateMsg); - DownlinkMsg convertAssetProfileEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java index 2b1440a480..af243e3afe 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.asset.profile; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.asset.AssetProfile; import org.thingsboard.server.common.data.id.AssetProfileId; @@ -39,7 +40,7 @@ public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor { boolean assetProfileNameUpdated = false; assetCreationLock.lock(); try { - AssetProfile assetProfile = constructAssetProfileFromUpdateMsg(tenantId, assetProfileId, assetProfileUpdateMsg); + AssetProfile assetProfile = JacksonUtil.fromString(assetProfileUpdateMsg.getEntity(), AssetProfile.class, true); if (assetProfile == null) { throw new RuntimeException("[{" + tenantId + "}] assetProfileUpdateMsg {" + assetProfileUpdateMsg + "} cannot be converted to asset profile"); } @@ -81,8 +82,6 @@ public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor { return Pair.of(created, assetProfileNameUpdated); } - protected abstract AssetProfile constructAssetProfileFromUpdateMsg(TenantId tenantId, AssetProfileId assetProfileId, AssetProfileUpdateMsg assetProfileUpdateMsg); - protected abstract void setDefaultRuleChainId(TenantId tenantId, AssetProfile assetProfile, RuleChainId ruleChainId); protected abstract void setDefaultEdgeRuleChainId(AssetProfile assetProfile, RuleChainId ruleChainId, AssetProfileUpdateMsg assetProfileUpdateMsg); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java index ddf6f25728..2ecec3893e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java @@ -18,7 +18,6 @@ package org.thingsboard.server.service.edge.rpc.processor.customer; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.EdgeUtils; @@ -33,35 +32,30 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageDataIterable; import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.customer.CustomerMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.customer.CustomerMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; import java.util.ArrayList; import java.util.List; import java.util.UUID; -@Component @Slf4j +@Component @TbCoreComponent public class CustomerEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private CustomerMsgConstructorFactory customerMsgConstructorFactory; - - public DownlinkMsg convertCustomerEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { CustomerId customerId = new CustomerId(edgeEvent.getEntityId()); - var msgConstructor = (CustomerMsgConstructor) customerMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { Customer customer = edgeCtx.getCustomerService().findCustomerById(edgeEvent.getTenantId(), customerId); if (customer != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - CustomerUpdateMsg customerUpdateMsg = msgConstructor.constructCustomerUpdatedMsg(msgType, customer); + CustomerUpdateMsg customerUpdateMsg = EdgeMsgConstructorUtils.constructCustomerUpdatedMsg(msgType, customer); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addCustomerUpdateMsg(customerUpdateMsg) @@ -69,7 +63,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { } } case DELETED -> { - CustomerUpdateMsg customerUpdateMsg = msgConstructor.constructCustomerDeleteMsg(customerId); + CustomerUpdateMsg customerUpdateMsg = EdgeMsgConstructorUtils.constructCustomerDeleteMsg(customerId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addCustomerUpdateMsg(customerUpdateMsg) @@ -79,7 +73,8 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { return null; } - public ListenableFuture processCustomerNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { + @Override + public ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); EdgeEventType type = EdgeEventType.valueOf(edgeNotificationMsg.getType()); UUID uuid = new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB()); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java index 52277b8527..ae593aca1b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java @@ -17,6 +17,7 @@ package org.thingsboard.server.service.edge.rpc.processor.dashboard; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Dashboard; import org.thingsboard.server.common.data.ShortCustomerInfo; import org.thingsboard.server.common.data.id.CustomerId; @@ -36,7 +37,7 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { protected boolean saveOrUpdateDashboard(TenantId tenantId, DashboardId dashboardId, DashboardUpdateMsg dashboardUpdateMsg, CustomerId customerId) { boolean created = false; - Dashboard dashboard = constructDashboardFromUpdateMsg(tenantId, dashboardId, dashboardUpdateMsg); + Dashboard dashboard = JacksonUtil.fromString(dashboardUpdateMsg.getEntity(), Dashboard.class, true); if (dashboard == null) { throw new RuntimeException("[{" + tenantId + "}] dashboardUpdateMsg {" + dashboardUpdateMsg + "} cannot be converted to dashboard"); } @@ -86,8 +87,6 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { } } - protected abstract Dashboard constructDashboardFromUpdateMsg(TenantId tenantId, DashboardId dashboardId, DashboardUpdateMsg dashboardUpdateMsg); - protected abstract Set filterNonExistingCustomers(TenantId tenantId, Set assignedCustomers); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java index cb54977c3c..e4842a16db 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java @@ -18,7 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.dashboard; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Dashboard; import org.thingsboard.server.common.data.EdgeUtils; @@ -32,19 +32,17 @@ import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.dashboard.DashboardMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.dashboard.DashboardMsgConstructorFactory; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.Set; import java.util.UUID; @Slf4j -public abstract class DashboardEdgeProcessor extends BaseDashboardProcessor implements DashboardProcessor { - - @Autowired - private DashboardMsgConstructorFactory dashboardMsgConstructorFactory; +@Component +@TbCoreComponent +public class DashboardEdgeProcessor extends BaseDashboardProcessor implements DashboardProcessor { @Override public ListenableFuture processDashboardMsgFromEdge(TenantId tenantId, Edge edge, DashboardUpdateMsg dashboardUpdateMsg) { @@ -101,15 +99,14 @@ public abstract class DashboardEdgeProcessor extends BaseDashboardProcessor impl } @Override - public DownlinkMsg convertDashboardEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { DashboardId dashboardId = new DashboardId(edgeEvent.getEntityId()); - var msgConstructor = (DashboardMsgConstructor) dashboardMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE, ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { Dashboard dashboard = edgeCtx.getDashboardService().findDashboardById(edgeEvent.getTenantId(), dashboardId); if (dashboard != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - DashboardUpdateMsg dashboardUpdateMsg = msgConstructor.constructDashboardUpdatedMsg(msgType, dashboard); + DashboardUpdateMsg dashboardUpdateMsg = EdgeMsgConstructorUtils.constructDashboardUpdatedMsg(msgType, dashboard); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addDashboardUpdateMsg(dashboardUpdateMsg) @@ -117,7 +114,7 @@ public abstract class DashboardEdgeProcessor extends BaseDashboardProcessor impl } } case DELETED, UNASSIGNED_FROM_EDGE -> { - DashboardUpdateMsg dashboardUpdateMsg = msgConstructor.constructDashboardDeleteMsg(dashboardId); + DashboardUpdateMsg dashboardUpdateMsg = EdgeMsgConstructorUtils.constructDashboardDeleteMsg(dashboardId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addDashboardUpdateMsg(dashboardUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorFactory.java deleted file mode 100644 index 0d2e9c16fe..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.dashboard; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class DashboardEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java deleted file mode 100644 index 20ab6019bf..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.dashboard; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import com.fasterxml.jackson.core.type.TypeReference; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Dashboard; -import org.thingsboard.server.common.data.ShortCustomerInfo; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.Set; - -@Component -@TbCoreComponent -public class DashboardEdgeProcessorV1 extends DashboardEdgeProcessor { - - @Override - protected Dashboard constructDashboardFromUpdateMsg(TenantId tenantId, DashboardId dashboardId, DashboardUpdateMsg dashboardUpdateMsg) { - Dashboard dashboard = new Dashboard(); - dashboard.setTenantId(tenantId); - dashboard.setCreatedTime(Uuids.unixTimestamp(dashboardId.getId())); - dashboard.setTitle(dashboardUpdateMsg.getTitle()); - dashboard.setImage(dashboardUpdateMsg.hasImage() ? dashboardUpdateMsg.getImage() : null); - dashboard.setConfiguration(JacksonUtil.toJsonNode(dashboardUpdateMsg.getConfiguration())); - - Set assignedCustomers; - if (dashboardUpdateMsg.hasAssignedCustomers()) { - assignedCustomers = JacksonUtil.fromString(dashboardUpdateMsg.getAssignedCustomers(), new TypeReference<>() {}); - assignedCustomers = filterNonExistingCustomers(tenantId, assignedCustomers); - dashboard.setAssignedCustomers(assignedCustomers); - } - dashboard.setMobileOrder(dashboardUpdateMsg.hasMobileOrder() ? dashboardUpdateMsg.getMobileOrder() : null); - dashboard.setMobileHide(dashboardUpdateMsg.getMobileHide()); - return dashboard; - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV2.java deleted file mode 100644 index 10bfe555a6..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV2.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.dashboard; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Dashboard; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class DashboardEdgeProcessorV2 extends DashboardEdgeProcessor { - - @Override - protected Dashboard constructDashboardFromUpdateMsg(TenantId tenantId, DashboardId dashboardId, DashboardUpdateMsg dashboardUpdateMsg) { - return JacksonUtil.fromString(dashboardUpdateMsg.getEntity(), Dashboard.class, true); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardProcessor.java index 4f24d759bb..88837aff54 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardProcessor.java @@ -17,16 +17,12 @@ package org.thingsboard.server.service.edge.rpc.processor.dashboard; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; public interface DashboardProcessor extends EdgeProcessor { ListenableFuture processDashboardMsgFromEdge(TenantId tenantId, Edge edge, DashboardUpdateMsg dashboardUpdateMsg); - DownlinkMsg convertDashboardEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java index 4b2757e510..2bea268da1 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.device; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.id.CustomerId; @@ -40,7 +41,7 @@ public abstract class BaseDeviceProcessor extends BaseEdgeProcessor { boolean deviceNameUpdated = false; deviceCreationLock.lock(); try { - Device device = constructDeviceFromUpdateMsg(tenantId, deviceId, deviceUpdateMsg); + Device device =JacksonUtil.fromString(deviceUpdateMsg.getEntity(), Device.class, true); if (device == null) { throw new RuntimeException("[{" + tenantId + "}] deviceUpdateMsg {" + deviceUpdateMsg + "} cannot be converted to device"); } @@ -78,7 +79,7 @@ public abstract class BaseDeviceProcessor extends BaseEdgeProcessor { } protected void updateDeviceCredentials(TenantId tenantId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg) { - DeviceCredentials deviceCredentials = constructDeviceCredentialsFromUpdateMsg(tenantId, deviceCredentialsUpdateMsg); + DeviceCredentials deviceCredentials = JacksonUtil.fromString(deviceCredentialsUpdateMsg.getEntity(), DeviceCredentials.class, true); if (deviceCredentials == null) { throw new RuntimeException("[{" + tenantId + "}] deviceCredentialsUpdateMsg {" + deviceCredentialsUpdateMsg + "} cannot be converted to device credentials"); } @@ -107,10 +108,6 @@ public abstract class BaseDeviceProcessor extends BaseEdgeProcessor { } } - protected abstract Device constructDeviceFromUpdateMsg(TenantId tenantId, DeviceId deviceId, DeviceUpdateMsg deviceUpdateMsg); - protected abstract void setCustomerId(TenantId tenantId, CustomerId customerId, Device device, DeviceUpdateMsg deviceUpdateMsg); - protected abstract DeviceCredentials constructDeviceCredentialsFromUpdateMsg(TenantId tenantId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java index e453cbc26f..daf687fe6f 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java @@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import lombok.extern.slf4j.Slf4j; import org.springframework.data.util.Pair; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; @@ -31,6 +32,7 @@ import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; @@ -47,16 +49,18 @@ import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.TbQueueCallback; import org.thingsboard.server.queue.TbQueueMsgMetadata; -import org.thingsboard.server.service.edge.rpc.constructor.device.DeviceMsgConstructor; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; @Slf4j -public abstract class DeviceEdgeProcessor extends BaseDeviceProcessor implements DeviceProcessor { +@Component +@TbCoreComponent +public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DeviceProcessor { @Override public ListenableFuture processDeviceMsgFromEdge(TenantId tenantId, Edge edge, DeviceUpdateMsg deviceUpdateMsg) { @@ -213,9 +217,8 @@ public abstract class DeviceEdgeProcessor extends BaseDeviceProcessor implements } @Override - public DownlinkMsg convertDeviceEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { DeviceId deviceId = new DeviceId(edgeEvent.getEntityId()); - var msgConstructor = (DeviceMsgConstructor) edgeCtx.getDeviceMsgConstructorFactory().getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED: case UPDATED: @@ -225,18 +228,18 @@ public abstract class DeviceEdgeProcessor extends BaseDeviceProcessor implements Device device = edgeCtx.getDeviceService().findDeviceById(edgeEvent.getTenantId(), deviceId); if (device != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - DeviceUpdateMsg deviceUpdateMsg = msgConstructor.constructDeviceUpdatedMsg(msgType, device); + DeviceUpdateMsg deviceUpdateMsg = EdgeMsgConstructorUtils.constructDeviceUpdatedMsg(msgType, device); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addDeviceUpdateMsg(deviceUpdateMsg); DeviceCredentials deviceCredentials = edgeCtx.getDeviceCredentialsService().findDeviceCredentialsByDeviceId(edgeEvent.getTenantId(), deviceId); if (deviceCredentials != null) { - DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg = msgConstructor.constructDeviceCredentialsUpdatedMsg(deviceCredentials); + DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg = EdgeMsgConstructorUtils.constructDeviceCredentialsUpdatedMsg(deviceCredentials); builder.addDeviceCredentialsUpdateMsg(deviceCredentialsUpdateMsg).build(); } if (UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE.equals(msgType)) { DeviceProfile deviceProfile = edgeCtx.getDeviceProfileService().findDeviceProfileById(edgeEvent.getTenantId(), device.getDeviceProfileId()); - builder.addDeviceProfileUpdateMsg(msgConstructor.constructDeviceProfileUpdatedMsg(msgType, deviceProfile)); + builder.addDeviceProfileUpdateMsg(EdgeMsgConstructorUtils.constructDeviceProfileUpdatedMsg(msgType, deviceProfile)); } return builder.build(); } @@ -245,24 +248,30 @@ public abstract class DeviceEdgeProcessor extends BaseDeviceProcessor implements case UNASSIGNED_FROM_EDGE: return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addDeviceUpdateMsg(msgConstructor.constructDeviceDeleteMsg(deviceId)) + .addDeviceUpdateMsg(EdgeMsgConstructorUtils.constructDeviceDeleteMsg(deviceId)) .build(); case CREDENTIALS_UPDATED: DeviceCredentials deviceCredentials = edgeCtx.getDeviceCredentialsService().findDeviceCredentialsByDeviceId(edgeEvent.getTenantId(), deviceId); if (deviceCredentials != null) { return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addDeviceCredentialsUpdateMsg(msgConstructor.constructDeviceCredentialsUpdatedMsg(deviceCredentials)) + .addDeviceCredentialsUpdateMsg(EdgeMsgConstructorUtils.constructDeviceCredentialsUpdatedMsg(deviceCredentials)) .build(); } break; case RPC_CALL: return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addDeviceRpcCallMsg(msgConstructor.constructDeviceRpcCallMsg(edgeEvent.getEntityId(), edgeEvent.getBody())) + .addDeviceRpcCallMsg(EdgeMsgConstructorUtils.constructDeviceRpcCallMsg(edgeEvent.getEntityId(), edgeEvent.getBody())) .build(); } return null; } + @Override + protected void setCustomerId(TenantId tenantId, CustomerId customerId, Device device, DeviceUpdateMsg deviceUpdateMsg) { + CustomerId customerUUID = device.getCustomerId() != null ? device.getCustomerId() : customerId; + device.setCustomerId(customerUUID); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorFactory.java deleted file mode 100644 index 85327bfc1f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.device; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class DeviceEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV1.java deleted file mode 100644 index 6756c6c2f8..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV1.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.device; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Device; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.DeviceProfileId; -import org.thingsboard.server.common.data.id.OtaPackageId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.security.DeviceCredentials; -import org.thingsboard.server.common.data.security.DeviceCredentialsType; -import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.UUID; - -@Component -@TbCoreComponent -public class DeviceEdgeProcessorV1 extends DeviceEdgeProcessor { - - @Override - protected Device constructDeviceFromUpdateMsg(TenantId tenantId, DeviceId deviceId, DeviceUpdateMsg deviceUpdateMsg) { - Device device = new Device(); - device.setTenantId(tenantId); - device.setCreatedTime(Uuids.unixTimestamp(deviceId.getId())); - device.setName(deviceUpdateMsg.getName()); - device.setType(deviceUpdateMsg.getType()); - device.setLabel(deviceUpdateMsg.hasLabel() ? deviceUpdateMsg.getLabel() : null); - device.setAdditionalInfo(deviceUpdateMsg.hasAdditionalInfo() - ? JacksonUtil.toJsonNode(deviceUpdateMsg.getAdditionalInfo()) : null); - - UUID deviceProfileUUID = safeGetUUID(deviceUpdateMsg.getDeviceProfileIdMSB(), deviceUpdateMsg.getDeviceProfileIdLSB()); - device.setDeviceProfileId(deviceProfileUUID != null ? new DeviceProfileId(deviceProfileUUID) : null); - - device.setDeviceDataBytes(deviceUpdateMsg.getDeviceDataBytes().toByteArray()); - - UUID firmwareUUID = safeGetUUID(deviceUpdateMsg.getFirmwareIdMSB(), deviceUpdateMsg.getFirmwareIdLSB()); - device.setFirmwareId(firmwareUUID != null ? new OtaPackageId(firmwareUUID) : null); - UUID softwareUUID = safeGetUUID(deviceUpdateMsg.getSoftwareIdMSB(), deviceUpdateMsg.getSoftwareIdLSB()); - device.setSoftwareId(softwareUUID != null ? new OtaPackageId(softwareUUID) : null); - - return device; - } - - @Override - protected DeviceCredentials constructDeviceCredentialsFromUpdateMsg(TenantId tenantId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg) { - DeviceCredentials deviceCredentials = new DeviceCredentials(); - deviceCredentials.setDeviceId(new DeviceId(new UUID(deviceCredentialsUpdateMsg.getDeviceIdMSB(), deviceCredentialsUpdateMsg.getDeviceIdLSB()))); - deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType())); - deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId()); - deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.hasCredentialsValue() - ? deviceCredentialsUpdateMsg.getCredentialsValue() : null); - return deviceCredentials; - } - - @Override - protected void setCustomerId(TenantId tenantId, CustomerId customerId, Device device, DeviceUpdateMsg deviceUpdateMsg) { - CustomerId customerUUID = safeGetCustomerId(deviceUpdateMsg.getCustomerIdMSB(), deviceUpdateMsg.getCustomerIdLSB()); - device.setCustomerId(customerUUID != null ? customerUUID : customerId); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV2.java deleted file mode 100644 index 0ea4f62862..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessorV2.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.device; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.Device; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.security.DeviceCredentials; -import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class DeviceEdgeProcessorV2 extends DeviceEdgeProcessor { - - @Override - protected Device constructDeviceFromUpdateMsg(TenantId tenantId, DeviceId deviceId, DeviceUpdateMsg deviceUpdateMsg) { - return JacksonUtil.fromString(deviceUpdateMsg.getEntity(), Device.class, true); - } - - @Override - protected DeviceCredentials constructDeviceCredentialsFromUpdateMsg(TenantId tenantId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg) { - return JacksonUtil.fromString(deviceCredentialsUpdateMsg.getEntity(), DeviceCredentials.class, true); - } - - @Override - protected void setCustomerId(TenantId tenantId, CustomerId customerId, Device device, DeviceUpdateMsg deviceUpdateMsg) { - CustomerId customerUUID = device.getCustomerId() != null ? device.getCustomerId() : customerId; - device.setCustomerId(customerUUID); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceProcessor.java index 087b5f36a7..a7fdbae588 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceProcessor.java @@ -17,14 +17,11 @@ package org.thingsboard.server.service.edge.rpc.processor.device; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; public interface DeviceProcessor extends EdgeProcessor { @@ -33,8 +30,6 @@ public interface DeviceProcessor extends EdgeProcessor { ListenableFuture processDeviceCredentialsMsgFromEdge(TenantId tenantId, EdgeId edgeId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg); - DownlinkMsg convertDeviceEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - ListenableFuture processDeviceRpcCallFromEdge(TenantId tenantId, Edge edge, DeviceRpcCallMsg deviceRpcCallMsg); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java index d06618772d..47935da4fd 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.device.profile; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.id.DashboardId; @@ -39,7 +40,7 @@ public abstract class BaseDeviceProfileProcessor extends BaseEdgeProcessor { boolean deviceProfileNameUpdated = false; deviceCreationLock.lock(); try { - DeviceProfile deviceProfile = constructDeviceProfileFromUpdateMsg(tenantId, deviceProfileId, deviceProfileUpdateMsg); + DeviceProfile deviceProfile = JacksonUtil.fromString(deviceProfileUpdateMsg.getEntity(), DeviceProfile.class, true); if (deviceProfile == null) { throw new RuntimeException("[{" + tenantId + "}] deviceProfileUpdateMsg {" + deviceProfileUpdateMsg + "} cannot be converted to device profile"); } @@ -81,8 +82,6 @@ public abstract class BaseDeviceProfileProcessor extends BaseEdgeProcessor { return Pair.of(created, deviceProfileNameUpdated); } - protected abstract DeviceProfile constructDeviceProfileFromUpdateMsg(TenantId tenantId, DeviceProfileId deviceProfileId, DeviceProfileUpdateMsg deviceProfileUpdateMsg); - protected abstract void setDefaultRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, RuleChainId ruleChainId); protected abstract void setDefaultEdgeRuleChainId(DeviceProfile deviceProfile, RuleChainId ruleChainId, DeviceProfileUpdateMsg deviceProfileUpdateMsg); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java index a0a699d340..31a007219d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java @@ -19,6 +19,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; import org.springframework.data.util.Pair; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.EdgeUtils; @@ -26,21 +27,25 @@ import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.device.DeviceMsgConstructor; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; @Slf4j -public abstract class DeviceProfileEdgeProcessor extends BaseDeviceProfileProcessor implements DeviceProfileProcessor { +@Component +@TbCoreComponent +public class DeviceProfileEdgeProcessor extends BaseDeviceProfileProcessor implements DeviceProfileProcessor { @Override public ListenableFuture processDeviceProfileMsgFromEdge(TenantId tenantId, Edge edge, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { @@ -49,16 +54,13 @@ public abstract class DeviceProfileEdgeProcessor extends BaseDeviceProfileProces try { edgeSynchronizationManager.getEdgeId().set(edge.getId()); - switch (deviceProfileUpdateMsg.getMsgType()) { - case ENTITY_CREATED_RPC_MESSAGE: - case ENTITY_UPDATED_RPC_MESSAGE: + return switch (deviceProfileUpdateMsg.getMsgType()) { + case ENTITY_CREATED_RPC_MESSAGE, ENTITY_UPDATED_RPC_MESSAGE -> { saveOrUpdateDeviceProfile(tenantId, deviceProfileId, deviceProfileUpdateMsg, edge); - return Futures.immediateFuture(null); - case ENTITY_DELETED_RPC_MESSAGE: - case UNRECOGNIZED: - default: - return handleUnsupportedMsgType(deviceProfileUpdateMsg.getMsgType()); - } + yield Futures.immediateFuture(null); + } + default -> handleUnsupportedMsgType(deviceProfileUpdateMsg.getMsgType()); + }; } catch (DataValidationException e) { log.warn("[{}] Failed to process DeviceProfileUpdateMsg from Edge [{}]", tenantId, deviceProfileUpdateMsg, e); return Futures.immediateFailedFuture(e); @@ -92,15 +94,14 @@ public abstract class DeviceProfileEdgeProcessor extends BaseDeviceProfileProces } @Override - public DownlinkMsg convertDeviceProfileEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { DeviceProfileId deviceProfileId = new DeviceProfileId(edgeEvent.getEntityId()); - var msgConstructor = (DeviceMsgConstructor) edgeCtx.getDeviceMsgConstructorFactory().getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { DeviceProfile deviceProfile = edgeCtx.getDeviceProfileService().findDeviceProfileById(edgeEvent.getTenantId(), deviceProfileId); if (deviceProfile != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - DeviceProfileUpdateMsg deviceProfileUpdateMsg = msgConstructor.constructDeviceProfileUpdatedMsg(msgType, deviceProfile); + DeviceProfileUpdateMsg deviceProfileUpdateMsg = EdgeMsgConstructorUtils.constructDeviceProfileUpdatedMsg(msgType, deviceProfile); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addDeviceProfileUpdateMsg(deviceProfileUpdateMsg) @@ -108,7 +109,7 @@ public abstract class DeviceProfileEdgeProcessor extends BaseDeviceProfileProces } } case DELETED -> { - DeviceProfileUpdateMsg deviceProfileUpdateMsg = msgConstructor.constructDeviceProfileDeleteMsg(deviceProfileId); + DeviceProfileUpdateMsg deviceProfileUpdateMsg = EdgeMsgConstructorUtils.constructDeviceProfileDeleteMsg(deviceProfileId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addDeviceProfileUpdateMsg(deviceProfileUpdateMsg) @@ -118,4 +119,21 @@ public abstract class DeviceProfileEdgeProcessor extends BaseDeviceProfileProces return null; } + @Override + protected void setDefaultRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, RuleChainId ruleChainId) { + deviceProfile.setDefaultRuleChainId(ruleChainId); + } + + @Override + protected void setDefaultEdgeRuleChainId(DeviceProfile deviceProfile, RuleChainId ruleChainId, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { + UUID defaultEdgeRuleChainUUID = ruleChainId != null ? ruleChainId.getId() : null; + deviceProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null); + } + + @Override + protected void setDefaultDashboardId(TenantId tenantId, DashboardId dashboardId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { + UUID defaultDashboardUUID = deviceProfile.getDefaultDashboardId() != null ? deviceProfile.getDefaultDashboardId().getId() : (dashboardId != null ? dashboardId.getId() : null); + deviceProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorFactory.java deleted file mode 100644 index a69fba1fb5..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.device.profile; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class DeviceProfileEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV1.java deleted file mode 100644 index a86afcfb73..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV1.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.device.profile; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.data.DeviceProfile; -import org.thingsboard.server.common.data.DeviceProfileProvisionType; -import org.thingsboard.server.common.data.DeviceProfileType; -import org.thingsboard.server.common.data.DeviceTransportType; -import org.thingsboard.server.common.data.StringUtils; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.common.data.id.DeviceProfileId; -import org.thingsboard.server.common.data.id.OtaPackageId; -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -@Component -@TbCoreComponent -public class DeviceProfileEdgeProcessorV1 extends DeviceProfileEdgeProcessor { - - @Override - protected DeviceProfile constructDeviceProfileFromUpdateMsg(TenantId tenantId, DeviceProfileId deviceProfileId, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { - DeviceProfile deviceProfile = new DeviceProfile(); - deviceProfile.setTenantId(tenantId); - deviceProfile.setCreatedTime(Uuids.unixTimestamp(deviceProfileId.getId())); - deviceProfile.setName(deviceProfileUpdateMsg.getName()); - deviceProfile.setDefault(deviceProfileUpdateMsg.getDefault()); - deviceProfile.setDescription(deviceProfileUpdateMsg.hasDescription() ? deviceProfileUpdateMsg.getDescription() : null); - deviceProfile.setType(DeviceProfileType.valueOf(deviceProfileUpdateMsg.getType())); - deviceProfile.setTransportType(deviceProfileUpdateMsg.hasTransportType() - ? DeviceTransportType.valueOf(deviceProfileUpdateMsg.getTransportType()) : DeviceTransportType.DEFAULT); - deviceProfile.setImage(deviceProfileUpdateMsg.hasImage() - ? new String(deviceProfileUpdateMsg.getImage().toByteArray(), StandardCharsets.UTF_8) : null); - deviceProfile.setProvisionType(deviceProfileUpdateMsg.hasProvisionType() - ? DeviceProfileProvisionType.valueOf(deviceProfileUpdateMsg.getProvisionType()) : DeviceProfileProvisionType.DISABLED); - deviceProfile.setProvisionDeviceKey(deviceProfileUpdateMsg.hasProvisionDeviceKey() - ? deviceProfileUpdateMsg.getProvisionDeviceKey() : null); - deviceProfile.setDefaultQueueName(deviceProfileUpdateMsg.getDefaultQueueName()); - - deviceProfile.setProfileDataBytes(deviceProfileUpdateMsg.getProfileDataBytes().toByteArray()); - - String defaultQueueName = StringUtils.isNotBlank(deviceProfileUpdateMsg.getDefaultQueueName()) - ? deviceProfileUpdateMsg.getDefaultQueueName() : null; - deviceProfile.setDefaultQueueName(defaultQueueName); - - UUID firmwareUUID = safeGetUUID(deviceProfileUpdateMsg.getFirmwareIdMSB(), deviceProfileUpdateMsg.getFirmwareIdLSB()); - deviceProfile.setFirmwareId(firmwareUUID != null ? new OtaPackageId(firmwareUUID) : null); - - UUID softwareUUID = safeGetUUID(deviceProfileUpdateMsg.getSoftwareIdMSB(), deviceProfileUpdateMsg.getSoftwareIdLSB()); - deviceProfile.setSoftwareId(softwareUUID != null ? new OtaPackageId(softwareUUID) : null); - return deviceProfile; - } - - @Override - protected void setDefaultRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, RuleChainId ruleChainId) { - deviceProfile.setDefaultRuleChainId(ruleChainId); - } - - @Override - protected void setDefaultEdgeRuleChainId(DeviceProfile deviceProfile, RuleChainId ruleChainId, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { - UUID defaultEdgeRuleChainUUID = safeGetUUID(deviceProfileUpdateMsg.getDefaultRuleChainIdMSB(), deviceProfileUpdateMsg.getDefaultRuleChainIdLSB()); - deviceProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : ruleChainId); - } - - @Override - protected void setDefaultDashboardId(TenantId tenantId, DashboardId dashboardId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { - UUID defaultDashboardUUID = safeGetUUID(deviceProfileUpdateMsg.getDefaultDashboardIdMSB(), deviceProfileUpdateMsg.getDefaultDashboardIdLSB()); - deviceProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : dashboardId); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV2.java deleted file mode 100644 index 15c07fdaa7..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessorV2.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.device.profile; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.DeviceProfile; -import org.thingsboard.server.common.data.id.DashboardId; -import org.thingsboard.server.common.data.id.DeviceProfileId; -import org.thingsboard.server.common.data.id.RuleChainId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.UUID; - -@Primary -@Component -@TbCoreComponent -public class DeviceProfileEdgeProcessorV2 extends DeviceProfileEdgeProcessor { - - @Override - protected DeviceProfile constructDeviceProfileFromUpdateMsg(TenantId tenantId, DeviceProfileId deviceProfileId, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { - return JacksonUtil.fromString(deviceProfileUpdateMsg.getEntity(), DeviceProfile.class, true); - } - - @Override - protected void setDefaultRuleChainId(TenantId tenantId, DeviceProfile deviceProfile, RuleChainId ruleChainId) { - deviceProfile.setDefaultRuleChainId(ruleChainId); - } - - @Override - protected void setDefaultEdgeRuleChainId(DeviceProfile deviceProfile, RuleChainId ruleChainId, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { - UUID defaultEdgeRuleChainUUID = ruleChainId != null ? ruleChainId.getId() : null; - deviceProfile.setDefaultEdgeRuleChainId(defaultEdgeRuleChainUUID != null ? new RuleChainId(defaultEdgeRuleChainUUID) : null); - } - - @Override - protected void setDefaultDashboardId(TenantId tenantId, DashboardId dashboardId, DeviceProfile deviceProfile, DeviceProfileUpdateMsg deviceProfileUpdateMsg) { - UUID defaultDashboardUUID = deviceProfile.getDefaultDashboardId() != null ? deviceProfile.getDefaultDashboardId().getId() : (dashboardId != null ? dashboardId.getId() : null); - deviceProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null); - } -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileProcessor.java index 817d35879d..77bf9500c5 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileProcessor.java @@ -17,17 +17,12 @@ package org.thingsboard.server.service.edge.rpc.processor.device.profile; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; public interface DeviceProfileProcessor extends EdgeProcessor { ListenableFuture processDeviceProfileMsgFromEdge(TenantId tenantId, Edge edge, DeviceProfileUpdateMsg deviceProfileUpdateMsg); - DownlinkMsg convertDeviceProfileEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java similarity index 93% rename from application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeProcessor.java rename to application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java index 024147507a..7c1f907cb0 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java @@ -32,9 +32,9 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; import java.util.ArrayList; @@ -44,26 +44,10 @@ import java.util.UUID; @Slf4j @Component @TbCoreComponent -public class EdgeProcessor extends BaseEdgeProcessor { +public class EdgeEntityProcessor extends BaseEdgeProcessor { - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { - EdgeId edgeId = new EdgeId(edgeEvent.getEntityId()); - switch (edgeEvent.getAction()) { - case ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { - Edge edge = edgeCtx.getEdgeService().findEdgeById(edgeEvent.getTenantId(), edgeId); - if (edge != null) { - EdgeConfiguration edgeConfigMsg = edgeCtx.getEdgeMsgConstructor().constructEdgeConfiguration(edge); - return DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .setEdgeConfiguration(edgeConfigMsg) - .build(); - } - } - } - return null; - } - - public ListenableFuture processEdgeNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { + @Override + public ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { try { EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); EdgeId edgeId = new EdgeId(new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB())); @@ -112,4 +96,21 @@ public class EdgeProcessor extends BaseEdgeProcessor { } } + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + EdgeId edgeId = new EdgeId(edgeEvent.getEntityId()); + switch (edgeEvent.getAction()) { + case ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { + Edge edge = edgeCtx.getEdgeService().findEdgeById(edgeEvent.getTenantId(), edgeId); + if (edge != null) { + return DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .setEdgeConfiguration(EdgeMsgConstructorUtils.constructEdgeConfiguration(edge)) + .build(); + } + } + } + return null; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java index 757f606f69..2ded93c253 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.entityview; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EntityView; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.id.CustomerId; @@ -36,7 +37,7 @@ public abstract class BaseEntityViewProcessor extends BaseEdgeProcessor { protected Pair saveOrUpdateEntityView(TenantId tenantId, EntityViewId entityViewId, EntityViewUpdateMsg entityViewUpdateMsg) { boolean created = false; boolean entityViewNameUpdated = false; - EntityView entityView = constructEntityViewFromUpdateMsg(tenantId, entityViewId, entityViewUpdateMsg); + EntityView entityView = JacksonUtil.fromString(entityViewUpdateMsg.getEntity(), EntityView.class, true); if (entityView == null) { throw new RuntimeException("[{" + tenantId + "}] entityViewUpdateMsg {" + entityViewUpdateMsg + "} cannot be converted to entity view"); } @@ -66,8 +67,6 @@ public abstract class BaseEntityViewProcessor extends BaseEdgeProcessor { return Pair.of(created, entityViewNameUpdated); } - protected abstract EntityView constructEntityViewFromUpdateMsg(TenantId tenantId, EntityViewId entityViewId, EntityViewUpdateMsg entityViewUpdateMsg); - protected abstract void setCustomerId(TenantId tenantId, CustomerId customerId, EntityView entityView, EntityViewUpdateMsg entityViewUpdateMsg); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java index aa105652d5..a46ac3acdd 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java @@ -18,8 +18,8 @@ package org.thingsboard.server.service.edge.rpc.processor.entityview; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.EntityView; @@ -27,25 +27,24 @@ import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.EntityViewId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.entityview.EntityViewMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.entityview.EntityViewMsgConstructorFactory; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; @Slf4j -public abstract class EntityViewEdgeProcessor extends BaseEntityViewProcessor implements EntityViewProcessor { - - @Autowired - private EntityViewMsgConstructorFactory entityViewMsgConstructorFactory; +@Component +@TbCoreComponent +public class EntityViewEdgeProcessor extends BaseEntityViewProcessor implements EntityViewProcessor { @Override public ListenableFuture processEntityViewMsgFromEdge(TenantId tenantId, Edge edge, EntityViewUpdateMsg entityViewUpdateMsg) { @@ -106,15 +105,15 @@ public abstract class EntityViewEdgeProcessor extends BaseEntityViewProcessor im } } - public DownlinkMsg convertEntityViewEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { EntityViewId entityViewId = new EntityViewId(edgeEvent.getEntityId()); - var msgConstructor = (EntityViewMsgConstructor) entityViewMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE, ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { EntityView entityView = edgeCtx.getEntityViewService().findEntityViewById(edgeEvent.getTenantId(), entityViewId); if (entityView != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - EntityViewUpdateMsg entityViewUpdateMsg = msgConstructor.constructEntityViewUpdatedMsg(msgType, entityView); + EntityViewUpdateMsg entityViewUpdateMsg = EdgeMsgConstructorUtils.constructEntityViewUpdatedMsg(msgType, entityView); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addEntityViewUpdateMsg(entityViewUpdateMsg) @@ -122,7 +121,7 @@ public abstract class EntityViewEdgeProcessor extends BaseEntityViewProcessor im } } case DELETED, UNASSIGNED_FROM_EDGE -> { - EntityViewUpdateMsg entityViewUpdateMsg = msgConstructor.constructEntityViewDeleteMsg(entityViewId); + EntityViewUpdateMsg entityViewUpdateMsg = EdgeMsgConstructorUtils.constructEntityViewDeleteMsg(entityViewId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addEntityViewUpdateMsg(entityViewUpdateMsg) @@ -132,4 +131,10 @@ public abstract class EntityViewEdgeProcessor extends BaseEntityViewProcessor im return null; } + @Override + protected void setCustomerId(TenantId tenantId, CustomerId customerId, EntityView entityView, EntityViewUpdateMsg entityViewUpdateMsg) { + CustomerId customerUUID = entityView.getCustomerId() != null ? entityView.getCustomerId() : customerId; + entityView.setCustomerId(customerUUID); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessor.java index 061cd89bf0..b0eaf1d60e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessor.java @@ -17,10 +17,7 @@ package org.thingsboard.server.service.edge.rpc.processor.entityview; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; @@ -28,6 +25,4 @@ public interface EntityViewProcessor extends EdgeProcessor { ListenableFuture processEntityViewMsgFromEdge(TenantId tenantId, Edge edge, EntityViewUpdateMsg entityViewUpdateMsg); - DownlinkMsg convertEntityViewEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorFactory.java deleted file mode 100644 index d6a3f0c250..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.entityview; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class EntityViewProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV1.java deleted file mode 100644 index acb8877c03..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV1.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.entityview; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityView; -import org.thingsboard.server.common.data.id.AssetId; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.EntityViewId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.EdgeEntityType; -import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.UUID; - -@Component -@TbCoreComponent -public class EntityViewProcessorV1 extends EntityViewEdgeProcessor { - - @Override - protected EntityView constructEntityViewFromUpdateMsg(TenantId tenantId, EntityViewId entityViewId, EntityViewUpdateMsg entityViewUpdateMsg) { - EntityView entityView = new EntityView(); - entityView.setTenantId(tenantId); - entityView.setCreatedTime(Uuids.unixTimestamp(entityViewId.getId())); - entityView.setName(entityViewUpdateMsg.getName()); - entityView.setType(entityViewUpdateMsg.getType()); - - entityView.setAdditionalInfo(entityViewUpdateMsg.hasAdditionalInfo() ? - JacksonUtil.toJsonNode(entityViewUpdateMsg.getAdditionalInfo()) : null); - - CustomerId customerId = safeGetCustomerId(entityViewUpdateMsg.getCustomerIdMSB(), entityViewUpdateMsg.getCustomerIdLSB()); - entityView.setCustomerId(customerId); - - UUID entityIdUUID = safeGetUUID(entityViewUpdateMsg.getEntityIdMSB(), entityViewUpdateMsg.getEntityIdLSB()); - if (EdgeEntityType.DEVICE.equals(entityViewUpdateMsg.getEntityType())) { - entityView.setEntityId(entityIdUUID != null ? new DeviceId(entityIdUUID) : null); - } else if (EdgeEntityType.ASSET.equals(entityViewUpdateMsg.getEntityType())) { - entityView.setEntityId(entityIdUUID != null ? new AssetId(entityIdUUID) : null); - } - return entityView; - } - - @Override - protected void setCustomerId(TenantId tenantId, CustomerId customerId, EntityView entityView, EntityViewUpdateMsg entityViewUpdateMsg) { - CustomerId customerUUID = safeGetCustomerId(entityViewUpdateMsg.getCustomerIdMSB(), entityViewUpdateMsg.getCustomerIdLSB()); - entityView.setCustomerId(customerUUID != null ? customerUUID : customerId); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV2.java deleted file mode 100644 index fa4177552e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewProcessorV2.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.entityview; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityView; -import org.thingsboard.server.common.data.id.CustomerId; -import org.thingsboard.server.common.data.id.EntityViewId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class EntityViewProcessorV2 extends EntityViewEdgeProcessor { - - @Override - protected EntityView constructEntityViewFromUpdateMsg(TenantId tenantId, EntityViewId entityViewId, EntityViewUpdateMsg entityViewUpdateMsg) { - return JacksonUtil.fromString(entityViewUpdateMsg.getEntity(), EntityView.class, true); - } - - @Override - protected void setCustomerId(TenantId tenantId, CustomerId customerId, EntityView entityView, EntityViewUpdateMsg entityViewUpdateMsg) { - CustomerId customerUUID = entityView.getCustomerId() != null ? entityView.getCustomerId() : customerId; - entityView.setCustomerId(customerUUID); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationEdgeProcessor.java deleted file mode 100644 index 67aa1dece2..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationEdgeProcessor.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.notification; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.data.EdgeUtils; -import org.thingsboard.server.common.data.edge.EdgeEvent; -import org.thingsboard.server.common.data.id.NotificationRuleId; -import org.thingsboard.server.common.data.id.NotificationTargetId; -import org.thingsboard.server.common.data.id.NotificationTemplateId; -import org.thingsboard.server.common.data.notification.rule.NotificationRule; -import org.thingsboard.server.common.data.notification.targets.NotificationTarget; -import org.thingsboard.server.common.data.notification.template.NotificationTemplate; -import org.thingsboard.server.dao.notification.NotificationRuleService; -import org.thingsboard.server.dao.notification.NotificationTargetService; -import org.thingsboard.server.dao.notification.NotificationTemplateService; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; -import org.thingsboard.server.gen.edge.v1.NotificationTargetUpdateMsg; -import org.thingsboard.server.gen.edge.v1.NotificationTemplateUpdateMsg; -import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.notification.NotificationMsgConstructor; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; - -@Slf4j -@Component -@TbCoreComponent -public class NotificationEdgeProcessor extends BaseEdgeProcessor { - - @Autowired - protected NotificationRuleService notificationRuleService; - - @Autowired - private NotificationTargetService notificationTargetService; - - @Autowired - private NotificationTemplateService notificationTemplateService; - - @Autowired - private NotificationMsgConstructor notificationMsgConstructor; - - public DownlinkMsg convertNotificationRuleToDownlink(EdgeEvent edgeEvent) { - NotificationRuleId notificationRuleId = new NotificationRuleId(edgeEvent.getEntityId()); - DownlinkMsg downlinkMsg = null; - switch (edgeEvent.getAction()) { - case ADDED, UPDATED -> { - NotificationRule notificationRule = notificationRuleService.findNotificationRuleById(edgeEvent.getTenantId(), notificationRuleId); - if (notificationRule != null) { - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - NotificationRuleUpdateMsg notificationRuleUpdateMsg = notificationMsgConstructor.constructNotificationRuleUpdateMsg(msgType, notificationRule); - downlinkMsg = DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addNotificationRuleUpdateMsg(notificationRuleUpdateMsg) - .build(); - } - } - case DELETED -> { - NotificationRuleUpdateMsg notificationRuleUpdateMsg = notificationMsgConstructor.constructNotificationRuleDeleteMsg(notificationRuleId); - downlinkMsg = DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addNotificationRuleUpdateMsg(notificationRuleUpdateMsg) - .build(); - } - } - return downlinkMsg; - } - - public DownlinkMsg convertNotificationTargetToDownlink(EdgeEvent edgeEvent) { - NotificationTargetId notificationTargetId = new NotificationTargetId(edgeEvent.getEntityId()); - DownlinkMsg downlinkMsg = null; - switch (edgeEvent.getAction()) { - case ADDED, UPDATED -> { - NotificationTarget notificationTarget = notificationTargetService.findNotificationTargetById(edgeEvent.getTenantId(), notificationTargetId); - if (notificationTarget != null) { - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - NotificationTargetUpdateMsg notificationTargetUpdateMsg = notificationMsgConstructor.constructNotificationTargetUpdateMsg(msgType, notificationTarget); - downlinkMsg = DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addNotificationTargetUpdateMsg(notificationTargetUpdateMsg) - .build(); - } - } - case DELETED -> { - NotificationTargetUpdateMsg notificationTargetUpdateMsg = notificationMsgConstructor.constructNotificationTargetDeleteMsg(notificationTargetId); - downlinkMsg = DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addNotificationTargetUpdateMsg(notificationTargetUpdateMsg) - .build(); - } - } - return downlinkMsg; - } - - public DownlinkMsg convertNotificationTemplateToDownlink(EdgeEvent edgeEvent) { - NotificationTemplateId notificationTemplateId = new NotificationTemplateId(edgeEvent.getEntityId()); - DownlinkMsg downlinkMsg = null; - switch (edgeEvent.getAction()) { - case ADDED, UPDATED -> { - NotificationTemplate notificationTemplate = notificationTemplateService.findNotificationTemplateById(edgeEvent.getTenantId(), notificationTemplateId); - if (notificationTemplate != null) { - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - NotificationTemplateUpdateMsg notificationTemplateUpdateMsg = notificationMsgConstructor.constructNotificationTemplateUpdateMsg(msgType, notificationTemplate); - downlinkMsg = DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addNotificationTemplateUpdateMsg(notificationTemplateUpdateMsg) - .build(); - } - } - case DELETED -> { - NotificationTemplateUpdateMsg notificationTemplateUpdateMsg = notificationMsgConstructor.constructNotificationTemplateDeleteMsg(notificationTemplateId); - downlinkMsg = DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addNotificationTemplateUpdateMsg(notificationTemplateUpdateMsg) - .build(); - } - } - return downlinkMsg; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java new file mode 100644 index 0000000000..d5f68f5427 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java @@ -0,0 +1,68 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge.rpc.processor.notification; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.NotificationRuleId; +import org.thingsboard.server.common.data.notification.rule.NotificationRule; +import org.thingsboard.server.dao.notification.NotificationRuleService; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; + +@Slf4j +@Component +@TbCoreComponent +public class NotificationRuleEdgeProcessor extends BaseEdgeProcessor { + + @Autowired + private NotificationRuleService notificationRuleService; + + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + NotificationRuleId notificationRuleId = new NotificationRuleId(edgeEvent.getEntityId()); + DownlinkMsg downlinkMsg = null; + switch (edgeEvent.getAction()) { + case ADDED, UPDATED -> { + NotificationRule notificationRule = notificationRuleService.findNotificationRuleById(edgeEvent.getTenantId(), notificationRuleId); + if (notificationRule != null) { + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + NotificationRuleUpdateMsg notificationRuleUpdateMsg = EdgeMsgConstructorUtils.constructNotificationRuleUpdateMsg(msgType, notificationRule); + downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addNotificationRuleUpdateMsg(notificationRuleUpdateMsg) + .build(); + } + } + case DELETED -> { + NotificationRuleUpdateMsg notificationRuleUpdateMsg = EdgeMsgConstructorUtils.constructNotificationRuleDeleteMsg(notificationRuleId); + downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addNotificationRuleUpdateMsg(notificationRuleUpdateMsg) + .build(); + } + } + return downlinkMsg; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java new file mode 100644 index 0000000000..08d0efcaad --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java @@ -0,0 +1,68 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge.rpc.processor.notification; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.NotificationTargetId; +import org.thingsboard.server.common.data.notification.targets.NotificationTarget; +import org.thingsboard.server.dao.notification.NotificationTargetService; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.NotificationTargetUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; + +@Slf4j +@Component +@TbCoreComponent +public class NotificationTargetEdgeProcessor extends BaseEdgeProcessor { + + @Autowired + private NotificationTargetService notificationTargetService; + + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + NotificationTargetId notificationTargetId = new NotificationTargetId(edgeEvent.getEntityId()); + DownlinkMsg downlinkMsg = null; + switch (edgeEvent.getAction()) { + case ADDED, UPDATED -> { + NotificationTarget notificationTarget = notificationTargetService.findNotificationTargetById(edgeEvent.getTenantId(), notificationTargetId); + if (notificationTarget != null) { + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + NotificationTargetUpdateMsg notificationTargetUpdateMsg = EdgeMsgConstructorUtils.constructNotificationTargetUpdateMsg(msgType, notificationTarget); + downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addNotificationTargetUpdateMsg(notificationTargetUpdateMsg) + .build(); + } + } + case DELETED -> { + NotificationTargetUpdateMsg notificationTargetUpdateMsg = EdgeMsgConstructorUtils.constructNotificationTargetDeleteMsg(notificationTargetId); + downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addNotificationTargetUpdateMsg(notificationTargetUpdateMsg) + .build(); + } + } + return downlinkMsg; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java new file mode 100644 index 0000000000..1a4227a5fc --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java @@ -0,0 +1,68 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge.rpc.processor.notification; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.NotificationTemplateId; +import org.thingsboard.server.common.data.notification.template.NotificationTemplate; +import org.thingsboard.server.dao.notification.NotificationTemplateService; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.NotificationTemplateUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; + +@Slf4j +@Component +@TbCoreComponent +public class NotificationTemplateEdgeProcessor extends BaseEdgeProcessor { + + @Autowired + private NotificationTemplateService notificationTemplateService; + + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + NotificationTemplateId notificationTemplateId = new NotificationTemplateId(edgeEvent.getEntityId()); + DownlinkMsg downlinkMsg = null; + switch (edgeEvent.getAction()) { + case ADDED, UPDATED -> { + NotificationTemplate notificationTemplate = notificationTemplateService.findNotificationTemplateById(edgeEvent.getTenantId(), notificationTemplateId); + if (notificationTemplate != null) { + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + NotificationTemplateUpdateMsg notificationTemplateUpdateMsg = EdgeMsgConstructorUtils.constructNotificationTemplateUpdateMsg(msgType, notificationTemplate); + downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addNotificationTemplateUpdateMsg(notificationTemplateUpdateMsg) + .build(); + } + } + case DELETED -> { + NotificationTemplateUpdateMsg notificationTemplateUpdateMsg = EdgeMsgConstructorUtils.constructNotificationTemplateDeleteMsg(notificationTemplateId); + downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addNotificationTemplateUpdateMsg(notificationTemplateUpdateMsg) + .build(); + } + } + return downlinkMsg; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2EdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java similarity index 53% rename from application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2EdgeProcessor.java rename to application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java index 9f4af7d0dc..a6016c97d9 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2EdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java @@ -22,55 +22,46 @@ import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.domain.DomainInfo; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.DomainId; -import org.thingsboard.server.common.data.id.OAuth2ClientId; import org.thingsboard.server.common.data.oauth2.OAuth2Client; import org.thingsboard.server.dao.domain.DomainService; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.OAuth2ClientUpdateMsg; import org.thingsboard.server.gen.edge.v1.OAuth2DomainUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.oauth2.OAuth2MsgConstructor; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; @Slf4j @Component @TbCoreComponent -public class OAuth2EdgeProcessor extends BaseEdgeProcessor { +public class DomainEdgeProcessor extends BaseEdgeProcessor { @Autowired private DomainService domainService; - @Autowired - private OAuth2MsgConstructor oAuth2MsgConstructor; - - public DownlinkMsg convertOAuth2DomainEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0)) { - return null; - } + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { DomainId domainId = new DomainId(edgeEvent.getEntityId()); - switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { DomainInfo domainInfo = domainService.findDomainInfoById(edgeEvent.getTenantId(), domainId); if (domainInfo != null && domainInfo.isPropagateToEdge()) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - OAuth2DomainUpdateMsg oAuth2DomainUpdateMsg = oAuth2MsgConstructor.constructOAuth2DomainUpdateMsg(msgType, domainInfo); + OAuth2DomainUpdateMsg oAuth2DomainUpdateMsg = EdgeMsgConstructorUtils.constructOAuth2DomainUpdateMsg(msgType, domainInfo); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addOAuth2DomainUpdateMsg(oAuth2DomainUpdateMsg); domainInfo.getOauth2ClientInfos().forEach(clientInfo -> { OAuth2Client oauth2Client = edgeCtx.getOAuth2ClientService().findOAuth2ClientById(edgeEvent.getTenantId(), clientInfo.getId()); - OAuth2ClientUpdateMsg oAuth2ClientUpdateMsg = oAuth2MsgConstructor.constructOAuth2ClientUpdateMsg(msgType, oauth2Client); + OAuth2ClientUpdateMsg oAuth2ClientUpdateMsg = EdgeMsgConstructorUtils.constructOAuth2ClientUpdateMsg(msgType, oauth2Client); builder.addOAuth2ClientUpdateMsg(oAuth2ClientUpdateMsg); }); return builder.build(); } } case DELETED -> { - OAuth2DomainUpdateMsg oAuth2DomainUpdateMsg = oAuth2MsgConstructor.constructOAuth2DomainDeleteMsg(domainId); + OAuth2DomainUpdateMsg oAuth2DomainUpdateMsg = EdgeMsgConstructorUtils.constructOAuth2DomainDeleteMsg(domainId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addOAuth2DomainUpdateMsg(oAuth2DomainUpdateMsg) @@ -80,37 +71,4 @@ public class OAuth2EdgeProcessor extends BaseEdgeProcessor { return null; } - public DownlinkMsg convertOAuth2ClientEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0)) { - return null; - } - OAuth2ClientId oAuth2ClientId = new OAuth2ClientId(edgeEvent.getEntityId()); - - switch (edgeEvent.getAction()) { - case ADDED, UPDATED -> { - boolean isPropagateToEdge = edgeCtx.getOAuth2ClientService().isPropagateOAuth2ClientToEdge(edgeEvent.getTenantId(), oAuth2ClientId); - if (!isPropagateToEdge) { - return null; - } - OAuth2Client oAuth2Client = edgeCtx.getOAuth2ClientService().findOAuth2ClientById(edgeEvent.getTenantId(), oAuth2ClientId); - if (oAuth2Client != null) { - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - OAuth2ClientUpdateMsg oAuth2ClientUpdateMsg = oAuth2MsgConstructor.constructOAuth2ClientUpdateMsg(msgType, oAuth2Client); - return DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addOAuth2ClientUpdateMsg(oAuth2ClientUpdateMsg) - .build(); - } - } - case DELETED -> { - OAuth2ClientUpdateMsg oAuth2ClientDeleteMsg = oAuth2MsgConstructor.constructOAuth2ClientDeleteMsg(oAuth2ClientId); - return DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addOAuth2ClientUpdateMsg(oAuth2ClientDeleteMsg) - .build(); - } - } - return null; - } - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java new file mode 100644 index 0000000000..cc1c361824 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java @@ -0,0 +1,67 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge.rpc.processor.oauth2; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.OAuth2ClientId; +import org.thingsboard.server.common.data.oauth2.OAuth2Client; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.OAuth2ClientUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; + +@Slf4j +@Component +@TbCoreComponent +public class OAuth2ClientEdgeProcessor extends BaseEdgeProcessor { + + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + OAuth2ClientId oAuth2ClientId = new OAuth2ClientId(edgeEvent.getEntityId()); + + switch (edgeEvent.getAction()) { + case ADDED, UPDATED -> { + boolean isPropagateToEdge = edgeCtx.getOAuth2ClientService().isPropagateOAuth2ClientToEdge(edgeEvent.getTenantId(), oAuth2ClientId); + if (!isPropagateToEdge) { + return null; + } + OAuth2Client oAuth2Client = edgeCtx.getOAuth2ClientService().findOAuth2ClientById(edgeEvent.getTenantId(), oAuth2ClientId); + if (oAuth2Client != null) { + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + OAuth2ClientUpdateMsg oAuth2ClientUpdateMsg = EdgeMsgConstructorUtils.constructOAuth2ClientUpdateMsg(msgType, oAuth2Client); + return DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addOAuth2ClientUpdateMsg(oAuth2ClientUpdateMsg) + .build(); + } + } + case DELETED -> { + OAuth2ClientUpdateMsg oAuth2ClientDeleteMsg = EdgeMsgConstructorUtils.constructOAuth2ClientDeleteMsg(oAuth2ClientId); + return DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addOAuth2ClientUpdateMsg(oAuth2ClientDeleteMsg) + .build(); + } + } + return null; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java index fc803caf4d..c09d735f5b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java @@ -16,38 +16,32 @@ package org.thingsboard.server.service.edge.rpc.processor.ota; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.OtaPackage; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.OtaPackageId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.ota.OtaPackageMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.ota.OtaPackageMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; -@Component @Slf4j +@Component @TbCoreComponent public class OtaPackageEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private OtaPackageMsgConstructorFactory otaPackageMsgConstructorFactory; - - public DownlinkMsg convertOtaPackageEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { OtaPackageId otaPackageId = new OtaPackageId(edgeEvent.getEntityId()); - var msgConstructor = (OtaPackageMsgConstructor) otaPackageMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { OtaPackage otaPackage = edgeCtx.getOtaPackageService().findOtaPackageById(edgeEvent.getTenantId(), otaPackageId); if (otaPackage != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - OtaPackageUpdateMsg otaPackageUpdateMsg = msgConstructor.constructOtaPackageUpdatedMsg(msgType, otaPackage); + OtaPackageUpdateMsg otaPackageUpdateMsg = EdgeMsgConstructorUtils.constructOtaPackageUpdatedMsg(msgType, otaPackage); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addOtaPackageUpdateMsg(otaPackageUpdateMsg) @@ -55,7 +49,7 @@ public class OtaPackageEdgeProcessor extends BaseEdgeProcessor { } } case DELETED -> { - OtaPackageUpdateMsg otaPackageUpdateMsg = msgConstructor.constructOtaPackageDeleteMsg(otaPackageId); + OtaPackageUpdateMsg otaPackageUpdateMsg = EdgeMsgConstructorUtils.constructOtaPackageDeleteMsg(otaPackageId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addOtaPackageUpdateMsg(otaPackageUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java index 76f068ac7a..937049f447 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java @@ -16,19 +16,16 @@ package org.thingsboard.server.service.edge.rpc.processor.queue; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.QueueId; import org.thingsboard.server.common.data.queue.Queue; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.queue.QueueMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.queue.QueueMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j @@ -36,18 +33,15 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @TbCoreComponent public class QueueEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private QueueMsgConstructorFactory queueMsgConstructorFactory; - - public DownlinkMsg convertQueueEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { QueueId queueId = new QueueId(edgeEvent.getEntityId()); - var msgConstructor = (QueueMsgConstructor) queueMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { Queue queue = edgeCtx.getQueueService().findQueueById(edgeEvent.getTenantId(), queueId); if (queue != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - QueueUpdateMsg queueUpdateMsg = msgConstructor.constructQueueUpdatedMsg(msgType, queue); + QueueUpdateMsg queueUpdateMsg = EdgeMsgConstructorUtils.constructQueueUpdatedMsg(msgType, queue); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addQueueUpdateMsg(queueUpdateMsg) @@ -55,7 +49,7 @@ public class QueueEdgeProcessor extends BaseEdgeProcessor { } } case DELETED -> { - QueueUpdateMsg queueDeleteMsg = msgConstructor.constructQueueDeleteMsg(queueId); + QueueUpdateMsg queueDeleteMsg = EdgeMsgConstructorUtils.constructQueueDeleteMsg(queueId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addQueueUpdateMsg(queueDeleteMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java index 0c6da73a25..488e065a26 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.relation; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; @@ -29,7 +30,7 @@ public abstract class BaseRelationProcessor extends BaseEdgeProcessor { protected ListenableFuture processRelationMsg(TenantId tenantId, RelationUpdateMsg relationUpdateMsg) { log.trace("[{}] processRelationMsg [{}]", tenantId, relationUpdateMsg); try { - EntityRelation entityRelation = constructEntityRelationFromUpdateMsg(relationUpdateMsg); + EntityRelation entityRelation = JacksonUtil.fromString(relationUpdateMsg.getEntity(), EntityRelation.class, true); if (entityRelation == null) { throw new RuntimeException("[{" + tenantId + "}] relationUpdateMsg {" + relationUpdateMsg + "} cannot be converted to entity relation"); } @@ -56,6 +57,4 @@ public abstract class BaseRelationProcessor extends BaseEdgeProcessor { return Futures.immediateFuture(null); } - protected abstract EntityRelation constructEntityRelationFromUpdateMsg(RelationUpdateMsg relationUpdateMsg); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java index 87b9797620..bc9b955033 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java @@ -18,7 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.relation; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.EntityType; @@ -30,12 +30,11 @@ import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; -import org.thingsboard.server.service.edge.rpc.constructor.relation.RelationMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.relation.RelationMsgConstructorFactory; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.ArrayList; import java.util.HashSet; @@ -43,10 +42,9 @@ import java.util.List; import java.util.Set; @Slf4j -public abstract class RelationEdgeProcessor extends BaseRelationProcessor implements RelationProcessor { - - @Autowired - private RelationMsgConstructorFactory relationMsgConstructorFactory; +@Component +@TbCoreComponent +public class RelationEdgeProcessor extends BaseRelationProcessor implements RelationProcessor { @Override public ListenableFuture processRelationMsgFromEdge(TenantId tenantId, Edge edge, RelationUpdateMsg relationUpdateMsg) { @@ -60,18 +58,7 @@ public abstract class RelationEdgeProcessor extends BaseRelationProcessor implem } @Override - public DownlinkMsg convertRelationEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { - EntityRelation entityRelation = JacksonUtil.convertValue(edgeEvent.getBody(), EntityRelation.class); - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - RelationUpdateMsg relationUpdateMsg = ((RelationMsgConstructor) relationMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion)) - .constructRelationUpdatedMsg(msgType, entityRelation); - return DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addRelationUpdateMsg(relationUpdateMsg) - .build(); - } - - public ListenableFuture processRelationNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { + public ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { EntityRelation relation = JacksonUtil.fromString(edgeNotificationMsg.getBody(), EntityRelation.class); if (relation == null || (relation.getFrom().getEntityType().equals(EntityType.EDGE) || relation.getTo().getEntityType().equals(EntityType.EDGE))) { return Futures.immediateFuture(null); @@ -97,4 +84,15 @@ public abstract class RelationEdgeProcessor extends BaseRelationProcessor implem return Futures.transform(Futures.allAsList(futures), voids -> null, dbCallbackExecutorService); } + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + EntityRelation entityRelation = JacksonUtil.convertValue(edgeEvent.getBody(), EntityRelation.class); + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + RelationUpdateMsg relationUpdateMsg = EdgeMsgConstructorUtils.constructRelationUpdatedMsg(msgType, entityRelation); + return DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addRelationUpdateMsg(relationUpdateMsg) + .build(); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorFactory.java deleted file mode 100644 index 3dea55205e..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.relation; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class RelationEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV1.java deleted file mode 100644 index 647cec120a..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV1.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.relation; - -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityType; -import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.EntityIdFactory; -import org.thingsboard.server.common.data.relation.EntityRelation; -import org.thingsboard.server.common.data.relation.RelationTypeGroup; -import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import java.util.UUID; - -@Component -@TbCoreComponent -public class RelationEdgeProcessorV1 extends RelationEdgeProcessor { - - @Override - protected EntityRelation constructEntityRelationFromUpdateMsg(RelationUpdateMsg relationUpdateMsg) { - EntityRelation entityRelation = new EntityRelation(); - - UUID fromUUID = new UUID(relationUpdateMsg.getFromIdMSB(), relationUpdateMsg.getFromIdLSB()); - EntityId fromId = EntityIdFactory.getByTypeAndUuid(EntityType.valueOf(relationUpdateMsg.getFromEntityType()), fromUUID); - entityRelation.setFrom(fromId); - - UUID toUUID = new UUID(relationUpdateMsg.getToIdMSB(), relationUpdateMsg.getToIdLSB()); - EntityId toId = EntityIdFactory.getByTypeAndUuid(EntityType.valueOf(relationUpdateMsg.getToEntityType()), toUUID); - entityRelation.setTo(toId); - - entityRelation.setType(relationUpdateMsg.getType()); - entityRelation.setTypeGroup(relationUpdateMsg.hasTypeGroup() - ? RelationTypeGroup.valueOf(relationUpdateMsg.getTypeGroup()) : RelationTypeGroup.COMMON); - entityRelation.setAdditionalInfo(JacksonUtil.toJsonNode(relationUpdateMsg.getAdditionalInfo())); - return entityRelation; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV2.java deleted file mode 100644 index 7b31da421d..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessorV2.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.relation; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.relation.EntityRelation; -import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class RelationEdgeProcessorV2 extends RelationEdgeProcessor { - - @Override - protected EntityRelation constructEntityRelationFromUpdateMsg(RelationUpdateMsg relationUpdateMsg) { - return JacksonUtil.fromString(relationUpdateMsg.getEntity(), EntityRelation.class, true); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationProcessor.java index 82a893e9ba..d3d31cd780 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationProcessor.java @@ -17,10 +17,7 @@ package org.thingsboard.server.service.edge.rpc.processor.relation; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; @@ -28,6 +25,4 @@ public interface RelationProcessor extends EdgeProcessor { ListenableFuture processRelationMsgFromEdge(TenantId tenantId, Edge edge, RelationUpdateMsg relationUpdateMsg); - DownlinkMsg convertRelationEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java index ac7bd6768c..11a0d70211 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.resource; import com.datastax.oss.driver.api.core.uuid.Uuids; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.TbResource; @@ -38,7 +39,7 @@ public abstract class BaseResourceProcessor extends BaseEdgeProcessor { protected boolean saveOrUpdateTbResource(TenantId tenantId, TbResourceId tbResourceId, ResourceUpdateMsg resourceUpdateMsg) { boolean resourceKeyUpdated = false; try { - TbResource resource = constructResourceFromUpdateMsg(tenantId, tbResourceId, resourceUpdateMsg); + TbResource resource = JacksonUtil.fromString(resourceUpdateMsg.getEntity(), TbResource.class, true); if (resource == null) { throw new RuntimeException("[{" + tenantId + "}] resourceUpdateMsg {" + resourceUpdateMsg + " } cannot be converted to resource"); } @@ -76,6 +77,4 @@ public abstract class BaseResourceProcessor extends BaseEdgeProcessor { return resourceKeyUpdated; } - protected abstract TbResource constructResourceFromUpdateMsg(TenantId tenantId, TbResourceId tbResourceId, ResourceUpdateMsg resourceUpdateMsg); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java index 10c58e89d0..1d5ebc188f 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java @@ -18,7 +18,7 @@ package org.thingsboard.server.service.edge.rpc.processor.resource; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.TbResource; import org.thingsboard.server.common.data.edge.Edge; @@ -29,19 +29,17 @@ import org.thingsboard.server.common.data.id.TbResourceId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.constructor.resource.ResourceMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.resource.ResourceMsgConstructorFactory; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; @Slf4j -public abstract class ResourceEdgeProcessor extends BaseResourceProcessor implements ResourceProcessor { - - @Autowired - private ResourceMsgConstructorFactory resourceMsgConstructorFactory; +@Component +@TbCoreComponent +public class ResourceEdgeProcessor extends BaseResourceProcessor implements ResourceProcessor { @Override public ListenableFuture processResourceMsgFromEdge(TenantId tenantId, Edge edge, ResourceUpdateMsg resourceUpdateMsg) { @@ -75,23 +73,22 @@ public abstract class ResourceEdgeProcessor extends BaseResourceProcessor implem } @Override - public DownlinkMsg convertResourceEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { TbResourceId tbResourceId = new TbResourceId(edgeEvent.getEntityId()); - var msgConstructor = (ResourceMsgConstructor) resourceMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { TbResource tbResource = edgeCtx.getResourceService().findResourceById(edgeEvent.getTenantId(), tbResourceId); if (tbResource != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - ResourceUpdateMsg resourceUpdateMsg = msgConstructor.constructResourceUpdatedMsg(msgType, tbResource); - return resourceUpdateMsg != null ? DownlinkMsg.newBuilder() + ResourceUpdateMsg resourceUpdateMsg = EdgeMsgConstructorUtils.constructResourceUpdatedMsg(msgType, tbResource); + return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addResourceUpdateMsg(resourceUpdateMsg) - .build() : null; + .build(); } } case DELETED -> { - ResourceUpdateMsg resourceUpdateMsg = msgConstructor.constructResourceDeleteMsg(tbResourceId); + ResourceUpdateMsg resourceUpdateMsg = EdgeMsgConstructorUtils.constructResourceDeleteMsg(tbResourceId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addResourceUpdateMsg(resourceUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorFactory.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorFactory.java deleted file mode 100644 index 9f45aacdeb..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.resource; - -import org.springframework.stereotype.Component; -import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessorFactory; - -@Component -@TbCoreComponent -public class ResourceEdgeProcessorFactory extends BaseEdgeProcessorFactory { - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV1.java deleted file mode 100644 index f272d447a4..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV1.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.resource; - -import com.datastax.oss.driver.api.core.uuid.Uuids; -import org.springframework.stereotype.Component; -import org.thingsboard.server.common.data.ResourceType; -import org.thingsboard.server.common.data.TbResource; -import org.thingsboard.server.common.data.id.TbResourceId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Component -@TbCoreComponent -public class ResourceEdgeProcessorV1 extends ResourceEdgeProcessor { - - @Override - protected TbResource constructResourceFromUpdateMsg(TenantId tenantId, TbResourceId tbResourceId, ResourceUpdateMsg resourceUpdateMsg) { - TbResource resource = new TbResource(); - if (resourceUpdateMsg.getIsSystem()) { - resource.setTenantId(TenantId.SYS_TENANT_ID); - } else { - resource.setTenantId(tenantId); - } - resource.setCreatedTime(Uuids.unixTimestamp(tbResourceId.getId())); - resource.setTitle(resourceUpdateMsg.getTitle()); - resource.setResourceKey(resourceUpdateMsg.getResourceKey()); - resource.setResourceType(ResourceType.valueOf(resourceUpdateMsg.getResourceType())); - resource.setFileName(resourceUpdateMsg.getFileName()); - resource.setEncodedData(resourceUpdateMsg.hasData() ? resourceUpdateMsg.getData() : null); - resource.setEtag(resourceUpdateMsg.hasEtag() ? resourceUpdateMsg.getEtag() : null); - return resource; - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV2.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV2.java deleted file mode 100644 index 108a6c8ecb..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessorV2.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge.rpc.processor.resource; - -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.TbResource; -import org.thingsboard.server.common.data.id.TbResourceId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; -import org.thingsboard.server.queue.util.TbCoreComponent; - -@Primary -@Component -@TbCoreComponent -public class ResourceEdgeProcessorV2 extends ResourceEdgeProcessor { - - @Override - protected TbResource constructResourceFromUpdateMsg(TenantId tenantId, TbResourceId tbResourceId, ResourceUpdateMsg resourceUpdateMsg) { - return JacksonUtil.fromString(resourceUpdateMsg.getEntity(), TbResource.class, true); - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceProcessor.java index a52d31a98b..5ed1f7c363 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceProcessor.java @@ -17,10 +17,7 @@ package org.thingsboard.server.service.edge.rpc.processor.resource; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.Edge; -import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.EdgeProcessor; @@ -28,6 +25,4 @@ public interface ResourceProcessor extends EdgeProcessor { ListenableFuture processResourceMsgFromEdge(TenantId tenantId, Edge edge, ResourceUpdateMsg resourceUpdateMsg); - DownlinkMsg convertResourceEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion); - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java index 6df069e400..72d6565b92 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.edge.rpc.processor.rule; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.Edge; @@ -25,13 +24,11 @@ import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.rule.RuleChainMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.rule.RuleChainMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; import static org.thingsboard.server.dao.edge.EdgeServiceImpl.EDGE_IS_ROOT_BODY_KEY; @@ -41,13 +38,10 @@ import static org.thingsboard.server.dao.edge.EdgeServiceImpl.EDGE_IS_ROOT_BODY_ @TbCoreComponent public class RuleChainEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private RuleChainMsgConstructorFactory ruleChainMsgConstructorFactory; - - public DownlinkMsg convertRuleChainEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { RuleChainId ruleChainId = new RuleChainId(edgeEvent.getEntityId()); DownlinkMsg downlinkMsg = null; - var msgConstructor = (RuleChainMsgConstructor) ruleChainMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE -> { RuleChain ruleChain = edgeCtx.getRuleChainService().findRuleChainById(edgeEvent.getTenantId(), ruleChainId); @@ -64,46 +58,25 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { isRoot = edge.getRootRuleChainId().equals(ruleChainId); } UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - RuleChainUpdateMsg ruleChainUpdateMsg = msgConstructor.constructRuleChainUpdatedMsg(msgType, ruleChain, isRoot); + RuleChainUpdateMsg ruleChainUpdateMsg = EdgeMsgConstructorUtils.constructRuleChainUpdatedMsg(msgType, ruleChain, isRoot); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addRuleChainUpdateMsg(ruleChainUpdateMsg); RuleChainMetaData ruleChainMetaData = edgeCtx.getRuleChainService().loadRuleChainMetaData(edgeEvent.getTenantId(), ruleChainId); - RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = msgConstructor - .constructRuleChainMetadataUpdatedMsg(edgeEvent.getTenantId(), msgType, ruleChainMetaData, edgeVersion); - if (ruleChainMetadataUpdateMsg != null) { - builder.addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg); - } + RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = EdgeMsgConstructorUtils + .constructRuleChainMetadataUpdatedMsg(msgType, ruleChainMetaData); + builder.addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg); downlinkMsg = builder.build(); } } case DELETED, UNASSIGNED_FROM_EDGE -> downlinkMsg = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addRuleChainUpdateMsg(msgConstructor.constructRuleChainDeleteMsg(ruleChainId)) + .addRuleChainUpdateMsg(EdgeMsgConstructorUtils.constructRuleChainDeleteMsg(ruleChainId)) .build(); } return downlinkMsg; } - public DownlinkMsg convertRuleChainMetadataEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { - RuleChainId ruleChainId = new RuleChainId(edgeEvent.getEntityId()); - RuleChain ruleChain = edgeCtx.getRuleChainService().findRuleChainById(edgeEvent.getTenantId(), ruleChainId); - var msgConstructor = (RuleChainMsgConstructor) ruleChainMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); - if (ruleChain != null) { - RuleChainMetaData ruleChainMetaData = edgeCtx.getRuleChainService().loadRuleChainMetaData(edgeEvent.getTenantId(), ruleChainId); - UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = msgConstructor - .constructRuleChainMetadataUpdatedMsg(edgeEvent.getTenantId(), msgType, ruleChainMetaData, edgeVersion); - if (ruleChainMetadataUpdateMsg != null) { - return DownlinkMsg.newBuilder() - .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg) - .build(); - } - } - return null; - } - } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java new file mode 100644 index 0000000000..eedfc835ae --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java @@ -0,0 +1,54 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge.rpc.processor.rule; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.RuleChainId; +import org.thingsboard.server.common.data.rule.RuleChain; +import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; + +@Slf4j +@Component +@TbCoreComponent +public class RuleChainMetadataEdgeProcessor extends BaseEdgeProcessor { + + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + RuleChainId ruleChainId = new RuleChainId(edgeEvent.getEntityId()); + RuleChain ruleChain = edgeCtx.getRuleChainService().findRuleChainById(edgeEvent.getTenantId(), ruleChainId); + if (ruleChain != null) { + RuleChainMetaData ruleChainMetaData = edgeCtx.getRuleChainService().loadRuleChainMetaData(edgeEvent.getTenantId(), ruleChainId); + UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); + RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = EdgeMsgConstructorUtils + .constructRuleChainMetadataUpdatedMsg(msgType, ruleChainMetaData); + return DownlinkMsg.newBuilder() + .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) + .addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg) + .build(); + } + return null; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java index 3c0d4fb99c..bdfa597ae7 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.edge.rpc.processor.settings; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.AdminSettings; @@ -24,10 +23,7 @@ import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.settings.AdminSettingsMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.settings.AdminSettingsMsgConstructorFactory; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j @@ -35,19 +31,16 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @TbCoreComponent public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private AdminSettingsMsgConstructorFactory adminSettingsMsgConstructorFactory; - - public DownlinkMsg convertAdminSettingsEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { AdminSettings adminSettings = JacksonUtil.convertValue(edgeEvent.getBody(), AdminSettings.class); if (adminSettings == null) { return null; } - AdminSettingsUpdateMsg adminSettingsUpdateMsg = ((AdminSettingsMsgConstructor) - adminSettingsMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion)).constructAdminSettingsUpdateMsg(adminSettings); + AdminSettingsUpdateMsg msg = AdminSettingsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(adminSettings)).build(); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addAdminSettingsUpdateMsg(adminSettingsUpdateMsg) + .addAdminSettingsUpdateMsg(msg) .build(); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java index d94d4d8939..1f426c9982 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java @@ -70,7 +70,7 @@ import org.thingsboard.server.queue.TbQueueProducer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.provider.TbQueueProducerProvider; -import org.thingsboard.server.service.edge.rpc.constructor.telemetry.EntityDataMsgConstructor; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; @@ -83,9 +83,6 @@ import java.util.UUID; @Slf4j public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { - @Autowired - private EntityDataMsgConstructor entityDataMsgConstructor; - @Autowired private PartitionService partitionService; @@ -356,8 +353,7 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { } } String bodyJackson = JacksonUtil.toString(body); - return bodyJackson == null ? null : - entityDataMsgConstructor.constructEntityDataMsg(tenantId, entityId, actionType, JsonParser.parseString(bodyJackson)); + return bodyJackson == null ? null : EdgeMsgConstructorUtils.constructEntityDataMsg(tenantId, entityId, actionType, JsonParser.parseString(bodyJackson)); } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java index aa6795b123..311975501d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.edge.rpc.processor.tenant; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.Tenant; @@ -25,13 +24,11 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.tenant.TenantMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.tenant.TenantMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j @@ -39,19 +36,16 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @TbCoreComponent public class TenantEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private TenantMsgConstructorFactory tenantMsgConstructorFactory; - - public DownlinkMsg convertTenantEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { TenantId tenantId = TenantId.fromUUID(edgeEvent.getEntityId()); - var msgConstructor = ((TenantMsgConstructor) tenantMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion)); if (EdgeEventActionType.UPDATED.equals(edgeEvent.getAction())) { Tenant tenant = edgeCtx.getTenantService().findTenantById(tenantId); if (tenant != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - TenantUpdateMsg tenantUpdateMsg = msgConstructor.constructTenantUpdateMsg(msgType, tenant); + TenantUpdateMsg tenantUpdateMsg = EdgeMsgConstructorUtils.constructTenantUpdateMsg(msgType, tenant); TenantProfile tenantProfile = edgeCtx.getTenantProfileService().findTenantProfileById(tenantId, tenant.getTenantProfileId()); - TenantProfileUpdateMsg tenantProfileUpdateMsg = msgConstructor.constructTenantProfileUpdateMsg(msgType, tenantProfile, edgeVersion); + TenantProfileUpdateMsg tenantProfileUpdateMsg = EdgeMsgConstructorUtils.constructTenantProfileUpdateMsg(msgType, tenantProfile); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addTenantUpdateMsg(tenantUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java index 07ba6039af..b02a8e2ce3 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.edge.rpc.processor.tenant; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.TenantProfile; @@ -24,12 +23,10 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.id.TenantProfileId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.tenant.TenantMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.tenant.TenantMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j @@ -37,17 +34,14 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @TbCoreComponent public class TenantProfileEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private TenantMsgConstructorFactory tenantMsgConstructorFactory; - - public DownlinkMsg convertTenantProfileEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { TenantProfileId tenantProfileId = new TenantProfileId(edgeEvent.getEntityId()); - var msgConstructor = ((TenantMsgConstructor) tenantMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion)); if (EdgeEventActionType.UPDATED.equals(edgeEvent.getAction())) { TenantProfile tenantProfile = edgeCtx.getTenantProfileService().findTenantProfileById(edgeEvent.getTenantId(), tenantProfileId); if (tenantProfile != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - TenantProfileUpdateMsg tenantProfileUpdateMsg = msgConstructor.constructTenantProfileUpdateMsg(msgType, tenantProfile, edgeVersion); + TenantProfileUpdateMsg tenantProfileUpdateMsg = EdgeMsgConstructorUtils.constructTenantProfileUpdateMsg(msgType, tenantProfile); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addTenantProfileUpdateMsg(tenantProfileUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java index 319812a33b..1d2f1f364a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.edge.rpc.processor.user; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.User; @@ -24,12 +23,10 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.user.UserMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.user.UserMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j @@ -37,12 +34,9 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @TbCoreComponent public class UserEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private UserMsgConstructorFactory userMsgConstructorFactory; - - public DownlinkMsg convertUserEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { UserId userId = new UserId(edgeEvent.getEntityId()); - var msgConstructor = (UserMsgConstructor) userMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { User user = edgeCtx.getUserService().findUserById(edgeEvent.getTenantId(), userId); @@ -50,10 +44,10 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addUserUpdateMsg(msgConstructor.constructUserUpdatedMsg(msgType, user)); + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserUpdatedMsg(msgType, user)); UserCredentials userCredentialsByUserId = edgeCtx.getUserService().findUserCredentialsByUserId(edgeEvent.getTenantId(), userId); if (userCredentialsByUserId != null && userCredentialsByUserId.isEnabled()) { - builder.addUserCredentialsUpdateMsg(msgConstructor.constructUserCredentialsUpdatedMsg(userCredentialsByUserId)); + builder.addUserCredentialsUpdateMsg(EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentialsByUserId)); } return builder.build(); } @@ -61,13 +55,13 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { case DELETED -> { return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) - .addUserUpdateMsg(msgConstructor.constructUserDeleteMsg(userId)) + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserDeleteMsg(userId)) .build(); } case CREDENTIALS_UPDATED -> { UserCredentials userCredentialsByUserId = edgeCtx.getUserService().findUserCredentialsByUserId(edgeEvent.getTenantId(), userId); if (userCredentialsByUserId != null && userCredentialsByUserId.isEnabled()) { - UserCredentialsUpdateMsg userCredentialsUpdateMsg = msgConstructor.constructUserCredentialsUpdatedMsg(userCredentialsByUserId); + UserCredentialsUpdateMsg userCredentialsUpdateMsg = EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentialsByUserId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addUserCredentialsUpdateMsg(userCredentialsUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java index 87eece2841..5ea5817639 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java @@ -16,19 +16,16 @@ package org.thingsboard.server.service.edge.rpc.processor.widget; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.WidgetsBundleId; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.widget.WidgetMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.widget.WidgetMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; import java.util.List; @@ -38,19 +35,16 @@ import java.util.List; @TbCoreComponent public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private WidgetMsgConstructorFactory widgetMsgConstructorFactory; - - public DownlinkMsg convertWidgetsBundleEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { WidgetsBundleId widgetsBundleId = new WidgetsBundleId(edgeEvent.getEntityId()); - var msgConstructor = ((WidgetMsgConstructor) widgetMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion)); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { WidgetsBundle widgetsBundle = edgeCtx.getWidgetsBundleService().findWidgetsBundleById(edgeEvent.getTenantId(), widgetsBundleId); if (widgetsBundle != null) { List widgets = edgeCtx.getWidgetTypeService().findWidgetFqnsByWidgetsBundleId(edgeEvent.getTenantId(), widgetsBundleId); UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - WidgetsBundleUpdateMsg widgetsBundleUpdateMsg = msgConstructor.constructWidgetsBundleUpdateMsg(msgType, widgetsBundle, widgets); + WidgetsBundleUpdateMsg widgetsBundleUpdateMsg = EdgeMsgConstructorUtils.constructWidgetsBundleUpdateMsg(msgType, widgetsBundle, widgets); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addWidgetsBundleUpdateMsg(widgetsBundleUpdateMsg) @@ -58,7 +52,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { } } case DELETED -> { - WidgetsBundleUpdateMsg widgetsBundleUpdateMsg = msgConstructor.constructWidgetsBundleDeleteMsg(widgetsBundleId); + WidgetsBundleUpdateMsg widgetsBundleUpdateMsg = EdgeMsgConstructorUtils.constructWidgetsBundleDeleteMsg(widgetsBundleId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addWidgetsBundleUpdateMsg(widgetsBundleUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java index 10d2ce4e82..f3ea3ec1ef 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java @@ -16,19 +16,16 @@ package org.thingsboard.server.service.edge.rpc.processor.widget; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.id.WidgetTypeId; import org.thingsboard.server.common.data.widget.WidgetTypeDetails; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; -import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.edge.rpc.constructor.widget.WidgetMsgConstructor; -import org.thingsboard.server.service.edge.rpc.constructor.widget.WidgetMsgConstructorFactory; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j @@ -36,18 +33,15 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @TbCoreComponent public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { - @Autowired - private WidgetMsgConstructorFactory widgetMsgConstructorFactory; - - public DownlinkMsg convertWidgetTypeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { + @Override + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { WidgetTypeId widgetTypeId = new WidgetTypeId(edgeEvent.getEntityId()); - var msgConstructor = (WidgetMsgConstructor) widgetMsgConstructorFactory.getMsgConstructorByEdgeVersion(edgeVersion); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { WidgetTypeDetails widgetTypeDetails = edgeCtx.getWidgetTypeService().findWidgetTypeDetailsById(edgeEvent.getTenantId(), widgetTypeId); if (widgetTypeDetails != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); - WidgetTypeUpdateMsg widgetTypeUpdateMsg = msgConstructor.constructWidgetTypeUpdateMsg(msgType, widgetTypeDetails, edgeVersion); + WidgetTypeUpdateMsg widgetTypeUpdateMsg = EdgeMsgConstructorUtils.constructWidgetTypeUpdateMsg(msgType, widgetTypeDetails); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addWidgetTypeUpdateMsg(widgetTypeUpdateMsg) @@ -55,7 +49,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { } } case DELETED -> { - WidgetTypeUpdateMsg widgetTypeUpdateMsg = msgConstructor.constructWidgetTypeDeleteMsg(widgetTypeId); + WidgetTypeUpdateMsg widgetTypeUpdateMsg = EdgeMsgConstructorUtils.constructWidgetTypeDeleteMsg(widgetTypeId); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addWidgetTypeUpdateMsg(widgetTypeUpdateMsg) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java index f219d7ae69..68df0c5424 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java @@ -247,36 +247,7 @@ public class DefaultTbEdgeConsumerService extends AbstractConsumerService future; - switch (type) { - case EDGE -> future = edgeCtx.getEdgeProcessor().processEdgeNotification(tenantId, edgeNotificationMsg); - case ASSET -> future = edgeCtx.getAssetProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case ASSET_PROFILE -> future = edgeCtx.getAssetProfileProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case DEVICE -> future = edgeCtx.getDeviceProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case DEVICE_PROFILE -> future = edgeCtx.getDeviceProfileProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case ENTITY_VIEW -> future = edgeCtx.getEntityViewProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case DASHBOARD -> future = edgeCtx.getDashboardProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case RULE_CHAIN -> future = edgeCtx.getRuleChainProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case USER -> future = edgeCtx.getUserProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case CUSTOMER -> future = edgeCtx.getCustomerProcessor().processCustomerNotification(tenantId, edgeNotificationMsg); - case OTA_PACKAGE -> future = edgeCtx.getOtaPackageProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case WIDGETS_BUNDLE -> future = edgeCtx.getWidgetBundleProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case WIDGET_TYPE -> future = edgeCtx.getWidgetTypeProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case QUEUE -> future = edgeCtx.getQueueProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case ALARM -> future = edgeCtx.getAlarmProcessor().processAlarmNotification(tenantId, edgeNotificationMsg); - case ALARM_COMMENT -> future = edgeCtx.getAlarmProcessor().processAlarmCommentNotification(tenantId, edgeNotificationMsg); - case RELATION -> future = edgeCtx.getRelationProcessor().processRelationNotification(tenantId, edgeNotificationMsg); - case TENANT -> future = edgeCtx.getTenantProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case TENANT_PROFILE -> future = edgeCtx.getTenantProfileProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case NOTIFICATION_RULE, NOTIFICATION_TARGET, NOTIFICATION_TEMPLATE -> - future = edgeCtx.getNotificationEdgeProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case TB_RESOURCE -> future = edgeCtx.getResourceProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - case DOMAIN, OAUTH2_CLIENT -> future = edgeCtx.getOAuth2EdgeProcessor().processEntityNotification(tenantId, edgeNotificationMsg); - default -> { - future = Futures.immediateFuture(null); - log.warn("[{}] Edge event type [{}] is not designed to be pushed to edge", tenantId, type); - } - } + ListenableFuture future = edgeCtx.getProcessor(type).processEntityNotification(tenantId, edgeNotificationMsg); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(@Nullable Void unused) { diff --git a/common/edge-api/src/main/java/org/thingsboard/edge/rpc/EdgeGrpcClient.java b/common/edge-api/src/main/java/org/thingsboard/edge/rpc/EdgeGrpcClient.java index fcef33b968..3936b3ee63 100644 --- a/common/edge-api/src/main/java/org/thingsboard/edge/rpc/EdgeGrpcClient.java +++ b/common/edge-api/src/main/java/org/thingsboard/edge/rpc/EdgeGrpcClient.java @@ -136,7 +136,7 @@ public class EdgeGrpcClient implements EdgeRpcClient { .setConnectRequestMsg(ConnectRequestMsg.newBuilder() .setEdgeRoutingKey(edgeKey) .setEdgeSecret(edgeSecret) - .setEdgeVersion(EdgeVersion.V_3_9_0) + .setEdgeVersion(EdgeVersion.V_4_0_0) .setMaxInboundMessageSize(maxInboundMessageSize) .build()) .build()); diff --git a/common/edge-api/src/main/proto/edge.proto b/common/edge-api/src/main/proto/edge.proto index 4dc762e14c..79d80fc35f 100644 --- a/common/edge-api/src/main/proto/edge.proto +++ b/common/edge-api/src/main/proto/edge.proto @@ -41,6 +41,7 @@ enum EdgeVersion { V_3_7_0 = 7; V_3_8_0 = 8; V_3_9_0 = 9; + V_4_0_0 = 10; } /** @@ -92,12 +93,10 @@ message ConnectResponseMsg { } message SyncRequestMsg { - bool syncRequired = 1 [deprecated = true]; optional bool fullSync = 2; } -message SyncCompletedMsg { -} +message SyncCompletedMsg {} message EdgeConfiguration { int64 edgeIdMSB = 1; @@ -120,7 +119,7 @@ enum UpdateMsgType { ENTITY_DELETED_RPC_MESSAGE = 2; ALARM_ACK_RPC_MESSAGE = 3; ALARM_CLEAR_RPC_MESSAGE = 4; - ENTITY_MERGE_RPC_MESSAGE = 5 [deprecated = true]; + // use 6 as a next number } message EntityDataProto { @@ -143,68 +142,18 @@ message RuleChainUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string name = 4 [deprecated = true]; - optional int64 firstRuleNodeIdMSB = 5 [deprecated = true]; - optional int64 firstRuleNodeIdLSB = 6 [deprecated = true]; - bool root = 7 [deprecated = true]; - bool debugMode = 8 [deprecated = true]; - string configuration = 9 [deprecated = true]; string entity = 10; } message RuleChainMetadataUpdateMsg { UpdateMsgType msgType = 1; - int64 ruleChainIdMSB = 2 [deprecated = true]; - int64 ruleChainIdLSB = 3 [deprecated = true]; - int32 firstNodeIndex = 4 [deprecated = true]; - repeated RuleNodeProto nodes = 5 [deprecated = true]; - repeated NodeConnectionInfoProto connections = 6 [deprecated = true]; - repeated RuleChainConnectionInfoProto ruleChainConnections = 7 [deprecated = true]; string entity = 8; } -message RuleNodeProto { - option deprecated = true; - int64 idMSB = 1; - int64 idLSB = 2; - string type = 3; - string name = 4; - bool debugMode = 5 [deprecated = true]; - string configuration = 6; - string additionalInfo = 7; - bool singletonMode = 8; - int32 configurationVersion = 9; - string debugSettings = 10; -} - -message NodeConnectionInfoProto { - option deprecated = true; - int32 fromIndex = 1; - int32 toIndex = 2; - string type = 3; -} - -message RuleChainConnectionInfoProto { - option deprecated = true; - int32 fromIndex = 1; - int64 targetRuleChainIdMSB = 2; - int64 targetRuleChainIdLSB = 3; - string type = 4; - string additionalInfo = 5; -} - message DashboardUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - optional int64 customerIdMSB = 4 [deprecated = true]; - optional int64 customerIdLSB = 5 [deprecated = true]; - string title = 6 [deprecated = true]; - string configuration = 7 [deprecated = true]; - optional string assignedCustomers = 8 [deprecated = true]; - optional string image = 9 [deprecated = true]; - optional int32 mobileOrder = 10 [deprecated = true]; - bool mobileHide = 11 [deprecated = true]; string entity = 12; } @@ -212,20 +161,6 @@ message DeviceUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - optional int64 customerIdMSB = 4 [deprecated = true]; - optional int64 customerIdLSB = 5 [deprecated = true]; - optional int64 deviceProfileIdMSB = 6 [deprecated = true]; - optional int64 deviceProfileIdLSB = 7 [deprecated = true]; - string name = 8 [deprecated = true]; - string type = 9 [deprecated = true]; - optional string label = 10 [deprecated = true]; - optional string additionalInfo = 11 [deprecated = true]; - optional string conflictName = 12 [deprecated = true]; - optional int64 firmwareIdMSB = 13 [deprecated = true]; - optional int64 firmwareIdLSB = 14 [deprecated = true]; - optional bytes deviceDataBytes = 15 [deprecated = true]; - optional int64 softwareIdMSB = 16 [deprecated = true]; - optional int64 softwareIdLSB = 17 [deprecated = true]; string entity = 18; } @@ -233,24 +168,6 @@ message DeviceProfileUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string name = 4 [deprecated = true]; - optional string description = 5 [deprecated = true]; - bool default = 6 [deprecated = true]; - string type = 7 [deprecated = true]; - optional string transportType = 8 [deprecated = true]; - optional string provisionType = 9 [deprecated = true]; - int64 defaultRuleChainIdMSB = 10 [deprecated = true]; - int64 defaultRuleChainIdLSB = 11 [deprecated = true]; - string defaultQueueName = 12 [deprecated = true]; - bytes profileDataBytes = 13 [deprecated = true]; - optional string provisionDeviceKey = 14 [deprecated = true]; - optional bytes image = 15 [deprecated = true]; - optional int64 firmwareIdMSB = 16 [deprecated = true]; - optional int64 firmwareIdLSB = 17 [deprecated = true]; - optional int64 softwareIdMSB = 18 [deprecated = true]; - optional int64 softwareIdLSB = 19 [deprecated = true]; - optional int64 defaultDashboardIdMSB = 20 [deprecated = true]; - optional int64 defaultDashboardIdLSB = 21 [deprecated = true]; string entity = 22; } @@ -258,24 +175,10 @@ message AssetProfileUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string name = 4 [deprecated = true]; - optional string description = 5 [deprecated = true]; - bool default = 6 [deprecated = true]; - int64 defaultRuleChainIdMSB = 7 [deprecated = true]; - int64 defaultRuleChainIdLSB = 8 [deprecated = true]; - int64 defaultDashboardIdMSB = 9 [deprecated = true]; - int64 defaultDashboardIdLSB = 10 [deprecated = true]; - optional string defaultQueueName = 11 [deprecated = true]; - optional bytes image = 12 [deprecated = true]; string entity = 13; } message DeviceCredentialsUpdateMsg { - int64 deviceIdMSB = 1 [deprecated = true]; - int64 deviceIdLSB = 2 [deprecated = true]; - string credentialsType = 3 [deprecated = true]; - string credentialsId = 4 [deprecated = true]; - optional string credentialsValue = 5 [deprecated = true]; string entity = 6; } @@ -283,14 +186,6 @@ message AssetUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - optional int64 customerIdMSB = 4 [deprecated = true]; - optional int64 customerIdLSB = 5 [deprecated = true]; - string name = 6 [deprecated = true]; - string type = 7 [deprecated = true]; - optional string label = 8 [deprecated = true]; - optional string additionalInfo = 9 [deprecated = true]; - optional int64 assetProfileIdMSB = 10 [deprecated = true]; - optional int64 assetProfileIdLSB = 11 [deprecated = true]; string entity = 12; } @@ -298,14 +193,6 @@ message EntityViewUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - optional int64 customerIdMSB = 4 [deprecated = true]; - optional int64 customerIdLSB = 5 [deprecated = true]; - string name = 6 [deprecated = true]; - string type = 7 [deprecated = true]; - int64 entityIdMSB = 8 [deprecated = true]; - int64 entityIdLSB = 9 [deprecated = true]; - EdgeEntityType entityType = 10 [deprecated = true]; - optional string additionalInfo = 11 [deprecated = true]; string entity = 12; } @@ -313,20 +200,6 @@ message AlarmUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string name = 4 [deprecated = true]; - string type = 5 [deprecated = true]; - string originatorType = 6 [deprecated = true]; - string originatorName = 7 [deprecated = true]; - string severity = 8 [deprecated = true]; - string status = 9 [deprecated = true]; - int64 startTs = 10 [deprecated = true]; - int64 endTs = 11 [deprecated = true]; - int64 ackTs = 12 [deprecated = true]; - int64 clearTs = 13 [deprecated = true]; - string details = 14 [deprecated = true]; - bool propagate = 15 [deprecated = true]; - bool propagateToOwner = 16 [deprecated = true]; - bool propagateToTenant = 17 [deprecated = true]; string entity = 18; } @@ -339,30 +212,11 @@ message CustomerUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string title = 4 [deprecated = true]; - optional string country = 5 [deprecated = true]; - optional string state = 6 [deprecated = true]; - optional string city = 7 [deprecated = true]; - optional string address = 8 [deprecated = true]; - optional string address2 = 9 [deprecated = true]; - optional string zip = 10 [deprecated = true]; - optional string phone = 11 [deprecated = true]; - optional string email = 12 [deprecated = true]; - optional string additionalInfo = 13 [deprecated = true]; string entity = 14; } message RelationUpdateMsg { UpdateMsgType msgType = 1; - int64 fromIdMSB = 2 [deprecated = true]; - int64 fromIdLSB = 3 [deprecated = true]; - string fromEntityType = 4 [deprecated = true]; - int64 toIdMSB = 5 [deprecated = true]; - int64 toIdLSB = 6 [deprecated = true]; - string toEntityType = 7 [deprecated = true]; - string type = 8 [deprecated = true]; - optional string typeGroup = 9 [deprecated = true]; - string additionalInfo = 10 [deprecated = true]; string entity = 11; } @@ -370,13 +224,6 @@ message UserUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - optional int64 customerIdMSB = 4 [deprecated = true]; - optional int64 customerIdLSB = 5 [deprecated = true]; - string email = 6 [deprecated = true]; - string authority = 7 [deprecated = true]; - optional string firstName = 8 [deprecated = true]; - optional string lastName = 9 [deprecated = true]; - optional string additionalInfo = 10 [deprecated = true]; string entity = 11; } @@ -384,13 +231,7 @@ message WidgetsBundleUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string title = 4 [deprecated = true]; - string alias = 5 [deprecated = true]; - optional bytes image = 6 [deprecated = true]; - bool isSystem = 7 [deprecated = true]; - optional string description = 8 [deprecated = true]; optional string widgets = 9; - optional int32 order = 10 [deprecated = true]; string entity = 11; } @@ -398,63 +239,24 @@ message WidgetTypeUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - optional string bundleAlias = 4 [deprecated = true]; - optional string alias = 5 [deprecated = true]; - optional string name = 6 [deprecated = true]; - optional string descriptorJson = 7 [deprecated = true]; - bool isSystem = 8 [deprecated = true]; - optional string image = 9 [deprecated = true]; - optional string description = 10 [deprecated = true]; - optional string fqn = 11 [deprecated = true]; - bool deprecated = 12 [deprecated = true]; - repeated string tags = 13 [deprecated = true]; string entity = 14; } message AdminSettingsUpdateMsg { - bool isSystem = 1 [deprecated = true]; - string key = 2 [deprecated = true]; - string jsonValue = 3 [deprecated = true]; string entity = 4; } message UserCredentialsUpdateMsg { - int64 userIdMSB = 1 [deprecated = true]; - int64 userIdLSB = 2 [deprecated = true]; - bool enabled = 3 [deprecated = true]; - string password = 4 [deprecated = true]; string entity = 5; } message TenantUpdateMsg { UpdateMsgType msgType = 1; - int64 idMSB = 2 [deprecated = true]; - int64 idLSB = 3 [deprecated = true]; - string title = 4 [deprecated = true]; - int64 profileIdMSB = 5 [deprecated = true]; - int64 profileIdLSB = 6 [deprecated = true]; - string region = 7 [deprecated = true]; - optional string country = 8 [deprecated = true]; - optional string state = 9 [deprecated = true]; - optional string city = 10 [deprecated = true]; - optional string address = 11 [deprecated = true]; - optional string address2 = 12 [deprecated = true]; - optional string zip = 13 [deprecated = true]; - optional string phone = 14 [deprecated = true]; - optional string email = 15 [deprecated = true]; - optional string additionalInfo = 16 [deprecated = true]; string entity = 17; } message TenantProfileUpdateMsg { UpdateMsgType msgType = 1; - int64 idMSB = 2 [deprecated = true]; - int64 idLSB = 3 [deprecated = true]; - string name = 4 [deprecated = true]; - optional string description = 5 [deprecated = true]; - bool default = 6 [deprecated = true]; - bool isolatedRuleChain = 7 [deprecated = true]; - bytes profileDataBytes = 8 [deprecated = true]; string entity = 9; } @@ -462,13 +264,6 @@ message ResourceUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - string title = 4 [deprecated = true]; - string resourceType = 5 [deprecated = true]; - string resourceKey = 6 [deprecated = true]; - string fileName = 7 [deprecated = true]; - optional string data = 8 [deprecated = true]; - optional string etag = 9 [deprecated = true]; - bool isSystem = 10 [deprecated = true]; string entity = 11; } @@ -535,12 +330,6 @@ message DeviceCredentialsRequestMsg { int64 deviceIdLSB = 2; } -message DeviceProfileDevicesRequestMsg { - option deprecated = true; - int64 deviceProfileIdMSB = 1; - int64 deviceProfileIdLSB = 2; -} - message WidgetBundleTypesRequestMsg { int64 widgetBundleIdMSB = 1; int64 widgetBundleIdLSB = 2; @@ -579,29 +368,10 @@ message RpcResponseMsg { string error = 2; } -enum EdgeEntityType { - DEVICE = 0; - ASSET = 1; -} - message OtaPackageUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - int64 deviceProfileIdMSB = 4 [deprecated = true]; - int64 deviceProfileIdLSB = 5 [deprecated = true]; - string type = 6 [deprecated = true]; - string title = 7 [deprecated = true]; - string version = 8 [deprecated = true]; - string tag = 9 [deprecated = true]; - optional string url = 10 [deprecated = true]; - optional string fileName = 11 [deprecated = true]; - optional string contentType = 12 [deprecated = true]; - optional string checksumAlgorithm = 13 [deprecated = true]; - optional string checksum = 14 [deprecated = true]; - optional int64 dataSize = 15 [deprecated = true]; - optional bytes data = 16 [deprecated = true]; - optional string additionalInfo = 17 [deprecated = true]; string entity = 18; } @@ -609,34 +379,9 @@ message QueueUpdateMsg { UpdateMsgType msgType = 1; int64 idMSB = 2; int64 idLSB = 3; - int64 tenantIdMSB = 4 [deprecated = true]; - int64 tenantIdLSB = 5 [deprecated = true]; - string name = 6 [deprecated = true]; - string topic = 7 [deprecated = true]; - int32 pollInterval = 8 [deprecated = true]; - int32 partitions = 9 [deprecated = true]; - bool consumerPerPartition = 10 [deprecated = true]; - int64 packProcessingTimeout = 11 [deprecated = true]; - SubmitStrategyProto submitStrategy = 12 [deprecated = true]; - ProcessingStrategyProto processingStrategy = 13 [deprecated = true]; string entity = 14; } -message SubmitStrategyProto { - option deprecated = true; - string type = 1; - int32 batchSize = 2; -} - -message ProcessingStrategyProto { - option deprecated = true; - string type = 1; - int32 retries = 2; - double failurePercentage = 3; - int64 pauseBetweenRetries = 4; - int64 maxPauseBetweenRetries = 5; -} - /** * Main Messages; */ @@ -654,7 +399,6 @@ message UplinkMsg { repeated UserCredentialsRequestMsg userCredentialsRequestMsg = 10; repeated DeviceCredentialsRequestMsg deviceCredentialsRequestMsg = 11; repeated DeviceRpcCallMsg deviceRpcCallMsg = 12; - repeated DeviceProfileDevicesRequestMsg deviceProfileDevicesRequestMsg = 13 [deprecated = true]; repeated WidgetBundleTypesRequestMsg widgetBundleTypesRequestMsg = 14; repeated EntityViewsRequestMsg entityViewsRequestMsg = 15; repeated AssetUpdateMsg assetUpdateMsg = 16; From 8df4c326cb643825b43f66ca17c260973921a095 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Thu, 19 Dec 2024 10:41:09 +0200 Subject: [PATCH 002/100] Fix Oauth2EdgeTest --- .../server/service/edge/EdgeContextComponent.java | 1 + .../service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java index ce0725a627..d001cbc38b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java @@ -118,6 +118,7 @@ public class EdgeContextComponent { map.put(EdgeEventType.NOTIFICATION_RULE, notificationRuleProcessor); map.put(EdgeEventType.NOTIFICATION_TARGET, notificationTargetProcessor); map.put(EdgeEventType.NOTIFICATION_TEMPLATE, notificationTemplateProcessor); + map.put(EdgeEventType.OAUTH2_CLIENT, oAuth2ClientProcessor); map.put(EdgeEventType.OTA_PACKAGE, otaPackageProcessor); map.put(EdgeEventType.QUEUE, queueProcessor); map.put(EdgeEventType.RELATION, relationProcessor); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java index 6cfe5a6819..32dc3bca4c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java @@ -18,7 +18,6 @@ package org.thingsboard.server.service.edge.rpc.processor.alarm; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; @@ -29,7 +28,6 @@ import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.AlarmId; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.dao.entity.EntityService; import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; @@ -45,9 +43,6 @@ import java.util.UUID; @TbCoreComponent public class AlarmEdgeProcessor extends BaseAlarmProcessor implements AlarmProcessor { - @Autowired - private EntityService entityService; - @Override public ListenableFuture processAlarmMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmUpdateMsg alarmUpdateMsg) { log.trace("[{}] processAlarmMsgFromEdge [{}]", tenantId, alarmUpdateMsg); From 8abaf9e0e8a131bd66701f79fe24aad4a99cf88a Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 20 Dec 2024 15:28:21 +0200 Subject: [PATCH 003/100] Refactor EdgeContextComponent map --- .../service/edge/EdgeContextComponent.java | 52 ++++++------------- .../edge/rpc/processor/BaseEdgeProcessor.java | 2 + .../edge/rpc/processor/EdgeProcessor.java | 5 ++ .../processor/alarm/AlarmEdgeProcessor.java | 5 ++ .../comment/AlarmCommentEdgeProcessor.java | 5 ++ .../processor/asset/AssetEdgeProcessor.java | 5 ++ .../profile/AssetProfileEdgeProcessor.java | 5 ++ .../customer/CustomerEdgeProcessor.java | 5 ++ .../dashboard/DashboardEdgeProcessor.java | 6 +++ .../processor/device/DeviceEdgeProcessor.java | 5 ++ .../profile/DeviceProfileEdgeProcessor.java | 5 ++ .../processor/edge/EdgeEntityProcessor.java | 5 ++ .../entityview/EntityViewEdgeProcessor.java | 5 ++ .../NotificationRuleEdgeProcessor.java | 6 +++ .../NotificationTargetEdgeProcessor.java | 6 +++ .../NotificationTemplateEdgeProcessor.java | 6 +++ .../processor/oauth2/DomainEdgeProcessor.java | 6 +++ .../oauth2/OAuth2ClientEdgeProcessor.java | 6 +++ .../ota/OtaPackageEdgeProcessor.java | 6 +++ .../processor/queue/QueueEdgeProcessor.java | 6 +++ .../relation/RelationEdgeProcessor.java | 5 ++ .../resource/ResourceEdgeProcessor.java | 5 ++ .../rule/RuleChainEdgeProcessor.java | 6 +++ .../rule/RuleChainMetadataEdgeProcessor.java | 6 +++ .../settings/AdminSettingsEdgeProcessor.java | 6 +++ .../processor/tenant/TenantEdgeProcessor.java | 6 +++ .../tenant/TenantProfileEdgeProcessor.java | 6 +++ .../rpc/processor/user/UserEdgeProcessor.java | 6 +++ .../widget/WidgetBundleEdgeProcessor.java | 6 +++ .../widget/WidgetTypeEdgeProcessor.java | 6 +++ 30 files changed, 174 insertions(+), 36 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java index d001cbc38b..fd0dff95de 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java @@ -16,6 +16,7 @@ package org.thingsboard.server.service.edge; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -87,50 +88,29 @@ import org.thingsboard.server.service.edge.rpc.processor.widget.WidgetTypeEdgePr import org.thingsboard.server.service.edge.rpc.sync.EdgeRequestsService; import org.thingsboard.server.service.executors.GrpcCallbackExecutorService; -import javax.annotation.PostConstruct; -import java.util.Collections; -import java.util.HashMap; +import java.util.EnumMap; +import java.util.List; import java.util.Map; @Lazy @Data +@Slf4j @Component @TbCoreComponent public class EdgeContextComponent { - private Map processorMap; - - @PostConstruct - private void initProcessorMap() { - Map map = new HashMap<>(); - map.put(EdgeEventType.ADMIN_SETTINGS, adminSettingsProcessor); - map.put(EdgeEventType.ALARM, alarmProcessor); - map.put(EdgeEventType.ALARM_COMMENT, alarmCommentProcessor); - map.put(EdgeEventType.ASSET, assetProcessor); - map.put(EdgeEventType.ASSET_PROFILE, assetProfileProcessor); - map.put(EdgeEventType.CUSTOMER, customerProcessor); - map.put(EdgeEventType.DASHBOARD, dashboardProcessor); - map.put(EdgeEventType.DEVICE, deviceProcessor); - map.put(EdgeEventType.DEVICE_PROFILE, deviceProfileProcessor); - map.put(EdgeEventType.DOMAIN, domainProcessor); - map.put(EdgeEventType.EDGE, edgeEntityProcessor); - map.put(EdgeEventType.ENTITY_VIEW, entityViewProcessor); - map.put(EdgeEventType.NOTIFICATION_RULE, notificationRuleProcessor); - map.put(EdgeEventType.NOTIFICATION_TARGET, notificationTargetProcessor); - map.put(EdgeEventType.NOTIFICATION_TEMPLATE, notificationTemplateProcessor); - map.put(EdgeEventType.OAUTH2_CLIENT, oAuth2ClientProcessor); - map.put(EdgeEventType.OTA_PACKAGE, otaPackageProcessor); - map.put(EdgeEventType.QUEUE, queueProcessor); - map.put(EdgeEventType.RELATION, relationProcessor); - map.put(EdgeEventType.RULE_CHAIN, ruleChainProcessor); - map.put(EdgeEventType.RULE_CHAIN_METADATA, ruleChainMetadataProcessor); - map.put(EdgeEventType.TB_RESOURCE, resourceProcessor); - map.put(EdgeEventType.TENANT, tenantProcessor); - map.put(EdgeEventType.TENANT_PROFILE, tenantProfileProcessor); - map.put(EdgeEventType.USER, userProcessor); - map.put(EdgeEventType.WIDGETS_BUNDLE, widgetBundleProcessor); - map.put(EdgeEventType.WIDGET_TYPE, widgetTypeProcessor); - this.processorMap = Collections.unmodifiableMap(map); + private final Map processorMap = new EnumMap<>(EdgeEventType.class); + + @Autowired + public EdgeContextComponent(List processors) { + processors.forEach(processor -> { + EdgeEventType eventType = processor.getEdgeEventType(); + if (eventType != null) { + processorMap.put(eventType, processor); + } else { + log.warn("Processor {} does not specify a supported EdgeEventType", processor.getClass().getSimpleName()); + } + }); } // services diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java index c8647fb40a..f88fd4f156 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java @@ -20,6 +20,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.EdgeUtils; @@ -75,6 +76,7 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { protected static final Lock deviceCreationLock = new ReentrantLock(); protected static final Lock assetCreationLock = new ReentrantLock(); + @Lazy @Autowired protected EdgeContextComponent edgeCtx; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java index b4d4550966..98342998a0 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java @@ -17,6 +17,7 @@ package org.thingsboard.server.service.edge.rpc.processor; import com.google.common.util.concurrent.ListenableFuture; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.gen.transport.TransportProtos; @@ -29,4 +30,8 @@ public interface EdgeProcessor { return null; } + default EdgeEventType getEdgeEventType() { + return null; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java index 32dc3bca4c..72ff03128a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java @@ -115,4 +115,9 @@ public class AlarmEdgeProcessor extends BaseAlarmProcessor implements AlarmProce return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.ALARM; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java index ef13144ba8..90c2e8031e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java @@ -90,4 +90,9 @@ public class AlarmCommentEdgeProcessor extends BaseAlarmProcessor implements Ala return Futures.transform(Futures.allAsList(delFutures), voids -> null, dbCallbackExecutorService); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.ALARM_COMMENT; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java index 81145a6195..51815bc3aa 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java @@ -141,4 +141,9 @@ public class AssetEdgeProcessor extends BaseAssetProcessor implements AssetProce asset.setCustomerId(customerUUID); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.ASSET; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java index df3d74ceaa..53f35d3aac 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java @@ -136,4 +136,9 @@ public class AssetProfileEdgeProcessor extends BaseAssetProfileProcessor impleme assetProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.ASSET_PROFILE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java index 2ecec3893e..fc70e8964b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java @@ -95,4 +95,9 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { } } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.CUSTOMER; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java index e4842a16db..8b89eb51c4 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.ShortCustomerInfo; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; @@ -130,4 +131,9 @@ public class DashboardEdgeProcessor extends BaseDashboardProcessor implements Da return assignedCustomers; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.DASHBOARD; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java index daf687fe6f..db407b23b7 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java @@ -274,4 +274,9 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr device.setCustomerId(customerUUID); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.DEVICE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java index 31a007219d..eef994be93 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java @@ -136,4 +136,9 @@ public class DeviceProfileEdgeProcessor extends BaseDeviceProfileProcessor imple deviceProfile.setDefaultDashboardId(defaultDashboardUUID != null ? new DashboardId(defaultDashboardUUID) : null); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.DEVICE_PROFILE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java index 7c1f907cb0..7e969d5db4 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java @@ -113,4 +113,9 @@ public class EdgeEntityProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.EDGE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java index a46ac3acdd..620e9c9c34 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java @@ -137,4 +137,9 @@ public class EntityViewEdgeProcessor extends BaseEntityViewProcessor implements entityView.setCustomerId(customerUUID); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.ENTITY_VIEW; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java index d5f68f5427..0322c17b74 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java @@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.NotificationRuleId; import org.thingsboard.server.common.data.notification.rule.NotificationRule; import org.thingsboard.server.dao.notification.NotificationRuleService; @@ -65,4 +66,9 @@ public class NotificationRuleEdgeProcessor extends BaseEdgeProcessor { return downlinkMsg; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.NOTIFICATION_RULE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java index 08d0efcaad..a9a6044812 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java @@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.NotificationTargetId; import org.thingsboard.server.common.data.notification.targets.NotificationTarget; import org.thingsboard.server.dao.notification.NotificationTargetService; @@ -65,4 +66,9 @@ public class NotificationTargetEdgeProcessor extends BaseEdgeProcessor { return downlinkMsg; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.NOTIFICATION_TARGET; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java index 1a4227a5fc..589db4912b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java @@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.NotificationTemplateId; import org.thingsboard.server.common.data.notification.template.NotificationTemplate; import org.thingsboard.server.dao.notification.NotificationTemplateService; @@ -65,4 +66,9 @@ public class NotificationTemplateEdgeProcessor extends BaseEdgeProcessor { return downlinkMsg; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.NOTIFICATION_TEMPLATE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java index a6016c97d9..4eb3e4001d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java @@ -21,6 +21,7 @@ import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.domain.DomainInfo; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.DomainId; import org.thingsboard.server.common.data.oauth2.OAuth2Client; import org.thingsboard.server.dao.domain.DomainService; @@ -71,4 +72,9 @@ public class DomainEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.DOMAIN; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java index cc1c361824..512f03f666 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.OAuth2ClientId; import org.thingsboard.server.common.data.oauth2.OAuth2Client; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; @@ -64,4 +65,9 @@ public class OAuth2ClientEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.OAUTH2_CLIENT; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java index c09d735f5b..0cc90a3ef2 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.OtaPackage; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.OtaPackageId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; @@ -59,4 +60,9 @@ public class OtaPackageEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.OTA_PACKAGE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java index 937049f447..8da1a18f86 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.QueueId; import org.thingsboard.server.common.data.queue.Queue; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; @@ -59,4 +60,9 @@ public class QueueEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.QUEUE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java index bc9b955033..9fc234c114 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java @@ -95,4 +95,9 @@ public class RelationEdgeProcessor extends BaseRelationProcessor implements Rela .build(); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.RELATION; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java index 1d5ebc188f..1b1829743b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java @@ -98,4 +98,9 @@ public class ResourceEdgeProcessor extends BaseResourceProcessor implements Reso return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.TB_RESOURCE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java index 72d6565b92..80b0963d0a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; @@ -79,4 +80,9 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { return downlinkMsg; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.RULE_CHAIN; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java index eedfc835ae..f85045093c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; @@ -51,4 +52,9 @@ public class RuleChainMetadataEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.RULE_CHAIN_METADATA; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java index bdfa597ae7..2dc6f0e3f8 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java @@ -21,6 +21,7 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.AdminSettings; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -44,4 +45,9 @@ public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { .build(); } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.ADMIN_SETTINGS; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java index 311975501d..4234e0ca32 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java @@ -22,6 +22,7 @@ import org.thingsboard.server.common.data.Tenant; import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; @@ -56,4 +57,9 @@ public class TenantEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.TENANT; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java index b02a8e2ce3..0312389e0d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java @@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.TenantProfileId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; @@ -51,4 +52,9 @@ public class TenantProfileEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.TENANT_PROFILE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java index 1d2f1f364a..f7ab19af60 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.User; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; @@ -72,4 +73,9 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.USER; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java index 5ea5817639..24217d80e2 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.WidgetsBundleId; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; @@ -62,4 +63,9 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.WIDGETS_BUNDLE; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java index f3ea3ec1ef..c626a9ad0a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.WidgetTypeId; import org.thingsboard.server.common.data.widget.WidgetTypeDetails; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; @@ -59,4 +60,9 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { return null; } + @Override + public EdgeEventType getEdgeEventType() { + return EdgeEventType.WIDGET_TYPE; + } + } From eaad06309682c8280439b2f8814f33d63442f780 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 20 Dec 2024 15:33:28 +0200 Subject: [PATCH 004/100] Remove log.warn from EdgeContextComponent --- .../thingsboard/server/service/edge/EdgeContextComponent.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java index fd0dff95de..9faafa6379 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java @@ -107,8 +107,6 @@ public class EdgeContextComponent { EdgeEventType eventType = processor.getEdgeEventType(); if (eventType != null) { processorMap.put(eventType, processor); - } else { - log.warn("Processor {} does not specify a supported EdgeEventType", processor.getClass().getSimpleName()); } }); } From f6c5674e00d1675edba1e890f410d0d0ee2180bb Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Tue, 24 Dec 2024 16:32:45 +0200 Subject: [PATCH 005/100] Clean up Autowired imports --- .../service/edge/EdgeContextComponent.java | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java index 9faafa6379..2ea64893d0 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeContextComponent.java @@ -61,30 +61,15 @@ import org.thingsboard.server.service.edge.rpc.processor.alarm.AlarmProcessor; import org.thingsboard.server.service.edge.rpc.processor.alarm.comment.AlarmCommentProcessor; import org.thingsboard.server.service.edge.rpc.processor.asset.AssetEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.asset.profile.AssetProfileEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.customer.CustomerEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.dashboard.DashboardEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.device.DeviceEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.device.profile.DeviceProfileEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.edge.EdgeEntityProcessor; import org.thingsboard.server.service.edge.rpc.processor.entityview.EntityViewEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationRuleEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationTargetEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.notification.NotificationTemplateEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.oauth2.DomainEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.oauth2.OAuth2ClientEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.ota.OtaPackageEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.queue.QueueEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.relation.RelationEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.resource.ResourceEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.rule.RuleChainEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.rule.RuleChainMetadataEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.settings.AdminSettingsEdgeProcessor; import org.thingsboard.server.service.edge.rpc.processor.telemetry.TelemetryEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.tenant.TenantEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.tenant.TenantProfileEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.user.UserEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.widget.WidgetBundleEdgeProcessor; -import org.thingsboard.server.service.edge.rpc.processor.widget.WidgetTypeEdgeProcessor; import org.thingsboard.server.service.edge.rpc.sync.EdgeRequestsService; import org.thingsboard.server.service.executors.GrpcCallbackExecutorService; @@ -213,9 +198,6 @@ public class EdgeContextComponent { // processors - @Autowired - private AdminSettingsEdgeProcessor adminSettingsProcessor; - @Autowired private AlarmProcessor alarmProcessor; @@ -228,9 +210,6 @@ public class EdgeContextComponent { @Autowired private AssetProfileEdgeProcessor assetProfileProcessor; - @Autowired - private CustomerEdgeProcessor customerProcessor; - @Autowired private DashboardEdgeProcessor dashboardProcessor; @@ -240,36 +219,12 @@ public class EdgeContextComponent { @Autowired private DeviceProfileEdgeProcessor deviceProfileProcessor; - @Autowired - private EdgeEntityProcessor edgeEntityProcessor; - @Autowired private EntityViewEdgeProcessor entityViewProcessor; @Autowired private NotificationRuleProcessor ruleProcessor; - @Autowired - private NotificationRuleEdgeProcessor notificationRuleProcessor; - - @Autowired - private NotificationTargetEdgeProcessor notificationTargetProcessor; - - @Autowired - private NotificationTemplateEdgeProcessor notificationTemplateProcessor; - - @Autowired - private DomainEdgeProcessor domainProcessor; - - @Autowired - private OAuth2ClientEdgeProcessor oAuth2ClientProcessor; - - @Autowired - private OtaPackageEdgeProcessor otaPackageProcessor; - - @Autowired - private QueueEdgeProcessor queueProcessor; - @Autowired private RelationEdgeProcessor relationProcessor; @@ -285,21 +240,6 @@ public class EdgeContextComponent { @Autowired private TelemetryEdgeProcessor telemetryProcessor; - @Autowired - private TenantEdgeProcessor tenantProcessor; - - @Autowired - private TenantProfileEdgeProcessor tenantProfileProcessor; - - @Autowired - private UserEdgeProcessor userProcessor; - - @Autowired - private WidgetBundleEdgeProcessor widgetBundleProcessor; - - @Autowired - private WidgetTypeEdgeProcessor widgetTypeProcessor; - // config @Autowired private EdgeEventStorageSettings edgeEventStorageSettings; From 11cb43a115a6feb240497075430454aeaa12a475 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Tue, 31 Dec 2024 16:34:40 +0200 Subject: [PATCH 006/100] Redis-cache: relatedEdges changed key, lua improvement --- .../src/main/resources/thingsboard.yml | 2 +- .../cache/RedisTbTransactionalCache.java | 29 +++++++++++++++++++ .../server/cache/VersionedRedisTbCache.java | 28 ++---------------- .../cache/edge/RelatedEdgesCacheKey.java | 2 +- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 066c1468fb..32fd62670d 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -600,7 +600,7 @@ cache: maxSize: "${CACHE_SPECS_EDGE_SESSIONS_MAX_SIZE:10000}" # 0 means the cache is disabled relatedEdges: timeToLiveInMinutes: "${CACHE_SPECS_RELATED_EDGES_TTL:1440}" # Related Edges cache TTL - maxSize: "${CACHE_SPECS_RELATED_EDGES_MAX_SIZE:0}" # 0 means the cache is disabled + maxSize: "${CACHE_SPECS_RELATED_EDGES_MAX_SIZE:10000}" # 0 means the cache is disabled repositorySettings: timeToLiveInMinutes: "${CACHE_SPECS_REPOSITORY_SETTINGS_TTL:1440}" # Repository settings cache TTL maxSize: "${CACHE_SPECS_REPOSITORY_SETTINGS_MAX_SIZE:10000}" # 0 means the cache is disabled diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java index 8ee58ab8eb..1eee03ccf9 100644 --- a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java +++ b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java @@ -19,9 +19,11 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.support.NullValue; +import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisStringCommands; +import org.springframework.data.redis.connection.ReturnType; import org.springframework.data.redis.connection.jedis.JedisClusterConnection; import org.springframework.data.redis.connection.jedis.JedisConnection; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; @@ -269,4 +271,31 @@ public abstract class RedisTbTransactionalCache extends RedisTbTransactionalCache implements VersionedTbCache { @@ -67,15 +65,7 @@ public abstract class VersionedRedisTbCache Date: Thu, 9 Jan 2025 10:29:38 +0200 Subject: [PATCH 007/100] Increate log level to warn for evalSha --- .../server/cache/RedisTbTransactionalCache.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java index 1eee03ccf9..c3ce4b356f 100644 --- a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java +++ b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java @@ -286,13 +286,13 @@ public abstract class RedisTbTransactionalCache Date: Thu, 9 Jan 2025 11:10:35 +0200 Subject: [PATCH 008/100] Improvement for logs in executeScript --- .../server/cache/RedisTbTransactionalCache.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java index c3ce4b356f..97fc36fe27 100644 --- a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java +++ b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java @@ -286,13 +286,13 @@ public abstract class RedisTbTransactionalCache Date: Wed, 15 Jan 2025 16:11:54 +0200 Subject: [PATCH 009/100] EntityDataProto: add ts to correctly handle PostAttributeMsg update from/to Edge --- .../telemetry/EntityDataMsgConstructor.java | 6 +++ .../telemetry/BaseTelemetryProcessor.java | 46 ++++++++++++---- .../server/edge/DeviceEdgeTest.java | 53 +++++++++++++++++++ common/edge-api/src/main/proto/edge.proto | 1 + .../server/common/adaptor/JsonConverter.java | 10 ++-- .../common/transport/util/JsonUtils.java | 4 +- .../engine/edge/AbstractTbMsgPushNode.java | 1 + 7 files changed, 107 insertions(+), 14 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java index 6493f97f57..f7f3cc31dd 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/constructor/telemetry/EntityDataMsgConstructor.java @@ -67,6 +67,9 @@ public class EntityDataMsgConstructor { TransportProtos.PostAttributeMsg attributesUpdatedMsg = JsonConverter.convertToAttributesProto(data.getAsJsonObject("kv")); builder.setAttributesUpdatedMsg(attributesUpdatedMsg); builder.setPostAttributeScope(getScopeOfDefault(data)); + if (data.get("ts") != null && !data.get("ts").isJsonNull()) { + builder.setAttributeTs(data.getAsJsonPrimitive("ts").getAsLong()); + } } catch (Exception e) { log.warn("[{}][{}] Can't convert to AttributesUpdatedMsg proto, entityData [{}]", tenantId, entityId, entityData, e); } @@ -77,6 +80,9 @@ public class EntityDataMsgConstructor { TransportProtos.PostAttributeMsg postAttributesMsg = JsonConverter.convertToAttributesProto(data.getAsJsonObject("kv")); builder.setPostAttributesMsg(postAttributesMsg); builder.setPostAttributeScope(getScopeOfDefault(data)); + if (data.get("ts") != null && !data.get("ts").isJsonNull()) { + builder.setAttributeTs(data.getAsJsonPrimitive("ts").getAsLong()); + } } catch (Exception e) { log.warn("[{}][{}] Can't convert to PostAttributesMsg, entityData [{}]", tenantId, entityId, entityData, e); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java index 488fc3d8b9..520c7ef5ff 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java @@ -54,6 +54,7 @@ import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.common.data.kv.KvEntry; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgMetaData; @@ -79,7 +80,9 @@ import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; @Slf4j public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { @@ -114,7 +117,7 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { abstract protected String getMsgSourceKey(); - public List> processTelemetryMsg(TenantId tenantId, EntityDataProto entityData) { + public List> processTelemetryMsg(TenantId tenantId, EntityDataProto entityData) throws Exception { log.trace("[{}] processTelemetryMsg [{}]", tenantId, entityData); List> result = new ArrayList<>(); EntityId entityId = constructEntityId(entityData.getEntityType(), entityData.getEntityIdMSB(), entityData.getEntityIdLSB()); @@ -125,11 +128,13 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { CustomerId customerId = pair.getValue(); metaData.putValue(DataConstants.MSG_SOURCE_KEY, getMsgSourceKey()); if (entityData.hasPostAttributesMsg()) { - result.add(processPostAttributes(tenantId, customerId, entityId, entityData.getPostAttributesMsg(), metaData)); + long ts = entityData.hasAttributeTs() ? entityData.getAttributeTs() : System.currentTimeMillis(); + result.add(processPostAttributes(tenantId, customerId, entityId, entityData.getPostAttributesMsg(), metaData, ts)); } if (entityData.hasAttributesUpdatedMsg()) { metaData.putValue("scope", entityData.getPostAttributeScope()); - result.add(processAttributesUpdate(tenantId, customerId, entityId, entityData.getAttributesUpdatedMsg(), metaData)); + long ts = entityData.hasAttributeTs() ? entityData.getAttributeTs() : System.currentTimeMillis(); + result.add(processAttributesUpdate(tenantId, customerId, entityId, entityData.getAttributesUpdatedMsg(), metaData, ts)); } if (entityData.hasPostTelemetryMsg()) { result.add(processPostTelemetry(tenantId, customerId, entityId, entityData.getPostTelemetryMsg(), metaData)); @@ -257,9 +262,13 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { return new ImmutablePair<>(queueName, ruleChainId); } - private ListenableFuture processPostAttributes(TenantId tenantId, CustomerId customerId, EntityId entityId, TransportProtos.PostAttributeMsg msg, TbMsgMetaData metaData) { + private ListenableFuture processPostAttributes(TenantId tenantId, CustomerId customerId, EntityId entityId, TransportProtos.PostAttributeMsg msg, TbMsgMetaData metaData, long ts) throws Exception { SettableFuture futureToSet = SettableFuture.create(); JsonObject json = JsonUtils.getJsonObject(msg.getKvList()); + + List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json, ts)); + filterAttributesByTs(tenantId, entityId, AttributeScope.CLIENT_SCOPE, attributes, json); + var defaultQueueAndRuleChain = getDefaultQueueNameAndRuleChainId(tenantId, entityId); TbMsg tbMsg = TbMsg.newMsg() .queueName(defaultQueueAndRuleChain.getKey()) @@ -289,16 +298,18 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { CustomerId customerId, EntityId entityId, TransportProtos.PostAttributeMsg msg, - TbMsgMetaData metaData) { + TbMsgMetaData metaData, + long ts) throws Exception { SettableFuture futureToSet = SettableFuture.create(); JsonObject json = JsonUtils.getJsonObject(msg.getKvList()); - List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json)); - String scope = metaData.getValue("scope"); + AttributeScope scope = AttributeScope.valueOf(metaData.getValue("scope")); + List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json, ts)); + List attributesToSave = filterAttributesByTs(tenantId, entityId, scope, attributes, json); tsSubService.saveAttributes(AttributesSaveRequest.builder() .tenantId(tenantId) .entityId(entityId) - .scope(AttributeScope.valueOf(scope)) - .entries(attributes) + .scope(scope) + .entries(attributesToSave) .callback(new FutureCallback<>() { @Override public void onSuccess(@Nullable Void tmp) { @@ -390,4 +401,21 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { entityDataMsgConstructor.constructEntityDataMsg(tenantId, entityId, actionType, JsonParser.parseString(bodyJackson)); } + private List filterAttributesByTs(TenantId tenantId, EntityId entityId, AttributeScope scope, List attributes, JsonObject jsonObject) throws Exception { + List keys = attributes.stream().map(KvEntry::getKey).toList(); + Map existingAttributesTs = edgeCtx.getAttributesService().find(tenantId, entityId, scope, keys).get() + .stream().collect(Collectors.toMap(KvEntry::getKey, AttributeKvEntry::getLastUpdateTs)); + return attributes.stream() + .filter(attribute -> { + String key = attribute.getKey(); + long incomingTs = attribute.getLastUpdateTs(); + if (incomingTs > existingAttributesTs.getOrDefault(key, 0L)) { + return true; + } else { + jsonObject.remove(key); + return false; + } + }).toList(); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java index 387011717a..11bc053bb5 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java @@ -488,6 +488,59 @@ public class DeviceEdgeTest extends AbstractEdgeTest { doDelete("/api/plugins/telemetry/DEVICE/" + device.getId().getId() + "/SERVER_SCOPE?keys=" + attributesKey, String.class); } + @Test + public void testSendOutdatedAttributeToCloud() throws Exception { + long ts = System.currentTimeMillis(); + Device device = saveDeviceOnCloudAndVerifyDeliveryToEdge(); + + edgeImitator.expectResponsesAmount(1); + + ObjectNode attributesNode = JacksonUtil.newObjectNode(); + String originalValue = "original_value"; + attributesNode.put("test_attr", originalValue); + doPost("/api/plugins/telemetry/DEVICE/" + device.getId() + "/attributes/SERVER_SCOPE", attributesNode); + + JsonObject attributesData = new JsonObject(); + // incorrect msg, will not be saved, because of ts is lower than for already existing + String attributesKey = "test_attr"; + String attributeValueIncorrect = "test_value"; + // correct msg, will be saved, no ts issue + String attributeKey2 = "test_attr2"; + String attributeValue2Correct = "test_value2"; + attributesData.addProperty(attributesKey, attributeValueIncorrect); + attributesData.addProperty(attributeKey2, attributeValue2Correct); + UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); + EntityDataProto.Builder entityDataBuilder = EntityDataProto.newBuilder(); + entityDataBuilder.setEntityType(device.getId().getEntityType().name()); + entityDataBuilder.setEntityIdMSB(device.getId().getId().getMostSignificantBits()); + entityDataBuilder.setEntityIdLSB(device.getId().getId().getLeastSignificantBits()); + entityDataBuilder.setAttributesUpdatedMsg(JsonConverter.convertToAttributesProto(attributesData)); + entityDataBuilder.setPostAttributeScope(DataConstants.SERVER_SCOPE); + entityDataBuilder.setAttributeTs(ts); + + uplinkMsgBuilder.addEntityData(entityDataBuilder.build()); + + edgeImitator.sendUplinkMsg(uplinkMsgBuilder.build()); + Assert.assertTrue(edgeImitator.waitForResponses()); + + String attributeValuesUrl = "/api/plugins/telemetry/DEVICE/" + device.getId() + "/values/attributes/" + DataConstants.SERVER_SCOPE; + List> attributes = doGetAsyncTyped(attributeValuesUrl, new TypeReference<>() { + }); + + Optional> customAttributeOpt = getAttributeByKey(attributesKey, attributes); + Assert.assertTrue(customAttributeOpt.isPresent()); + Map customAttribute = customAttributeOpt.get(); + Assert.assertNotEquals(attributeValueIncorrect, customAttribute.get("value")); + Assert.assertEquals(originalValue, customAttribute.get("value")); + + customAttributeOpt = getAttributeByKey(attributeKey2, attributes); + Assert.assertTrue(customAttributeOpt.isPresent()); + customAttribute = customAttributeOpt.get(); + Assert.assertEquals(attributeValue2Correct, customAttribute.get("value")); + + doDelete("/api/plugins/telemetry/DEVICE/" + device.getId().getId() + "/SERVER_SCOPE?keys=" + attributesKey, String.class); + } + @Test public void testSendDeviceToCloudWithNameThatAlreadyExistsOnCloud() throws Exception { String deviceOnCloudName = StringUtils.randomAlphanumeric(15); diff --git a/common/edge-api/src/main/proto/edge.proto b/common/edge-api/src/main/proto/edge.proto index 4dc762e14c..0557c5f5d4 100644 --- a/common/edge-api/src/main/proto/edge.proto +++ b/common/edge-api/src/main/proto/edge.proto @@ -132,6 +132,7 @@ message EntityDataProto { transport.PostAttributeMsg attributesUpdatedMsg = 6; string postAttributeScope = 7; AttributeDeleteMsg attributeDeleteMsg = 8; + optional int64 attributeTs = 9; } message AttributeDeleteMsg { diff --git a/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java b/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java index f4abf5f3a0..9226395289 100644 --- a/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java +++ b/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java @@ -63,7 +63,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; import java.util.function.Consumer; -import java.util.stream.Collectors; public class JsonConverter { @@ -540,10 +539,12 @@ public class JsonConverter { } public static Set convertToAttributes(JsonElement element) { - Set result = new HashSet<>(); long ts = System.currentTimeMillis(); - result.addAll(parseValues(element.getAsJsonObject()).stream().map(kv -> new BaseAttributeKvEntry(kv, ts)).collect(Collectors.toList())); - return result; + return new HashSet<>(parseValues(element.getAsJsonObject()).stream().map(kv -> new BaseAttributeKvEntry(kv, ts)).toList()); + } + + public static Set convertToAttributes(JsonElement element, long ts) { + return new HashSet<>(parseValues(element.getAsJsonObject()).stream().map(kv -> new BaseAttributeKvEntry(kv, ts)).toList()); } private static List parseValues(JsonObject valuesObject) { @@ -702,4 +703,5 @@ public class JsonConverter { return ""; } } + } diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/JsonUtils.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/JsonUtils.java index ed0b425c76..a97dc411b4 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/JsonUtils.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/JsonUtils.java @@ -49,6 +49,7 @@ public class JsonUtils { } return json; } + public static JsonElement parse(Object value) { if (value instanceof Integer) { return new JsonPrimitive((Integer) value); @@ -67,7 +68,7 @@ public class JsonUtils { } } - public static JsonObject convertToJsonObject(Map map) { + public static JsonObject convertToJsonObject(Map map) { JsonObject jsonObject = new JsonObject(); for (Map.Entry entry : map.entrySet()) { jsonObject.add(entry.getKey(), parse(entry.getValue())); @@ -75,4 +76,5 @@ public class JsonUtils { return jsonObject; } + } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java index 73368d40f5..f1fe1affc6 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java @@ -89,6 +89,7 @@ public abstract class AbstractTbMsgPushNode { entityBody.put("kv", dataJson); + entityBody.put("ts", msg.getMetaDataTs()); entityBody.put(SCOPE, getScope(metadata)); if (EdgeEventActionType.POST_ATTRIBUTES.equals(actionType)) { entityBody.put("isPostAttributes", true); From d9dad36c54179b42d6cad4b66c82e6cab61436a8 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Wed, 15 Jan 2025 16:19:56 +0200 Subject: [PATCH 010/100] Send alarm_ack and alarm_clear only by 'Push to Edge' node --- .../edge/EdgeEventSourcingListener.java | 3 ++ .../server/edge/AlarmEdgeTest.java | 33 +++++-------------- .../engine/edge/AbstractTbMsgPushNode.java | 12 +++++-- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java index 9317c51a64..02b2346e64 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java @@ -135,6 +135,9 @@ public class EdgeEventSourcingListener { if (EntityType.DEVICE.equals(event.getEntityId().getEntityType()) && ActionType.ASSIGNED_TO_TENANT.equals(event.getActionType())) { return; } + if (EntityType.ALARM.equals(event.getEntityId().getEntityType())) { + return; + } try { if (event.getEntityId().getEntityType().equals(EntityType.RULE_CHAIN) && event.getEdgeId() != null && event.getActionType().equals(ActionType.ASSIGNED_TO_EDGE)) { try { diff --git a/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java index 239cb87ab4..0ceebf1cf4 100644 --- a/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java @@ -94,44 +94,26 @@ public class AlarmEdgeTest extends AbstractEdgeTest { Alarm savedAlarm = doPost("/api/alarm", alarm, Alarm.class); edgeImitator.ignoreType(AlarmCommentUpdateMsg.class); - // ack alarm + // ack alarm - send only by using push to edge node edgeImitator.expectMessageAmount(1); doPost("/api/alarm/" + savedAlarm.getUuidId() + "/ack"); - Assert.assertTrue(edgeImitator.waitForMessages()); - AbstractMessage latestMessage = edgeImitator.getLatestMessage(); - Assert.assertTrue(latestMessage instanceof AlarmUpdateMsg); - AlarmUpdateMsg alarmUpdateMsg = (AlarmUpdateMsg) latestMessage; - Assert.assertEquals(UpdateMsgType.ALARM_ACK_RPC_MESSAGE, alarmUpdateMsg.getMsgType()); - Alarm alarmMsg = JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); - Assert.assertNotNull(alarmMsg); - Assert.assertEquals(savedAlarm.getType(), alarmMsg.getType()); - Assert.assertEquals(savedAlarm.getName(), alarmMsg.getName()); - Assert.assertEquals(AlarmStatus.ACTIVE_ACK, alarmMsg.getStatus()); + Assert.assertFalse(edgeImitator.waitForMessages(5)); - // clear alarm + // clear alarm - send only by using push to edge node edgeImitator.expectMessageAmount(1); doPost("/api/alarm/" + savedAlarm.getUuidId() + "/clear"); - Assert.assertTrue(edgeImitator.waitForMessages()); - latestMessage = edgeImitator.getLatestMessage(); - Assert.assertTrue(latestMessage instanceof AlarmUpdateMsg); - alarmUpdateMsg = (AlarmUpdateMsg) latestMessage; - Assert.assertEquals(UpdateMsgType.ALARM_CLEAR_RPC_MESSAGE, alarmUpdateMsg.getMsgType()); - alarmMsg = JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); - Assert.assertNotNull(alarmMsg); - Assert.assertEquals(savedAlarm.getType(), alarmMsg.getType()); - Assert.assertEquals(savedAlarm.getName(), alarmMsg.getName()); - Assert.assertEquals(AlarmStatus.CLEARED_ACK, alarmMsg.getStatus()); + Assert.assertFalse(edgeImitator.waitForMessages(5)); // delete alarm edgeImitator.expectMessageAmount(1); doDelete("/api/alarm/" + savedAlarm.getUuidId()) .andExpect(status().isOk()); Assert.assertTrue(edgeImitator.waitForMessages()); - latestMessage = edgeImitator.getLatestMessage(); + AbstractMessage latestMessage = edgeImitator.getLatestMessage(); Assert.assertTrue(latestMessage instanceof AlarmUpdateMsg); - alarmUpdateMsg = (AlarmUpdateMsg) latestMessage; + AlarmUpdateMsg alarmUpdateMsg = (AlarmUpdateMsg) latestMessage; Assert.assertEquals(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE, alarmUpdateMsg.getMsgType()); - alarmMsg = JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); + Alarm alarmMsg = JacksonUtil.fromString(alarmUpdateMsg.getEntity(), Alarm.class, true); Assert.assertNotNull(alarmMsg); Assert.assertEquals(savedAlarm.getType(), alarmMsg.getType()); Assert.assertEquals(savedAlarm.getName(), alarmMsg.getName()); @@ -252,4 +234,5 @@ public class AlarmEdgeTest extends AbstractEdgeTest { alarmComment.setCreatedTime(Uuids.unixTimestamp(uuid)); return alarmComment; } + } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java index 73368d40f5..8ed0313d32 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java @@ -39,6 +39,8 @@ import java.util.UUID; import static org.thingsboard.server.common.data.msg.TbMsgType.ACTIVITY_EVENT; import static org.thingsboard.server.common.data.msg.TbMsgType.ALARM; +import static org.thingsboard.server.common.data.msg.TbMsgType.ALARM_ACK; +import static org.thingsboard.server.common.data.msg.TbMsgType.ALARM_CLEAR; import static org.thingsboard.server.common.data.msg.TbMsgType.ATTRIBUTES_DELETED; import static org.thingsboard.server.common.data.msg.TbMsgType.ATTRIBUTES_UPDATED; import static org.thingsboard.server.common.data.msg.TbMsgType.CONNECT_EVENT; @@ -81,6 +83,9 @@ public abstract class AbstractTbMsgPushNode metadata = msg.getMetaData().getData(); EdgeEventActionType actionType = getEdgeEventActionTypeByMsgType(msg); @@ -164,8 +169,9 @@ public abstract class AbstractTbMsgPushNode Date: Wed, 15 Jan 2025 17:22:14 +0200 Subject: [PATCH 011/100] Change ts in test to be for sure condifent --- .../test/java/org/thingsboard/server/edge/DeviceEdgeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java index 11bc053bb5..e4f9080686 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java @@ -490,7 +490,7 @@ public class DeviceEdgeTest extends AbstractEdgeTest { @Test public void testSendOutdatedAttributeToCloud() throws Exception { - long ts = System.currentTimeMillis(); + long ts = System.currentTimeMillis() - 5; Device device = saveDeviceOnCloudAndVerifyDeliveryToEdge(); edgeImitator.expectResponsesAmount(1); From 6923639dc59c55c59556877380fc30d0acaf657a Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Wed, 15 Jan 2025 17:42:22 +0200 Subject: [PATCH 012/100] Fix AlarmControllerTest --- .../controller/AlarmControllerTest.java | 28 +++++++++---------- .../import-dialog.component.html | 3 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/AlarmControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AlarmControllerTest.java index 2f264d49ff..6bd8396ceb 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AlarmControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AlarmControllerTest.java @@ -169,7 +169,7 @@ public class AlarmControllerTest extends AbstractControllerTest { foundAlarm = doGet("/api/alarm/info/" + updatedAlarm.getId(), AlarmInfo.class); testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(foundAlarm, customerDevice, tenantId, - customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ACK, 1, 1, 1); + customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ACK, 1, 0, 1); Mockito.reset(tbClusterService, auditLogService); alarm = updatedAlarm; @@ -183,7 +183,7 @@ public class AlarmControllerTest extends AbstractControllerTest { foundAlarm = doGet("/api/alarm/info/" + updatedAlarm.getId(), AlarmInfo.class); testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(foundAlarm, customerDevice, tenantId, - customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_CLEAR, 1, 1, 1); + customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_CLEAR, 1, 0, 1); Mockito.reset(tbClusterService, auditLogService); alarm = updatedAlarm; @@ -197,7 +197,7 @@ public class AlarmControllerTest extends AbstractControllerTest { foundAlarm = doGet("/api/alarm/info/" + updatedAlarm.getId(), AlarmInfo.class); testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(foundAlarm, customerDevice, tenantId, - customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ASSIGNED, 1, 1, 1); + customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ASSIGNED, 1, 0, 1); Mockito.reset(tbClusterService, auditLogService); alarm = updatedAlarm; @@ -211,7 +211,7 @@ public class AlarmControllerTest extends AbstractControllerTest { foundAlarm = doGet("/api/alarm/info/" + updatedAlarm.getId(), AlarmInfo.class); testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(foundAlarm, customerDevice, tenantId, - customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_UNASSIGNED, 1, 1, 1); + customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_UNASSIGNED, 1, 0, 1); Mockito.reset(tbClusterService, auditLogService); } @@ -321,7 +321,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertNotNull(foundAlarm); Assert.assertEquals(AlarmStatus.CLEARED_UNACK, foundAlarm.getStatus()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.ALARM_CLEAR); } @@ -337,7 +337,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertNotNull(foundAlarm); Assert.assertEquals(AlarmStatus.CLEARED_UNACK, foundAlarm.getStatus()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_CLEAR); } @@ -354,7 +354,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertNotNull(foundAlarm); Assert.assertEquals(AlarmStatus.ACTIVE_ACK, foundAlarm.getStatus()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.ALARM_ACK); } @@ -434,7 +434,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertEquals(tenantAdminUserId, foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ASSIGNED); } @@ -465,7 +465,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertEquals(tenantAdminUserId, foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ASSIGNED); logout(); @@ -482,7 +482,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertEquals(customerUserId, foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.ALARM_ASSIGNED); } @@ -500,7 +500,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertEquals(tenantAdminUserId, foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ASSIGNED); beforeAssignmentTs = System.currentTimeMillis(); @@ -511,7 +511,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertNull(foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_UNASSIGNED); } @@ -529,7 +529,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertEquals(tenantAdminUserId, foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ALARM_ASSIGNED); logout(); @@ -545,7 +545,7 @@ public class AlarmControllerTest extends AbstractControllerTest { Assert.assertNull(foundAlarm.getAssigneeId()); Assert.assertTrue(foundAlarm.getAssignTs() > beforeAssignmentTs && foundAlarm.getAssignTs() < System.currentTimeMillis()); - testNotifyEntityAllOneTime(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), + testNotifyEntityOneTimeMsgToEdgeServiceNever(foundAlarm, foundAlarm.getId(), foundAlarm.getOriginator(), tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.ALARM_UNASSIGNED); } diff --git a/ui-ngx/src/app/shared/import-export/import-dialog.component.html b/ui-ngx/src/app/shared/import-export/import-dialog.component.html index 8bbe1599c4..76e6f8efac 100644 --- a/ui-ngx/src/app/shared/import-export/import-dialog.component.html +++ b/ui-ngx/src/app/shared/import-export/import-dialog.component.html @@ -63,8 +63,7 @@ {{ 'action.cancel' | translate }} From 1bbb88b826e439f68970d9d5ff1340af3d8158a7 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 20 Jan 2025 16:21:24 +0200 Subject: [PATCH 013/100] Revert import-dialog back to default --- .../src/app/shared/import-export/import-dialog.component.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/import-export/import-dialog.component.html b/ui-ngx/src/app/shared/import-export/import-dialog.component.html index 76e6f8efac..8bbe1599c4 100644 --- a/ui-ngx/src/app/shared/import-export/import-dialog.component.html +++ b/ui-ngx/src/app/shared/import-export/import-dialog.component.html @@ -63,7 +63,8 @@ {{ 'action.cancel' | translate }} From 12233475875c6e83f1bae1c6ab7c186a1115a27e Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 20 Jan 2025 16:38:03 +0200 Subject: [PATCH 014/100] Fix testSendOutdatedAttributeToCloud --- .../test/java/org/thingsboard/server/edge/DeviceEdgeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java index e4f9080686..060e641b93 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java @@ -490,7 +490,7 @@ public class DeviceEdgeTest extends AbstractEdgeTest { @Test public void testSendOutdatedAttributeToCloud() throws Exception { - long ts = System.currentTimeMillis() - 5; + long ts = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1); Device device = saveDeviceOnCloudAndVerifyDeliveryToEdge(); edgeImitator.expectResponsesAmount(1); From 5d07beb0dedcee4182f817130e21b5a20e9864be Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 20 Jan 2025 17:44:09 +0200 Subject: [PATCH 015/100] Refactor executeScript to not load script on init, but on execute --- .../cache/RedisTbTransactionalCache.java | 21 +++++++------------ .../server/cache/VersionedRedisTbCache.java | 6 ------ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java index 97fc36fe27..379f08af37 100644 --- a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java +++ b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbTransactionalCache.java @@ -271,24 +271,17 @@ public abstract class RedisTbTransactionalCache Date: Wed, 22 Jan 2025 12:51:49 +0100 Subject: [PATCH 016/100] fixed NPE in sendRpcResponseToTbCore --- .../server/service/rpc/DefaultTbRuleEngineRpcService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/rpc/DefaultTbRuleEngineRpcService.java b/application/src/main/java/org/thingsboard/server/service/rpc/DefaultTbRuleEngineRpcService.java index debc1cb987..27a64dc443 100644 --- a/application/src/main/java/org/thingsboard/server/service/rpc/DefaultTbRuleEngineRpcService.java +++ b/application/src/main/java/org/thingsboard/server/service/rpc/DefaultTbRuleEngineRpcService.java @@ -115,8 +115,9 @@ public class DefaultTbRuleEngineRpcService implements TbRuleEngineDeviceRpcServi ToDeviceRpcRequest request = new ToDeviceRpcRequest(src.getRequestUUID(), src.getTenantId(), src.getDeviceId(), src.isOneway(), src.getExpirationTime(), new ToDeviceRpcRequestBody(src.getMethod(), src.getBody()), src.isPersisted(), src.getRetries(), src.getAdditionalInfo()); forwardRpcRequestToDeviceActor(request, response -> { - if (src.isRestApiCall()) { - sendRpcResponseToTbCore(src.getOriginServiceId(), response); + String originServiceId = src.getOriginServiceId(); + if (src.isRestApiCall() && originServiceId != null) { + sendRpcResponseToTbCore(originServiceId, response); } consumer.accept(RuleEngineDeviceRpcResponse.builder() .deviceId(src.getDeviceId()) From 8b7bf4a633c70811e5e36746e728c3b4a003fddf Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 29 Jan 2025 18:43:15 +0200 Subject: [PATCH 017/100] UI: Add new 'Get Dashboard State with Parameters' action type --- .../widget/lib/action/action-widget.models.ts | 23 +++++++++++++++++++ ...value-action-settings-panel.component.html | 4 +++- ...t-value-action-settings-panel.component.ts | 10 +++++--- .../get-value-action-settings.component.ts | 8 +++++++ .../models/action-widget-settings.models.ts | 6 +++-- .../assets/locale/locale.constant-en_US.json | 3 +++ 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index b4a46d9592..aa001f5a1b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -57,6 +57,7 @@ import { isDefinedAndNotNull } from '@core/utils'; import { parseError } from '@shared/models/error.models'; import { CompiledTbFunction, compileTbFunction } from '@shared/models/js-function.models'; import { HttpClient } from '@angular/common/http'; +import { StateObject } from '@core/api/widget-api.models'; @Directive() // eslint-disable-next-line @angular-eslint/directive-class-suffix @@ -269,6 +270,8 @@ export abstract class ValueGetter extends ValueAction { return new AlarmStatusValueGetter(ctx, settings, valueType, valueObserver, simulated); case GetValueAction.GET_DASHBOARD_STATE: return new DashboardStateGetter(ctx, settings, valueType, valueObserver, simulated); + case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + return new DashboardStateWithParamsGetter(ctx, settings, valueType, valueObserver, simulated); } } @@ -641,6 +644,26 @@ export class DashboardStateGetter extends ValueGetter { } } +export class DashboardStateWithParamsGetter extends ValueGetter { + constructor(protected ctx: WidgetContext, + protected settings: GetValueSettings, + protected valueType: ValueType, + protected valueObserver: Partial>, + protected simulated: boolean) { + super(ctx, settings, valueType, valueObserver, simulated); + } + + protected doGetValue(): Observable { + if (this.simulated) { + return of({id: 'default', params: {}}); + } else { + return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe( + map(id => ({id, params: this.ctx.stateController.getStateParams()})) + ); + } + } +} + export class ExecuteRpcValueSetter extends ValueSetter { private readonly executeRpcSettings: RpcSettings; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html index cb6cd5cbe0..68a9872799 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html @@ -131,7 +131,9 @@ class="tb-form-panel stroked" formGroupName="dataToValue">
widgets.value-action.action-result-converter
- + {{ 'widgets.value-action.converter-none' | translate }} {{ 'widgets.value-action.converter-function' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts index a4339b7e12..82bc659e12 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts @@ -99,6 +99,8 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen getValueSettingsFormGroup: UntypedFormGroup; + entityType = EntityType; + alarmSeverities = Object.keys(AlarmSeverity) as AlarmSeverity[]; alarmSeverityTranslationMap = alarmSeverityTranslations; @@ -167,7 +169,7 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen private updateValidators() { const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; - const dataToValueType: DataToValueType = this.getValueSettingsFormGroup.get('dataToValue').get('type').value; + let dataToValueType: DataToValueType = this.getValueSettingsFormGroup.get('dataToValue').get('type').value; this.getValueSettingsFormGroup.get('defaultValue').disable({emitEvent: false}); this.getValueSettingsFormGroup.get('executeRpc').disable({emitEvent: false}); @@ -196,6 +198,10 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen case GetValueAction.GET_ALARM_STATUS: this.getValueSettingsFormGroup.get('getAlarmStatus').enable({emitEvent: false}); break; + case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + this.getValueSettingsFormGroup.get('dataToValue.type').setValue(DataToValueType.FUNCTION, {emitEvent: false}); + dataToValueType = DataToValueType.FUNCTION; + break } if (action === GetValueAction.DO_NOTHING || action === GetValueAction.GET_ALARM_STATUS) { this.getValueSettingsFormGroup.get('dataToValue').disable({emitEvent: false}); @@ -208,6 +214,4 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen } } } - - protected readonly entityType = EntityType; } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts index 871923e5b7..d482d2e9fe 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts @@ -191,6 +191,14 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-text'); } break; + case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + if (this.valueType === ValueType.BOOLEAN) { + const state = this.modelValue.dataToValue?.compareToValue; + this.displayValue = this.translate.instant('widgets.value-action.when-dashboard-state-with-params-function-is-text', {state}); + } else { + this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-with-params-text'); + } + break; } this.cd.markForCheck(); } diff --git a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts index b1c47a1fd3..1c83669206 100644 --- a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts @@ -25,7 +25,8 @@ export enum GetValueAction { GET_ATTRIBUTE = 'GET_ATTRIBUTE', GET_TIME_SERIES = 'GET_TIME_SERIES', GET_ALARM_STATUS = 'GET_ALARM_STATUS', - GET_DASHBOARD_STATE = 'GET_DASHBOARD_STATE' + GET_DASHBOARD_STATE = 'GET_DASHBOARD_STATE', + GET_DASHBOARD_STATE_WITH_PARAMS = 'GET_DASHBOARD_STATE_WITH_PARAMS', } export const getValueActions = Object.keys(GetValueAction) as GetValueAction[]; @@ -45,7 +46,8 @@ export const getValueActionTranslations = new Map( [GetValueAction.GET_ATTRIBUTE, 'widgets.value-action.get-attribute'], [GetValueAction.GET_TIME_SERIES, 'widgets.value-action.get-time-series'], [GetValueAction.GET_ALARM_STATUS, 'widgets.value-action.get-alarm-status'], - [GetValueAction.GET_DASHBOARD_STATE, 'widgets.value-action.get-dashboard-state'] + [GetValueAction.GET_DASHBOARD_STATE, 'widgets.value-action.get-dashboard-state'], + [GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS, 'widgets.value-action.get-dashboard-state-with-params'], ] ); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index a16625bdaa..8e7e6deb7e 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8265,14 +8265,17 @@ "get-time-series": "Get time series", "get-alarm-status": "Get alarm status", "get-dashboard-state": "Get dashboard state", + "get-dashboard-state-with-params": "Get dashboard state with params", "add-time-series": "Add time series", "execute-rpc-text": "Execute RPC method '{{methodName}}'", "get-time-series-text": "Use time series '{{key}}'", "get-attribute-text": "Use attribute '{{key}}'", "get-alarm-status-text": "Use alarm status", "get-dashboard-state-text": "Use dashboard state", + "get-dashboard-state-with-params-text": "Use dashboard state with params", "when-dashboard-state-is-text": "When dashboard state is '{{state}}'", "when-dashboard-state-function-is-text": "When f(dashboard state) is '{{state}}'", + "when-dashboard-state-with-params-function-is-text": "When f(dashboard state with params) is '{{state}}'", "set-attribute-to-value-text": "Set '{{key}}' attribute to: {{value}}", "add-time-series-value-text": "Add '{{key}}' time series value: {{value}}", "set-attribute-text": "Set '{{key}}' attribute", From c6bb337d23460f7b468085412d099ac08d6d09e9 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 29 Jan 2025 19:08:11 +0200 Subject: [PATCH 018/100] UI: Add help to function 'Get Dashboard State with Parameters' --- ...value-action-settings-panel.component.html | 2 +- ...t-value-action-settings-panel.component.ts | 8 ++++ ...alue_get_dashboard_state_with_params_fn.md | 40 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html index 68a9872799..7783c0af20 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html @@ -145,7 +145,7 @@ [globalVariables]="functionScopeVariables" [functionArgs]="['data']" functionTitle="{{ 'widgets.value-action.parse-value-function' | translate }}" - helpId="widget/lib/rpc/parse_value_fn"> + [helpId]="getParseValueFunctionHelpId()">
{{ 'widgets.value-action.state-when-result-is' | translate:{state: stateLabel} }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts index 82bc659e12..4c98c0cac4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts @@ -167,6 +167,14 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen this.getValueSettingsApplied.emit(getValueSettings); } + getParseValueFunctionHelpId(): string { + const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; + if (action === GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS) { + return 'widget/config/parse_value_get_dashboard_state_with_params_fn'; + } + return 'widget/lib/rpc/parse_value_fn'; + } + private updateValidators() { const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; let dataToValueType: DataToValueType = this.getValueSettingsFormGroup.get('dataToValue').get('type').value; diff --git a/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md new file mode 100644 index 0000000000..c272a07f79 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md @@ -0,0 +1,40 @@ +#### Parse value function + +
+
+ +*function (data): boolean* + +A JavaScript function that converts the current dashboard state and parameters into a boolean value. + +**Parameters:** + +
    +
  • data: StateObject - the current dashboard state object. +
  • +
+ +**Returns:** + +`true` if the widget should be in an activated state, `false` otherwise. + +
+ +##### Examples + +* Check if the current dashboard state ID is "default": + +```javascript +return data.id === 'default' ? true : false; +{:copy-code} +``` + +* Check if the current dashboard state parameters are empty: + +```javascript +return Object.keys(data.params).length ? true : false; +{:copy-code} +``` + +
+
From 50f36c7a5ce7513ade46bbc934b39fec61783963 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 31 Jan 2025 10:11:47 +0200 Subject: [PATCH 019/100] UI: In action dashboard state params added new instance params --- .../home/components/widget/lib/action/action-widget.models.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index aa001f5a1b..dbf83aac9a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -53,7 +53,7 @@ import { import { ValueType } from '@shared/models/constants'; import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; import { EntityId } from '@shared/models/id/entity-id'; -import { isDefinedAndNotNull } from '@core/utils'; +import { deepClone, isDefinedAndNotNull } from '@core/utils'; import { parseError } from '@shared/models/error.models'; import { CompiledTbFunction, compileTbFunction } from '@shared/models/js-function.models'; import { HttpClient } from '@angular/common/http'; @@ -658,7 +658,7 @@ export class DashboardStateWithParamsGetter extends ValueGetter { return of({id: 'default', params: {}}); } else { return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe( - map(id => ({id, params: this.ctx.stateController.getStateParams()})) + map(id => ({id, params: deepClone(this.ctx.stateController.getStateParams())})) ); } } From 5f793b11f91d097187565810a63ac1856672e0b4 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 31 Jan 2025 16:06:52 +0200 Subject: [PATCH 020/100] BaseTelemetryProcessor - use async instead of .get() --- .../telemetry/BaseTelemetryProcessor.java | 161 +++++++++++------- 1 file changed, 95 insertions(+), 66 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java index 520c7ef5ff..5e7731db1d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; import com.google.gson.Gson; import com.google.gson.JsonObject; @@ -81,6 +82,7 @@ import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; @@ -262,27 +264,38 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { return new ImmutablePair<>(queueName, ruleChainId); } - private ListenableFuture processPostAttributes(TenantId tenantId, CustomerId customerId, EntityId entityId, TransportProtos.PostAttributeMsg msg, TbMsgMetaData metaData, long ts) throws Exception { + private ListenableFuture processPostAttributes(TenantId tenantId, CustomerId customerId, EntityId entityId, + TransportProtos.PostAttributeMsg msg, TbMsgMetaData metaData, long ts) throws Exception { SettableFuture futureToSet = SettableFuture.create(); JsonObject json = JsonUtils.getJsonObject(msg.getKvList()); - List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json, ts)); - filterAttributesByTs(tenantId, entityId, AttributeScope.CLIENT_SCOPE, attributes, json); - - var defaultQueueAndRuleChain = getDefaultQueueNameAndRuleChainId(tenantId, entityId); - TbMsg tbMsg = TbMsg.newMsg() - .queueName(defaultQueueAndRuleChain.getKey()) - .type(TbMsgType.POST_ATTRIBUTES_REQUEST) - .originator(entityId) - .customerId(customerId) - .copyMetaData(metaData) - .data(gson.toJson(json)) - .ruleChainId(defaultQueueAndRuleChain.getValue()) - .build(); - edgeCtx.getClusterService().pushMsgToRuleEngine(tenantId, tbMsg.getOriginator(), tbMsg, new TbQueueCallback() { + ListenableFuture> future = filterAttributesByTs(tenantId, entityId, AttributeScope.CLIENT_SCOPE, attributes); + Futures.addCallback(future, new FutureCallback<>() { @Override - public void onSuccess(TbQueueMsgMetadata metadata) { - futureToSet.set(null); + public void onSuccess(List attributesToSave) { + JsonObject jsonToSave = filterAttributesFromJson(json, attributesToSave); + var defaultQueueAndRuleChain = getDefaultQueueNameAndRuleChainId(tenantId, entityId); + TbMsg tbMsg = TbMsg.newMsg() + .queueName(defaultQueueAndRuleChain.getKey()) + .type(TbMsgType.POST_ATTRIBUTES_REQUEST) + .originator(entityId) + .customerId(customerId) + .copyMetaData(metaData) + .data(gson.toJson(jsonToSave)) + .ruleChainId(defaultQueueAndRuleChain.getValue()) + .build(); + edgeCtx.getClusterService().pushMsgToRuleEngine(tenantId, tbMsg.getOriginator(), tbMsg, new TbQueueCallback() { + @Override + public void onSuccess(TbQueueMsgMetadata metadata) { + futureToSet.set(null); + } + + @Override + public void onFailure(Throwable t) { + log.error("[{}] Can't process post attributes [{}]", tenantId, msg, t); + futureToSet.setException(t); + } + }); } @Override @@ -290,7 +303,7 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { log.error("[{}] Can't process post attributes [{}]", tenantId, msg, t); futureToSet.setException(t); } - }); + }, dbCallbackExecutorService); return futureToSet; } @@ -299,34 +312,46 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { EntityId entityId, TransportProtos.PostAttributeMsg msg, TbMsgMetaData metaData, - long ts) throws Exception { + long ts) { SettableFuture futureToSet = SettableFuture.create(); JsonObject json = JsonUtils.getJsonObject(msg.getKvList()); AttributeScope scope = AttributeScope.valueOf(metaData.getValue("scope")); List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json, ts)); - List attributesToSave = filterAttributesByTs(tenantId, entityId, scope, attributes, json); - tsSubService.saveAttributes(AttributesSaveRequest.builder() - .tenantId(tenantId) - .entityId(entityId) - .scope(scope) - .entries(attributesToSave) - .callback(new FutureCallback<>() { - @Override - public void onSuccess(@Nullable Void tmp) { - var defaultQueueAndRuleChain = getDefaultQueueNameAndRuleChainId(tenantId, entityId); - TbMsg tbMsg = TbMsg.newMsg() - .queueName(defaultQueueAndRuleChain.getKey()) - .type(TbMsgType.ATTRIBUTES_UPDATED) - .originator(entityId) - .customerId(customerId) - .copyMetaData(metaData) - .data(gson.toJson(json)) - .ruleChainId(defaultQueueAndRuleChain.getValue()) - .build(); - edgeCtx.getClusterService().pushMsgToRuleEngine(tenantId, tbMsg.getOriginator(), tbMsg, new TbQueueCallback() { + ListenableFuture> future = filterAttributesByTs(tenantId, entityId, scope, attributes); + Futures.addCallback(future, new FutureCallback<>() { + @Override + public void onSuccess(List attributesToSave) { + JsonObject jsonToSave = filterAttributesFromJson(json, attributesToSave); + tsSubService.saveAttributes(AttributesSaveRequest.builder() + .tenantId(tenantId) + .entityId(entityId) + .scope(scope) + .entries(attributesToSave) + .callback(new FutureCallback<>() { @Override - public void onSuccess(TbQueueMsgMetadata metadata) { - futureToSet.set(null); + public void onSuccess(@Nullable Void tmp) { + var defaultQueueAndRuleChain = getDefaultQueueNameAndRuleChainId(tenantId, entityId); + TbMsg tbMsg = TbMsg.newMsg() + .queueName(defaultQueueAndRuleChain.getKey()) + .type(TbMsgType.ATTRIBUTES_UPDATED) + .originator(entityId) + .customerId(customerId) + .copyMetaData(metaData) + .data(gson.toJson(jsonToSave)) + .ruleChainId(defaultQueueAndRuleChain.getValue()) + .build(); + edgeCtx.getClusterService().pushMsgToRuleEngine(tenantId, tbMsg.getOriginator(), tbMsg, new TbQueueCallback() { + @Override + public void onSuccess(TbQueueMsgMetadata metadata) { + futureToSet.set(null); + } + + @Override + public void onFailure(Throwable t) { + log.error("[{}] Can't process attributes update [{}]", tenantId, msg, t); + futureToSet.setException(t); + } + }); } @Override @@ -334,22 +359,28 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { log.error("[{}] Can't process attributes update [{}]", tenantId, msg, t); futureToSet.setException(t); } - }); - } + }) + .build()); + } - @Override - public void onFailure(Throwable t) { - log.error("[{}] Can't process attributes update [{}]", tenantId, msg, t); - futureToSet.setException(t); - } - }) - .build()); + @Override + public void onFailure(Throwable t) { + log.error("[{}] Can't process attributes update [{}]", tenantId, msg, t); + futureToSet.setException(t); + } + }, dbCallbackExecutorService); return futureToSet; } - private ListenableFuture processAttributeDeleteMsg(TenantId tenantId, EntityId entityId, AttributeDeleteMsg attributeDeleteMsg, - String entityType) { + private JsonObject filterAttributesFromJson(JsonObject json, List attributesToSave) { + Set keysToSave = attributesToSave.stream() + .map(KvEntry::getKey) + .collect(Collectors.toSet()); + json.keySet().removeIf(key -> !keysToSave.contains(key)); + return json; + } + private ListenableFuture processAttributeDeleteMsg(TenantId tenantId, EntityId entityId, AttributeDeleteMsg attributeDeleteMsg, String entityType) { String scope = attributeDeleteMsg.getScope(); List attributeKeys = attributeDeleteMsg.getAttributeNamesList(); ListenableFuture> removeAllFuture = edgeCtx.getAttributesService().removeAll(tenantId, entityId, AttributeScope.valueOf(scope), attributeKeys); @@ -401,21 +432,19 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { entityDataMsgConstructor.constructEntityDataMsg(tenantId, entityId, actionType, JsonParser.parseString(bodyJackson)); } - private List filterAttributesByTs(TenantId tenantId, EntityId entityId, AttributeScope scope, List attributes, JsonObject jsonObject) throws Exception { + private ListenableFuture> filterAttributesByTs(TenantId tenantId, EntityId entityId, AttributeScope scope, + List attributes) { List keys = attributes.stream().map(KvEntry::getKey).toList(); - Map existingAttributesTs = edgeCtx.getAttributesService().find(tenantId, entityId, scope, keys).get() - .stream().collect(Collectors.toMap(KvEntry::getKey, AttributeKvEntry::getLastUpdateTs)); - return attributes.stream() - .filter(attribute -> { - String key = attribute.getKey(); - long incomingTs = attribute.getLastUpdateTs(); - if (incomingTs > existingAttributesTs.getOrDefault(key, 0L)) { - return true; - } else { - jsonObject.remove(key); - return false; - } - }).toList(); + ListenableFuture> future = edgeCtx.getAttributesService().find(tenantId, entityId, scope, keys); + return Futures.transform(future, input -> { + Map existingAttributesTs = input.stream().collect(Collectors.toMap(KvEntry::getKey, AttributeKvEntry::getLastUpdateTs)); + return attributes.stream() + .filter(attribute -> { + String key = attribute.getKey(); + long incomingTs = attribute.getLastUpdateTs(); + return incomingTs > existingAttributesTs.getOrDefault(key, 0L); + }).toList(); + }, dbCallbackExecutorService); } } From ce4c654e21d89784a7b893f1abe9bac56ecb1e21 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 31 Jan 2025 16:58:12 +0200 Subject: [PATCH 021/100] BaseTelemetryProcessor - use scope from msg, and not hardcoded CLIENT_SCOPE --- .../processor/telemetry/BaseTelemetryProcessor.java | 8 +++++--- .../rule/engine/edge/AbstractTbMsgPushNode.java | 10 ++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java index 5e7731db1d..73713ccf99 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java @@ -130,11 +130,12 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { CustomerId customerId = pair.getValue(); metaData.putValue(DataConstants.MSG_SOURCE_KEY, getMsgSourceKey()); if (entityData.hasPostAttributesMsg()) { + metaData.putValue(DataConstants.SCOPE, entityData.getPostAttributeScope()); long ts = entityData.hasAttributeTs() ? entityData.getAttributeTs() : System.currentTimeMillis(); result.add(processPostAttributes(tenantId, customerId, entityId, entityData.getPostAttributesMsg(), metaData, ts)); } if (entityData.hasAttributesUpdatedMsg()) { - metaData.putValue("scope", entityData.getPostAttributeScope()); + metaData.putValue(DataConstants.SCOPE, entityData.getPostAttributeScope()); long ts = entityData.hasAttributeTs() ? entityData.getAttributeTs() : System.currentTimeMillis(); result.add(processAttributesUpdate(tenantId, customerId, entityId, entityData.getAttributesUpdatedMsg(), metaData, ts)); } @@ -268,8 +269,9 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { TransportProtos.PostAttributeMsg msg, TbMsgMetaData metaData, long ts) throws Exception { SettableFuture futureToSet = SettableFuture.create(); JsonObject json = JsonUtils.getJsonObject(msg.getKvList()); + AttributeScope scope = AttributeScope.valueOf(metaData.getValue(DataConstants.SCOPE)); List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json, ts)); - ListenableFuture> future = filterAttributesByTs(tenantId, entityId, AttributeScope.CLIENT_SCOPE, attributes); + ListenableFuture> future = filterAttributesByTs(tenantId, entityId, scope, attributes); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(List attributesToSave) { @@ -315,7 +317,7 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { long ts) { SettableFuture futureToSet = SettableFuture.create(); JsonObject json = JsonUtils.getJsonObject(msg.getKvList()); - AttributeScope scope = AttributeScope.valueOf(metaData.getValue("scope")); + AttributeScope scope = AttributeScope.valueOf(metaData.getValue(DataConstants.SCOPE)); List attributes = new ArrayList<>(JsonConverter.convertToAttributes(json, ts)); ListenableFuture> future = filterAttributesByTs(tenantId, entityId, scope, attributes); Futures.addCallback(future, new FutureCallback<>() { diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java index f1fe1affc6..911bfac43f 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java @@ -54,8 +54,6 @@ public abstract class AbstractTbMsgPushNode { entityBody.put("kv", dataJson); entityBody.put("ts", msg.getMetaDataTs()); - entityBody.put(SCOPE, getScope(metadata)); + entityBody.put(DataConstants.SCOPE, getScope(metadata)); if (EdgeEventActionType.POST_ATTRIBUTES.equals(actionType)) { entityBody.put("isPostAttributes", true); } @@ -99,7 +97,7 @@ public abstract class AbstractTbMsgPushNode keys = JacksonUtil.convertValue(dataJson.get("attributes"), new TypeReference<>() { }); entityBody.put("keys", keys); - entityBody.put(SCOPE, getScope(metadata)); + entityBody.put(DataConstants.SCOPE, getScope(metadata)); } case TIMESERIES_UPDATED -> { entityBody.put("data", dataJson); @@ -146,7 +144,7 @@ public abstract class AbstractTbMsgPushNode metadata) { - String scope = metadata.get(SCOPE); + String scope = metadata.get(DataConstants.SCOPE); if (StringUtils.isEmpty(scope)) { scope = config.getScope(); } @@ -164,7 +162,7 @@ public abstract class AbstractTbMsgPushNode Date: Fri, 31 Jan 2025 17:02:07 +0200 Subject: [PATCH 022/100] BaseTelemetryProcessor - Fixed import --- .../edge/rpc/processor/telemetry/BaseTelemetryProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java index 73713ccf99..4251ee8a79 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; import com.google.gson.Gson; import com.google.gson.JsonObject; From 99effb6918b897f9d502e4272e286f823b2e48b4 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Fri, 31 Jan 2025 18:00:24 +0200 Subject: [PATCH 023/100] ERRORs processing RESOURCES - Disabled duplicate validation on cloud for resource message --- .../edge/rpc/processor/resource/BaseResourceProcessor.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java index ac7bd6768c..4608e52cbf 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java @@ -17,24 +17,18 @@ package org.thingsboard.server.service.edge.rpc.processor.resource; import com.datastax.oss.driver.api.core.uuid.Uuids; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.TbResource; -import org.thingsboard.server.common.data.TbResourceInfo; import org.thingsboard.server.common.data.id.TbResourceId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageDataIterable; -import org.thingsboard.server.dao.service.DataValidator; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j public abstract class BaseResourceProcessor extends BaseEdgeProcessor { - @Autowired - private DataValidator resourceValidator; - protected boolean saveOrUpdateTbResource(TenantId tenantId, TbResourceId tbResourceId, ResourceUpdateMsg resourceUpdateMsg) { boolean resourceKeyUpdated = false; try { @@ -64,7 +58,6 @@ public abstract class BaseResourceProcessor extends BaseEdgeProcessor { } } resource.setResourceKey(resourceKey); - resourceValidator.validate(resource, TbResourceInfo::getTenantId); if (created) { resource.setId(tbResourceId); } From 0f7142cfef7f04afc69ebf5f2a63885accc0b3f3 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Fri, 31 Jan 2025 18:11:51 +0200 Subject: [PATCH 024/100] ERRORs processing DEVICE PROFILE - Added saving the DELETED action when the edge is offline. - Added synchronization of Device Profile twice for its relation with Ota Package. --- .../org/thingsboard/server/service/edge/rpc/EdgeSyncCursor.java | 1 + .../server/service/edge/rpc/processor/BaseEdgeProcessor.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeSyncCursor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeSyncCursor.java index 7426207a56..7fab0094b4 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeSyncCursor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeSyncCursor.java @@ -87,6 +87,7 @@ public class EdgeSyncCursor { fetchers.add(new SystemWidgetsBundlesEdgeEventFetcher(ctx.getWidgetsBundleService())); fetchers.add(new TenantWidgetsBundlesEdgeEventFetcher(ctx.getWidgetsBundleService())); fetchers.add(new OtaPackagesEdgeEventFetcher(ctx.getOtaPackageService())); + fetchers.add(new DeviceProfilesEdgeEventFetcher(ctx.getDeviceProfileService())); fetchers.add(new TenantResourcesEdgeEventFetcher(ctx.getResourceService())); fetchers.add(new OAuth2EdgeEventFetcher(ctx.getDomainService())); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java index e448fbd937..8f0f06c6bf 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java @@ -120,7 +120,7 @@ public abstract class BaseEdgeProcessor { private boolean doSaveIfEdgeIsOffline(EdgeEventType type, EdgeEventActionType action) { return switch (action) { case TIMESERIES_UPDATED, ALARM_ACK, ALARM_CLEAR, ALARM_ASSIGNED, ALARM_UNASSIGNED, ADDED_COMMENT, - UPDATED_COMMENT -> true; + UPDATED_COMMENT, DELETED -> true; default -> switch (type) { case ALARM, ALARM_COMMENT, RULE_CHAIN, RULE_CHAIN_METADATA, USER, CUSTOMER, TENANT, TENANT_PROFILE, WIDGETS_BUNDLE, WIDGET_TYPE, ADMIN_SETTINGS, OTA_PACKAGE, QUEUE, RELATION, NOTIFICATION_TEMPLATE, NOTIFICATION_TARGET, From 3b8be75a14fe87968a5823346db4f1f8afcadf1c Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 31 Jan 2025 18:24:50 +0200 Subject: [PATCH 025/100] DeviceEdgeTest.testSendOutdatedAttributeToCloud - improved stability for concurrent issue --- .../java/org/thingsboard/server/edge/DeviceEdgeTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java index 060e641b93..80e7d2aed4 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java @@ -500,6 +500,15 @@ public class DeviceEdgeTest extends AbstractEdgeTest { attributesNode.put("test_attr", originalValue); doPost("/api/plugins/telemetry/DEVICE/" + device.getId() + "/attributes/SERVER_SCOPE", attributesNode); + // Wait before device attributes saved to database + Awaitility.await() + .atMost(10, TimeUnit.SECONDS) + .until(() -> { + String urlTemplate = "/api/plugins/telemetry/DEVICE/" + device.getId() + "/keys/attributes/" + DataConstants.SERVER_SCOPE; + List actualKeys = doGetAsyncTyped(urlTemplate, new TypeReference<>() {}); + return actualKeys != null && !actualKeys.isEmpty() && actualKeys.contains("test_attr"); + }); + JsonObject attributesData = new JsonObject(); // incorrect msg, will not be saved, because of ts is lower than for already existing String attributesKey = "test_attr"; From c3de38305f2ef8210c52f62729c5f21d8faf58d1 Mon Sep 17 00:00:00 2001 From: Illia Tsybulenko-Sihov Date: Fri, 31 Jan 2025 22:27:18 +0200 Subject: [PATCH 026/100] updated prometheus version to 3.1.0 --- docker/docker-compose.prometheus-grafana.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.prometheus-grafana.yml b/docker/docker-compose.prometheus-grafana.yml index 311d96bd86..f6a5f7fb6d 100644 --- a/docker/docker-compose.prometheus-grafana.yml +++ b/docker/docker-compose.prometheus-grafana.yml @@ -23,7 +23,7 @@ volumes: services: prometheus: - image: prom/prometheus:v2.1.0 + image: prom/prometheus:v3.1.0 volumes: - ./monitoring/prometheus/:/etc/prometheus/ - prometheus_data:/prometheus From 4dfd4737a40fe2d5d84d2348e3992647cf3a9164 Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Mon, 3 Feb 2025 18:17:15 +0100 Subject: [PATCH 027/100] Device Actor processor remove subscriptions on MaxSessionsLimit --- .../server/actors/device/DeviceActorMessageProcessor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java index 3dca3417b4..77bf7c32fa 100644 --- a/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java @@ -865,6 +865,8 @@ public class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcesso } private void notifyTransportAboutClosedSessionMaxSessionsLimit(UUID sessionId, SessionInfoMetaData sessionMd) { + attributeSubscriptions.remove(sessionId); + rpcSubscriptions.remove(sessionId); notifyTransportAboutClosedSession(sessionId, sessionMd, TransportSessionCloseReason.MAX_CONCURRENT_SESSIONS_LIMIT_REACHED); } From 726e6f79024da417e7545f5217824955bf3c6013 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Tue, 4 Feb 2025 12:02:58 +0200 Subject: [PATCH 028/100] Fix error in resource processing - Added a check that the resource is not updatable --- .../rpc/processor/resource/BaseResourceProcessor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java index 4608e52cbf..a9a3bcf9fb 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java @@ -17,18 +17,24 @@ package org.thingsboard.server.service.edge.rpc.processor.resource; import com.datastax.oss.driver.api.core.uuid.Uuids; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.TbResource; +import org.thingsboard.server.common.data.TbResourceInfo; import org.thingsboard.server.common.data.id.TbResourceId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageDataIterable; +import org.thingsboard.server.dao.service.DataValidator; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @Slf4j public abstract class BaseResourceProcessor extends BaseEdgeProcessor { + @Autowired + private DataValidator resourceValidator; + protected boolean saveOrUpdateTbResource(TenantId tenantId, TbResourceId tbResourceId, ResourceUpdateMsg resourceUpdateMsg) { boolean resourceKeyUpdated = false; try { @@ -47,6 +53,9 @@ public abstract class BaseResourceProcessor extends BaseEdgeProcessor { } String resourceKey = resource.getResourceKey(); ResourceType resourceType = resource.getResourceType(); + if (!created && !resourceType.isUpdatable()) { + resource.setData(null); + } PageDataIterable resourcesIterable = new PageDataIterable<>( link -> edgeCtx.getResourceService().findTenantResourcesByResourceTypeAndPageLink(tenantId, resourceType, link), 1024); for (TbResource tbResource : resourcesIterable) { @@ -58,6 +67,7 @@ public abstract class BaseResourceProcessor extends BaseEdgeProcessor { } } resource.setResourceKey(resourceKey); + resourceValidator.validate(resource, TbResourceInfo::getTenantId); if (created) { resource.setId(tbResourceId); } From 0dface5490f374aafd67a2301e54a71ed754765b Mon Sep 17 00:00:00 2001 From: yevhenii Date: Tue, 4 Feb 2025 16:41:13 +0200 Subject: [PATCH 029/100] Fix error in resource processing - Added update JKS resource on Cloud --- .../server/edge/ResourceEdgeTest.java | 76 +++++++++++-------- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java index c27489d207..cc5aa4da0e 100644 --- a/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java @@ -17,6 +17,7 @@ package org.thingsboard.server.edge; import com.datastax.oss.driver.api.core.uuid.Uuids; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.InvalidProtocolBufferException; import org.junit.Assert; import org.junit.Test; import org.thingsboard.common.util.JacksonUtil; @@ -98,30 +99,23 @@ public class ResourceEdgeTest extends AbstractEdgeTest { public void testSendResourceToCloud() throws Exception { TbResource tbResource = createTbResource(); UUID uuid = Uuids.timeBased(); + UplinkMsg uplinkMsg = getUplinkMsg(uuid, tbResource, UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); - UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); - ResourceUpdateMsg.Builder resourceUpdateMsgBuilder = ResourceUpdateMsg.newBuilder(); - resourceUpdateMsgBuilder.setIdMSB(uuid.getMostSignificantBits()); - resourceUpdateMsgBuilder.setIdLSB(uuid.getLeastSignificantBits()); - resourceUpdateMsgBuilder.setEntity(JacksonUtil.toString(tbResource)); - resourceUpdateMsgBuilder.setMsgType(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); - testAutoGeneratedCodeByProtobuf(resourceUpdateMsgBuilder); - uplinkMsgBuilder.addResourceUpdateMsg(resourceUpdateMsgBuilder.build()); + checkResourceOnCloud(uplinkMsg, uuid, tbResource.getTitle()); + } - testAutoGeneratedCodeByProtobuf(uplinkMsgBuilder); + @Test + public void testUpdateResourceTitleOnCloud() throws Exception { + TbResource tbResource = createTbResource(); + UUID uuid = Uuids.timeBased(); + UplinkMsg uplinkMsg = getUplinkMsg(uuid, tbResource, UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); - edgeImitator.expectResponsesAmount(1); - edgeImitator.sendUplinkMsg(uplinkMsgBuilder.build()); + checkResourceOnCloud(uplinkMsg, uuid, tbResource.getTitle()); - Assert.assertTrue(edgeImitator.waitForResponses()); + tbResource.setTitle("Updated Edge Test Resource"); + UplinkMsg updatedUplinkMsg = getUplinkMsg(uuid, tbResource, UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE); - UplinkResponseMsg latestResponseMsg = edgeImitator.getLatestResponseMsg(); - Assert.assertTrue(latestResponseMsg.getSuccess()); - - TbResource tb = doGet("/api/resource/" + uuid, TbResource.class); - Assert.assertNotNull(tb); - Assert.assertEquals("Edge Test Resource", tb.getName()); - Assert.assertEquals(TEST_DATA, tb.getEncodedData()); + checkResourceOnCloud(updatedUplinkMsg, uuid, tbResource.getTitle()); } @Test @@ -134,21 +128,12 @@ public class ResourceEdgeTest extends AbstractEdgeTest { UUID uuid = Uuids.timeBased(); - UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); - ResourceUpdateMsg.Builder resourceUpdateMsgBuilder = ResourceUpdateMsg.newBuilder(); - resourceUpdateMsgBuilder.setIdMSB(uuid.getMostSignificantBits()); - resourceUpdateMsgBuilder.setIdLSB(uuid.getLeastSignificantBits()); - resourceUpdateMsgBuilder.setEntity(JacksonUtil.toString(resource)); - resourceUpdateMsgBuilder.setMsgType(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); - testAutoGeneratedCodeByProtobuf(resourceUpdateMsgBuilder); - uplinkMsgBuilder.addResourceUpdateMsg(resourceUpdateMsgBuilder.build()); - - testAutoGeneratedCodeByProtobuf(uplinkMsgBuilder); + UplinkMsg uplinkMsg = getUplinkMsg(uuid, resource, UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); edgeImitator.expectResponsesAmount(1); edgeImitator.expectMessageAmount(1); - edgeImitator.sendUplinkMsg(uplinkMsgBuilder.build()); + edgeImitator.sendUplinkMsg(uplinkMsg); Assert.assertTrue(edgeImitator.waitForResponses()); Assert.assertTrue(edgeImitator.waitForMessages()); @@ -177,4 +162,35 @@ public class ResourceEdgeTest extends AbstractEdgeTest { tbResource.setEncodedData(TEST_DATA); return tbResource; } + + private UplinkMsg getUplinkMsg(UUID uuid, TbResource tbResource, UpdateMsgType updateMsgType) throws InvalidProtocolBufferException { + UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); + ResourceUpdateMsg.Builder resourceUpdateMsgBuilder = ResourceUpdateMsg.newBuilder(); + resourceUpdateMsgBuilder.setIdMSB(uuid.getMostSignificantBits()); + resourceUpdateMsgBuilder.setIdLSB(uuid.getLeastSignificantBits()); + resourceUpdateMsgBuilder.setEntity(JacksonUtil.toString(tbResource)); + resourceUpdateMsgBuilder.setMsgType(updateMsgType); + testAutoGeneratedCodeByProtobuf(resourceUpdateMsgBuilder); + uplinkMsgBuilder.addResourceUpdateMsg(resourceUpdateMsgBuilder.build()); + + testAutoGeneratedCodeByProtobuf(uplinkMsgBuilder); + + return uplinkMsgBuilder.build(); + } + + private void checkResourceOnCloud(UplinkMsg uplinkMsg, UUID uuid, String resourceTitle) throws Exception { + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsg); + + Assert.assertTrue(edgeImitator.waitForResponses()); + + UplinkResponseMsg latestResponseMsg = edgeImitator.getLatestResponseMsg(); + Assert.assertTrue(latestResponseMsg.getSuccess()); + + TbResource tb = doGet("/api/resource/" + uuid, TbResource.class); + Assert.assertNotNull(tb); + Assert.assertEquals(resourceTitle, tb.getName()); + Assert.assertEquals(TEST_DATA, tb.getEncodedData()); + } + } From 4657e66d92e650f9b1dbaf58e66f554f9bd7b090 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Tue, 4 Feb 2025 17:15:43 +0200 Subject: [PATCH 030/100] Fixed assignemnt/unassignemnt of dashboards --- .../dashboard/BaseDashboardProcessor.java | 62 +++++++++++-------- .../dashboard/DashboardEdgeProcessor.java | 6 +- .../dashboard/DashboardEdgeProcessorV1.java | 3 +- .../server/edge/DashboardEdgeTest.java | 15 ++++- 4 files changed, 54 insertions(+), 32 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java index 52277b8527..faf001fbba 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java @@ -26,6 +26,7 @@ import org.thingsboard.server.dao.service.DataValidator; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; +import java.util.HashSet; import java.util.Set; @Slf4j @@ -40,54 +41,63 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { if (dashboard == null) { throw new RuntimeException("[{" + tenantId + "}] dashboardUpdateMsg {" + dashboardUpdateMsg + "} cannot be converted to dashboard"); } - Set assignedCustomers = null; + Set newAssignedCustomers = new HashSet<>(dashboard.getAssignedCustomers()); Dashboard dashboardById = edgeCtx.getDashboardService().findDashboardById(tenantId, dashboardId); if (dashboardById == null) { created = true; dashboard.setId(null); + dashboard.setAssignedCustomers(null); } else { dashboard.setId(dashboardId); - assignedCustomers = filterNonExistingCustomers(tenantId, dashboardById.getAssignedCustomers()); + dashboard.setAssignedCustomers(dashboardById.getAssignedCustomers()); } dashboardValidator.validate(dashboard, Dashboard::getTenantId); if (created) { dashboard.setId(dashboardId); } - Set msgAssignedCustomers = filterNonExistingCustomers(tenantId, dashboard.getAssignedCustomers()); - if (msgAssignedCustomers != null) { - if (assignedCustomers == null) { - assignedCustomers = msgAssignedCustomers; - } else { - assignedCustomers.addAll(msgAssignedCustomers); + + Dashboard savedDashboard = edgeCtx.getDashboardService().saveDashboard(dashboard, false); + + updateDashboardAssignments(tenantId, dashboardById, savedDashboard, newAssignedCustomers); + + return created; + } + + private void updateDashboardAssignments(TenantId tenantId, Dashboard dashboardById, Dashboard savedDashboard, Set newAssignedCustomers) { + Set currentAssignedCustomers = new HashSet<>(); + if (dashboardById != null) { + if (dashboardById.getAssignedCustomers() != null) { + currentAssignedCustomers.addAll(dashboardById.getAssignedCustomers()); } } - dashboard.setAssignedCustomers(assignedCustomers); - Dashboard savedDashboard = edgeCtx.getDashboardService().saveDashboard(dashboard, false); - if (msgAssignedCustomers != null && !msgAssignedCustomers.isEmpty()) { - for (ShortCustomerInfo assignedCustomer : msgAssignedCustomers) { - if (assignedCustomer.getCustomerId().equals(customerId)) { - edgeCtx.getDashboardService().assignDashboardToCustomer(tenantId, savedDashboard.getId(), assignedCustomer.getCustomerId()); - } + + newAssignedCustomers = filterNonExistingCustomers(tenantId, currentAssignedCustomers, newAssignedCustomers); + + Set addedCustomerIds = new HashSet<>(); + Set removedCustomerIds = new HashSet<>(); + for (ShortCustomerInfo newAssignedCustomer : newAssignedCustomers) { + if (!savedDashboard.isAssignedToCustomer(newAssignedCustomer.getCustomerId())) { + addedCustomerIds.add(newAssignedCustomer.getCustomerId()); } - } else { - unassignCustomersFromDashboard(tenantId, savedDashboard, customerId); } - return created; - } - private void unassignCustomersFromDashboard(TenantId tenantId, Dashboard dashboard, CustomerId customerId) { - if (dashboard.getAssignedCustomers() != null && !dashboard.getAssignedCustomers().isEmpty()) { - for (ShortCustomerInfo assignedCustomer : dashboard.getAssignedCustomers()) { - if (assignedCustomer.getCustomerId().equals(customerId)) { - edgeCtx.getDashboardService().unassignDashboardFromCustomer(tenantId, dashboard.getId(), assignedCustomer.getCustomerId()); - } + for (ShortCustomerInfo currentAssignedCustomer : currentAssignedCustomers) { + if (!newAssignedCustomers.contains(currentAssignedCustomer)) { + removedCustomerIds.add(currentAssignedCustomer.getCustomerId()); } } + + for (CustomerId customerIdToAdd : addedCustomerIds) { + edgeCtx.getDashboardService().assignDashboardToCustomer(tenantId, savedDashboard.getId(), customerIdToAdd); + } + for (CustomerId customerIdToRemove : removedCustomerIds) { + edgeCtx.getDashboardService().unassignDashboardFromCustomer(tenantId, savedDashboard.getId(), customerIdToRemove); + } } protected abstract Dashboard constructDashboardFromUpdateMsg(TenantId tenantId, DashboardId dashboardId, DashboardUpdateMsg dashboardUpdateMsg); - protected abstract Set filterNonExistingCustomers(TenantId tenantId, Set assignedCustomers); + protected abstract Set filterNonExistingCustomers(TenantId tenantId, Set currentAssignedCustomers, Set newAssignedCustomers); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java index cb54977c3c..8d953907b6 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java @@ -128,9 +128,9 @@ public abstract class DashboardEdgeProcessor extends BaseDashboardProcessor impl } @Override - protected Set filterNonExistingCustomers(TenantId tenantId, Set assignedCustomers) { - // do nothing on cloud - return assignedCustomers; + protected Set filterNonExistingCustomers(TenantId tenantId, Set currentAssignedCustomers, Set newAssignedCustomers) { + newAssignedCustomers.addAll(currentAssignedCustomers); + return newAssignedCustomers; } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java index 20ab6019bf..c13c85779a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessorV1.java @@ -26,6 +26,7 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; import org.thingsboard.server.queue.util.TbCoreComponent; +import java.util.HashSet; import java.util.Set; @Component @@ -44,7 +45,7 @@ public class DashboardEdgeProcessorV1 extends DashboardEdgeProcessor { Set assignedCustomers; if (dashboardUpdateMsg.hasAssignedCustomers()) { assignedCustomers = JacksonUtil.fromString(dashboardUpdateMsg.getAssignedCustomers(), new TypeReference<>() {}); - assignedCustomers = filterNonExistingCustomers(tenantId, assignedCustomers); + assignedCustomers = filterNonExistingCustomers(tenantId, new HashSet<>(), assignedCustomers); dashboard.setAssignedCustomers(assignedCustomers); } dashboard.setMobileOrder(dashboardUpdateMsg.hasMobileOrder() ? dashboardUpdateMsg.getMobileOrder() : null); diff --git a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java index 3b252046ab..5b09e05a09 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edge; import com.fasterxml.jackson.core.type.TypeReference; +import com.google.common.collect.Sets; import com.google.protobuf.AbstractMessage; import org.junit.Assert; import org.junit.Test; @@ -175,7 +176,11 @@ public class DashboardEdgeTest extends AbstractEdgeTest { @Test public void testSendDashboardToCloud() throws Exception { - Dashboard dashboard = buildDashboardForUplinkMsg(); + Customer customer = new Customer(); + customer.setTitle("Edge Customer"); + Customer savedCustomer = doPost("/api/customer", customer, Customer.class); + + Dashboard dashboard = buildDashboardForUplinkMsg(savedCustomer); UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); DashboardUpdateMsg.Builder dashboardUpdateMsgBuilder = DashboardUpdateMsg.newBuilder(); @@ -196,6 +201,11 @@ public class DashboardEdgeTest extends AbstractEdgeTest { Dashboard foundDashboard = doGet("/api/dashboard/" + dashboard.getUuidId(), Dashboard.class); Assert.assertNotNull(foundDashboard); Assert.assertEquals("Edge Test Dashboard", foundDashboard.getName()); + + PageData pageData = doGetTypedWithPageLink("/api/customer/" + savedCustomer.getId().toString() + "/dashboards?", + new TypeReference<>() {}, new PageLink(100)); + Assert.assertEquals(1, pageData.getData().size()); + Assert.assertEquals("Edge Test Dashboard", pageData.getData().get(0).getTitle()); } @Test @@ -242,11 +252,12 @@ public class DashboardEdgeTest extends AbstractEdgeTest { return savedDashboard; } - private Dashboard buildDashboardForUplinkMsg() { + private Dashboard buildDashboardForUplinkMsg(Customer savedCustomer) { Dashboard dashboard = new Dashboard(); dashboard.setId(new DashboardId(UUID.randomUUID())); dashboard.setTenantId(tenantId); dashboard.setTitle("Edge Test Dashboard"); + dashboard.setAssignedCustomers(Sets.newHashSet(new ShortCustomerInfo(savedCustomer.getId(), savedCustomer.getTitle(), savedCustomer.isPublic()))); return dashboard; } From be41d477f8bc5b8b619006ad6773b0faf847b0ff Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 4 Feb 2025 17:33:57 +0200 Subject: [PATCH 031/100] UI: Fixed detect change state in dashboard --- .../widget/lib/action/action-widget.models.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index dbf83aac9a..9c5bc7885a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -25,6 +25,7 @@ import { WidgetContext } from '@home/models/widget-component.models'; import { BehaviorSubject, forkJoin, + merge, Observable, Observer, of, @@ -33,7 +34,7 @@ import { switchMap, throwError } from 'rxjs'; -import { catchError, delay, map, share, take } from 'rxjs/operators'; +import { catchError, debounceTime, delay, map, share, take } from 'rxjs/operators'; import { AfterViewInit, ChangeDetectorRef, Directive, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core'; import { DataToValueSettings, @@ -657,8 +658,15 @@ export class DashboardStateWithParamsGetter extends ValueGetter { if (this.simulated) { return of({id: 'default', params: {}}); } else { - return this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId.pipe( - map(id => ({id, params: deepClone(this.ctx.stateController.getStateParams())})) + return merge( + this.ctx.stateController.dashboardCtrl.dashboardCtx.stateId, + this.ctx.stateController.dashboardCtrl.dashboardCtx.stateChanged + ).pipe( + debounceTime(10), + map(() => ({ + id: this.ctx.stateController.getStateId(), + params: deepClone(this.ctx.stateController.getStateParams()) + })) ); } } From 76155aca75c3e49553700b354941779ff1472f5f Mon Sep 17 00:00:00 2001 From: Oleksandra Matviienko Date: Tue, 4 Feb 2025 21:24:24 +0100 Subject: [PATCH 032/100] Added test to verify attribute and RPC subscriptions removal on session overflow. Signed-off-by: Oleksandra Matviienko --- .../server/actors/ActorSystemContext.java | 2 +- .../device/DeviceActorMessageProcessor.java | 4 +-- .../DeviceActorMessageProcessorTest.java | 30 ++++++++++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java index 1c18a31f68..b13cf8e490 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java @@ -489,7 +489,7 @@ public class ActorSystemContext { @Value("${actors.session.max_concurrent_sessions_per_device:1}") @Getter - private long maxConcurrentSessionsPerDevice; + private int maxConcurrentSessionsPerDevice; @Value("${actors.session.sync.timeout:10000}") @Getter diff --git a/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java index 77bf7c32fa..a29fcfc362 100644 --- a/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessor.java @@ -126,8 +126,8 @@ public class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcesso final TenantId tenantId; final DeviceId deviceId; final LinkedHashMapRemoveEldest sessions; - private final Map attributeSubscriptions; - private final Map rpcSubscriptions; + final Map attributeSubscriptions; + final Map rpcSubscriptions; private final Map toDeviceRpcPendingMap; private final boolean rpcSequential; private final RpcSubmitStrategy rpcSubmitStrategy; diff --git a/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java b/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java index 35f53587e5..8408f9868f 100644 --- a/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java +++ b/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java @@ -17,22 +17,27 @@ package org.thingsboard.server.actors.device; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import org.thingsboard.common.util.LinkedHashMapRemoveEldest; import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.device.DeviceService; +import org.thingsboard.server.service.transport.TbCoreToTransportService; + +import java.util.UUID; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; public class DeviceActorMessageProcessorTest { - public static final long MAX_CONCURRENT_SESSIONS_PER_DEVICE = 10L; + public static final int MAX_CONCURRENT_SESSIONS_PER_DEVICE = 10; ActorSystemContext systemContext; DeviceService deviceService; TenantId tenantId = TenantId.SYS_TENANT_ID; @@ -47,6 +52,7 @@ public class DeviceActorMessageProcessorTest { willReturn(MAX_CONCURRENT_SESSIONS_PER_DEVICE).given(systemContext).getMaxConcurrentSessionsPerDevice(); willReturn(deviceService).given(systemContext).getDeviceService(); processor = new DeviceActorMessageProcessor(systemContext, tenantId, deviceId); + willReturn(mock(TbCoreToTransportService.class)).given(systemContext).getTbCoreToTransportService(); } @Test @@ -55,4 +61,26 @@ public class DeviceActorMessageProcessorTest { assertThat(processor.sessions.getMaxEntries(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE)); assertThat(processor.sessions.getRemovalConsumer(), notNullValue()); } + + @Test + public void givenFullSessionMap_whenSessionOverflow_thenShouldDeleteAttributeAndRPCSubscriptions() { + //givenFullSessionMap + for (int i = 0; i < MAX_CONCURRENT_SESSIONS_PER_DEVICE; i++) { + UUID sessionID = UUID.randomUUID(); + processor.sessions.put(sessionID, Mockito.mock(SessionInfoMetaData.class, RETURNS_DEEP_STUBS)); + processor.attributeSubscriptions.put(sessionID, Mockito.mock(SessionInfo.class)); + processor.rpcSubscriptions.put(sessionID, Mockito.mock(SessionInfo.class)); + } + assertThat(processor.sessions.size(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE)); + assertThat(processor.attributeSubscriptions.size(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE)); + assertThat(processor.rpcSubscriptions.size(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE)); + + //add one more + processor.sessions.put(UUID.randomUUID(), Mockito.mock(SessionInfoMetaData.class)); + + assertThat(processor.sessions.size(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE)); + assertThat(processor.attributeSubscriptions.size(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE-1)); + assertThat(processor.rpcSubscriptions.size(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE-1)); + + } } \ No newline at end of file From 139c0c1d0433eed08b36eacb56208edf83b31d5c Mon Sep 17 00:00:00 2001 From: Oleksandra Matviienko Date: Wed, 5 Feb 2025 13:25:00 +0100 Subject: [PATCH 033/100] Type casting was performed in the Test class Signed-off-by: Oleksandra Matviienko --- .../org/thingsboard/server/actors/ActorSystemContext.java | 2 +- .../server/actors/device/DeviceActorMessageProcessorTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java index b13cf8e490..1c18a31f68 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java @@ -489,7 +489,7 @@ public class ActorSystemContext { @Value("${actors.session.max_concurrent_sessions_per_device:1}") @Getter - private int maxConcurrentSessionsPerDevice; + private long maxConcurrentSessionsPerDevice; @Value("${actors.session.sync.timeout:10000}") @Getter diff --git a/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java b/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java index 8408f9868f..4f571d4fe6 100644 --- a/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java +++ b/application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java @@ -49,7 +49,7 @@ public class DeviceActorMessageProcessorTest { public void setUp() { systemContext = mock(ActorSystemContext.class); deviceService = mock(DeviceService.class); - willReturn(MAX_CONCURRENT_SESSIONS_PER_DEVICE).given(systemContext).getMaxConcurrentSessionsPerDevice(); + willReturn((long)MAX_CONCURRENT_SESSIONS_PER_DEVICE).given(systemContext).getMaxConcurrentSessionsPerDevice(); willReturn(deviceService).given(systemContext).getDeviceService(); processor = new DeviceActorMessageProcessor(systemContext, tenantId, deviceId); willReturn(mock(TbCoreToTransportService.class)).given(systemContext).getTbCoreToTransportService(); @@ -58,7 +58,7 @@ public class DeviceActorMessageProcessorTest { @Test public void givenSystemContext_whenNewInstance_thenVerifySessionMapMaxSize() { assertThat(processor.sessions, instanceOf(LinkedHashMapRemoveEldest.class)); - assertThat(processor.sessions.getMaxEntries(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE)); + assertThat(processor.sessions.getMaxEntries(), is((long)MAX_CONCURRENT_SESSIONS_PER_DEVICE)); assertThat(processor.sessions.getRemovalConsumer(), notNullValue()); } From dd9e45deee753a58b9e518607fdda211fc4a0b98 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 5 Feb 2025 16:37:10 +0200 Subject: [PATCH 034/100] UI: Rename 'get dashboard state with params' to 'get dashboard state object' --- .../widget/lib/action/action-widget.models.ts | 2 +- .../get-value-action-settings-panel.component.html | 2 +- .../get-value-action-settings-panel.component.ts | 6 +++--- .../action/get-value-action-settings.component.ts | 6 +++--- .../shared/models/action-widget-settings.models.ts | 4 ++-- ... => parse_value_get_dashboard_state_object_fn.md} | 4 ++-- ui-ngx/src/assets/locale/locale.constant-en_US.json | 12 ++++++------ 7 files changed, 18 insertions(+), 18 deletions(-) rename ui-ngx/src/assets/help/en_US/widget/config/{parse_value_get_dashboard_state_with_params_fn.md => parse_value_get_dashboard_state_object_fn.md} (89%) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts index 9c5bc7885a..2e02d36f04 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/action/action-widget.models.ts @@ -271,7 +271,7 @@ export abstract class ValueGetter extends ValueAction { return new AlarmStatusValueGetter(ctx, settings, valueType, valueObserver, simulated); case GetValueAction.GET_DASHBOARD_STATE: return new DashboardStateGetter(ctx, settings, valueType, valueObserver, simulated); - case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + case GetValueAction.GET_DASHBOARD_STATE_OBJECT: return new DashboardStateWithParamsGetter(ctx, settings, valueType, valueObserver, simulated); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html index 7783c0af20..9c9f45173d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.html @@ -133,7 +133,7 @@
widgets.value-action.action-result-converter
+ [class.invisible]="getValueSettingsFormGroup.get('action').value === getValueAction.GET_DASHBOARD_STATE_OBJECT"> {{ 'widgets.value-action.converter-none' | translate }} {{ 'widgets.value-action.converter-function' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts index 4c98c0cac4..9b8b86e626 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings-panel.component.ts @@ -169,8 +169,8 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen getParseValueFunctionHelpId(): string { const action: GetValueAction = this.getValueSettingsFormGroup.get('action').value; - if (action === GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS) { - return 'widget/config/parse_value_get_dashboard_state_with_params_fn'; + if (action === GetValueAction.GET_DASHBOARD_STATE_OBJECT) { + return 'widget/config/parse_value_get_dashboard_state_object_fn'; } return 'widget/lib/rpc/parse_value_fn'; } @@ -206,7 +206,7 @@ export class GetValueActionSettingsPanelComponent extends PageComponent implemen case GetValueAction.GET_ALARM_STATUS: this.getValueSettingsFormGroup.get('getAlarmStatus').enable({emitEvent: false}); break; - case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + case GetValueAction.GET_DASHBOARD_STATE_OBJECT: this.getValueSettingsFormGroup.get('dataToValue.type').setValue(DataToValueType.FUNCTION, {emitEvent: false}); dataToValueType = DataToValueType.FUNCTION; break diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts index d482d2e9fe..5e2661df59 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts @@ -191,12 +191,12 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-text'); } break; - case GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS: + case GetValueAction.GET_DASHBOARD_STATE_OBJECT: if (this.valueType === ValueType.BOOLEAN) { const state = this.modelValue.dataToValue?.compareToValue; - this.displayValue = this.translate.instant('widgets.value-action.when-dashboard-state-with-params-function-is-text', {state}); + this.displayValue = this.translate.instant('widgets.value-action.when-dashboard-state-object-function-is-text', {state}); } else { - this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-with-params-text'); + this.displayValue = this.translate.instant('widgets.value-action.get-dashboard-state-object-text'); } break; } diff --git a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts index 1c83669206..fd78ab30f0 100644 --- a/ui-ngx/src/app/shared/models/action-widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/action-widget-settings.models.ts @@ -26,7 +26,7 @@ export enum GetValueAction { GET_TIME_SERIES = 'GET_TIME_SERIES', GET_ALARM_STATUS = 'GET_ALARM_STATUS', GET_DASHBOARD_STATE = 'GET_DASHBOARD_STATE', - GET_DASHBOARD_STATE_WITH_PARAMS = 'GET_DASHBOARD_STATE_WITH_PARAMS', + GET_DASHBOARD_STATE_OBJECT = 'GET_DASHBOARD_STATE_OBJECT', } export const getValueActions = Object.keys(GetValueAction) as GetValueAction[]; @@ -47,7 +47,7 @@ export const getValueActionTranslations = new Map( [GetValueAction.GET_TIME_SERIES, 'widgets.value-action.get-time-series'], [GetValueAction.GET_ALARM_STATUS, 'widgets.value-action.get-alarm-status'], [GetValueAction.GET_DASHBOARD_STATE, 'widgets.value-action.get-dashboard-state'], - [GetValueAction.GET_DASHBOARD_STATE_WITH_PARAMS, 'widgets.value-action.get-dashboard-state-with-params'], + [GetValueAction.GET_DASHBOARD_STATE_OBJECT, 'widgets.value-action.get-dashboard-state-object'], ] ); diff --git a/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md similarity index 89% rename from ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md rename to ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md index c272a07f79..ddc1ed7bc8 100644 --- a/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_with_params_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/config/parse_value_get_dashboard_state_object_fn.md @@ -5,7 +5,7 @@ *function (data): boolean* -A JavaScript function that converts the current dashboard state and parameters into a boolean value. +A JavaScript function that converts the current dashboard state object into a boolean value. **Parameters:** @@ -22,7 +22,7 @@ A JavaScript function that converts the current dashboard state and parameters i ##### Examples -* Check if the current dashboard state ID is "default": +* Check if the current dashboard state id is "default": ```javascript return data.id === 'default' ? true : false; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index cd91f44b4b..7871e6c022 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8334,18 +8334,18 @@ "set-attribute": "Set attribute", "get-time-series": "Get time series", "get-alarm-status": "Get alarm status", - "get-dashboard-state": "Get dashboard state", - "get-dashboard-state-with-params": "Get dashboard state with params", + "get-dashboard-state": "Get dashboard state id", + "get-dashboard-state-object": "Get dashboard state object", "add-time-series": "Add time series", "execute-rpc-text": "Execute RPC method '{{methodName}}'", "get-time-series-text": "Use time series '{{key}}'", "get-attribute-text": "Use attribute '{{key}}'", "get-alarm-status-text": "Use alarm status", "get-dashboard-state-text": "Use dashboard state", - "get-dashboard-state-with-params-text": "Use dashboard state with params", - "when-dashboard-state-is-text": "When dashboard state is '{{state}}'", - "when-dashboard-state-function-is-text": "When f(dashboard state) is '{{state}}'", - "when-dashboard-state-with-params-function-is-text": "When f(dashboard state with params) is '{{state}}'", + "get-dashboard-state-object-text": "Use dashboard state object", + "when-dashboard-state-is-text": "When dashboard state id is '{{state}}'", + "when-dashboard-state-function-is-text": "When f(dashboard state id) is '{{state}}'", + "when-dashboard-state-object-function-is-text": "When f(dashboard state object) is '{{state}}'", "set-attribute-to-value-text": "Set '{{key}}' attribute to: {{value}}", "add-time-series-value-text": "Add '{{key}}' time series value: {{value}}", "set-attribute-text": "Set '{{key}}' attribute", From 3370935be8ecb643a201dbc38f314ae029a9e7f0 Mon Sep 17 00:00:00 2001 From: artem-barysh-dev Date: Wed, 5 Feb 2025 19:15:14 +0200 Subject: [PATCH 035/100] MQTT: fix unsubscribe error without previous subscribe (#12575) improved formatting and moved check to recordActivityInternal. Added warn log and check on provision Updated license format --- .../server/transport/mqtt/MqttTransportHandler.java | 2 +- .../common/transport/service/DefaultTransportService.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java index 2b7e2a51dc..33448b58ec 100644 --- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java +++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java @@ -963,7 +963,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement unSubResults.add((short) MqttReasonCodes.UnsubAck.NO_SUBSCRIPTION_EXISTED.byteValue()); } } - if (!activityReported) { + if (!activityReported && !deviceSessionCtx.isProvisionOnly()) { transportService.recordActivity(deviceSessionCtx.getSessionInfo()); } ctx.writeAndFlush(createUnSubAckMessage(mqttMsg.variableHeader().messageId(), unSubResults)); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java index 44f61270b4..be29592635 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java @@ -736,7 +736,11 @@ public class DefaultTransportService extends TransportActivityManager implements } private void recordActivityInternal(TransportProtos.SessionInfoProto sessionInfo) { - onActivity(toSessionId(sessionInfo), sessionInfo, getCurrentTimeMillis()); + if (sessionInfo != null) { + onActivity(toSessionId(sessionInfo), sessionInfo, getCurrentTimeMillis()); + } else { + log.warn("Session info is missing, unable to record activity"); + } } @Override From 08eef1c92211509069f874eb259dc5bc99617e06 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 6 Feb 2025 12:01:55 +0200 Subject: [PATCH 036/100] UI: Fixed incorrect search by LWM2M models --- .../profile/device/lwm2m/lwm2m-object-list.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts index 775a5c963e..dbcd38a46f 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts @@ -190,7 +190,7 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V private fetchListObjects = (searchText: string): Observable> => { this.searchText = searchText; const pageLink = new PageLink(PAGE_SIZE_LIMIT, 0, this.searchText, { - property: 'id', + property: 'resourceKey', direction: Direction.ASC }); return this.deviceProfileService.getLwm2mObjectsPage(pageLink); From 3a32bf81dab73839a322fd419c93da1c6937e312 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Thu, 6 Feb 2025 13:20:25 +0200 Subject: [PATCH 037/100] Fix error in device profile processing - Added and fixed test --- .../server/controller/EdgeControllerTest.java | 3 +- .../server/edge/AbstractEdgeTest.java | 10 ++--- .../server/edge/DeviceProfileEdgeTest.java | 40 +++++++++++++++++++ 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java index 4d38934dcb..0ffdbe8e60 100644 --- a/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java @@ -897,7 +897,7 @@ public class EdgeControllerTest extends AbstractControllerTest { edgeImitator.ignoreType(OAuth2ClientUpdateMsg.class); edgeImitator.ignoreType(OAuth2DomainUpdateMsg.class); - edgeImitator.expectMessageAmount(26); + edgeImitator.expectMessageAmount(27); edgeImitator.connect(); waitForMessages(edgeImitator); @@ -1003,6 +1003,7 @@ public class EdgeControllerTest extends AbstractControllerTest { Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgs(), "connectivity")); Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgs(), "jwt")); Assert.assertTrue(popDeviceProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); + Assert.assertTrue(popDeviceProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); Assert.assertTrue(popAssetProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); Assert.assertTrue(popDeviceProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); Assert.assertTrue(popAssetProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); diff --git a/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java index 10db03a6c2..afc0f72081 100644 --- a/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java @@ -144,7 +144,7 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { edgeImitator = new EdgeImitator("localhost", 7070, edge.getRoutingKey(), edge.getSecret()); edgeImitator.ignoreType(OAuth2ClientUpdateMsg.class); edgeImitator.ignoreType(OAuth2DomainUpdateMsg.class); - edgeImitator.expectMessageAmount(24); + edgeImitator.expectMessageAmount(26); edgeImitator.connect(); requestEdgeRuleChainMetadata(); @@ -265,10 +265,10 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { // 4 messages // - 1 from default profile fetcher - // - 2 from device profile fetcher (default and thermostat) + // - 4 from device profile fetcher (2 * (default and thermostat) before and after ota packages fetcher // - 1 from device fetcher - validateMsgsCnt(DeviceProfileUpdateMsg.class, 4); - validateDeviceProfiles(4); + validateMsgsCnt(DeviceProfileUpdateMsg.class, 6); + validateDeviceProfiles(6); // 3 messages // - 1 from default profile fetcher @@ -656,7 +656,7 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { } protected RuleChainId createEdgeRuleChainAndAssignToEdge(String ruleChainName) throws Exception { - edgeImitator.expectMessageAmount(1); + edgeImitator.expectMessageAmount(2); RuleChain ruleChain = new RuleChain(); ruleChain.setName(ruleChainName); ruleChain.setType(RuleChainType.EDGE); diff --git a/application/src/test/java/org/thingsboard/server/edge/DeviceProfileEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DeviceProfileEdgeTest.java index a085f3a821..244163732f 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DeviceProfileEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DeviceProfileEdgeTest.java @@ -126,6 +126,45 @@ public class DeviceProfileEdgeTest extends AbstractEdgeTest { unAssignFromEdgeAndDeleteDashboard(thermostatsDashboardId); } + @Test + public void testDeleteDeviceProfilesWhenEdgeIsOffline() throws Exception { + RuleChainId thermostatsRuleChainId = createEdgeRuleChainAndAssignToEdge("Thermostats Rule Chain"); + + // create device profile + DeviceProfile deviceProfile = this.createDeviceProfile("ONE_MORE_DEVICE_PROFILE", null); + deviceProfile.setDefaultEdgeRuleChainId(thermostatsRuleChainId); + extendDeviceProfileData(deviceProfile); + edgeImitator.expectMessageAmount(1); + deviceProfile = doPost("/api/deviceProfile", deviceProfile, DeviceProfile.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + AbstractMessage latestMessage = edgeImitator.getLatestMessage(); + Assert.assertTrue(latestMessage instanceof DeviceProfileUpdateMsg); + DeviceProfileUpdateMsg deviceProfileUpdateMsg = (DeviceProfileUpdateMsg) latestMessage; + DeviceProfile deviceProfileMsg = JacksonUtil.fromString(deviceProfileUpdateMsg.getEntity(), DeviceProfile.class, true); + Assert.assertNotNull(deviceProfileMsg); + Assert.assertEquals(deviceProfile, deviceProfileMsg); + Assert.assertEquals(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, deviceProfileUpdateMsg.getMsgType()); + + // delete profile when edge is offline + edgeImitator.disconnect(); + doDelete("/api/deviceProfile/" + deviceProfile.getUuidId()) + .andExpect(status().isOk()); + edgeImitator.connect(); + // 27 sync message + // + 1 delete message + edgeImitator.expectMessageAmount(28); + Assert.assertTrue(edgeImitator.waitForMessages()); + + latestMessage = edgeImitator.getLatestMessage(); + Assert.assertTrue(latestMessage instanceof DeviceProfileUpdateMsg); + deviceProfileUpdateMsg = (DeviceProfileUpdateMsg) latestMessage; + Assert.assertEquals(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE, deviceProfileUpdateMsg.getMsgType()); + Assert.assertEquals(deviceProfile.getUuidId().getMostSignificantBits(), deviceProfileUpdateMsg.getIdMSB()); + Assert.assertEquals(deviceProfile.getUuidId().getLeastSignificantBits(), deviceProfileUpdateMsg.getIdLSB()); + + unAssignFromEdgeAndDeleteRuleChain(thermostatsRuleChainId); + } + @Test public void testDeviceProfiles_snmp() throws Exception { DeviceProfile deviceProfile = createDeviceProfileAndDoBasicAssert("SNMP", createSnmpDeviceProfileTransportConfiguration()); @@ -449,4 +488,5 @@ public class DeviceProfileEdgeTest extends AbstractEdgeTest { deviceProfile.setProfileData(createProfileData()); return deviceProfile; } + } From 12a8c070a674b35b4dffc8ae5599e6acc6ed590f Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Fri, 7 Feb 2025 11:45:15 +0200 Subject: [PATCH 038/100] Change wording from persistence to processing on backend --- .../rule_chains/edge_root_rule_chain.json | 2 +- .../device_profile/rule_chain_template.json | 2 +- .../tenant/rule_chains/root_rule_chain.json | 2 +- .../main/data/upgrade/basic/schema_update.sql | 4 +- .../src/main/resources/root_rule_chain.json | 6 +- .../resources/MqttRuleNodeTestMetadata.json | 2 +- .../engine/telemetry/TbMsgTimeseriesNode.java | 52 ++++++------- .../TbMsgTimeseriesNodeConfiguration.java | 28 +++---- ...ava => DeduplicateProcessingStrategy.java} | 6 +- ... => OnEveryMessageProcessingStrategy.java} | 10 +-- ...eStrategy.java => ProcessingStrategy.java} | 22 +++--- ...ategy.java => SkipProcessingStrategy.java} | 10 +-- .../telemetry/TbMsgTimeseriesNodeTest.java | 72 +++++++++--------- ...=> DeduplicateProcessingStrategyTest.java} | 76 +++++++++---------- ...OnEveryMessageProcessingStrategyTest.java} | 6 +- ...yTest.java => ProcessingStrategyTest.java} | 14 ++-- ...t.java => SkipProcessingStrategyTest.java} | 6 +- 17 files changed, 160 insertions(+), 160 deletions(-) rename rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/{DeduplicatePersistenceStrategy.java => DeduplicateProcessingStrategy.java} (94%) rename rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/{OnEveryMessagePersistenceStrategy.java => OnEveryMessageProcessingStrategy.java} (69%) rename rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/{PersistenceStrategy.java => ProcessingStrategy.java} (53%) rename rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/{SkipPersistenceStrategy.java => SkipProcessingStrategy.java} (72%) rename rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/{DeduplicatePersistenceStrategyTest.java => DeduplicateProcessingStrategyTest.java} (75%) rename rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/{OnEveryMessagePersistenceStrategyTest.java => OnEveryMessageProcessingStrategyTest.java} (89%) rename rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/{PersistenceStrategyTest.java => ProcessingStrategyTest.java} (76%) rename rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/{SkipPersistenceStrategyTest.java => SkipProcessingStrategyTest.java} (90%) diff --git a/application/src/main/data/json/edge/rule_chains/edge_root_rule_chain.json b/application/src/main/data/json/edge/rule_chains/edge_root_rule_chain.json index e663ff779d..6701b59e0e 100644 --- a/application/src/main/data/json/edge/rule_chains/edge_root_rule_chain.json +++ b/application/src/main/data/json/edge/rule_chains/edge_root_rule_chain.json @@ -37,7 +37,7 @@ "configuration": { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }, diff --git a/application/src/main/data/json/tenant/device_profile/rule_chain_template.json b/application/src/main/data/json/tenant/device_profile/rule_chain_template.json index 325e01003f..0f2473cde6 100644 --- a/application/src/main/data/json/tenant/device_profile/rule_chain_template.json +++ b/application/src/main/data/json/tenant/device_profile/rule_chain_template.json @@ -23,7 +23,7 @@ "configuration": { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } } diff --git a/application/src/main/data/json/tenant/rule_chains/root_rule_chain.json b/application/src/main/data/json/tenant/rule_chains/root_rule_chain.json index 4dc202d740..8efda98c5b 100644 --- a/application/src/main/data/json/tenant/rule_chains/root_rule_chain.json +++ b/application/src/main/data/json/tenant/rule_chains/root_rule_chain.json @@ -22,7 +22,7 @@ "configuration": { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } } diff --git a/application/src/main/data/upgrade/basic/schema_update.sql b/application/src/main/data/upgrade/basic/schema_update.sql index 31833112ad..a1ef460854 100644 --- a/application/src/main/data/upgrade/basic/schema_update.sql +++ b/application/src/main/data/upgrade/basic/schema_update.sql @@ -225,7 +225,7 @@ DO $$ SET configuration = ( (configuration::jsonb - 'skipLatestPersistence') || jsonb_build_object( - 'persistenceSettings', jsonb_build_object( + 'processingSettings', jsonb_build_object( 'type', 'ADVANCED', 'timeseries', jsonb_build_object('type', 'ON_EVERY_MESSAGE'), 'latest', jsonb_build_object('type', 'SKIP'), @@ -242,7 +242,7 @@ DO $$ SET configuration = ( (configuration::jsonb - 'skipLatestPersistence') || jsonb_build_object( - 'persistenceSettings', jsonb_build_object( + 'processingSettings', jsonb_build_object( 'type', 'ON_EVERY_MESSAGE' ) ) diff --git a/monitoring/src/main/resources/root_rule_chain.json b/monitoring/src/main/resources/root_rule_chain.json index eda3e44e1b..46bdc72d9f 100644 --- a/monitoring/src/main/resources/root_rule_chain.json +++ b/monitoring/src/main/resources/root_rule_chain.json @@ -25,7 +25,7 @@ "configuration": { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }, @@ -281,7 +281,7 @@ "configuration": { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }, @@ -319,7 +319,7 @@ "configuration": { "defaultTTL": 180, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }, diff --git a/msa/black-box-tests/src/test/resources/MqttRuleNodeTestMetadata.json b/msa/black-box-tests/src/test/resources/MqttRuleNodeTestMetadata.json index c495e590cd..c09da6aebb 100644 --- a/msa/black-box-tests/src/test/resources/MqttRuleNodeTestMetadata.json +++ b/msa/black-box-tests/src/test/resources/MqttRuleNodeTestMetadata.json @@ -40,7 +40,7 @@ "configuration": { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }, diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNode.java index b98b1d205e..1b3acb6dae 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNode.java @@ -27,7 +27,7 @@ import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; import org.thingsboard.rule.engine.api.TimeseriesSaveRequest; import org.thingsboard.rule.engine.api.util.TbNodeUtils; -import org.thingsboard.rule.engine.telemetry.strategy.PersistenceStrategy; +import org.thingsboard.rule.engine.telemetry.strategy.ProcessingStrategy; import org.thingsboard.server.common.adaptor.JsonConverter; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.TenantProfile; @@ -45,11 +45,11 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Advanced; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Deduplicate; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.OnEveryMessage; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.WebSocketsOnly; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Advanced; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Deduplicate; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.OnEveryMessage; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.WebSocketsOnly; import static org.thingsboard.server.common.data.msg.TbMsgType.POST_TELEMETRY_REQUEST; @Slf4j @@ -58,7 +58,7 @@ import static org.thingsboard.server.common.data.msg.TbMsgType.POST_TELEMETRY_RE name = "save time series", configClazz = TbMsgTimeseriesNodeConfiguration.class, nodeDescription = """ - Saves time series data with a configurable TTL and according to configured persistence strategies. + Saves time series data with a configurable TTL and according to configured processing strategies. """, nodeDetails = """ Node performs three actions: @@ -68,14 +68,14 @@ import static org.thingsboard.server.common.data.msg.TbMsgType.POST_TELEMETRY_RE
  • WebSockets: notify WebSockets subscriptions about time series data updates.
  • - For each action, three persistence strategies are available: + For each action, three processing strategies are available:
    • On every message: perform the action for every message.
    • Deduplicate: perform the action only for the first message from a particular originator within a configurable interval.
    • Skip: never perform the action.
    - Persistence strategies are configured using persistence settings, which support two modes: + Processing strategies are configured using processing settings, which support two modes:
    • Basic
        @@ -110,7 +110,7 @@ public class TbMsgTimeseriesNode implements TbNode { private TbContext ctx; private long tenantProfileDefaultStorageTtl; - private PersistenceSettings persistenceSettings; + private ProcessingSettings processingSettings; @Override public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException { @@ -118,7 +118,7 @@ public class TbMsgTimeseriesNode implements TbNode { this.ctx = ctx; ctx.addTenantProfileListener(this::onTenantProfileUpdate); onTenantProfileUpdate(ctx.getTenantProfile()); - persistenceSettings = config.getPersistenceSettings(); + processingSettings = config.getProcessingSettings(); } private void onTenantProfileUpdate(TenantProfile tenantProfile) { @@ -175,25 +175,25 @@ public class TbMsgTimeseriesNode implements TbNode { } private TimeseriesSaveRequest.Strategy determineSaveStrategy(long ts, UUID originatorUuid) { - if (persistenceSettings instanceof OnEveryMessage) { + if (processingSettings instanceof OnEveryMessage) { return TimeseriesSaveRequest.Strategy.SAVE_ALL; } - if (persistenceSettings instanceof WebSocketsOnly) { + if (processingSettings instanceof WebSocketsOnly) { return TimeseriesSaveRequest.Strategy.WS_ONLY; } - if (persistenceSettings instanceof Deduplicate deduplicate) { - boolean isFirstMsgInInterval = deduplicate.getPersistenceStrategy().shouldPersist(ts, originatorUuid); + if (processingSettings instanceof Deduplicate deduplicate) { + boolean isFirstMsgInInterval = deduplicate.getProcessingStrategy().shouldProcess(ts, originatorUuid); return isFirstMsgInInterval ? TimeseriesSaveRequest.Strategy.SAVE_ALL : TimeseriesSaveRequest.Strategy.SKIP_ALL; } - if (persistenceSettings instanceof Advanced advanced) { + if (processingSettings instanceof Advanced advanced) { return new TimeseriesSaveRequest.Strategy( - advanced.timeseries().shouldPersist(ts, originatorUuid), - advanced.latest().shouldPersist(ts, originatorUuid), - advanced.webSockets().shouldPersist(ts, originatorUuid) + advanced.timeseries().shouldProcess(ts, originatorUuid), + advanced.latest().shouldProcess(ts, originatorUuid), + advanced.webSockets().shouldProcess(ts, originatorUuid) ); } // should not happen - throw new IllegalArgumentException("Unknown persistence settings type: " + persistenceSettings.getClass().getSimpleName()); + throw new IllegalArgumentException("Unknown processing settings type: " + processingSettings.getClass().getSimpleName()); } @Override @@ -209,14 +209,14 @@ public class TbMsgTimeseriesNode implements TbNode { hasChanges = true; JsonNode skipLatestPersistence = oldConfiguration.get("skipLatestPersistence"); if (skipLatestPersistence != null && "true".equals(skipLatestPersistence.asText())) { - var skipLatestPersistenceSettings = new Advanced( - PersistenceStrategy.onEveryMessage(), - PersistenceStrategy.skip(), - PersistenceStrategy.onEveryMessage() + var skipLatestProcessingSettings = new Advanced( + ProcessingStrategy.onEveryMessage(), + ProcessingStrategy.skip(), + ProcessingStrategy.onEveryMessage() ); - ((ObjectNode) oldConfiguration).set("persistenceSettings", JacksonUtil.valueToTree(skipLatestPersistenceSettings)); + ((ObjectNode) oldConfiguration).set("processingSettings", JacksonUtil.valueToTree(skipLatestProcessingSettings)); } else { - ((ObjectNode) oldConfiguration).set("persistenceSettings", JacksonUtil.valueToTree(new OnEveryMessage())); + ((ObjectNode) oldConfiguration).set("processingSettings", JacksonUtil.valueToTree(new OnEveryMessage())); } ((ObjectNode) oldConfiguration).remove("skipLatestPersistence"); break; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeConfiguration.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeConfiguration.java index a1386fee49..88524e3751 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeConfiguration.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeConfiguration.java @@ -24,14 +24,14 @@ import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.Getter; import org.thingsboard.rule.engine.api.NodeConfiguration; -import org.thingsboard.rule.engine.telemetry.strategy.PersistenceStrategy; +import org.thingsboard.rule.engine.telemetry.strategy.ProcessingStrategy; import java.util.Objects; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Advanced; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Deduplicate; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.OnEveryMessage; -import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.PersistenceSettings.WebSocketsOnly; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Advanced; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Deduplicate; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.OnEveryMessage; +import static org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration.ProcessingSettings.WebSocketsOnly; @Data public class TbMsgTimeseriesNodeConfiguration implements NodeConfiguration { @@ -39,14 +39,14 @@ public class TbMsgTimeseriesNodeConfiguration implements NodeConfiguration> deduplicationCache; @JsonCreator - public DeduplicatePersistenceStrategy(@JsonProperty("deduplicationIntervalSecs") int deduplicationIntervalSecs) { + public DeduplicateProcessingStrategy(@JsonProperty("deduplicationIntervalSecs") int deduplicationIntervalSecs) { if (deduplicationIntervalSecs < MIN_DEDUPLICATION_INTERVAL_SECS || deduplicationIntervalSecs > MAX_DEDUPLICATION_INTERVAL_SECS) { throw new IllegalArgumentException("Deduplication interval must be at least " + MIN_DEDUPLICATION_INTERVAL_SECS + " second(s) " + "and at most " + MAX_DEDUPLICATION_INTERVAL_SECS + " second(s), was " + deduplicationIntervalSecs + " second(s)"); @@ -81,7 +81,7 @@ final class DeduplicatePersistenceStrategy implements PersistenceStrategy { } @Override - public boolean shouldPersist(long ts, UUID originatorUuid) { + public boolean shouldProcess(long ts, UUID originatorUuid) { long intervalNumber = ts / deduplicationIntervalMillis; return deduplicationCache.get(intervalNumber).add(originatorUuid); } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessagePersistenceStrategy.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessageProcessingStrategy.java similarity index 69% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessagePersistenceStrategy.java rename to rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessageProcessingStrategy.java index 4fcb74dc33..9e8a87364a 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessagePersistenceStrategy.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessageProcessingStrategy.java @@ -19,19 +19,19 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.UUID; -final class OnEveryMessagePersistenceStrategy implements PersistenceStrategy { +final class OnEveryMessageProcessingStrategy implements ProcessingStrategy { - private static final OnEveryMessagePersistenceStrategy INSTANCE = new OnEveryMessagePersistenceStrategy(); + private static final OnEveryMessageProcessingStrategy INSTANCE = new OnEveryMessageProcessingStrategy(); - private OnEveryMessagePersistenceStrategy() {} + private OnEveryMessageProcessingStrategy() {} @JsonCreator - public static OnEveryMessagePersistenceStrategy getInstance() { + public static OnEveryMessageProcessingStrategy getInstance() { return INSTANCE; } @Override - public boolean shouldPersist(long ts, UUID originatorUuid) { + public boolean shouldProcess(long ts, UUID originatorUuid) { return true; } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/PersistenceStrategy.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/ProcessingStrategy.java similarity index 53% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/PersistenceStrategy.java rename to rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/ProcessingStrategy.java index 453092117b..724727dc22 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/PersistenceStrategy.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/ProcessingStrategy.java @@ -26,24 +26,24 @@ import java.util.UUID; property = "type" ) @JsonSubTypes({ - @JsonSubTypes.Type(value = OnEveryMessagePersistenceStrategy.class, name = "ON_EVERY_MESSAGE"), - @JsonSubTypes.Type(value = DeduplicatePersistenceStrategy.class, name = "DEDUPLICATE"), - @JsonSubTypes.Type(value = SkipPersistenceStrategy.class, name = "SKIP") + @JsonSubTypes.Type(value = OnEveryMessageProcessingStrategy.class, name = "ON_EVERY_MESSAGE"), + @JsonSubTypes.Type(value = DeduplicateProcessingStrategy.class, name = "DEDUPLICATE"), + @JsonSubTypes.Type(value = SkipProcessingStrategy.class, name = "SKIP") }) -public sealed interface PersistenceStrategy permits OnEveryMessagePersistenceStrategy, DeduplicatePersistenceStrategy, SkipPersistenceStrategy { +public sealed interface ProcessingStrategy permits OnEveryMessageProcessingStrategy, DeduplicateProcessingStrategy, SkipProcessingStrategy { - static PersistenceStrategy onEveryMessage() { - return OnEveryMessagePersistenceStrategy.getInstance(); + static ProcessingStrategy onEveryMessage() { + return OnEveryMessageProcessingStrategy.getInstance(); } - static PersistenceStrategy deduplicate(int deduplicationIntervalSecs) { - return new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + static ProcessingStrategy deduplicate(int deduplicationIntervalSecs) { + return new DeduplicateProcessingStrategy(deduplicationIntervalSecs); } - static PersistenceStrategy skip() { - return SkipPersistenceStrategy.getInstance(); + static ProcessingStrategy skip() { + return SkipProcessingStrategy.getInstance(); } - boolean shouldPersist(long ts, UUID originatorUuid); + boolean shouldProcess(long ts, UUID originatorUuid); } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/SkipPersistenceStrategy.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/SkipProcessingStrategy.java similarity index 72% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/SkipPersistenceStrategy.java rename to rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/SkipProcessingStrategy.java index c3d96e8ca7..66b966653d 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/SkipPersistenceStrategy.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/telemetry/strategy/SkipProcessingStrategy.java @@ -19,19 +19,19 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.UUID; -final class SkipPersistenceStrategy implements PersistenceStrategy { +final class SkipProcessingStrategy implements ProcessingStrategy { - private static final SkipPersistenceStrategy INSTANCE = new SkipPersistenceStrategy(); + private static final SkipProcessingStrategy INSTANCE = new SkipProcessingStrategy(); - private SkipPersistenceStrategy() {} + private SkipProcessingStrategy() {} @JsonCreator - public static SkipPersistenceStrategy getInstance() { + public static SkipProcessingStrategy getInstance() { return INSTANCE; } @Override - public boolean shouldPersist(long ts, UUID originatorUuid) { + public boolean shouldProcess(long ts, UUID originatorUuid) { return false; } diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeTest.java index 02c19ed5fc..892e217414 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/TbMsgTimeseriesNodeTest.java @@ -34,7 +34,7 @@ import org.thingsboard.rule.engine.api.TbNode; import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; import org.thingsboard.rule.engine.api.TimeseriesSaveRequest; -import org.thingsboard.rule.engine.telemetry.strategy.PersistenceStrategy; +import org.thingsboard.rule.engine.telemetry.strategy.ProcessingStrategy; import org.thingsboard.server.common.adaptor.JsonConverter; import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.id.DeviceId; @@ -110,7 +110,7 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { @Test public void verifyDefaultConfig() { assertThat(config.getDefaultTTL()).isEqualTo(0L); - assertThat(config.getPersistenceSettings()).isInstanceOf(TbMsgTimeseriesNodeConfiguration.PersistenceSettings.OnEveryMessage.class); + assertThat(config.getProcessingSettings()).isInstanceOf(TbMsgTimeseriesNodeConfiguration.ProcessingSettings.OnEveryMessage.class); assertThat(config.isUseServerTs()).isFalse(); } @@ -124,14 +124,14 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenPersistenceSettingsAreNull_whenValidatingConstraints_thenThrowsException() { + public void givenProcessingSettingsAreNull_whenValidatingConstraints_thenThrowsException() { // GIVEN - config.setPersistenceSettings(null); + config.setProcessingSettings(null); // WHEN-THEN assertThatThrownBy(() -> ConstraintValidator.validateFields(config)) .isInstanceOf(DataValidationException.class) - .hasMessage("Validation error: persistenceSettings must not be null"); + .hasMessage("Validation error: processingSettings must not be null"); } @ParameterizedTest @@ -216,15 +216,15 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenSkipLatestPersistenceSettingsAndTtlFromConfig_whenOnMsg_thenSaveTimeseriesUsingTtlFromConfig() throws TbNodeException { + public void givenSkipLatestProcessingSettingsAndTtlFromConfig_whenOnMsg_thenSaveTimeseriesUsingTtlFromConfig() throws TbNodeException { // GIVEN config.setDefaultTTL(10L); - var timeseriesStrategy = PersistenceStrategy.onEveryMessage(); - var latestStrategy = PersistenceStrategy.skip(); - var webSockets = PersistenceStrategy.onEveryMessage(); - var persistenceSettings = new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Advanced(timeseriesStrategy, latestStrategy, webSockets); - config.setPersistenceSettings(persistenceSettings); + var timeseriesStrategy = ProcessingStrategy.onEveryMessage(); + var latestStrategy = ProcessingStrategy.skip(); + var webSockets = ProcessingStrategy.onEveryMessage(); + var processingSettings = new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Advanced(timeseriesStrategy, latestStrategy, webSockets); + config.setProcessingSettings(processingSettings); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -333,9 +333,9 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenOnEveryMessagePersistenceSettingsAndSameMessageTwoTimes_whenOnMsg_thenPersistSameMessageTwoTimes() throws TbNodeException { + public void givenOnEveryMessageProcessingSettingsAndSameMessageTwoTimes_whenOnMsg_thenPersistSameMessageTwoTimes() throws TbNodeException { // GIVEN - config.setPersistenceSettings(new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.OnEveryMessage()); + config.setProcessingSettings(new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.OnEveryMessage()); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -368,9 +368,9 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenDeduplicatePersistenceSettingsAndSameMessageTwoTimes_whenOnMsg_thenPersistThisMessageOnlyFirstTime() throws TbNodeException { + public void givenDeduplicateProcessingSettingsAndSameMessageTwoTimes_whenOnMsg_thenPersistThisMessageOnlyFirstTime() throws TbNodeException { // GIVEN - config.setPersistenceSettings(new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Deduplicate(10)); + config.setProcessingSettings(new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Deduplicate(10)); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -403,9 +403,9 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenWebsocketsOnlyPersistenceSettingsAndSameMessageTwoTimes_whenOnMsg_thenSendsOnlyWsUpdateTwoTimes() throws TbNodeException { + public void givenWebSocketsOnlyProcessingSettingsAndSameMessageTwoTimes_whenOnMsg_thenSendsOnlyWsUpdateTwoTimes() throws TbNodeException { // GIVEN - config.setPersistenceSettings(new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.WebSocketsOnly()); + config.setProcessingSettings(new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.WebSocketsOnly()); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -438,12 +438,12 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenAdvancedPersistenceSettingsWithOnEveryMessageStrategiesForAllActionsAndSameMessageTwoTimes_whenOnMsg_thenPersistSameMessageTwoTimes() throws TbNodeException { + public void givenAdvancedProcessingSettingsWithOnEveryMessageStrategiesForAllActionsAndSameMessageTwoTimes_whenOnMsg_thenPersistSameMessageTwoTimes() throws TbNodeException { // GIVEN - config.setPersistenceSettings(new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Advanced( - PersistenceStrategy.onEveryMessage(), - PersistenceStrategy.onEveryMessage(), - PersistenceStrategy.onEveryMessage() + config.setProcessingSettings(new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Advanced( + ProcessingStrategy.onEveryMessage(), + ProcessingStrategy.onEveryMessage(), + ProcessingStrategy.onEveryMessage() )); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -477,12 +477,12 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenAdvancedPersistenceSettingsWithDifferentDeduplicateStrategyForEachAction_whenOnMsg_thenEvaluatesStrategiesForEachActionsIndependently() throws TbNodeException { + public void givenAdvancedProcessingSettingsWithDifferentDeduplicateStrategyForEachAction_whenOnMsg_thenEvaluatesStrategiesForEachActionsIndependently() throws TbNodeException { // GIVEN - config.setPersistenceSettings(new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Advanced( - PersistenceStrategy.deduplicate(1), - PersistenceStrategy.deduplicate(2), - PersistenceStrategy.deduplicate(3) + config.setProcessingSettings(new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Advanced( + ProcessingStrategy.deduplicate(1), + ProcessingStrategy.deduplicate(2), + ProcessingStrategy.deduplicate(3) )); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -528,12 +528,12 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { } @Test - public void givenAdvancedPersistenceSettingsWithSkipStrategiesForAllActionsAndSameMessageTwoTimes_whenOnMsg_thenSkipsSameMessageTwoTimes() throws TbNodeException { + public void givenAdvancedProcessingSettingsWithSkipStrategiesForAllActionsAndSameMessageTwoTimes_whenOnMsg_thenSkipsSameMessageTwoTimes() throws TbNodeException { // GIVEN - config.setPersistenceSettings(new TbMsgTimeseriesNodeConfiguration.PersistenceSettings.Advanced( - PersistenceStrategy.skip(), - PersistenceStrategy.skip(), - PersistenceStrategy.skip() + config.setProcessingSettings(new TbMsgTimeseriesNodeConfiguration.ProcessingSettings.Advanced( + ProcessingStrategy.skip(), + ProcessingStrategy.skip(), + ProcessingStrategy.skip() )); node.init(ctxMock, new TbNodeConfiguration(JacksonUtil.valueToTree(config))); @@ -577,7 +577,7 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }"""), @@ -591,7 +591,7 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }"""), @@ -606,7 +606,7 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ON_EVERY_MESSAGE" } }"""), @@ -621,7 +621,7 @@ public class TbMsgTimeseriesNodeTest extends AbstractRuleNodeUpgradeTest { { "defaultTTL": 0, "useServerTs": false, - "persistenceSettings": { + "processingSettings": { "type": "ADVANCED", "timeseries": { "type": "ON_EVERY_MESSAGE" diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/DeduplicatePersistenceStrategyTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/DeduplicateProcessingStrategyTest.java similarity index 75% rename from rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/DeduplicatePersistenceStrategyTest.java rename to rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/DeduplicateProcessingStrategyTest.java index 1ae2b367a5..2c81ecd0a1 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/DeduplicatePersistenceStrategyTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/DeduplicateProcessingStrategyTest.java @@ -28,27 +28,27 @@ import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -class DeduplicatePersistenceStrategyTest { +class DeduplicateProcessingStrategyTest { final int deduplicationIntervalSecs = 10; - DeduplicatePersistenceStrategy strategy; + DeduplicateProcessingStrategy strategy; @BeforeEach void setup() { - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); } @Test void shouldThrowWhenDeduplicationIntervalIsLessThanOneSecond() { - assertThatThrownBy(() -> new DeduplicatePersistenceStrategy(0)) + assertThatThrownBy(() -> new DeduplicateProcessingStrategy(0)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Deduplication interval must be at least 1 second(s) and at most 86400 second(s), was 0 second(s)"); } @Test void shouldThrowWhenDeduplicationIntervalIsMoreThan24Hours() { - assertThatThrownBy(() -> new DeduplicatePersistenceStrategy(86401)) + assertThatThrownBy(() -> new DeduplicateProcessingStrategy(86401)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Deduplication interval must be at least 1 second(s) and at most 86400 second(s), was 86401 second(s)"); } @@ -59,7 +59,7 @@ class DeduplicatePersistenceStrategyTest { int deduplicationIntervalSecs = 1; // min deduplication interval duration // WHEN - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); // THEN var deduplicationCache = (LoadingCache>) ReflectionTestUtils.getField(strategy, "deduplicationCache"); @@ -76,7 +76,7 @@ class DeduplicatePersistenceStrategyTest { int deduplicationIntervalSecs = (int) Duration.ofHours(1L).toSeconds(); // max deduplication interval duration // WHEN - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); // THEN var deduplicationCache = (LoadingCache>) ReflectionTestUtils.getField(strategy, "deduplicationCache"); @@ -93,7 +93,7 @@ class DeduplicatePersistenceStrategyTest { int deduplicationIntervalSecs = (int) Duration.ofDays(1L).toSeconds(); // max deduplication interval duration // WHEN - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); // THEN var deduplicationCache = (LoadingCache>) ReflectionTestUtils.getField(strategy, "deduplicationCache"); @@ -110,7 +110,7 @@ class DeduplicatePersistenceStrategyTest { int deduplicationIntervalSecs = 1; // min deduplication interval duration // WHEN - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); // THEN var deduplicationCache = (LoadingCache>) ReflectionTestUtils.getField(strategy, "deduplicationCache"); @@ -127,7 +127,7 @@ class DeduplicatePersistenceStrategyTest { int deduplicationIntervalSecs = (int) Duration.ofHours(1L).toSeconds(); // WHEN - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); // THEN var deduplicationCache = (LoadingCache>) ReflectionTestUtils.getField(strategy, "deduplicationCache"); @@ -144,7 +144,7 @@ class DeduplicatePersistenceStrategyTest { int deduplicationIntervalSecs = (int) Duration.ofDays(1L).toSeconds(); // max deduplication interval duration // WHEN - strategy = new DeduplicatePersistenceStrategy(deduplicationIntervalSecs); + strategy = new DeduplicateProcessingStrategy(deduplicationIntervalSecs); // THEN var deduplicationCache = (LoadingCache>) ReflectionTestUtils.getField(strategy, "deduplicationCache"); @@ -160,7 +160,7 @@ class DeduplicatePersistenceStrategyTest { long ts = 1_000_000L; UUID originator = UUID.randomUUID(); - assertThat(strategy.shouldPersist(ts, originator)).isTrue(); + assertThat(strategy.shouldProcess(ts, originator)).isTrue(); } @Test @@ -169,11 +169,11 @@ class DeduplicatePersistenceStrategyTest { UUID originator = UUID.randomUUID(); // Initial call should return true - assertThat(strategy.shouldPersist(baseTs, originator)).isTrue(); + assertThat(strategy.shouldProcess(baseTs, originator)).isTrue(); // Subsequent call within the same interval should return false for the same originator long withinSameIntervalTs = baseTs + 1000L; - assertThat(strategy.shouldPersist(withinSameIntervalTs, originator)).isFalse(); + assertThat(strategy.shouldProcess(withinSameIntervalTs, originator)).isFalse(); } @Test @@ -183,12 +183,12 @@ class DeduplicatePersistenceStrategyTest { UUID originator2 = UUID.randomUUID(); // First call for different originators in the same interval should return true independently - assertThat(strategy.shouldPersist(baseTs, originator1)).isTrue(); - assertThat(strategy.shouldPersist(baseTs, originator2)).isTrue(); + assertThat(strategy.shouldProcess(baseTs, originator1)).isTrue(); + assertThat(strategy.shouldProcess(baseTs, originator2)).isTrue(); // Subsequent calls for the same originators within the same interval should return false - assertThat(strategy.shouldPersist(baseTs + 500L, originator1)).isFalse(); - assertThat(strategy.shouldPersist(baseTs + 500L, originator2)).isFalse(); + assertThat(strategy.shouldProcess(baseTs + 500L, originator1)).isFalse(); + assertThat(strategy.shouldProcess(baseTs + 500L, originator2)).isFalse(); } @Test @@ -197,11 +197,11 @@ class DeduplicatePersistenceStrategyTest { long maxTs = Long.MAX_VALUE; UUID originator = UUID.randomUUID(); - assertThat(strategy.shouldPersist(minTs, originator)).isTrue(); - assertThat(strategy.shouldPersist(minTs + 1L, originator)).isFalse(); + assertThat(strategy.shouldProcess(minTs, originator)).isTrue(); + assertThat(strategy.shouldProcess(minTs + 1L, originator)).isFalse(); - assertThat(strategy.shouldPersist(maxTs, originator)).isTrue(); - assertThat(strategy.shouldPersist(maxTs - 1L, originator)).isFalse(); + assertThat(strategy.shouldProcess(maxTs, originator)).isTrue(); + assertThat(strategy.shouldProcess(maxTs - 1L, originator)).isFalse(); } @Test @@ -213,22 +213,22 @@ class DeduplicatePersistenceStrategyTest { long firstIntervalEnd = firstIntervalStart + Duration.ofSeconds(deduplicationIntervalSecs).toMillis() - 1L; long firstIntervalMiddle = calculateMiddle(firstIntervalStart, firstIntervalEnd); - assertThat(strategy.shouldPersist(firstIntervalStart, originator)).isTrue(); - assertThat(strategy.shouldPersist(firstIntervalStart + 1, originator)).isFalse(); - assertThat(strategy.shouldPersist(firstIntervalMiddle, originator)).isFalse(); - assertThat(strategy.shouldPersist(firstIntervalEnd - 1, originator)).isFalse(); - assertThat(strategy.shouldPersist(firstIntervalEnd, originator)).isFalse(); + assertThat(strategy.shouldProcess(firstIntervalStart, originator)).isTrue(); + assertThat(strategy.shouldProcess(firstIntervalStart + 1, originator)).isFalse(); + assertThat(strategy.shouldProcess(firstIntervalMiddle, originator)).isFalse(); + assertThat(strategy.shouldProcess(firstIntervalEnd - 1, originator)).isFalse(); + assertThat(strategy.shouldProcess(firstIntervalEnd, originator)).isFalse(); // check 2nd interval long secondIntervalStart = firstIntervalEnd + 1L; long secondIntervalEnd = secondIntervalStart + Duration.ofSeconds(deduplicationIntervalSecs).toMillis() - 1L; long secondIntervalMiddle = calculateMiddle(secondIntervalStart, secondIntervalEnd); - assertThat(strategy.shouldPersist(secondIntervalStart, originator)).isTrue(); - assertThat(strategy.shouldPersist(secondIntervalStart + 1, originator)).isFalse(); - assertThat(strategy.shouldPersist(secondIntervalMiddle, originator)).isFalse(); - assertThat(strategy.shouldPersist(secondIntervalEnd - 1, originator)).isFalse(); - assertThat(strategy.shouldPersist(secondIntervalEnd, originator)).isFalse(); + assertThat(strategy.shouldProcess(secondIntervalStart, originator)).isTrue(); + assertThat(strategy.shouldProcess(secondIntervalStart + 1, originator)).isFalse(); + assertThat(strategy.shouldProcess(secondIntervalMiddle, originator)).isFalse(); + assertThat(strategy.shouldProcess(secondIntervalEnd - 1, originator)).isFalse(); + assertThat(strategy.shouldProcess(secondIntervalEnd, originator)).isFalse(); } @Test @@ -238,19 +238,19 @@ class DeduplicatePersistenceStrategyTest { long baseTs = 0L; // First interval for both originators - assertThat(strategy.shouldPersist(baseTs, originator1)).isTrue(); - assertThat(strategy.shouldPersist(baseTs, originator2)).isTrue(); + assertThat(strategy.shouldProcess(baseTs, originator1)).isTrue(); + assertThat(strategy.shouldProcess(baseTs, originator2)).isTrue(); // Move to the next interval long nextIntervalTs = baseTs + Duration.ofSeconds(10).toMillis(); // Each originator should be allowed again in the new interval - assertThat(strategy.shouldPersist(nextIntervalTs, originator1)).isTrue(); - assertThat(strategy.shouldPersist(nextIntervalTs, originator2)).isTrue(); + assertThat(strategy.shouldProcess(nextIntervalTs, originator1)).isTrue(); + assertThat(strategy.shouldProcess(nextIntervalTs, originator2)).isTrue(); // Subsequent calls in the same new interval should return false - assertThat(strategy.shouldPersist(nextIntervalTs + 500L, originator1)).isFalse(); - assertThat(strategy.shouldPersist(nextIntervalTs + 500L, originator2)).isFalse(); + assertThat(strategy.shouldProcess(nextIntervalTs + 500L, originator1)).isFalse(); + assertThat(strategy.shouldProcess(nextIntervalTs + 500L, originator2)).isFalse(); } private static long calculateMiddle(long start, long end) { diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessagePersistenceStrategyTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessageProcessingStrategyTest.java similarity index 89% rename from rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessagePersistenceStrategyTest.java rename to rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessageProcessingStrategyTest.java index 125da3a495..36858418c3 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessagePersistenceStrategyTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/OnEveryMessageProcessingStrategyTest.java @@ -24,13 +24,13 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -class OnEveryMessagePersistenceStrategyTest { +class OnEveryMessageProcessingStrategyTest { @ParameterizedTest @MethodSource("edgeCaseProvider") void shouldAlwaysReturnTrueForAnyInput(long timestamp, UUID originator) { - var onEveryMessage = OnEveryMessagePersistenceStrategy.getInstance(); - assertThat(onEveryMessage.shouldPersist(timestamp, originator)).isTrue(); + var onEveryMessage = OnEveryMessageProcessingStrategy.getInstance(); + assertThat(onEveryMessage.shouldProcess(timestamp, originator)).isTrue(); } private static Stream edgeCaseProvider() { diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/PersistenceStrategyTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/ProcessingStrategyTest.java similarity index 76% rename from rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/PersistenceStrategyTest.java rename to rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/ProcessingStrategyTest.java index 71a8eabed5..45fed469d2 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/PersistenceStrategyTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/ProcessingStrategyTest.java @@ -22,23 +22,23 @@ import java.time.Duration; import static org.assertj.core.api.Assertions.assertThat; -class PersistenceStrategyTest { +class ProcessingStrategyTest { @Test void testOnEveryMessageReturnsCorrectInstance() { - PersistenceStrategy strategy = PersistenceStrategy.onEveryMessage(); + ProcessingStrategy strategy = ProcessingStrategy.onEveryMessage(); assertThat(strategy) .isNotNull() - .isInstanceOf(OnEveryMessagePersistenceStrategy.class); + .isInstanceOf(OnEveryMessageProcessingStrategy.class); } @Test void testDeduplicateReturnsCorrectInstance() { int validDeduplicationIntervalSecs = 5; - PersistenceStrategy strategy = PersistenceStrategy.deduplicate(validDeduplicationIntervalSecs); + ProcessingStrategy strategy = ProcessingStrategy.deduplicate(validDeduplicationIntervalSecs); assertThat(strategy) .isNotNull() - .isInstanceOf(DeduplicatePersistenceStrategy.class); + .isInstanceOf(DeduplicateProcessingStrategy.class); long actualDeduplicationIntervalMillis = (long) ReflectionTestUtils.getField(strategy, "deduplicationIntervalMillis"); assertThat(actualDeduplicationIntervalMillis).isEqualTo(Duration.ofSeconds(validDeduplicationIntervalSecs).toMillis()); @@ -46,10 +46,10 @@ class PersistenceStrategyTest { @Test void testSkipReturnsCorrectInstance() { - PersistenceStrategy strategy = PersistenceStrategy.skip(); + ProcessingStrategy strategy = ProcessingStrategy.skip(); assertThat(strategy) .isNotNull() - .isInstanceOf(SkipPersistenceStrategy.class); + .isInstanceOf(SkipProcessingStrategy.class); } } diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/SkipPersistenceStrategyTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/SkipProcessingStrategyTest.java similarity index 90% rename from rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/SkipPersistenceStrategyTest.java rename to rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/SkipProcessingStrategyTest.java index 1a63ce7460..ffdf2fc87e 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/SkipPersistenceStrategyTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/telemetry/strategy/SkipProcessingStrategyTest.java @@ -24,13 +24,13 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -class SkipPersistenceStrategyTest { +class SkipProcessingStrategyTest { @ParameterizedTest @MethodSource("edgeCaseProvider") void shouldAlwaysReturnFalseForAnyInput(long timestamp, UUID originator) { - var skipStrategy = SkipPersistenceStrategy.getInstance(); - assertThat(skipStrategy.shouldPersist(timestamp, originator)).isFalse(); + var skipStrategy = SkipProcessingStrategy.getInstance(); + assertThat(skipStrategy.shouldProcess(timestamp, originator)).isFalse(); } private static Stream edgeCaseProvider() { From fc3bc522470ae75c9c9f6a926f17257b86b4bd1f Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 7 Feb 2025 12:15:32 +0200 Subject: [PATCH 039/100] UI: [Rule node save ts] Rename Persistence settings to Processing settings --- ...anced-persistence-setting-row.component.ts | 22 +++--- ...dvanced-persistence-setting.component.html | 5 ++ .../advanced-persistence-setting.component.ts | 5 +- .../action/timeseries-config.component.html | 13 ++-- .../action/timeseries-config.component.ts | 78 +++++++++---------- .../action/timeseries-config.models.ts | 54 ++++++------- .../common/example-hint.component.html | 6 +- .../common/example-hint.component.scss | 31 -------- .../common/example-hint.component.ts | 2 +- .../rulenode/save_timeseries_node_advanced.md | 3 + .../assets/locale/locale.constant-en_US.json | 5 +- 11 files changed, 100 insertions(+), 124 deletions(-) delete mode 100644 ui-ngx/src/app/modules/home/components/rule-node/common/example-hint.component.scss create mode 100644 ui-ngx/src/assets/help/en_US/rulenode/save_timeseries_node_advanced.md diff --git a/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting-row.component.ts b/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting-row.component.ts index 64ea045f8f..bf9b48aca3 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting-row.component.ts @@ -24,11 +24,11 @@ import { Validator } from '@angular/forms'; import { - AdvancedPersistenceConfig, - defaultAdvancedPersistenceConfig, + AdvancedProcessingConfig, + defaultAdvancedProcessingConfig, maxDeduplicateTimeSecs, - PersistenceType, - PersistenceTypeTranslationMap + ProcessingType, + ProcessingTypeTranslationMap } from '@home/components/rule-node/action/timeseries-config.models'; import { isDefinedAndNotNull } from '@core/utils'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @@ -52,13 +52,13 @@ export class AdvancedPersistenceSettingRowComponent implements ControlValueAcces title: string; persistenceSettingRowForm = this.fb.group({ - type: [defaultAdvancedPersistenceConfig.type], + type: [defaultAdvancedProcessingConfig.type], deduplicationIntervalSecs: [{value: 60, disabled: true}] }); - PersistenceType = PersistenceType; - persistenceStrategies = [PersistenceType.ON_EVERY_MESSAGE, PersistenceType.DEDUPLICATE, PersistenceType.SKIP]; - PersistenceTypeTranslationMap = PersistenceTypeTranslationMap; + PersistenceType = ProcessingType; + persistenceStrategies = [ProcessingType.ON_EVERY_MESSAGE, ProcessingType.DEDUPLICATE, ProcessingType.SKIP]; + PersistenceTypeTranslationMap = ProcessingTypeTranslationMap; maxDeduplicateTime = maxDeduplicateTimeSecs; @@ -96,16 +96,16 @@ export class AdvancedPersistenceSettingRowComponent implements ControlValueAcces }; } - writeValue(value: AdvancedPersistenceConfig) { + writeValue(value: AdvancedProcessingConfig) { if (isDefinedAndNotNull(value)) { this.persistenceSettingRowForm.patchValue(value, {emitEvent: false}); } else { - this.persistenceSettingRowForm.patchValue(defaultAdvancedPersistenceConfig); + this.persistenceSettingRowForm.patchValue(defaultAdvancedProcessingConfig); } } private updatedValidation() { - if (this.persistenceSettingRowForm.get('type').value === PersistenceType.DEDUPLICATE) { + if (this.persistenceSettingRowForm.get('type').value === ProcessingType.DEDUPLICATE) { this.persistenceSettingRowForm.get('deduplicationIntervalSecs').enable({emitEvent: false}); } else { this.persistenceSettingRowForm.get('deduplicationIntervalSecs').disable({emitEvent: false}) diff --git a/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting.component.html b/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting.component.html index eb0f05bec2..d3cbb1cdcb 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/action/advanced-persistence-setting.component.html @@ -16,6 +16,11 @@ -->
        + +
        -
        +
        -
        - rule-node-config.save-time-series.persistence-settings +
        + rule-node-config.save-time-series.processing-settings
        @@ -27,7 +27,7 @@ {{ 'rule-node-config.advanced-mode' | translate }}
        - @if(!timeseriesConfigForm.get('persistenceSettings.isAdvanced').value) { + @if(!timeseriesConfigForm.get('processingSettings.isAdvanced').value) { rule-node-config.save-time-series.strategy @@ -37,7 +37,7 @@ - @if(timeseriesConfigForm.get('persistenceSettings.type').value === PersistenceType.DEDUPLICATE) { + @if(timeseriesConfigForm.get('processingSettings.type').value === PersistenceType.DEDUPLICATE) { } - } - @else { + } @else { { - persistenceSettings: PersistenceSettingsForm +export interface TimeseriesNodeConfigurationForm extends Omit { + processingSettings: ProcessingSettingsForm } -export type PersistenceSettings = BasicPersistenceSettings & Partial & Partial; +export type ProcessingSettings = ProcessingSettingsSettings & Partial & Partial; -export type PersistenceSettingsForm = Omit & { +export type ProcessingSettingsForm = Omit & { isAdvanced: boolean; - advanced?: Partial; - type: PersistenceType; + advanced?: Partial; + type: ProcessingType; }; -export enum PersistenceType { +export enum ProcessingType { ON_EVERY_MESSAGE = 'ON_EVERY_MESSAGE', DEDUPLICATE = 'DEDUPLICATE', WEBSOCKETS_ONLY = 'WEBSOCKETS_ONLY', @@ -44,35 +44,35 @@ export enum PersistenceType { SKIP = 'SKIP' } -export const PersistenceTypeTranslationMap = new Map([ - [PersistenceType.ON_EVERY_MESSAGE, 'rule-node-config.save-time-series.strategy-type.every-message'], - [PersistenceType.DEDUPLICATE, 'rule-node-config.save-time-series.strategy-type.deduplicate'], - [PersistenceType.WEBSOCKETS_ONLY, 'rule-node-config.save-time-series.strategy-type.web-sockets-only'], - [PersistenceType.SKIP, 'rule-node-config.save-time-series.strategy-type.skip'], +export const ProcessingTypeTranslationMap = new Map([ + [ProcessingType.ON_EVERY_MESSAGE, 'rule-node-config.save-time-series.strategy-type.every-message'], + [ProcessingType.DEDUPLICATE, 'rule-node-config.save-time-series.strategy-type.deduplicate'], + [ProcessingType.WEBSOCKETS_ONLY, 'rule-node-config.save-time-series.strategy-type.web-sockets-only'], + [ProcessingType.SKIP, 'rule-node-config.save-time-series.strategy-type.skip'], ]) -export interface BasicPersistenceSettings { - type: PersistenceType; +export interface ProcessingSettingsSettings { + type: ProcessingType; } -export interface DeduplicatePersistenceStrategy extends BasicPersistenceSettings{ +export interface DeduplicateProcessingStrategy extends ProcessingSettingsSettings{ deduplicationIntervalSecs: number; } -export interface AdvancedPersistenceStrategy extends BasicPersistenceSettings{ - timeseries: AdvancedPersistenceConfig; - latest: AdvancedPersistenceConfig; - webSockets: AdvancedPersistenceConfig; +export interface AdvancedProcessingStrategy extends ProcessingSettingsSettings{ + timeseries: AdvancedProcessingConfig; + latest: AdvancedProcessingConfig; + webSockets: AdvancedProcessingConfig; } -export type AdvancedPersistenceConfig = WithOptional; +export type AdvancedProcessingConfig = WithOptional; -export const defaultAdvancedPersistenceConfig: AdvancedPersistenceConfig = { - type: PersistenceType.ON_EVERY_MESSAGE +export const defaultAdvancedProcessingConfig: AdvancedProcessingConfig = { + type: ProcessingType.ON_EVERY_MESSAGE } -export const defaultAdvancedPersistenceStrategy: Omit = { - timeseries: defaultAdvancedPersistenceConfig, - latest: defaultAdvancedPersistenceConfig, - webSockets: defaultAdvancedPersistenceConfig, +export const defaultAdvancedPersistenceStrategy: Omit = { + timeseries: defaultAdvancedProcessingConfig, + latest: defaultAdvancedProcessingConfig, + webSockets: defaultAdvancedProcessingConfig, } diff --git a/ui-ngx/src/app/modules/home/components/rule-node/common/example-hint.component.html b/ui-ngx/src/app/modules/home/components/rule-node/common/example-hint.component.html index 238fdce6af..0981daa5cb 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/common/example-hint.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/common/example-hint.component.html @@ -15,11 +15,11 @@ limitations under the License. --> -
        +
        -
        +
        Date: Fri, 7 Feb 2025 12:19:37 +0200 Subject: [PATCH 040/100] UI: [Rule node save ts] Fixed typo --- .../rule-node/action/timeseries-config.models.ts | 8 ++++---- ui-ngx/src/assets/locale/locale.constant-en_US.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/rule-node/action/timeseries-config.models.ts b/ui-ngx/src/app/modules/home/components/rule-node/action/timeseries-config.models.ts index dfee001181..e9d024663d 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/action/timeseries-config.models.ts +++ b/ui-ngx/src/app/modules/home/components/rule-node/action/timeseries-config.models.ts @@ -28,7 +28,7 @@ export interface TimeseriesNodeConfigurationForm extends Omit & Partial; +export type ProcessingSettings = BasicProcessingSettings & Partial & Partial; export type ProcessingSettingsForm = Omit & { isAdvanced: boolean; @@ -51,15 +51,15 @@ export const ProcessingTypeTranslationMap = new Map([ [ProcessingType.SKIP, 'rule-node-config.save-time-series.strategy-type.skip'], ]) -export interface ProcessingSettingsSettings { +export interface BasicProcessingSettings { type: ProcessingType; } -export interface DeduplicateProcessingStrategy extends ProcessingSettingsSettings{ +export interface DeduplicateProcessingStrategy extends BasicProcessingSettings{ deduplicationIntervalSecs: number; } -export interface AdvancedProcessingStrategy extends ProcessingSettingsSettings{ +export interface AdvancedProcessingStrategy extends BasicProcessingSettings{ timeseries: AdvancedProcessingConfig; latest: AdvancedProcessingConfig; webSockets: AdvancedProcessingConfig; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 9ca1e2dd4d..d3f6e3b2fc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5136,7 +5136,7 @@ "save-time-series": { "processing-settings": "Processing settings", "processing-settings-hint": "Define how time series data is processed. In Basic mode, select a preconfigured processing strategy or enable only WebSocket updates. Advanced mode allows you to select individual processing strategies for each action.", - "advanced-settings-hint": "Advanced settings mode is dangerous, and if you do not understand it, you may lose telemetry.\n\n\n\n\n\n\n\n", + "advanced-settings-hint": "Advanced settings mode is dangerous, and if you do not understand it, you may lose telemetry.", "strategy": "Strategy", "deduplication-interval": "Deduplication interval", "deduplication-interval-required": "Deduplication interval is required", From 5d47ef230918167fed530cb7d82d39e9abd6622d Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 7 Feb 2025 13:32:59 +0200 Subject: [PATCH 041/100] UI: Fixed a blur effect issue in the Getting started widget --- .../getting-started-widget.component.html | 26 +++++++++---------- .../getting-started-widget.component.scss | 3 +++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.html index 004d9807b7..c0f980ca2e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.html @@ -26,7 +26,7 @@ -
        +
        widgets.getting-started.sys-admin.step1.title
        {{ 'tenant.tenants' | translate }}
        @@ -37,7 +37,7 @@ -
        +
        widgets.getting-started.sys-admin.step2.title
        {{ 'admin.settings' | translate }}
        @@ -48,7 +48,7 @@ -
        +
        widgets.getting-started.sys-admin.step3.title
        {{ 'admin.settings' | translate }}
        @@ -59,7 +59,7 @@ -
        +
        widgets.getting-started.sys-admin.step4.title
        {{ 'admin.settings' | translate }}
        @@ -70,7 +70,7 @@ -
        +
        widgets.getting-started.sys-admin.step5.title
        {{ 'admin.settings' | translate }}
        @@ -81,7 +81,7 @@ -
        +
        widgets.getting-started.sys-admin.step6.title
        {{ 'admin.settings' | translate }}
        @@ -94,7 +94,7 @@ -
        +
        widgets.getting-started.tenant-admin.step1.title
        {{ 'device.devices' | translate }}
        @@ -105,7 +105,7 @@ -
        +
        widgets.getting-started.tenant-admin.step2.title
        @@ -153,7 +153,7 @@ -
        +
        widgets.getting-started.tenant-admin.step3.title
        {{ 'dashboard.dashboards' | translate }}
        @@ -164,7 +164,7 @@ -
        +
        widgets.getting-started.tenant-admin.step4.title
        {{ 'widgets.getting-started.tenant-admin.step4.alarm-rules' | translate }}
        @@ -175,7 +175,7 @@ -
        +
        widgets.getting-started.tenant-admin.step5.title
        @@ -193,7 +193,7 @@ -
        +
        widgets.getting-started.tenant-admin.step6.title
        {{ 'customer.customers' | translate }}
        @@ -205,7 +205,7 @@ -
        +
        diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss index e684c094d7..4a21006cc0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss @@ -38,6 +38,9 @@ .tb-get-started-container { flex: 1; overflow: auto; + mat-stepper { + transform: scale(1); //fixed blur content + } } } From 148ea630c2fd8cf9d8db07c1cf06e1ce2c014e9c Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Fri, 7 Feb 2025 15:58:03 +0200 Subject: [PATCH 042/100] Save time series strategies: added description for advanced processing settings mode --- .../rulenode/save_timeseries_node_advanced.md | 30 +++++++++++++++++-- .../assets/locale/locale.constant-en_US.json | 6 ++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/rulenode/save_timeseries_node_advanced.md b/ui-ngx/src/assets/help/en_US/rulenode/save_timeseries_node_advanced.md index 4aae99c710..44a037f180 100644 --- a/ui-ngx/src/assets/help/en_US/rulenode/save_timeseries_node_advanced.md +++ b/ui-ngx/src/assets/help/en_US/rulenode/save_timeseries_node_advanced.md @@ -1,3 +1,29 @@ -**TO DO;** +#### Potential unexpected behavior with mixed processing strategies -Advanced mode doc +When configuring the processing strategies, certain combinations can lead to unexpected behavior. Consider the following scenarios: + +- **Disabling WebSocket (WS) updates** + + If WS updates are disabled, any changes to the time series data won’t be pushed to dashboards (or other WS subscriptions). + This means that even if a database is updated, dashboards may not display the updated data until browser page is reloaded. + +- **Different deduplication intervals across actions** + + When you configure different deduplication intervals for actions, the same incoming message might be processed differently for each action. + For example, a message might be stored immediately in the Time series table (if set to *On every message*) while not being stored in the Latest values table because its deduplication interval hasn’t elapsed. + Also, if the WebSocket updates are configured with a different interval, dashboards might show updates that do not match what is stored in the database. + +- **Skipping database storage** + + Choosing to disable one or more persistence actions (for instance, skipping database storage for Time series or Latest values while keeping WS updates enabled) introduces the risk of having only partial data available: + - If a message is processed only for real-time notifications (WebSockets) and not stored in the database, historical queries may not match data on the dashboard. + - When processing strategies for Time series and Latest values are out-of-sync, telemetry data may be stored in one table (e.g., Time series) while the same data is absent in the other (e.g., Latest values). + +- **Deduplication cache clearing** + + The deduplication mechanism uses a cache to track processed messages within each interval. + For performance and system stability reasons, this cache is periodically cleared. + As a result, if a cache entry is removed during the deduplication period, messages from the same originator may be processed more than once within that interval. + This means deduplication should be used as a performance optimization rather than an absolute guarantee of single processing per interval. + +We recommend using deduplication only when the occasional repeated processing is acceptable and won't cause system correctness issue or data inconsistencies. diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index d3f6e3b2fc..2ad89d67ca 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5135,8 +5135,8 @@ "advanced-mode": "Advanced", "save-time-series": { "processing-settings": "Processing settings", - "processing-settings-hint": "Define how time series data is processed. In Basic mode, select a preconfigured processing strategy or enable only WebSocket updates. Advanced mode allows you to select individual processing strategies for each action.", - "advanced-settings-hint": "Advanced settings mode is dangerous, and if you do not understand it, you may lose telemetry.", + "processing-settings-hint": "Define how incoming messages are processed. In Basic mode, select a preconfigured processing strategy or enable only WebSocket updates. Advanced mode allows you to select individual processing strategies for each action.", + "advanced-settings-hint": "Be cautious when configuring processing strategies. Certain combinations can lead to unexpected behavior.", "strategy": "Strategy", "deduplication-interval": "Deduplication interval", "deduplication-interval-required": "Deduplication interval is required", @@ -5148,7 +5148,7 @@ "web-sockets-only": "WebSockets only" }, "time-series": "Time series", - "latest": "Latest", + "latest": "Latest values", "web-sockets": "WebSockets" }, "key-val": { From cc6f0b6c7b5a1f560b70b24efd984ec6decbda35 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 7 Feb 2025 15:59:52 +0200 Subject: [PATCH 043/100] UI: Value stepper widget --- .../json/system/widget_bundles/buttons.json | 1 + .../widget_bundles/control_widgets.json | 1 + .../system/widget_types/value_stepper.json | 51 +++ .../basic/basic-widget-config.module.ts | 5 + .../power-button-basic-config.component.html | 32 ++ .../power-button-basic-config.component.ts | 38 +- .../value-stepper-basic-config.component.html | 297 ++++++++++++++ .../value-stepper-basic-config.component.ts | 225 ++++++++++ .../lib/rpc/power-button-widget.component.ts | 7 +- .../lib/rpc/power-button-widget.models.ts | 373 +++++++++++------ .../rpc/value-stepper-widget.component.html | 43 ++ .../rpc/value-stepper-widget.component.scss | 90 ++++ .../lib/rpc/value-stepper-widget.component.ts | 388 ++++++++++++++++++ .../lib/rpc/value-stepper-widget.models.ts | 239 +++++++++++ ...lue-stepper-widget-settings.component.html | 266 ++++++++++++ ...value-stepper-widget-settings.component.ts | 191 +++++++++ .../lib/settings/widget-settings.module.ts | 5 + .../widget/widget-components.module.ts | 3 + .../assets/locale/locale.constant-en_US.json | 37 ++ .../assets/widget/value-stepper/filled.svg | 1 + .../widget/value-stepper/simplified.svg | 1 + .../assets/widget/value-stepper/volume.svg | 1 + 22 files changed, 2165 insertions(+), 130 deletions(-) create mode 100644 application/src/main/data/json/system/widget_types/value_stepper.json create mode 100644 ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.ts create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.scss create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.ts create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.ts create mode 100644 ui-ngx/src/assets/widget/value-stepper/filled.svg create mode 100644 ui-ngx/src/assets/widget/value-stepper/simplified.svg create mode 100644 ui-ngx/src/assets/widget/value-stepper/volume.svg diff --git a/application/src/main/data/json/system/widget_bundles/buttons.json b/application/src/main/data/json/system/widget_bundles/buttons.json index facca89336..939e583686 100644 --- a/application/src/main/data/json/system/widget_bundles/buttons.json +++ b/application/src/main/data/json/system/widget_bundles/buttons.json @@ -12,6 +12,7 @@ "command_button", "toggle_button", "two_segment_button", + "value_stepper", "power_button" ] } \ No newline at end of file diff --git a/application/src/main/data/json/system/widget_bundles/control_widgets.json b/application/src/main/data/json/system/widget_bundles/control_widgets.json index c3dc219f5b..71a25df0c2 100644 --- a/application/src/main/data/json/system/widget_bundles/control_widgets.json +++ b/application/src/main/data/json/system/widget_bundles/control_widgets.json @@ -12,6 +12,7 @@ "command_button", "toggle_button", "two_segment_button", + "value_stepper", "power_button", "slider", "control_widgets.switch_control", diff --git a/application/src/main/data/json/system/widget_types/value_stepper.json b/application/src/main/data/json/system/widget_types/value_stepper.json new file mode 100644 index 0000000000..0126b25470 --- /dev/null +++ b/application/src/main/data/json/system/widget_types/value_stepper.json @@ -0,0 +1,51 @@ +{ + "fqn": "slider", + "name": "Value stepper", + "deprecated": false, + "image": "tb-image;/api/images/system/value-stepper-widget.svg", + "description": "Allows users to click the buttons to send commands to devices or update attributes/time series data. Configurable settings let users define how to retrieve the initial state and specify actions for each button.", + "descriptor": { + "type": "rpc", + "sizeX": 3.5, + "sizeY": 2, + "resources": [], + "templateHtml": "\n", + "templateCss": "", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.actionWidget.onInit();\n}\n\nself.typeParameters = function() {\n return {\n previewWidth: '230px',\n previewHeight: '110px',\n embedTitlePanel: true,\n displayRpcMessageToast: false\n };\n};\n\nself.onDestroy = function() {\n}\n", + "dataKeySettingsForm": [], + "settingsDirective": "tb-value-stepper-widget-settings", + "hasBasicMode": true, + "basicModeDirective": "tb-value-stepper-basic-config", + "defaultConfig": "{\"showTitle\":true,\"backgroundColor\":\"#ffffff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"initialState\":{\"action\":\"EXECUTE_RPC\",\"defaultValue\":0,\"executeRpc\":{\"method\":\"getState\",\"requestTimeout\":5000,\"requestPersistent\":false,\"persistentPollingInterval\":1000},\"getAttribute\":{\"key\":\"state\",\"scope\":null},\"getTimeSeries\":{\"key\":\"state\"},\"getAlarmStatus\":{\"severityList\":null,\"typeList\":null},\"dataToValue\":{\"type\":\"NONE\",\"compareToValue\":true,\"dataToValueFunction\":\"/* Should return integer value */\\nreturn data;\"}},\"disabledState\":{\"action\":\"DO_NOTHING\",\"defaultValue\":false,\"getAttribute\":{\"key\":\"state\",\"scope\":null},\"getTimeSeries\":{\"key\":\"state\"},\"getAlarmStatus\":{\"severityList\":null,\"typeList\":null},\"dataToValue\":{\"type\":\"NONE\",\"compareToValue\":true,\"dataToValueFunction\":\"/* Should return boolean value */\\nreturn data;\"}},\"leftButtonClick\":{\"action\":\"EXECUTE_RPC\",\"executeRpc\":{\"method\":\"setState\",\"requestTimeout\":5000,\"requestPersistent\":false,\"persistentPollingInterval\":1000},\"setAttribute\":{\"key\":\"state\",\"scope\":\"SERVER_SCOPE\"},\"putTimeSeries\":{\"key\":\"state\"},\"valueToData\":{\"type\":\"VALUE\",\"constantValue\":0,\"valueToDataFunction\":\"/* Convert input integer value to RPC parameters or attribute/time-series value */\\nreturn value;\"}},\"rightButtonClick\":{\"action\":\"EXECUTE_RPC\",\"executeRpc\":{\"method\":\"setState\",\"requestTimeout\":5000,\"requestPersistent\":false,\"persistentPollingInterval\":1000},\"setAttribute\":{\"key\":\"state\",\"scope\":\"SERVER_SCOPE\"},\"putTimeSeries\":{\"key\":\"state\"},\"valueToData\":{\"type\":\"VALUE\",\"constantValue\":0,\"valueToDataFunction\":\"/* Convert input integer value to RPC parameters or attribute/time-series value */\\nreturn value;\"}},\"appearance\":{\"type\":\"simplified\",\"autoScale\":true,\"minValueRange\":-100,\"maxValueRange\":100,\"valueStep\":0.5,\"showValueBox\":true,\"valueUnits\":\"\",\"valueDecimals\":1,\"valueFont\":{\"family\":\"Roboto\",\"weight\":\"500\",\"style\":\"normal\",\"size\":16,\"sizeUnit\":\"px\",\"lineHeight\":\"24px\"},\"valueColor\":\"#000\",\"valueBoxBackground\":\"rgba(0, 0, 0, 0.04)\",\"showBorder\":true,\"borderWidth\":1,\"borderColor\":\"#305680\"},\"buttonAppearance\":{\"leftButton\":{\"showButton\":true,\"icon\":\"arrow_back_ios_new\",\"iconSize\":24,\"iconSizeUnit\":\"px\",\"mainColorOn\":\"#3F52DD\",\"backgroundColorOn\":\"#FFFFFF\",\"mainColorDisabled\":\"rgba(0,0,0,0.12)\",\"backgroundColorDisabled\":\"#FFFFFF\",\"customStyle\":{\"enabled\":null,\"hovered\":null,\"pressed\":null,\"activated\":null,\"disabled\":null}},\"rightButton\":{\"showButton\":true,\"icon\":\"arrow_forward_ios\",\"iconSize\":24,\"iconSizeUnit\":\"px\",\"mainColorOn\":\"#3F52DD\",\"backgroundColorOn\":\"#FFFFFF\",\"mainColorDisabled\":\"rgba(0,0,0,0.12)\",\"backgroundColorDisabled\":\"#FFFFFF\",\"customStyle\":{\"enabled\":null,\"hovered\":null,\"pressed\":null,\"activated\":null,\"disabled\":null}}},\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}},\"padding\":\"12px\"},\"title\":\"Value stepper\",\"dropShadow\":true,\"enableFullscreen\":false,\"widgetStyle\":{},\"actions\":{},\"widgetCss\":\"\",\"noDataDisplayMessage\":\"\",\"titleFont\":{\"size\":16,\"sizeUnit\":\"px\",\"family\":null,\"weight\":\"500\",\"style\":null,\"lineHeight\":\"24px\"},\"showTitleIcon\":false,\"titleTooltip\":\"\",\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"pageSize\":1024,\"titleIcon\":\"\",\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"14px\",\"configMode\":\"basic\",\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"datasources\":null,\"borderRadius\":null}" + }, + "resources": [ + { + "link": "/api/images/system/value-stepper-widget.svg", + "title": "\"Value stepper\" system widget image", + "type": "IMAGE", + "subType": "IMAGE", + "fileName": "value-stepper-widget.svg", + "publicResourceKey": "s0UKoqbiMCcKVn0pD55XZzPUR89XlXAO", + "mediaType": "image/svg+xml", + "data": "PHN2ZyB3aWR0aD0iMjE0IiBoZWlnaHQ9Ijc2IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnIGZpbHRlcj0idXJsKCNhKSI+PHJlY3QgeD0iOC41IiB5PSI0LjUiIHdpZHRoPSIxOTciIGhlaWdodD0iNTkiIHJ4PSI0IiBmaWxsPSIjZmZmIiBzaGFwZS1yZW5kZXJpbmc9ImNyaXNwRWRnZXMiLz48cmVjdCB4PSI5IiB5PSI1IiB3aWR0aD0iMTk2IiBoZWlnaHQ9IjU4IiByeD0iMy41IiBzdHJva2U9IiMzMDU2ODAiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxyZWN0IHg9IjIwLjUiIHk9IjE4IiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHJ4PSIxNiIgZmlsbD0iIzMwNTY4MCIvPjxwYXRoIGQ9Im0zOC41IDQwIDEuNDEtMS40MUwzNS4zMyAzNGw0LjU4LTQuNTlMMzguNSAyOGwtNiA2IDYgNloiIGZpbGw9IiNmZmYiLz48cmVjdCB4PSI2NSIgeT0iMTguNSIgd2lkdGg9Ijg0IiBoZWlnaHQ9IjMxIiByeD0iMy41IiBmaWxsPSIjMzA1NjgwIiBmaWxsLW9wYWNpdHk9Ii4wNCIvPjxyZWN0IHg9IjY1IiB5PSIxOC41IiB3aWR0aD0iODQiIGhlaWdodD0iMzEiIHJ4PSIzLjUiIHN0cm9rZT0iIzMwNTY4MCIvPjxwYXRoIGQ9Ik04OC41OSAzNy41VjM5aC03LjYzdi0xLjI5bDMuNy00LjA0Yy40MS0uNDYuNzMtLjg1Ljk3LTEuMTkuMjMtLjMzLjQtLjYzLjQ5LS45YTIuMyAyLjMgMCAwIDAtLjA2LTEuNzNjLS4xMy0uMjctLjMyLS41LS41OC0uNjVhMS43IDEuNyAwIDAgMC0uOTMtLjI0Yy0uNDIgMC0uNzcuMS0xLjA2LjI3LS4yOC4xOS0uNS40NC0uNjUuNzZhMi42IDIuNiAwIDAgMC0uMjIgMS4xaC0xLjg4YzAtLjY3LjE1LTEuMjcuNDYtMS44Mi4zLS41NS43My0uOTkgMS4zLTEuM2E0LjEgNC4xIDAgMCAxIDIuMDgtLjVjLjc2IDAgMS40LjEzIDEuOTQuMzguNTMuMjYuOTMuNjIgMS4yIDEuMDlhMy4zNiAzLjM2IDAgMCAxIC4yNSAyLjcyIDUgNSAwIDAgMS0uNDkgMS4wNCA5IDkgMCAwIDEtLjc0IDEuMDRjLS4yOC4zNS0uNi43LS45NCAxLjA1bC0yLjQ2IDIuNzFoNS4yNVptOS4yNy05Ljg4djEuMDRMOTMuMyAzOWgtMS45OGw0LjU0LTkuODhoLTUuOXYtMS41aDcuODlabTEuOTggMTAuNDRjMC0uMjkuMS0uNTMuMy0uNzMuMi0uMi40Ni0uMy44LS4zcy42LjEuOC4zYy4yLjIuMy40NC4zLjczYTEgMSAwIDAgMS0uMy43NGMtLjIuMi0uNDYuMy0uOC4zcy0uNi0uMS0uOC0uM2ExIDEgMCAwIDEtLjMtLjc0Wm02LjQ5LTQuMzUtMS41LS4zNy42MS01LjcyaDYuMTR2MS42SDEwN2wtLjMyIDIuNzlhMy42NyAzLjY3IDAgMCAxIDEuODEtLjQ2Yy41NCAwIDEuMDIuMDkgMS40NC4yNi40Mi4xNy43OS40MyAxLjA4Ljc2LjMuMzMuNTMuNzMuNjggMS4yYTUgNSAwIDAgMSAwIDMuMDcgMy4xNyAzLjE3IDAgMCAxLTEuODUgMi4wM2MtLjQ2LjE5LTEuMDEuMjktMS42NS4yOWE0LjYgNC42IDAgMCAxLTEuMzYtLjIgMy43MyAzLjczIDAgMCAxLTEuMTctLjYyIDMuMTQgMy4xNCAwIDAgMS0xLjE5LTIuNDJoMS44NWMuMDUuMzcuMTUuNjkuMy45NS4xNi4yNS4zOC40NS42NC41OGEyIDIgMCAwIDAgLjkyLjJjLjMyIDAgLjYtLjA1LjgzLS4xNi4yMy0uMTEuNDItLjI3LjU3LS40OC4xNS0uMjIuMjctLjQ3LjM0LS43NWEzLjYyIDMuNjIgMCAwIDAtLjAyLTEuODcgMS45OCAxLjk4IDAgMCAwLS4zOC0uNzJjLS4xNy0uMi0uMzgtLjM2LS42My0uNDdhMi4xMyAyLjEzIDAgMCAwLS44OC0uMTdjLS40NSAwLS44LjA3LTEuMDQuMi0uMjMuMTMtLjQ1LjI5LS42NS40OFptMTEuNzUtNC4xNmMwLS4zOC4xLS43Mi4yOC0xLjA0LjE5LS4zMi40NC0uNTcuNzUtLjc2YTEuOTYgMS45NiAwIDAgMSAyLjA1IDBjLjMxLjE5LjU2LjQ0Ljc0Ljc2LjE5LjMyLjI4LjY2LjI4IDEuMDRzLS4xLjczLS4yOCAxLjA1Yy0uMTguMzEtLjQzLjU2LS43NC43NGEyLjA0IDIuMDQgMCAwIDEtMi44LS43NCAyLjAzIDIuMDMgMCAwIDEtLjI4LTEuMDVabTEuMDUgMGExIDEgMCAwIDAgMSAxIC45Ny45NyAwIDAgMCAuOTgtMSAxIDEgMCAwIDAtLjI3LS43Mi45My45MyAwIDAgMC0uNy0uM2MtLjI4IDAtLjUxLjEtLjcxLjMtLjIuMi0uMy40My0uMy43MlptMTIuMTkgNS43NWgxLjk1YTQuNSA0LjUgMCAwIDEtLjYyIDEuOTkgMy43MiAzLjcyIDAgMCAxLTEuNSAxLjM3IDUgNSAwIDAgMS0yLjMzLjUgNC4xNSA0LjE1IDAgMCAxLTMuMzQtMS40NWMtLjQtLjQ4LS43MS0xLjA0LS45Mi0xLjctLjIxLS42Ni0uMzItMS40LS4zMi0yLjIydi0uOTVjMC0uODEuMS0xLjU1LjMyLTIuMjIuMjItLjY2LjUzLTEuMjIuOTQtMS42OS40LS40Ny45LS44NCAxLjQ2LTEuMDlhNC43OCA0Ljc4IDAgMCAxIDEuOTMtLjM3Yy45IDAgMS42Ny4xNyAyLjMuNS42Mi4zMyAxLjEuOCAxLjQ1IDEuMzguMzUuNTkuNTYgMS4yNi42NCAyLjAyaC0xLjk1Yy0uMDUtLjQ4LS4xNy0uOS0uMzUtMS4yNWExLjc3IDEuNzcgMCAwIDAtLjc2LS44IDIuNzMgMi43MyAwIDAgMC0xLjMzLS4yOGMtLjQ1IDAtLjg0LjA4LTEuMTcuMjVhMi4yIDIuMiAwIDAgMC0uODQuNzNjLS4yMi4zMy0uMzkuNzItLjUgMS4yLS4xMS40Ny0uMTcgMS0uMTcgMS42di45N2MwIC41Ny4wNSAxLjEuMTUgMS41Ni4xLjQ3LjI2Ljg2LjQ3IDEuMi4yMS4zMy40OC41OS44MS43Ny4zMy4xOC43Mi4yNyAxLjE4LjI3LjU2IDAgMS0uMDggMS4zNS0uMjYuMzUtLjE4LjYxLS40NC44LS43OC4xNy0uMzQuMy0uNzYuMzUtMS4yNVoiIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjg3Ii8+PHJlY3QgeD0iMTYxLjUiIHk9IjE4IiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHJ4PSIxNiIgZmlsbD0iIzMwNTY4MCIvPjxwYXRoIGQ9Im0xNzUuNSAyOC0xLjQxIDEuNDEgNC41OCA0LjU5LTQuNTggNC41OUwxNzUuNSA0MGw2LTYtNi02WiIgZmlsbD0iI2ZmZiIvPjwvZz48ZGVmcz48ZmlsdGVyIGlkPSJhIiB4PSIuNSIgeT0iLjUiIHdpZHRoPSIyMTMiIGhlaWdodD0iNzUiIGZpbHRlclVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj48ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPjxmZUNvbG9yTWF0cml4IGluPSJTb3VyY2VBbHBoYSIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz48ZmVPZmZzZXQgZHk9IjQiLz48ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSI0Ii8+PGZlQ29tcG9zaXRlIGluMj0iaGFyZEFscGhhIiBvcGVyYXRvcj0ib3V0Ii8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjA0IDAiLz48ZmVCbGVuZCBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfNTY2OV8xNjA3MDUiLz48ZmVCbGVuZCBpbj0iU291cmNlR3JhcGhpYyIgaW4yPSJlZmZlY3QxX2Ryb3BTaGFkb3dfNTY2OV8xNjA3MDUiIHJlc3VsdD0ic2hhcGUiLz48L2ZpbHRlcj48L2RlZnM+PC9zdmc+", + "public": true + } + ], + "scada": false, + "tags": [ + "command", + "downlink", + "device configuration", + "device control", + "invocation", + "remote method", + "remote function", + "interface", + "subroutine call", + "inter-process communication", + "server request", + "update attribute", + "set attribute", + "add time-series" + ] +} \ No newline at end of file diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts index 24cb04cca6..8a71e04e1e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/basic-widget-config.module.ts @@ -146,6 +146,9 @@ import { ScadaSymbolBasicConfigComponent } from '@home/components/widget/config/ import { SegmentedButtonBasicConfigComponent } from '@home/components/widget/config/basic/button/segmented-button-basic-config.component'; +import { + ValueStepperBasicConfigComponent +} from '@home/components/widget/config/basic/rpc/value-stepper-basic-config.component'; @NgModule({ declarations: [ @@ -182,6 +185,7 @@ import { PowerButtonBasicConfigComponent, SliderBasicConfigComponent, ToggleButtonBasicConfigComponent, + ValueStepperBasicConfigComponent, TimeSeriesChartBasicConfigComponent, ComparisonKeyRowComponent, ComparisonKeysTableComponent, @@ -236,6 +240,7 @@ import { PowerButtonBasicConfigComponent, SliderBasicConfigComponent, ToggleButtonBasicConfigComponent, + ValueStepperBasicConfigComponent, TimeSeriesChartBasicConfigComponent, StatusWidgetBasicConfigComponent, PieChartBasicConfigComponent, diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.html index 75fcf791b0..a2e3f90aee 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.html @@ -116,6 +116,38 @@
        +
        + + {{ 'widgets.power-button.button-icon-on' | translate }} + +
        + + + + + + +
        +
        +
        + + {{ 'widgets.power-button.button-icon-off' | translate }} + +
        + + + + + + +
        +
        {{ 'widgets.power-button.power-on-colors' | translate }}
        diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.ts index 2c92936141..00b0a41e18 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/button/power-button-basic-config.component.ts @@ -87,6 +87,19 @@ export class PowerButtonBasicConfigComponent extends BasicWidgetConfigComponent icon: [configData.config.titleIcon, []], iconColor: [configData.config.iconColor, []], + onButtonIcon: this.fb.group({ + showIcon: [settings.onButtonIcon.showIcon, []], + iconSize: [settings.onButtonIcon.iconSize, [Validators.min(0)]], + iconSizeUnit: [settings.onButtonIcon.iconSizeUnit, []], + icon: [settings.onButtonIcon.icon, []], + }), + offButtonIcon: this.fb.group({ + showIcon: [settings.offButtonIcon.showIcon, []], + iconSize: [settings.offButtonIcon.iconSize, [Validators.min(0)]], + iconSizeUnit: [settings.offButtonIcon.iconSizeUnit, []], + icon: [settings.offButtonIcon.icon, []], + }), + mainColorOn: [settings.mainColorOn, []], backgroundColorOn: [settings.backgroundColorOn, []], @@ -128,6 +141,9 @@ export class PowerButtonBasicConfigComponent extends BasicWidgetConfigComponent this.widgetConfig.config.settings.layout = config.layout; + this.widgetConfig.config.settings.onButtonIcon = config.onButtonIcon; + this.widgetConfig.config.settings.offButtonIcon = config.offButtonIcon; + this.widgetConfig.config.settings.mainColorOn = config.mainColorOn; this.widgetConfig.config.settings.backgroundColorOn = config.backgroundColorOn; @@ -148,12 +164,14 @@ export class PowerButtonBasicConfigComponent extends BasicWidgetConfigComponent } protected validatorTriggers(): string[] { - return ['showTitle', 'showIcon']; + return ['showTitle', 'showIcon', 'onButtonIcon.showIcon', 'offButtonIcon.showIcon']; } protected updateValidators(emitEvent: boolean, trigger?: string) { const showTitle: boolean = this.powerButtonWidgetConfigForm.get('showTitle').value; const showIcon: boolean = this.powerButtonWidgetConfigForm.get('showIcon').value; + const onButtonIcon: boolean = this.powerButtonWidgetConfigForm.get('onButtonIcon').get('showIcon').value; + const offButtonIcon: boolean = this.powerButtonWidgetConfigForm.get('offButtonIcon').get('showIcon').value; if (showTitle) { this.powerButtonWidgetConfigForm.get('title').enable(); this.powerButtonWidgetConfigForm.get('titleFont').enable(); @@ -180,6 +198,24 @@ export class PowerButtonBasicConfigComponent extends BasicWidgetConfigComponent this.powerButtonWidgetConfigForm.get('icon').disable(); this.powerButtonWidgetConfigForm.get('iconColor').disable(); } + if (onButtonIcon) { + this.powerButtonWidgetConfigForm.get('onButtonIcon').get('iconSize').enable(); + this.powerButtonWidgetConfigForm.get('onButtonIcon').get('iconSizeUnit').enable(); + this.powerButtonWidgetConfigForm.get('onButtonIcon').get('icon').enable(); + } else { + this.powerButtonWidgetConfigForm.get('onButtonIcon').get('iconSize').disable(); + this.powerButtonWidgetConfigForm.get('onButtonIcon').get('iconSizeUnit').disable(); + this.powerButtonWidgetConfigForm.get('onButtonIcon').get('icon').disable(); + } + if (offButtonIcon) { + this.powerButtonWidgetConfigForm.get('offButtonIcon').get('iconSize').enable(); + this.powerButtonWidgetConfigForm.get('offButtonIcon').get('iconSizeUnit').enable(); + this.powerButtonWidgetConfigForm.get('offButtonIcon').get('icon').enable(); + } else { + this.powerButtonWidgetConfigForm.get('offButtonIcon').get('iconSize').disable(); + this.powerButtonWidgetConfigForm.get('offButtonIcon').get('iconSizeUnit').disable(); + this.powerButtonWidgetConfigForm.get('offButtonIcon').get('icon').disable(); + } } private getCardButtons(config: WidgetConfig): string[] { diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.html new file mode 100644 index 0000000000..748cf64c7f --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.html @@ -0,0 +1,297 @@ + + + +
        +
        widgets.value-stepper.behavior
        +
        +
        widgets.value-stepper.initial-state
        + +
        +
        +
        widgets.value-stepper.left-button-click
        + +
        +
        +
        widgets.value-stepper.right-button-click
        + +
        +
        +
        widgets.button-state.disabled-state
        + +
        +
        +
        +
        widget-config.appearance
        + + + {{ valueStepperTypeTranslationMap.get(type) | translate }} + + +
        + + {{ 'widgets.value-stepper.auto-scale' | translate }} + +
        + +
        +
        {{ 'widgets.value-stepper.value-range' | translate }}
        +
        +
        widgets.value-stepper.min-range
        + + + +
        widgets.value-stepper.max-range
        + + + +
        +
        +
        +
        {{ 'widgets.value-stepper.value-increment-decrement-step' | translate }}
        + + + +
        +
        + + {{ 'widgets.value-stepper.value' | translate }} + +
        + + + +
        widget-config.decimals-suffix
        +
        + + + + +
        +
        + +
        +
        {{ 'widgets.value-stepper.value-box-background' | translate }}
        + + +
        +
        + + {{ 'widgets.value-stepper.border' | translate }} + +
        + + +
        px
        +
        + + +
        +
        +
        +
        +
        +
        widgets.value-stepper.button-appearance
        + + {{ 'widgets.value-stepper.left' | translate }} + {{ 'widgets.value-stepper.right' | translate }} + +
        +
        +
        + + {{ 'widgets.value-stepper.left-button' | translate }} + +
        +
        +
        {{ 'widgets.value-stepper.icon' | translate }}
        +
        + + + + + + +
        +
        +
        +
        {{ 'widgets.value-stepper.button-on-colors' | translate }}
        +
        +
        +
        widgets.value-stepper.main
        + + +
        + +
        +
        widgets.value-stepper.background
        + + +
        +
        +
        +
        +
        {{ 'widgets.value-stepper.disabled-colors' | translate }}
        +
        +
        +
        widgets.value-stepper.main
        + + +
        + +
        +
        widgets.value-stepper.background
        + + +
        +
        +
        +
        +
        +
        + + {{ 'widgets.value-stepper.right-button' | translate }} + +
        +
        +
        {{ 'widgets.value-stepper.icon' | translate }}
        +
        + + + + + + +
        +
        +
        +
        {{ 'widgets.value-stepper.button-on-colors' | translate }}
        +
        +
        +
        widgets.value-stepper.main
        + + +
        + +
        +
        widgets.value-stepper.background
        + + +
        +
        +
        +
        +
        {{ 'widgets.value-stepper.disabled-colors' | translate }}
        +
        +
        +
        widgets.value-stepper.main
        + + +
        + +
        +
        widgets.value-stepper.background
        + + +
        +
        +
        +
        +
        +
        +
        widget-config.card-appearance
        +
        +
        {{ 'widgets.background.background' | translate }}
        + + +
        +
        +
        widget-config.show-card-buttons
        + + {{ 'fullscreen.fullscreen' | translate }} + +
        +
        +
        {{ 'widget-config.card-border-radius' | translate }}
        + + + +
        +
        +
        {{ 'widget-config.card-padding' | translate }}
        + + + +
        +
        + + +
        diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.ts new file mode 100644 index 0000000000..abee223b40 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/rpc/value-stepper-basic-config.component.ts @@ -0,0 +1,225 @@ +/// +/// Copyright © 2016-2024 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { Component } from '@angular/core'; +import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { Store } from '@ngrx/store'; +import { AppState } from '@core/core.state'; +import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models'; +import { WidgetConfigComponentData } from '@home/models/widget-component.models'; +import { TargetDevice, WidgetConfig, } from '@shared/models/widget.models'; +import { WidgetConfigComponent } from '@home/components/widget/widget-config.component'; +import { formatValue, isUndefined } from '@core/utils'; +import { ValueType } from '@shared/models/constants'; +import { + valueStepperDefaultSettings, + valueStepperTypeImages, + valueStepperTypes, + valueStepperTypeTranslations, + ValueStepperWidgetSettings +} from '@home/components/widget/lib/rpc/value-stepper-widget.models'; + +type ButtonAppearanceType = 'left' | 'right'; + +@Component({ + selector: 'tb-value-stepper-basic-config', + templateUrl: './value-stepper-basic-config.component.html', + styleUrls: ['../basic-config.scss'] +}) +export class ValueStepperBasicConfigComponent extends BasicWidgetConfigComponent { + + get targetDevice(): TargetDevice { + return this.valueStepperWidgetConfigForm.get('targetDevice').value; + } + + valueStepperTypeTranslationMap = valueStepperTypeTranslations; + valueStepperTypes = valueStepperTypes; + valueStepperTypeImageMap = valueStepperTypeImages; + + buttonAppearanceType: ButtonAppearanceType = 'left'; + + valueType = ValueType; + + valueStepperWidgetConfigForm: UntypedFormGroup; + + valuePreviewFn = this._valuePreviewFn.bind(this); + + constructor(protected store: Store, + protected widgetConfigComponent: WidgetConfigComponent, + private fb: UntypedFormBuilder) { + super(store, widgetConfigComponent); + } + + protected configForm(): UntypedFormGroup { + return this.valueStepperWidgetConfigForm; + } + + protected onConfigSet(configData: WidgetConfigComponentData) { + const settings: ValueStepperWidgetSettings = {...valueStepperDefaultSettings, ...(configData.config.settings || {})}; + this.valueStepperWidgetConfigForm = this.fb.group({ + targetDevice: [configData.config.targetDevice, []], + + initialState: [settings.initialState, []], + leftButtonClick: [settings.leftButtonClick, []], + rightButtonClick: [settings.rightButtonClick, []], + disabledState: [settings.disabledState, []], + + appearance: this.fb.group({ + type: [settings.appearance.type, []], + autoScale: [settings.appearance.autoScale, []], + minValueRange: [settings.appearance.minValueRange, []], + maxValueRange: [settings.appearance.maxValueRange, []], + valueStep: [settings.appearance.valueStep, [Validators.min(0)]], + showValueBox: [settings.appearance.showValueBox, []], + valueUnits: [settings.appearance.valueUnits, []], + valueDecimals: [settings.appearance.valueDecimals, []], + valueFont: [settings.appearance.valueFont, []], + valueColor: [settings.appearance.valueColor], + valueBoxBackground: [settings.appearance.valueBoxBackground, []], + showBorder: [settings.appearance.showBorder, []], + borderWidth: [settings.appearance.borderWidth, []], + borderColor: [settings.appearance.borderColor, []] + }), + + buttonAppearance: this.fb.group({ + leftButton: this.fb.group({ + showButton: [settings.buttonAppearance.leftButton.showButton], + icon: [settings.buttonAppearance.leftButton.icon], + iconSize: [settings.buttonAppearance.leftButton.iconSize], + iconSizeUnit: [settings.buttonAppearance.leftButton.iconSizeUnit], + mainColorOn: [settings.buttonAppearance.leftButton.mainColorOn, []], + backgroundColorOn: [settings.buttonAppearance.leftButton.backgroundColorOn, []], + mainColorDisabled: [settings.buttonAppearance.leftButton.mainColorDisabled, []], + backgroundColorDisabled: [settings.buttonAppearance.leftButton.backgroundColorDisabled, []] + }), + rightButton: this.fb.group({ + showButton: [settings.buttonAppearance.rightButton.showButton], + icon: [settings.buttonAppearance.rightButton.icon], + iconSize: [settings.buttonAppearance.rightButton.iconSize], + iconSizeUnit: [settings.buttonAppearance.rightButton.iconSizeUnit], + mainColorOn: [settings.buttonAppearance.rightButton.mainColorOn, []], + backgroundColorOn: [settings.buttonAppearance.rightButton.backgroundColorOn, []], + mainColorDisabled: [settings.buttonAppearance.rightButton.mainColorDisabled, []], + backgroundColorDisabled: [settings.buttonAppearance.rightButton.backgroundColorDisabled, []] + }) + }), + + background: [settings.background, []], + cardButtons: [this.getCardButtons(configData.config), []], + borderRadius: [configData.config.borderRadius, []], + padding: [settings.padding, []], + + actions: [configData.config.actions || {}, []] + }); + } + + + protected prepareOutputConfig(config: any): WidgetConfigComponentData { + this.widgetConfig.config.targetDevice = config.targetDevice; + this.widgetConfig.config.settings = this.widgetConfig.config.settings || {}; + this.widgetConfig.config.settings.initialState = config.initialState; + this.widgetConfig.config.settings.disabledState = config.disabledState; + this.widgetConfig.config.settings.leftButtonClick = config.leftButtonClick; + this.widgetConfig.config.settings.rightButtonClick = config.rightButtonClick; + this.widgetConfig.config.settings.appearance = config.appearance; + this.widgetConfig.config.settings.buttonAppearance = config.buttonAppearance; + + this.widgetConfig.config.settings.background = config.background; + this.setCardButtons(config.cardButtons, this.widgetConfig.config); + this.widgetConfig.config.borderRadius = config.borderRadius; + this.widgetConfig.config.settings.padding = config.padding; + this.widgetConfig.config.actions = config.actions; + + return this.widgetConfig; + } + + + protected validatorTriggers(): string[] { + return ['appearance.showValueBox', 'appearance.showBorder', + 'buttonAppearance.leftButton.showButton', 'buttonAppearance.rightButton.showButton']; + } + + protected updateValidators(emitEvent: boolean, trigger?: string) { + const showValueBox: boolean = this.valueStepperWidgetConfigForm.get('appearance').get('showValueBox').value; + const showBorder: boolean = this.valueStepperWidgetConfigForm.get('appearance').get('showBorder').value; + const showLeftButton: boolean = this.valueStepperWidgetConfigForm.get('buttonAppearance').get('leftButton').get('showButton').value; + const showRightButton: boolean = this.valueStepperWidgetConfigForm.get('buttonAppearance').get('rightButton').get('showButton').value; + if (showValueBox) { + this.valueStepperWidgetConfigForm.get('appearance').get('valueUnits').enable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueDecimals').enable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueFont').enable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueColor').enable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueBoxBackground').enable(); + this.valueStepperWidgetConfigForm.get('appearance').get('showBorder').enable({emitEvent: false}); + if (showBorder) { + this.valueStepperWidgetConfigForm.get('appearance').get('borderWidth').enable(); + this.valueStepperWidgetConfigForm.get('appearance').get('borderColor').enable(); + } else { + this.valueStepperWidgetConfigForm.get('appearance').get('borderWidth').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('borderColor').disable(); + } + } else { + this.valueStepperWidgetConfigForm.get('appearance').get('valueUnits').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueDecimals').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueFont').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueColor').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('valueBoxBackground').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('showBorder').disable({emitEvent: false}); + this.valueStepperWidgetConfigForm.get('appearance').get('borderWidth').disable(); + this.valueStepperWidgetConfigForm.get('appearance').get('borderColor').disable(); + } + this.buttonValidators(showLeftButton, 'leftButton'); + this.buttonValidators(showRightButton, 'rightButton'); + } + + private buttonValidators(showButtonValue: boolean, button: string) { + if (showButtonValue) { + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('icon').enable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('iconSize').enable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('iconSizeUnit').enable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('mainColorOn').enable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('backgroundColorOn').enable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('mainColorDisabled').enable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('backgroundColorDisabled').enable() + } else { + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('icon').disable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('iconSize').disable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('iconSizeUnit').disable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('mainColorOn').disable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('backgroundColorOn').disable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('mainColorDisabled').disable() + this.valueStepperWidgetConfigForm.get('buttonAppearance').get(button).get('backgroundColorDisabled').disable() + } + } + + private getCardButtons(config: WidgetConfig): string[] { + const buttons: string[] = []; + if (isUndefined(config.enableFullscreen) || config.enableFullscreen) { + buttons.push('fullscreen'); + } + return buttons; + } + + private setCardButtons(buttons: string[], config: WidgetConfig) { + config.enableFullscreen = buttons.includes('fullscreen'); + } + + private _valuePreviewFn(): string { + const units: string = this.valueStepperWidgetConfigForm.get('appearance').get('valueUnits').value; + const decimals: number = this.valueStepperWidgetConfigForm.get('appearance').get('valueDecimals').value; + return formatValue(48, decimals, units, false); + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts index 6c9072e915..262a532163 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts @@ -33,11 +33,11 @@ import { DomSanitizer } from '@angular/platform-browser'; import { ValueType } from '@shared/models/constants'; import { powerButtonDefaultSettings, - PowerButtonShape, - powerButtonShapeSize, + PowerButtonShape, powerButtonShapeSize, PowerButtonWidgetSettings } from '@home/components/widget/lib/rpc/power-button-widget.models'; import { SVG, Svg } from '@svgdotjs/svg.js'; +import { MatIconRegistry } from '@angular/material/icon'; @Component({ selector: 'tb-power-button-widget', @@ -72,6 +72,7 @@ export class PowerButtonWidgetComponent extends constructor(protected imagePipe: ImagePipe, protected sanitizer: DomSanitizer, private renderer: Renderer2, + private iconRegistry: MatIconRegistry, protected cd: ChangeDetectorRef, protected zone: NgZone) { super(cd); @@ -180,7 +181,7 @@ export class PowerButtonWidgetComponent extends this.renderer.setStyle(this.svgShape.node, 'user-select', 'none'); this.zone.run(() => { - this.powerButtonSvgShape = PowerButtonShape.fromSettings(this.ctx, this.svgShape, + this.powerButtonSvgShape = PowerButtonShape.fromSettings(this.ctx, this.svgShape, this.iconRegistry, this.settings, this.value, this.disabledState, () => this.onClick()); }); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.models.ts index 503347939d..540ef8f9f3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.models.ts @@ -28,6 +28,11 @@ import { Circle, Effect, Element, G, Gradient, Path, Runner, Svg, Text, Timeline import '@svgdotjs/svg.filter.js'; import tinycolor from 'tinycolor2'; import { WidgetContext } from '@home/models/widget-component.models'; +import { Observable, of } from 'rxjs'; +import { isSvgIcon, splitIconName } from '@shared/models/icon.models'; +import { catchError, map, take } from 'rxjs/operators'; +import { MatIconRegistry } from '@angular/material/icon'; +import { isDefinedAndNotNull } from '@core/utils'; export enum PowerButtonLayout { default = 'default', @@ -71,20 +76,29 @@ export const powerButtonLayoutImages = new Map( ] ); +export interface ButtonIconSettings { + showIcon: boolean; + iconSize: number; + iconSizeUnit: string; + icon: string; +} + export interface PowerButtonWidgetSettings { - initialState: GetValueSettings; - disabledState: GetValueSettings; - onUpdateState: SetValueSettings; - offUpdateState: SetValueSettings; + initialState?: GetValueSettings; + disabledState?: GetValueSettings; + onUpdateState?: SetValueSettings; + offUpdateState?: SetValueSettings; layout: PowerButtonLayout; + onButtonIcon: ButtonIconSettings, + offButtonIcon: ButtonIconSettings, mainColorOn: string; backgroundColorOn: string; mainColorOff: string; backgroundColorOff: string; mainColorDisabled: string; backgroundColorDisabled: string; - background: BackgroundSettings; - padding: string; + background?: BackgroundSettings; + padding?: string; } export const powerButtonDefaultSettings: PowerButtonWidgetSettings = { @@ -177,6 +191,18 @@ export const powerButtonDefaultSettings: PowerButtonWidgetSettings = { } }, layout: PowerButtonLayout.default, + onButtonIcon: { + showIcon: false, + iconSize: 32, + iconSizeUnit: 'px', + icon: 'power_settings_new' + }, + offButtonIcon: { + showIcon: false, + iconSize: 32, + iconSizeUnit: 'px', + icon: 'power_settings_new' + }, mainColorOn: '#3F52DD', backgroundColorOn: '#FFFFFF', mainColorOff: '#A2A2A2', @@ -207,6 +233,11 @@ interface PowerButtonColorState { backgroundColor: PowerButtonColor; } +interface ButtonsIconSettings { + onButtonIcon: ButtonIconSettings; + offButtonIcon: ButtonIconSettings; +} + type PowerButtonShapeColors = Record; const createPowerButtonShapeColors = (settings: PowerButtonWidgetSettings): PowerButtonShapeColors => { @@ -257,33 +288,35 @@ export abstract class PowerButtonShape { static fromSettings(ctx: WidgetContext, svgShape: Svg, + iconRegistry: MatIconRegistry, settings: PowerButtonWidgetSettings, value: boolean, disabled: boolean, onClick: () => void): PowerButtonShape { switch (settings.layout) { case PowerButtonLayout.default: - return new DefaultPowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new DefaultPowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.simplified: - return new SimplifiedPowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new SimplifiedPowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.outlined: - return new OutlinedPowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new OutlinedPowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.default_volume: - return new DefaultVolumePowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new DefaultVolumePowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.simplified_volume: - return new SimplifiedVolumePowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new SimplifiedVolumePowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.outlined_volume: - return new OutlinedVolumePowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new OutlinedVolumePowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.default_icon: - return new DefaultIconPowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new DefaultIconPowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.simplified_icon: - return new SimplifiedIconPowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new SimplifiedIconPowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); case PowerButtonLayout.outlined_icon: - return new OutlinedIconPowerButtonShape(ctx, svgShape, settings, value, disabled, onClick); + return new OutlinedIconPowerButtonShape(ctx, svgShape, iconRegistry, settings, value, disabled, onClick); } } protected readonly colors: PowerButtonShapeColors; + protected readonly icons: ButtonsIconSettings; protected readonly onLabel: string; protected readonly offLabel: string; @@ -293,18 +326,67 @@ export abstract class PowerButtonShape { protected pressed = false; protected forcePressed = false; + protected offPowerSymbolIcon: Element; + protected onPowerSymbolIcon: Element; + protected offLabelShape: Text; + protected onLabelShape: Text; + + protected offPowerSymbolCircle: Path; + protected offPowerSymbolLine: Path; + protected onPowerSymbolCircle: Path; + protected onPowerSymbolLine: Path; + protected constructor(protected widgetContext: WidgetContext, protected svgShape: Svg, + protected iconRegistry: MatIconRegistry, protected settings: PowerButtonWidgetSettings, protected value: boolean, protected disabled: boolean, protected onClick: () => void) { this.colors = createPowerButtonShapeColors(this.settings); + this.icons = {onButtonIcon: this.settings.onButtonIcon, offButtonIcon: this.settings.offButtonIcon}; this.onLabel = this.widgetContext.translate.instant('widgets.power-button.on-label').toUpperCase(); this.offLabel = this.widgetContext.translate.instant('widgets.power-button.off-label').toUpperCase(); this._drawShape(); } + public createIconElement(icon: string, size: number): Observable { + const isSvg = isSvgIcon(icon); + if (isSvg) { + const [namespace, iconName] = splitIconName(icon); + return this.iconRegistry + .getNamedSvgIcon(iconName, namespace) + .pipe( + take(1), + map((svgElement) => { + const element = new Element(svgElement.firstChild); + const box = element.bbox(); + const scale = size / box.height; + element.scale(scale); + return element; + }), + catchError(() => of(null) + )); + } else { + const iconName = splitIconName(icon)[1]; + const textElement = this.svgShape.text(iconName); + const fontSetClasses = ( + this.iconRegistry.getDefaultFontSetClass() + ).filter(className => className.length > 0); + fontSetClasses.forEach(className => textElement.addClass(className)); + textElement.font({size: `${size}px`}); + textElement.attr({ + style: `font-size: ${size}px`, + 'text-anchor': 'start' + }); + const tspan = textElement.first(); + tspan.attr({ + 'dominant-baseline': 'hanging' + }); + return of(textElement); + } + } + public setValue(value: boolean) { if (this.value !== value) { this.value = value; @@ -330,6 +412,106 @@ export abstract class PowerButtonShape { } } + public drawOffShape(centerGroup: G, label: boolean, labelWeight?: string, circleStroke?: boolean) { + if (this.icons.offButtonIcon.showIcon) { + this.createIconElement(this.icons.offButtonIcon.icon, this.icons.offButtonIcon.iconSize).subscribe(icon => + this.offPowerSymbolIcon = icon.center(cx, cy).addTo(centerGroup)); + } else { + if (label) { + this.offLabelShape = this.createOffLabel(labelWeight).addTo(centerGroup); + } else { + this.offPowerSymbolCircle = this.svgShape.path(circleStroke ? powerCircle : powerCircleStroke).center(cx, cy).addTo(centerGroup); + this.offPowerSymbolLine = this.svgShape.path(circleStroke ? powerLine : powerLineStroke).center(cx, cy-12).addTo(centerGroup); + } + } + } + + public drawOnShape(onCenterGroup?: G, label?: boolean, labelWeight?: string, circleStroke?: boolean, mask?: Circle) { + if (this.icons.onButtonIcon.showIcon) { + this.createIconElement(this.icons.onButtonIcon.icon, this.icons.onButtonIcon.iconSize).subscribe(icon => { + this.onPowerSymbolIcon = icon.center(cx, cy); + if (isDefinedAndNotNull(onCenterGroup)) { + this.onPowerSymbolIcon.addTo(onCenterGroup); + } + if (isDefinedAndNotNull(mask)) { + this.createMask(mask, [this.onPowerSymbolIcon]); + } + }); + } else { + if (label) { + this.onLabelShape = this.createOnLabel(labelWeight); + if (isDefinedAndNotNull(onCenterGroup)) { + this.onLabelShape.addTo(onCenterGroup); + } + if (isDefinedAndNotNull(mask)) { + this.createMask(mask, [this.onLabelShape]); + } + } else { + this.onPowerSymbolCircle = this.svgShape.path(circleStroke ? powerCircle : powerCircleStroke).center(cx, cy); + this.onPowerSymbolLine = this.svgShape.path(circleStroke ? powerLine : powerLineStroke).center(cx, cy-12); + if (isDefinedAndNotNull(onCenterGroup)) { + this.onPowerSymbolCircle.addTo(onCenterGroup); + this.onPowerSymbolLine.addTo(onCenterGroup); + } + if (isDefinedAndNotNull(mask)) { + this.createMask(mask, [this.onPowerSymbolCircle, this.onPowerSymbolLine]); + } + } + } + } + + public onCenterTimeLine(timeline: Timeline, label: boolean) { + if (this.icons.onButtonIcon.showIcon) { + this.onPowerSymbolIcon.timeline(timeline); + } else { + if (label) { + this.onLabelShape.timeline(timeline); + } else { + this.onPowerSymbolCircle.timeline(timeline); + this.onPowerSymbolLine.timeline(timeline); + } + } + } + + public offCenterColor(mainColor: PowerButtonColor, label: boolean) { + if (this.icons.offButtonIcon.showIcon) { + this.offPowerSymbolIcon.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + } else { + if (label) { + this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + } else { + this.offPowerSymbolCircle.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offPowerSymbolLine.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + } + } + } + + public onCenterColor(mainColor: PowerButtonColor, label: boolean) { + if (this.icons.onButtonIcon.showIcon) { + this.onPowerSymbolIcon.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + } else { + if (label) { + this.onLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + } else { + this.onPowerSymbolCircle.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.onPowerSymbolLine.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + } + } + } + + public buttonAnimation(scale: number, label: boolean) { + if (this.icons.onButtonIcon.showIcon) { + powerButtonAnimation(this.onPowerSymbolIcon).transform({scale}); + } else { + if (label) { + powerButtonAnimation(this.onLabelShape).transform({scale, origin: {x: cx, y: cy}}); + } else { + powerButtonAnimation(this.onPowerSymbolCircle).transform({scale, origin: {x: cx, y: cy}}); + powerButtonAnimation(this.onPowerSymbolLine).transform({scale, origin: {x: cx, y: cy}}); + } + } + } + private _drawShape() { this.backgroundShape = this.svgShape.circle(powerButtonShapeSize).center(cx, cy) @@ -530,9 +712,7 @@ class DefaultPowerButtonShape extends PowerButtonShape { private outerBorder: Circle; private outerBorderMask: Circle; - private offLabelShape: Text; private onCircleShape: Circle; - private onLabelShape: Text; private pressedShadow: InnerShadowCircle; private pressedTimeline: Timeline; private centerGroup: G; @@ -543,22 +723,20 @@ class DefaultPowerButtonShape extends PowerButtonShape { this.outerBorderMask = this.svgShape.circle(powerButtonShapeSize - 20).center(cx, cy); this.createMask(this.outerBorder, [this.outerBorderMask]); this.centerGroup = this.svgShape.group(); - this.offLabelShape = this.createOffLabel().addTo(this.centerGroup); - this.onCircleShape = this.svgShape.circle(powerButtonShapeSize - 20) - .center(cx, cy); - this.onLabelShape = this.createOnLabel(); - this.createMask(this.onCircleShape, [this.onLabelShape]); + this.drawOffShape(this.centerGroup, true); + this.onCircleShape = this.svgShape.circle(powerButtonShapeSize - 20).center(cx, cy); + this.drawOnShape(null, true, '', false, this.onCircleShape); this.pressedShadow = new InnerShadowCircle(this.svgShape, powerButtonShapeSize - 20, cx, cy, 0, 0); this.pressedTimeline = new Timeline(); this.centerGroup.timeline(this.pressedTimeline); - this.onLabelShape.timeline(this.pressedTimeline); + this.onCenterTimeLine(this.pressedTimeline, true); this.pressedShadow.timeline(this.pressedTimeline); } protected drawColorState(mainColor: PowerButtonColor) { this.outerBorder.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, true); this.onCircleShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); } @@ -578,14 +756,14 @@ class DefaultPowerButtonShape extends PowerButtonShape { this.pressedTimeline.finish(); const pressedScale = 0.75; powerButtonAnimation(this.centerGroup).transform({scale: pressedScale}); - powerButtonAnimation(this.onLabelShape).transform({scale: pressedScale, origin: {x: cx, y: cy}}); + this.buttonAnimation(pressedScale, true); this.pressedShadow.animate(6, 0.6); } protected onPressEnd() { this.pressedTimeline.finish(); powerButtonAnimation(this.centerGroup).transform({scale: 1}); - powerButtonAnimation(this.onLabelShape).transform({scale: 1, origin: {x: cx, y: cy}}); + this.buttonAnimation(1, true); this.pressedShadow.animateRestore(); } @@ -596,8 +774,6 @@ class SimplifiedPowerButtonShape extends PowerButtonShape { private outerBorder: Circle; private outerBorderMask: Circle; private onCircleShape: Circle; - private offLabelShape: Text; - private onLabelShape: Text; private pressedShadow: InnerShadowCircle; private pressedTimeline: Timeline; private centerGroup: G; @@ -608,22 +784,21 @@ class SimplifiedPowerButtonShape extends PowerButtonShape { this.outerBorderMask = this.svgShape.circle(powerButtonShapeSize - 4).center(cx, cy); this.createMask(this.outerBorder, [this.outerBorderMask]); this.centerGroup = this.svgShape.group(); - this.offLabelShape = this.createOffLabel().addTo(this.centerGroup); + this.drawOffShape(this.centerGroup, true); this.onCircleShape = this.svgShape.circle(powerButtonShapeSize).center(cx, cy); - this.onLabelShape = this.createOnLabel(); - this.createMask(this.onCircleShape, [this.onLabelShape]); + this.drawOnShape(null, true, '', false, this.onCircleShape) this.pressedShadow = new InnerShadowCircle(this.svgShape, powerButtonShapeSize - 4, cx, cy, 0, 0); this.pressedTimeline = new Timeline(); this.centerGroup.timeline(this.pressedTimeline); - this.onLabelShape.timeline(this.pressedTimeline); + this.onCenterTimeLine(this.pressedTimeline, true); this.pressedShadow.timeline(this.pressedTimeline); } protected drawColorState(mainColor: PowerButtonColor) { this.outerBorder.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); this.onCircleShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, true); } protected drawOff() { @@ -642,14 +817,14 @@ class SimplifiedPowerButtonShape extends PowerButtonShape { this.pressedTimeline.finish(); const pressedScale = 0.75; powerButtonAnimation(this.centerGroup).transform({scale: pressedScale}); - powerButtonAnimation(this.onLabelShape).transform({scale: pressedScale, origin: {x: cx, y: cy}}); + this.buttonAnimation(pressedScale, true); this.pressedShadow.animate(6, 0.6); } protected onPressEnd() { this.pressedTimeline.finish(); powerButtonAnimation(this.centerGroup).transform({scale: 1}); - powerButtonAnimation(this.onLabelShape).transform({scale: 1, origin: {x: cx, y: cy}}); + this.buttonAnimation(1, true); this.pressedShadow.animateRestore(); } } @@ -659,9 +834,7 @@ class OutlinedPowerButtonShape extends PowerButtonShape { private outerBorderMask: Circle; private innerBorder: Circle; private innerBorderMask: Circle; - private offLabelShape: Text; private onCircleShape: Circle; - private onLabelShape: Text; private pressedShadow: InnerShadowCircle; private pressedTimeline: Timeline; private centerGroup: G; @@ -677,25 +850,23 @@ class OutlinedPowerButtonShape extends PowerButtonShape { this.innerBorderMask = this.svgShape.circle(powerButtonShapeSize - 24).center(cx, cy); this.createMask(this.innerBorder, [this.innerBorderMask]); this.centerGroup = this.svgShape.group(); - this.offLabelShape = this.createOffLabel().addTo(this.centerGroup); + this.drawOffShape(this.centerGroup, true); this.onCenterGroup = this.svgShape.group(); - this.onCircleShape = this.svgShape.circle(powerButtonShapeSize - 28).center(cx, cy) - .addTo(this.onCenterGroup); - this.onLabelShape = this.createOnLabel(); - this.createMask(this.onCircleShape, [this.onLabelShape]); + this.onCircleShape = this.svgShape.circle(powerButtonShapeSize - 28).center(cx, cy).addTo(this.onCenterGroup); + this.drawOnShape(null, true, '', false, this.onCircleShape) this.pressedShadow = new InnerShadowCircle(this.svgShape, powerButtonShapeSize - 24, cx, cy, 0, 0); this.pressedTimeline = new Timeline(); this.centerGroup.timeline(this.pressedTimeline); this.onCenterGroup.timeline(this.pressedTimeline); - this.onLabelShape.timeline(this.pressedTimeline); + this.onCenterTimeLine(this.pressedTimeline, true); this.pressedShadow.timeline(this.pressedTimeline); } protected drawColorState(mainColor: PowerButtonColor) { this.outerBorder.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); this.innerBorder.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, true); this.onCircleShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); } @@ -714,7 +885,7 @@ class OutlinedPowerButtonShape extends PowerButtonShape { const pressedScale = 0.75; powerButtonAnimation(this.centerGroup).transform({scale: pressedScale}); powerButtonAnimation(this.onCenterGroup).transform({scale: 0.98}); - powerButtonAnimation(this.onLabelShape).transform({scale: pressedScale / 0.98, origin: {x: cx, y: cy}}); + this.buttonAnimation(pressedScale / 0.98, true); this.pressedShadow.animate(6, 0.6); } @@ -722,7 +893,7 @@ class OutlinedPowerButtonShape extends PowerButtonShape { this.pressedTimeline.finish(); powerButtonAnimation(this.centerGroup).transform({scale: 1}); powerButtonAnimation(this.onCenterGroup).transform({scale: 1}); - powerButtonAnimation(this.onLabelShape).transform({scale: 1, origin: {x: cx, y: cy}}); + this.buttonAnimation(1, true); this.pressedShadow.animateRestore(); } } @@ -737,35 +908,29 @@ class DefaultVolumePowerButtonShape extends PowerButtonShape { private innerShadow: InnerShadowCircle; //private innerShadowGradient: Gradient; //private innerShadowGradientStop: Stop; - private offLabelShape: Text; - private onCircleShape: Circle; - private onLabelShape: Text; + protected onCircleShape: Circle; private pressedTimeline: Timeline; private centerGroup: G; protected drawOffCenter(centerGroup: G) { - this.offLabelShape = this.createOffLabel('400').addTo(centerGroup); + this.drawOffShape(centerGroup, true, '400'); } protected drawOnCenter() { - this.onLabelShape = this.createOnLabel('400'); - } - - protected addOnCenterToMask(onCircleShape: Circle) { - this.createMask(onCircleShape,[this.onLabelShape]); + this.drawOnShape(null, true, '400', false, this.onCircleShape); } protected addOnCenterTimeLine(pressedTimeline: Timeline) { - this.onLabelShape.timeline(pressedTimeline); + this.onCenterTimeLine(pressedTimeline, true); } protected drawOffCenterColor(mainColor: PowerButtonColor) { - this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, true); } protected onCenterAnimation(scale: number) { - powerButtonAnimation(this.onLabelShape).transform({scale, origin: {x: cx, y: cy}}); + this.buttonAnimation(scale, true); } protected drawShape() { @@ -789,7 +954,6 @@ class DefaultVolumePowerButtonShape extends PowerButtonShape { this.drawOffCenter(this.centerGroup); this.onCircleShape = this.svgShape.circle(powerButtonShapeSize - 24).center(cx, cy); this.drawOnCenter(); - this.addOnCenterToMask(this.onCircleShape); this.innerShadow = new InnerShadowCircle(this.svgShape, powerButtonShapeSize - 24, cx, cy, 3, 0.3); this.pressedTimeline = new Timeline(); @@ -857,38 +1021,25 @@ class DefaultVolumePowerButtonShape extends PowerButtonShape { } class DefaultIconPowerButtonShape extends DefaultVolumePowerButtonShape { - private offPowerSymbolCircle: Path; - private offPowerSymbolLine: Path; - private onPowerSymbolCircle: Path; - private onPowerSymbolLine: Path; protected drawOffCenter(centerGroup: G) { - this.offPowerSymbolCircle = this.svgShape.path(powerCircle).center(cx, cy).addTo(centerGroup); - this.offPowerSymbolLine = this.svgShape.path(powerLine).center(cx, cy-12).addTo(centerGroup); + this.drawOffShape(centerGroup, false); } protected drawOnCenter() { - this.onPowerSymbolCircle = this.svgShape.path(powerCircle).center(cx, cy); - this.onPowerSymbolLine = this.svgShape.path(powerLine).center(cx, cy-12); - } - - protected addOnCenterToMask(onCircleShape: Circle) { - this.createMask(onCircleShape, [this.onPowerSymbolCircle, this.onPowerSymbolLine]); + this.drawOnShape(null, false, '', false, this.onCircleShape); } protected addOnCenterTimeLine(pressedTimeline: Timeline) { - this.onPowerSymbolCircle.timeline(pressedTimeline); - this.onPowerSymbolLine.timeline(pressedTimeline); + this.onCenterTimeLine(pressedTimeline, false); } protected drawOffCenterColor(mainColor: PowerButtonColor) { - this.offPowerSymbolCircle.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.offPowerSymbolLine.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, false); } protected onCenterAnimation(scale: number) { - powerButtonAnimation(this.onPowerSymbolCircle).transform({scale, origin: {x: cx, y: cy}}); - powerButtonAnimation(this.onPowerSymbolLine).transform({scale, origin: {x: cx, y: cy}}); + this.buttonAnimation(scale, false); } } @@ -896,8 +1047,6 @@ class SimplifiedVolumePowerButtonShape extends PowerButtonShape { private outerBorder: Circle; private outerBorderMask: Circle; - private offLabelShape: Text; - private onLabelShape: Text; private innerShadow: InnerShadowCircle; private pressedShadow: InnerShadowCircle; private pressedTimeline: Timeline; @@ -905,8 +1054,8 @@ class SimplifiedVolumePowerButtonShape extends PowerButtonShape { private onCenterGroup: G; protected drawCenterGroup(centerGroup: G, onCenterGroup: G) { - this.offLabelShape = this.createOffLabel().addTo(centerGroup); - this.onLabelShape = this.createOnLabel().addTo(onCenterGroup); + this.drawOffShape(centerGroup, true); + this.drawOnShape(onCenterGroup, true); } protected drawShape() { @@ -926,8 +1075,8 @@ class SimplifiedVolumePowerButtonShape extends PowerButtonShape { } protected drawColorState(mainColor: PowerButtonColor){ - this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.onLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, true); + this.onCenterColor(mainColor, true); } protected drawOff() { @@ -970,23 +1119,15 @@ class SimplifiedVolumePowerButtonShape extends PowerButtonShape { } class SimplifiedIconPowerButtonShape extends SimplifiedVolumePowerButtonShape { - private offPowerSymbolCircle: Path; - private offPowerSymbolLine: Path; - private onPowerSymbolCircle: Path; - private onPowerSymbolLine: Path; protected drawCenterGroup(centerGroup: G, onCenterGroup: G) { - this.offPowerSymbolCircle = this.svgShape.path(powerCircle).center(cx, cy).addTo(centerGroup); - this.offPowerSymbolLine = this.svgShape.path(powerLine).center(cx, cy-12).addTo(centerGroup); - this.onPowerSymbolCircle = this.svgShape.path(powerCircle).center(cx, cy).addTo(onCenterGroup); - this.onPowerSymbolLine = this.svgShape.path(powerLine).center(cx, cy-12).addTo(onCenterGroup); + this.drawOffShape(centerGroup, false); + this.drawOnShape(onCenterGroup, false, '', false); } protected drawColorState(mainColor: PowerButtonColor) { - this.offPowerSymbolCircle.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.offPowerSymbolLine.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.onPowerSymbolCircle.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.onPowerSymbolLine.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, false); + this.onCenterColor(mainColor, false); } } @@ -996,36 +1137,30 @@ class OutlinedVolumePowerButtonShape extends PowerButtonShape { private outerBorderGradient: Gradient; private innerBorder: Circle; private innerBorderMask: Circle; - private offLabelShape: Text; - private onCircleShape: Circle; - private onLabelShape: Text; + protected onCircleShape: Circle; private pressedShadow: InnerShadowCircle; private pressedTimeline: Timeline; private centerGroup: G; private onCenterGroup: G; protected drawOffCenter(centerGroup: G) { - this.offLabelShape = this.createOffLabel('800').addTo(centerGroup); + this.drawOffShape(centerGroup, true, '800'); } protected drawOnCenter() { - this.onLabelShape = this.createOnLabel('800'); - } - - protected addOnCenterToMask(onCircleShape: Circle) { - this.createMask(onCircleShape,[this.onLabelShape]); + this.drawOnShape(null, true, '800', false, this.onCircleShape); } protected addOnCenterTimeLine(pressedTimeline: Timeline) { - this.onLabelShape.timeline(pressedTimeline); + this.onCenterTimeLine(pressedTimeline, true); } protected drawOffCenterColor(mainColor: PowerButtonColor) { - this.offLabelShape.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, true); } protected onCenterAnimation(scale: number) { - powerButtonAnimation(this.onLabelShape).transform({scale, origin: {x: cx, y: cy}}); + this.buttonAnimation(scale, true); } protected drawShape() { @@ -1047,7 +1182,6 @@ class OutlinedVolumePowerButtonShape extends PowerButtonShape { this.onCircleShape = this.svgShape.circle(powerButtonShapeSize - 30).center(cx, cy) .addTo(this.onCenterGroup); this.drawOnCenter(); - this.addOnCenterToMask(this.onCircleShape); this.pressedShadow = new InnerShadowCircle(this.svgShape, powerButtonShapeSize - 30, cx, cy, 0, 0); this.backgroundShape.addClass('tb-small-shadow'); @@ -1102,37 +1236,24 @@ class OutlinedVolumePowerButtonShape extends PowerButtonShape { } class OutlinedIconPowerButtonShape extends OutlinedVolumePowerButtonShape { - private offPowerSymbolCircle: Path; - private offPowerSymbolLine: Path; - private onPowerSymbolCircle: Path; - private onPowerSymbolLine: Path; protected drawOffCenter(centerGroup: G) { - this.offPowerSymbolCircle = this.svgShape.path(powerCircleStroke).center(cx, cy).addTo(centerGroup); - this.offPowerSymbolLine = this.svgShape.path(powerLineStroke).center(cx, cy-12).addTo(centerGroup); + this.drawOffShape(centerGroup, false, '', true); } protected drawOnCenter() { - this.onPowerSymbolCircle = this.svgShape.path(powerCircleStroke).center(cx, cy); - this.onPowerSymbolLine = this.svgShape.path(powerLineStroke).center(cx, cy-12); - } - - protected addOnCenterToMask(onCircleShape: Circle) { - this.createMask(onCircleShape, [this.onPowerSymbolCircle, this.onPowerSymbolLine]); + this.drawOnShape(null, false, '', true, this.onCircleShape); } protected addOnCenterTimeLine(pressedTimeline: Timeline) { - this.onPowerSymbolCircle.timeline(pressedTimeline); - this.onPowerSymbolLine.timeline(pressedTimeline); + this.onCenterTimeLine(pressedTimeline, false); } protected drawOffCenterColor(mainColor: PowerButtonColor) { - this.offPowerSymbolCircle.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); - this.offPowerSymbolLine.attr({ fill: mainColor.hex, 'fill-opacity': mainColor.opacity}); + this.offCenterColor(mainColor, false); } protected onCenterAnimation(scale: number) { - powerButtonAnimation(this.onPowerSymbolCircle).transform({scale, origin: {x: cx, y: cy}}); - powerButtonAnimation(this.onPowerSymbolLine).transform({scale, origin: {x: cx, y: cy}}); + this.buttonAnimation(scale, false); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html new file mode 100644 index 0000000000..6b28d44066 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html @@ -0,0 +1,43 @@ + +
        +
        + +
        +
        +
        +
        +
        {{ valueText }}
        +
        +
        +
        +
        + +
        diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.scss new file mode 100644 index 0000000000..47f15e9dd5 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.scss @@ -0,0 +1,90 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.tb-value-stepper-panel { + width: 100%; + height: 100%; + position: relative; + display: flex; + flex-direction: column; + gap: 16px; + padding: 20px 24px 24px 24px; + > div:not(.tb-value-stepper-overlay) { + z-index: 1; + } + .tb-value-stepper-overlay { + position: absolute; + top: 12px; + left: 12px; + bottom: 12px; + right: 12px; + } + div.tb-widget-title { + padding: 0; + } + .tb-value-stepper-content { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + min-width: 0; + min-height: 0; + height: 100%; + .tb-value-stepper-value-box { + display: flex; + align-items: center; + justify-content: center; + flex: 1; + height: 32px; + padding: 0 12px; + border-radius: 4px; + .tb-value-stepper-value-disabled { + color: rgba(0, 0, 0, 0.38) !important; + } + &-disabled { + border-color: rgba(0, 0, 0, 0.38); + } + } + .tb-button-shape { + width: 32px; + height: 32px; + display: flex; + align-items: center; + justify-content: center; + &-left { + margin-right: 12px; + } + &-right { + margin-left: 12px; + } + svg { + .tb-small-shadow { + filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.2)); + } + .tb-shadow { + filter: drop-shadow(0px 0px 10px rgba(0, 0, 0, 0.15)); + } + } + &.tb-button-pointer { + svg { + .tb-hover-circle { + cursor: pointer; + } + } + } + } + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.ts new file mode 100644 index 0000000000..d419aef0d4 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.ts @@ -0,0 +1,388 @@ +/// +/// Copyright © 2016-2024 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { + AfterViewInit, + ChangeDetectorRef, + Component, + ElementRef, + NgZone, + OnDestroy, + OnInit, + Renderer2, + ViewChild, + ViewEncapsulation +} from '@angular/core'; +import { BasicActionWidgetComponent, ValueSetter } from '@home/components/widget/lib/action/action-widget.models'; +import { backgroundStyle, ComponentStyle, overlayStyle, textStyle } from '@shared/models/widget-settings.models'; +import { BehaviorSubject, combineLatest, Observable, Subject } from 'rxjs'; +import { ImagePipe } from '@shared/pipe/image.pipe'; +import { DomSanitizer } from '@angular/platform-browser'; +import { ValueType } from '@shared/models/constants'; +import { + PowerButtonLayout, + PowerButtonShape, + powerButtonShapeSize, + PowerButtonWidgetSettings +} from '@home/components/widget/lib/rpc/power-button-widget.models'; +import { SVG, Svg } from '@svgdotjs/svg.js'; +import { MatIconRegistry } from '@angular/material/icon'; +import { formatValue, isDefinedAndNotNull, isNumeric } from '@core/utils'; +import { + valueStepperDefaultSettings, + ValueStepperWidgetSettings +} from '@home/components/widget/lib/rpc/value-stepper-widget.models'; +import { UtilsService } from '@core/services/utils.service'; +import { takeUntil } from 'rxjs/operators'; + +@Component({ + selector: 'tb-value-stepper-widget', + templateUrl: './value-stepper-widget.component.html', + styleUrls: ['../action/action-widget.scss', './value-stepper-widget.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class ValueStepperWidgetComponent extends + BasicActionWidgetComponent implements OnInit, AfterViewInit, OnDestroy { + + @ViewChild('leftButton', {static: false}) + leftButton: ElementRef; + + @ViewChild('rightButton', {static: false}) + rightButton: ElementRef; + + @ViewChild('stepperContent', {static: false}) + stepperContent: ElementRef; + + @ViewChild('valueBoxContainer', {static: false}) + valueBox: ElementRef; + + @ViewChild('value', {static: false}) + valueElement: ElementRef; + + settings: ValueStepperWidgetSettings; + + backgroundStyle$: Observable; + overlayStyle: ComponentStyle = {}; + padding: string; + + valueStyle: ComponentStyle = {}; + value: number = null; + + autoScale = false; + + showValueBox = true; + showLeftButton = true; + showRightButton = true; + + valueText = 'N/A'; + + disabledState$ = new BehaviorSubject(false); + + private prevValue: number = null; + private shapeResize$: ResizeObserver; + private drawSvgShapePending = false; + private svgShapeLeft: Svg; + private svgShapeRight: Svg; + private powerButtonSvgShapeLeft: PowerButtonShape; + private powerButtonSvgShapeRight: PowerButtonShape; + + private disabledState = false; + public leftDisabledState = false; + public rightDisabledState = false; + + private valueSetterLeft: ValueSetter; + private valueSetterRight: ValueSetter; + + private leftDisabledState$ = new BehaviorSubject(false); + private rightDisabledState$ = new BehaviorSubject(false); + private readonly destroy$ = new Subject(); + + constructor(protected imagePipe: ImagePipe, + protected sanitizer: DomSanitizer, + private renderer: Renderer2, + private iconRegistry: MatIconRegistry, + private utils: UtilsService, + private elementRef: ElementRef, + protected cd: ChangeDetectorRef, + protected zone: NgZone) { + super(cd); + } + + ngOnInit(): void { + super.ngOnInit(); + this.settings = {...valueStepperDefaultSettings, ...this.ctx.settings}; + + this.autoScale = this.settings.appearance.autoScale; + + this.backgroundStyle$ = backgroundStyle(this.settings.background, this.imagePipe, this.sanitizer); + this.overlayStyle = overlayStyle(this.settings.background.overlay); + this.padding = this.settings.background.overlay.enabled ? undefined : this.settings.padding; + + this.showValueBox = this.settings.appearance.showValueBox; + this.showLeftButton = this.settings.buttonAppearance.leftButton.showButton; + this.showRightButton = this.settings.buttonAppearance.rightButton.showButton; + this.valueStyle = textStyle(this.settings.appearance.valueFont); + this.valueStyle.color = this.settings.appearance.valueColor; + + if (this.showValueBox) { + const valueBoxCss = `.tb-value-stepper-value-box {\n`+ + `border: ${this.settings.appearance.showBorder ? + `${this.settings.appearance.borderWidth}px solid ${this.settings.appearance.borderColor}` : + 'none'};\n`+ + `background-color: ${this.settings.appearance.valueBoxBackground}` + + `}`; + this.utils.applyCssToElement(this.renderer, this.elementRef.nativeElement, 'tb-value-stepper-value-box', valueBoxCss); + } + + const getInitialStateSettings = + {...this.settings.initialState, actionLabel: this.ctx.translate.instant('widgets.slider.initial-value')}; + this.createValueGetter(getInitialStateSettings, ValueType.INTEGER, { + next: (value) => this.onValue(value) + }); + const disabledStateSettings = + {...this.settings.disabledState, actionLabel: this.ctx.translate.instant('widgets.rpc-state.disabled-state')}; + this.createValueGetter(disabledStateSettings, ValueType.BOOLEAN, { + next: (value) => this.disabledState$.next(value) + }); + + const leftButtonClick = {...this.settings.leftButtonClick, + actionLabel: this.ctx.translate.instant('widgets.slider.on-value-change')}; + this.valueSetterLeft = this.createValueSetter(leftButtonClick); + + const rightButtonClick = {...this.settings.rightButtonClick, + actionLabel: this.ctx.translate.instant('widgets.slider.on-value-change')}; + this.valueSetterRight = this.createValueSetter(rightButtonClick); + + combineLatest([ + this.loading$, + this.disabledState$.asObservable(), + this.leftDisabledState$.asObservable() + ]).pipe( + takeUntil(this.destroy$) + ).subscribe(value => { + const state = value.includes(true); + this.updateLeftDisabledState(state) + }); + + combineLatest([ + this.loading$, + this.disabledState$.asObservable(), + this.rightDisabledState$.asObservable() + ]).pipe( + takeUntil(this.destroy$) + ).subscribe(value => { + const state = value.includes(true); + this.updateRightDisabledState(state) + }); + } + + ngAfterViewInit(): void { + if (this.drawSvgShapePending) { + this.drawSvg(); + } + super.ngAfterViewInit(); + } + + ngOnDestroy() { + if (this.shapeResize$) { + this.shapeResize$.disconnect(); + } + this.destroy$.next(); + this.destroy$.complete(); + super.ngOnDestroy(); + } + + public onInit() { + super.onInit(); + const borderRadius = this.ctx.$widgetElement.css('borderRadius'); + this.overlayStyle = {...this.overlayStyle, ...{borderRadius}}; + if (this.leftButton || this.rightButton) { + this.drawSvg(); + } else { + this.drawSvgShapePending = true; + } + this.cd.detectChanges(); + } + + private onValue(value: number): void { + this.value = value; + this.prevValue = value; + if ((this.value + this.settings.appearance.valueStep) >= this.settings.appearance.maxValueRange) { + this.rightDisabledState$.next(true); + } else { + this.rightDisabledState$.next(false); + } + if ((this.value - this.settings.appearance.valueStep) <= this.settings.appearance.minValueRange) { + this.leftDisabledState$.next(true); + } else { + this.leftDisabledState$.next(false); + } + this.updateValueText(); + this.cd.markForCheck(); + } + + private updateValueText() { + if (isDefinedAndNotNull(this.value) && isNumeric(this.value)) { + this.valueText = formatValue(this.value, this.settings.appearance.valueDecimals, this.settings.appearance.valueUnits, false); + } else { + this.valueText = 'N/A'; + } + } + + private onClick(rightButtonClick: boolean = false) { + this.updateValueText(); + if (!this.ctx.isEdit && !this.ctx.isPreview && !this.disabledState) { + const prevValue = this.prevValue; + const targetValue = rightButtonClick ? + (this.value + this.settings.appearance.valueStep) : + (this.value - this.settings.appearance.valueStep); + this.updateValue(rightButtonClick ? this.valueSetterRight : this.valueSetterLeft, targetValue, { + next: () => this.onValue(targetValue), + error: () => this.onValue(prevValue) + }); + } + } + + private drawSvg() { + let leftButtonSetting: PowerButtonWidgetSettings; + let rightButtonSetting: PowerButtonWidgetSettings; + if (this.showLeftButton) { + this.svgShapeLeft = SVG().addTo(this.leftButton.nativeElement).size(powerButtonShapeSize, powerButtonShapeSize); + this.renderer.setStyle(this.svgShapeLeft.node, 'overflow', 'visible'); + this.renderer.setStyle(this.svgShapeLeft.node, 'user-select', 'none'); + leftButtonSetting = { + layout: PowerButtonLayout[this.settings.appearance.type], + onButtonIcon: { + showIcon: true, + icon: this.settings.buttonAppearance.leftButton.icon, + iconSize: this.settings.buttonAppearance.leftButton.iconSize * 1.7, + iconSizeUnit: this.settings.buttonAppearance.leftButton.iconSizeUnit + }, + offButtonIcon: { + showIcon: true, + icon: this.settings.buttonAppearance.leftButton.icon, + iconSize: this.settings.buttonAppearance.leftButton.iconSize * 1.7, + iconSizeUnit: this.settings.buttonAppearance.leftButton.iconSizeUnit + }, + mainColorOn: this.settings.buttonAppearance.leftButton.mainColorOn, + backgroundColorOn: this.settings.buttonAppearance.leftButton.backgroundColorOn, + mainColorOff: this.settings.buttonAppearance.leftButton.mainColorOff, + backgroundColorOff: this.settings.buttonAppearance.leftButton.backgroundColorOff, + mainColorDisabled: this.settings.buttonAppearance.leftButton.mainColorDisabled, + backgroundColorDisabled: this.settings.buttonAppearance.leftButton.backgroundColorDisabled + }; + } + if (this.showRightButton) { + this.svgShapeRight = SVG().addTo(this.rightButton.nativeElement).size(powerButtonShapeSize, powerButtonShapeSize); + this.renderer.setStyle(this.svgShapeRight.node, 'overflow', 'visible'); + this.renderer.setStyle(this.svgShapeRight.node, 'user-select', 'none'); + + rightButtonSetting = { + layout: PowerButtonLayout[this.settings.appearance.type], + onButtonIcon: { + showIcon: true, + icon: this.settings.buttonAppearance.rightButton.icon, + iconSize: this.settings.buttonAppearance.rightButton.iconSize * 1.7, + iconSizeUnit: this.settings.buttonAppearance.rightButton.iconSizeUnit + }, + offButtonIcon: { + showIcon: true, + icon: this.settings.buttonAppearance.rightButton.icon, + iconSize: this.settings.buttonAppearance.rightButton.iconSize * 1.7, + iconSizeUnit: this.settings.buttonAppearance.rightButton.iconSizeUnit + }, + mainColorOn: this.settings.buttonAppearance.rightButton.mainColorOn, + backgroundColorOn: this.settings.buttonAppearance.rightButton.backgroundColorOn, + mainColorOff: this.settings.buttonAppearance.rightButton.mainColorOff, + backgroundColorOff: this.settings.buttonAppearance.rightButton.backgroundColorOff, + mainColorDisabled: this.settings.buttonAppearance.rightButton.mainColorDisabled, + backgroundColorDisabled: this.settings.buttonAppearance.rightButton.backgroundColorDisabled + }; + } + + this.zone.run(() => { + if (this.showLeftButton) { + this.powerButtonSvgShapeLeft = PowerButtonShape.fromSettings(this.ctx, this.svgShapeLeft, this.iconRegistry, + leftButtonSetting , true, this.leftDisabledState, () => this.onClick()); + } + if (this.showRightButton) { + this.powerButtonSvgShapeRight = PowerButtonShape.fromSettings(this.ctx, this.svgShapeRight, this.iconRegistry, + rightButtonSetting, true, this.rightDisabledState, () => this.onClick(true)); + } + }); + + this.shapeResize$ = new ResizeObserver(() => { + this.onResize(); + }); + if (this.autoScale) { + this.shapeResize$.observe(this.stepperContent.nativeElement); + } + if (this.showLeftButton) { + this.shapeResize$.observe(this.leftButton.nativeElement); + } + if (this.showRightButton) { + this.shapeResize$.observe(this.rightButton.nativeElement); + } + this.onResize(); + } + + private updateLeftDisabledState(disabled: boolean) { + this.leftDisabledState = disabled; + this.powerButtonSvgShapeLeft?.setDisabled(this.leftDisabledState); + this.cd.markForCheck(); + } + + + private updateRightDisabledState(disabled: boolean) { + this.rightDisabledState = disabled; + this.powerButtonSvgShapeRight?.setDisabled(this.rightDisabledState); + this.cd.markForCheck(); + } + + private onResize() { + const panelWidth = this.stepperContent.nativeElement.getBoundingClientRect().width; + const panelHeight = this.stepperContent.nativeElement.getBoundingClientRect().height; + + const minAspect = 0.2; + const avgContentHeight = 32; + const targetHeight = panelWidth * Math.min(panelHeight / panelWidth, minAspect); + const multiplier = targetHeight / avgContentHeight; + const size = avgContentHeight * multiplier; + + if (this.showValueBox) { + this.renderer.setStyle(this.valueBox?.nativeElement, 'height', `${size}px`); + this.renderer.setStyle(this.valueElement?.nativeElement, 'font-size', `${this.settings.appearance.valueFont.size * multiplier}px`); + } + if (this.showLeftButton) { + this.renderer.setStyle(this.leftButton?.nativeElement, 'width', `${size}px`); + this.renderer.setStyle(this.leftButton?.nativeElement, 'height', `${size}px`); + } + if (this.showRightButton) { + this.renderer.setStyle(this.rightButton?.nativeElement, 'width', `${size}px`); + this.renderer.setStyle(this.rightButton?.nativeElement, 'height', `${size}px`); + } + if (size) { + const scale = size / powerButtonShapeSize; + if (this.showLeftButton) { + this.renderer.setStyle(this.svgShapeLeft?.node, 'transform', `scale(${scale})`); + } + if (this.showRightButton) { + this.renderer.setStyle(this.svgShapeRight?.node, 'transform', `scale(${scale})`); + } + } + } + +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts new file mode 100644 index 0000000000..02471bfc05 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts @@ -0,0 +1,239 @@ +import { + DataToValueType, + GetValueAction, + GetValueSettings, SetValueAction, + SetValueSettings, ValueToDataType +} from '@shared/models/action-widget-settings.models'; +import { defaultWidgetAction, WidgetAction } from '@shared/models/widget.models'; +import { + ButtonToggleAppearance, segmentedButtonDefaultAppearance, + SegmentedButtonWidgetSettings +} from '@home/components/widget/lib/button/segmented-button-widget.models'; +import { WidgetButtonCustomStyles, WidgetButtonType } from '@shared/components/button/widget-button.models'; +import { BackgroundSettings, BackgroundType, cssUnit, Font } from '@shared/models/widget-settings.models'; +import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; + + +const defaultMainColor = '#305680'; + +export enum ValueStepperType { + simplified = 'simplified', + default = 'default', + default_volume = 'default_volume' +} + +export const valueStepperTypes = Object.keys(ValueStepperType) as ValueStepperType[]; + +export const valueStepperTypeTranslations = new Map( + [ + [ValueStepperType.simplified, 'widgets.value-stepper.simplified'], + [ValueStepperType.default, 'widgets.value-stepper.filled'], + [ValueStepperType.default_volume, 'widgets.value-stepper.volume'] + ] +); + +export const valueStepperTypeImages = new Map( + [ + [ValueStepperType.simplified, 'assets/widget/value-stepper/simplified.svg'], + [ValueStepperType.default, 'assets/widget/value-stepper/filled.svg'], + [ValueStepperType.default_volume, 'assets/widget/value-stepper/volume.svg'] + ] +); + +export interface ValueStepperWidgetSettings { + initialState: GetValueSettings; + leftButtonClick: SetValueSettings; + rightButtonClick: SetValueSettings; + disabledState: GetValueSettings; + + appearance: ValueStepperAppearance; + buttonAppearance: { + leftButton: ValueStepperButtonAppearance; + rightButton: ValueStepperButtonAppearance; + } + + background: BackgroundSettings; + padding: string; +} + +export interface ValueStepperAppearance { + type: ValueStepperType; + autoScale: boolean; + minValueRange: number; + maxValueRange: number; + valueStep: number; + showValueBox: boolean; + valueUnits: string; + valueDecimals: number; + valueFont: Font; + valueColor: string; + valueBoxBackground: string; + showBorder: boolean; + borderWidth: number; + borderColor: string; +} + +export interface ValueStepperButtonAppearance { + showButton: boolean; + icon: string; + iconSize: number; + iconSizeUnit: cssUnit; + mainColorOn: string; + backgroundColorOn: string; + mainColorOff: string; + backgroundColorOff: string; + mainColorDisabled: string; + backgroundColorDisabled: string; + customStyle: WidgetButtonCustomStyles; +} + +export const valueStepperDefaultAppearance: ValueStepperAppearance = { + type: ValueStepperType.simplified, + autoScale: true, + minValueRange: -100, + maxValueRange: 100, + valueStep: 0.5, + showValueBox: true, + valueUnits: '', + valueDecimals: 1, + valueFont: { + family: 'Roboto', + weight: '500', + style: 'normal', + size: 16, + sizeUnit: 'px', + lineHeight: '24px' + }, + valueColor: '#000', + valueBoxBackground: 'rgba(0, 0, 0, 0.12)', + showBorder: true, + borderWidth: 1, + borderColor: defaultMainColor +} + +export const valueStepperButtonDefaultAppearance: ValueStepperButtonAppearance = { + showButton: true, + icon: '', + iconSize: 24, + iconSizeUnit: 'px', + + mainColorOn: '#3F52DD', + backgroundColorOn: '#FFFFFF', + mainColorOff: '#A2A2A2', + backgroundColorOff: '#FFFFFF', + mainColorDisabled: 'rgba(0,0,0,0.12)', + backgroundColorDisabled: '#FFFFFF', + customStyle: { + enabled: null, + hovered: null, + pressed: null, + activated: null, + disabled: null + } +} + +export const valueStepperDefaultSettings: ValueStepperWidgetSettings = { + initialState: { + action: GetValueAction.EXECUTE_RPC, + defaultValue: 0, + executeRpc: { + method: 'getState', + requestTimeout: 5000, + requestPersistent: false, + persistentPollingInterval: 1000 + }, + getAttribute: { + key: 'state', + scope: null + }, + getTimeSeries: { + key: 'state' + }, + getAlarmStatus: { + severityList: null, + typeList: null + }, + dataToValue: { + type: DataToValueType.NONE, + compareToValue: true, + dataToValueFunction: '/* Should return integer value */\nreturn data;' + } + }, + disabledState: { + action: GetValueAction.DO_NOTHING, + defaultValue: false, + getAttribute: { + key: 'state', + scope: null + }, + getTimeSeries: { + key: 'state' + }, + getAlarmStatus: { + severityList: null, + typeList: null + }, + dataToValue: { + type: DataToValueType.NONE, + compareToValue: true, + dataToValueFunction: '/* Should return boolean value */\nreturn data;' + } + }, + leftButtonClick: { + action: SetValueAction.EXECUTE_RPC, + executeRpc: { + method: 'setState', + requestTimeout: 5000, + requestPersistent: false, + persistentPollingInterval: 1000 + }, + setAttribute: { + key: 'state', + scope: AttributeScope.SERVER_SCOPE + }, + putTimeSeries: { + key: 'state' + }, + valueToData: { + type: ValueToDataType.VALUE, + constantValue: 0, + valueToDataFunction: '/* Convert input integer value to RPC parameters or attribute/time-series value */\nreturn value;' + } + }, + rightButtonClick: { + action: SetValueAction.EXECUTE_RPC, + executeRpc: { + method: 'setState', + requestTimeout: 5000, + requestPersistent: false, + persistentPollingInterval: 1000 + }, + setAttribute: { + key: 'state', + scope: AttributeScope.SERVER_SCOPE + }, + putTimeSeries: { + key: 'state' + }, + valueToData: { + type: ValueToDataType.VALUE, + constantValue: 0, + valueToDataFunction: '/* Convert input integer value to RPC parameters or attribute/time-series value */\nreturn value;' + } + }, + appearance: valueStepperDefaultAppearance, + buttonAppearance: { + leftButton: {...valueStepperButtonDefaultAppearance, icon: 'arrow_back_ios_new'}, + rightButton: {...valueStepperButtonDefaultAppearance, icon: 'arrow_forward_ios'} + }, + background: { + type: BackgroundType.color, + color: '#fff', + overlay: { + enabled: false, + color: 'rgba(255,255,255,0.72)', + blur: 3 + } + }, + padding: '12px' +}; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.html new file mode 100644 index 0000000000..ebc106794e --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.html @@ -0,0 +1,266 @@ + + +
        +
        widgets.value-stepper.behavior
        +
        +
        widgets.value-stepper.initial-state
        + +
        +
        +
        widgets.value-stepper.left-button-click
        + +
        +
        +
        widgets.value-stepper.right-button-click
        + +
        +
        +
        widgets.button-state.disabled-state
        + +
        +
        +
        +
        widget-config.appearance
        + + + {{ valueStepperTypeTranslationMap.get(type) | translate }} + + +
        + + {{ 'widgets.value-stepper.auto-scale' | translate }} + +
        + +
        +
        {{ 'widgets.value-stepper.value-range' | translate }}
        +
        +
        widgets.value-stepper.min-range
        + + + +
        widgets.value-stepper.max-range
        + + + +
        +
        +
        +
        {{ 'widgets.value-stepper.value-increment-decrement-step' | translate }}
        + + + +
        +
        + + {{ 'widgets.value-stepper.value' | translate }} + +
        + + + +
        widget-config.decimals-suffix
        +
        + + + + +
        +
        + +
        +
        {{ 'widgets.value-stepper.value-box-background' | translate }}
        + + +
        +
        + + {{ 'widgets.value-stepper.border' | translate }} + +
        + + +
        px
        +
        + + +
        +
        +
        +
        +
        +
        widgets.value-stepper.button-appearance
        + + {{ 'widgets.value-stepper.left' | translate }} + {{ 'widgets.value-stepper.right' | translate }} + +
        +
        +
        + + {{ 'widgets.value-stepper.left-button' | translate }} + +
        +
        +
        {{ 'widgets.value-stepper.icon' | translate }}
        +
        + + + + + + +
        +
        +
        +
        {{ 'widgets.power-button.power-on-colors' | translate }}
        +
        +
        +
        widgets.power-button.main
        + + +
        + +
        +
        widgets.power-button.background
        + + +
        +
        +
        +
        +
        {{ 'widgets.power-button.disabled-colors' | translate }}
        +
        +
        +
        widgets.power-button.main
        + + +
        + +
        +
        widgets.power-button.background
        + + +
        +
        +
        +
        +
        +
        + + {{ 'widgets.value-stepper.right-button' | translate }} + +
        +
        +
        {{ 'widgets.value-stepper.icon' | translate }}
        +
        + + + + + + +
        +
        +
        +
        {{ 'widgets.power-button.power-on-colors' | translate }}
        +
        +
        +
        widgets.power-button.main
        + + +
        + +
        +
        widgets.power-button.background
        + + +
        +
        +
        +
        +
        {{ 'widgets.power-button.disabled-colors' | translate }}
        +
        +
        +
        widgets.power-button.main
        + + +
        + +
        +
        widgets.power-button.background
        + + +
        +
        +
        +
        +
        +
        diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.ts new file mode 100644 index 0000000000..119c099da0 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/value-stepper-widget-settings.component.ts @@ -0,0 +1,191 @@ +/// +/// Copyright © 2016-2024 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { Component } from '@angular/core'; +import { TargetDevice, WidgetSettings, WidgetSettingsComponent, widgetType } from '@shared/models/widget.models'; +import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { Store } from '@ngrx/store'; +import { AppState } from '@core/core.state'; +import { ValueType } from '@shared/models/constants'; +import { getTargetDeviceFromDatasources } from '@shared/models/widget-settings.models'; +import { + valueStepperDefaultSettings, + valueStepperTypeImages, + valueStepperTypes, + valueStepperTypeTranslations +} from '@home/components/widget/lib/rpc/value-stepper-widget.models'; +import { formatValue } from '@core/utils'; + +type ButtonAppearanceType = 'left' | 'right'; + +@Component({ + selector: 'tb-value-stepper-widget-settings', + templateUrl: './value-stepper-widget-settings.component.html', + styleUrls: ['../widget-settings.scss'] +}) +export class ValueStepperWidgetSettingsComponent extends WidgetSettingsComponent { + + get targetDevice(): TargetDevice { + const datasources = this.widgetConfig?.config?.datasources; + return getTargetDeviceFromDatasources(datasources); + } + + get widgetType(): widgetType { + return this.widgetConfig?.widgetType; + } + get borderRadius(): string { + return this.widgetConfig?.config?.borderRadius; + } + + valueType = ValueType; + + valueStepperWidgetSettingsForm: UntypedFormGroup; + + valueStepperTypeTranslationMap = valueStepperTypeTranslations; + valueStepperTypes = valueStepperTypes; + valueStepperTypeImageMap = valueStepperTypeImages; + + buttonAppearanceType: ButtonAppearanceType = 'left'; + + valuePreviewFn = this._valuePreviewFn.bind(this); + + constructor(protected store: Store, + private fb: UntypedFormBuilder) { + super(store); + } + + protected settingsForm(): UntypedFormGroup { + return this.valueStepperWidgetSettingsForm; + } + + protected defaultSettings(): WidgetSettings { + return {...valueStepperDefaultSettings}; + } + + protected onSettingsSet(settings: WidgetSettings) { + this.valueStepperWidgetSettingsForm = this.fb.group({ + initialState: [settings.initialState, []], + leftButtonClick: [settings.leftButtonClick, []], + rightButtonClick: [settings.rightButtonClick, []], + disabledState: [settings.disabledState, []], + + appearance: this.fb.group({ + type: [settings.appearance.type, []], + autoScale: [settings.appearance.autoScale, []], + minValueRange: [settings.appearance.minValueRange, []], + maxValueRange: [settings.appearance.maxValueRange, []], + valueStep: [settings.appearance.valueStep, [Validators.min(0)]], + showValueBox: [settings.appearance.showValueBox, []], + valueUnits: [settings.appearance.valueUnits, []], + valueDecimals: [settings.appearance.valueDecimals, []], + valueFont: [settings.appearance.valueFont, []], + valueColor: [settings.appearance.valueColor], + valueBoxBackground: [settings.appearance.valueBoxBackground, []], + showBorder: [settings.appearance.showBorder, []], + borderWidth: [settings.appearance.borderWidth, []], + borderColor: [settings.appearance.borderColor, []] + }), + + buttonAppearance: this.fb.group({ + leftButton: this.fb.group({ + showButton: [settings.buttonAppearance.leftButton.showButton], + icon: [settings.buttonAppearance.leftButton.icon], + iconSize: [settings.buttonAppearance.leftButton.iconSize], + iconSizeUnit: [settings.buttonAppearance.leftButton.iconSizeUnit], + mainColorOn: [settings.buttonAppearance.leftButton.mainColorOn, []], + backgroundColorOn: [settings.buttonAppearance.leftButton.backgroundColorOn, []], + mainColorDisabled: [settings.buttonAppearance.leftButton.mainColorDisabled, []], + backgroundColorDisabled: [settings.buttonAppearance.leftButton.backgroundColorDisabled, []] + }), + rightButton: this.fb.group({ + showButton: [settings.buttonAppearance.rightButton.showButton], + icon: [settings.buttonAppearance.rightButton.icon], + iconSize: [settings.buttonAppearance.rightButton.iconSize], + iconSizeUnit: [settings.buttonAppearance.rightButton.iconSizeUnit], + mainColorOn: [settings.buttonAppearance.rightButton.mainColorOn, []], + backgroundColorOn: [settings.buttonAppearance.rightButton.backgroundColorOn, []], + mainColorDisabled: [settings.buttonAppearance.rightButton.mainColorDisabled, []], + backgroundColorDisabled: [settings.buttonAppearance.rightButton.backgroundColorDisabled, []] + }) + }) + }); + } + + + protected validatorTriggers(): string[] { + return ['appearance.showValueBox', 'appearance.showBorder', + 'buttonAppearance.leftButton.showButton', 'buttonAppearance.rightButton.showButton']; + } + + protected updateValidators(_emitEvent: boolean): void { + const showValueBox: boolean = this.valueStepperWidgetSettingsForm.get('appearance').get('showValueBox').value; + const showBorder: boolean = this.valueStepperWidgetSettingsForm.get('appearance').get('showBorder').value; + const showLeftButton: boolean = this.valueStepperWidgetSettingsForm.get('buttonAppearance').get('leftButton').get('showButton').value; + const showRightButton: boolean = this.valueStepperWidgetSettingsForm.get('buttonAppearance').get('rightButton').get('showButton').value; + if (showValueBox) { + this.valueStepperWidgetSettingsForm.get('appearance').get('valueUnits').enable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueDecimals').enable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueFont').enable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueColor').enable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueBoxBackground').enable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('showBorder').enable({emitEvent: false}); + if (showBorder) { + this.valueStepperWidgetSettingsForm.get('appearance').get('borderWidth').enable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('borderColor').enable(); + } else { + this.valueStepperWidgetSettingsForm.get('appearance').get('borderWidth').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('borderColor').disable(); + } + } else { + this.valueStepperWidgetSettingsForm.get('appearance').get('valueUnits').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueDecimals').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueFont').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueColor').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('valueBoxBackground').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('showBorder').disable({emitEvent: false}); + this.valueStepperWidgetSettingsForm.get('appearance').get('borderWidth').disable(); + this.valueStepperWidgetSettingsForm.get('appearance').get('borderColor').disable(); + } + this.buttonValidators(showLeftButton, 'leftButton'); + this.buttonValidators(showRightButton, 'rightButton'); + } + + private buttonValidators(showButtonValue: boolean, button: string) { + if (showButtonValue) { + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('icon').enable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('iconSize').enable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('iconSizeUnit').enable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('mainColorOn').enable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('backgroundColorOn').enable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('mainColorDisabled').enable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('backgroundColorDisabled').enable() + } else { + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('icon').disable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('iconSize').disable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('iconSizeUnit').disable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('mainColorOn').disable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('backgroundColorOn').disable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('mainColorDisabled').disable() + this.valueStepperWidgetSettingsForm.get('buttonAppearance').get(button).get('backgroundColorDisabled').disable() + } + } + + private _valuePreviewFn(): string { + const units: string = this.valueStepperWidgetSettingsForm.get('appearance').get('valueUnits').value; + const decimals: number = this.valueStepperWidgetSettingsForm.get('appearance').get('valueDecimals').value; + return formatValue(48, decimals, units, false); + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts index 0aee57babb..e50fcb30f0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/widget-settings.module.ts @@ -371,6 +371,9 @@ import { import { SegmentedButtonWidgetSettingsComponent } from '@home/components/widget/lib/settings/button/segmented-button-widget-settings.component'; +import { + ValueStepperWidgetSettingsComponent +} from '@home/components/widget/lib/settings/control/value-stepper-widget-settings.component'; @NgModule({ declarations: [ @@ -487,6 +490,7 @@ import { SingleSwitchWidgetSettingsComponent, ActionButtonWidgetSettingsComponent, SegmentedButtonWidgetSettingsComponent, + ValueStepperWidgetSettingsComponent, CommandButtonWidgetSettingsComponent, PowerButtonWidgetSettingsComponent, SliderWidgetSettingsComponent, @@ -624,6 +628,7 @@ import { SingleSwitchWidgetSettingsComponent, ActionButtonWidgetSettingsComponent, SegmentedButtonWidgetSettingsComponent, + ValueStepperWidgetSettingsComponent, CommandButtonWidgetSettingsComponent, PowerButtonWidgetSettingsComponent, SliderWidgetSettingsComponent, diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts index 21f2d89dc6..fe752bb8b5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts @@ -88,6 +88,7 @@ import { import { EllipsisChipListDirective } from '@shared/directives/ellipsis-chip-list.directive'; import { ScadaSymbolWidgetComponent } from '@home/components/widget/lib/scada/scada-symbol-widget.component'; import { TwoSegmentButtonWidgetComponent } from '@home/components/widget/lib/button/two-segment-button-widget.component'; +import { ValueStepperWidgetComponent } from '@home/components/widget/lib/rpc/value-stepper-widget.component'; @NgModule({ declarations: [ @@ -128,6 +129,7 @@ import { TwoSegmentButtonWidgetComponent } from '@home/components/widget/lib/but TwoSegmentButtonWidgetComponent, CommandButtonWidgetComponent, PowerButtonWidgetComponent, + ValueStepperWidgetComponent, SliderWidgetComponent, ToggleButtonWidgetComponent, TimeSeriesChartWidgetComponent, @@ -190,6 +192,7 @@ import { TwoSegmentButtonWidgetComponent } from '@home/components/widget/lib/but TwoSegmentButtonWidgetComponent, CommandButtonWidgetComponent, PowerButtonWidgetComponent, + ValueStepperWidgetComponent, SliderWidgetComponent, ToggleButtonWidgetComponent, TimeSeriesChartWidgetComponent, diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 57df3865e9..5163a3c2bb 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -6617,6 +6617,8 @@ "layout-outlined-icon": "Outlined.Icon", "main": "Main", "background": "Background", + "button-icon-on": "Button icon 'On'", + "button-icon-off": "Button icon 'Off'", "power-on-colors": "Power 'On' colors", "power-off-colors": "Power 'Off' colors", "disabled-colors": "Disabled colors", @@ -6669,6 +6671,41 @@ "preview": "Preview", "copy-style-from": "Copy style from" }, + "value-stepper": { + "behavior": "Behavior", + "simplified": "Simplified", + "filled": "Filled", + "outlined": "Outlined", + "volume": "Volume", + "initial-state": "Initial state", + "initial-state-hint": "Action to get the initial value.", + "disabled-state": "Disabled state", + "disabled-state-hint": "Configure condition under which the component is disabled.", + "right-button-click": "Right button click", + "right-button-click-hint": "Action while pressing on right button.", + "left-button-click": "Left button click", + "left-button-click-hint": "Action while pressing on left button.", + "auto-scale": "Auto scale", + "value-range": "Range", + "min-range": "Min", + "max-range": "Max", + "value-increment-decrement-step": "Value increment/decrement step", + "value": "Value", + "value-box-background": "Value box background", + "border": "Border", + "button-appearance": "Button appearance", + "left": "Left", + "right": "Right", + "left-button": "Left button", + "right-button": "Right button", + "icon": "Icon", + "color-palette": "Color palette", + "main": "Main", + "background": "Background", + "button-icon-on": "Button icon 'On'", + "button-on-colors": "Power 'On' colors", + "disabled-colors": "Disabled colors" + }, "button-state": { "activated-state": "Activated state", "activated-state-hint": "Configure condition under which the button is active.", diff --git a/ui-ngx/src/assets/widget/value-stepper/filled.svg b/ui-ngx/src/assets/widget/value-stepper/filled.svg new file mode 100644 index 0000000000..26c94b92cd --- /dev/null +++ b/ui-ngx/src/assets/widget/value-stepper/filled.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui-ngx/src/assets/widget/value-stepper/simplified.svg b/ui-ngx/src/assets/widget/value-stepper/simplified.svg new file mode 100644 index 0000000000..8a71ad47c8 --- /dev/null +++ b/ui-ngx/src/assets/widget/value-stepper/simplified.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui-ngx/src/assets/widget/value-stepper/volume.svg b/ui-ngx/src/assets/widget/value-stepper/volume.svg new file mode 100644 index 0000000000..96bda9fa7a --- /dev/null +++ b/ui-ngx/src/assets/widget/value-stepper/volume.svg @@ -0,0 +1 @@ + \ No newline at end of file From 3d407618316610bb9ba681270350317a41025a30 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Fri, 7 Feb 2025 16:01:38 +0200 Subject: [PATCH 044/100] Remove outdated deprecation checks --- .../service/update/DeprecationService.java | 90 ------------------- .../notification/DefaultNotifications.java | 19 ---- .../rule/engine/api/NotificationCenter.java | 2 +- 3 files changed, 1 insertion(+), 110 deletions(-) delete mode 100644 application/src/main/java/org/thingsboard/server/service/update/DeprecationService.java diff --git a/application/src/main/java/org/thingsboard/server/service/update/DeprecationService.java b/application/src/main/java/org/thingsboard/server/service/update/DeprecationService.java deleted file mode 100644 index ff1f013953..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/update/DeprecationService.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.update; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.thingsboard.rule.engine.api.NotificationCenter; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.notification.info.GeneralNotificationInfo; -import org.thingsboard.server.common.data.notification.targets.platform.SystemAdministratorsFilter; -import org.thingsboard.server.dao.notification.DefaultNotifications; -import org.thingsboard.server.dao.notification.DefaultNotifications.DefaultNotification; -import org.thingsboard.server.queue.util.AfterStartUp; - -import java.util.Map; - -@Service -@Slf4j -@RequiredArgsConstructor -public class DeprecationService { - - private final NotificationCenter notificationCenter; - - @Value("${queue.type}") - private String queueType; - - @Value("${database.ts.type}") - private String tsType; - - @Value("${database.ts_latest.type}") - private String tsLatestType; - - @AfterStartUp(order = Integer.MAX_VALUE) - public void checkDeprecation() { - checkQueueTypeDeprecation(); - checkDatabaseTypeDeprecation(); - } - - private void checkQueueTypeDeprecation() { - String queueTypeName; - switch (queueType) { - case "aws-sqs" -> queueTypeName = "AWS SQS"; - case "pubsub" -> queueTypeName = "PubSub"; - case "service-bus" -> queueTypeName = "Azure Service Bus"; - case "rabbitmq" -> queueTypeName = "RabbitMQ"; - default -> { - return; - } - } - - log.warn("WARNING: Starting with ThingsBoard 4.0, {} will no longer be supported as a message queue for microservices. " + - "Please migrate to Apache Kafka. This change will not impact any rule nodes", queueTypeName); - sendNotification(DefaultNotifications.queueTypeDeprecation, Map.of( - "queueType", queueTypeName - )); - } - - private void checkDatabaseTypeDeprecation() { - String deprecatedDatabaseType = "Timescale"; - if (StringUtils.equalsAnyIgnoreCase(deprecatedDatabaseType, tsType, tsLatestType)) { - log.warn("WARNING: Starting with ThingsBoard 4.0, {} will no longer be supported as a storage provider. " + - "Please migrate to Cassandra or PostgreSQL.", deprecatedDatabaseType); - sendNotification(DefaultNotifications.databaseTypeDeprecation, Map.of( - "databaseType", deprecatedDatabaseType - )); - } - } - - private void sendNotification(DefaultNotification notification, Map info) { - notificationCenter.sendGeneralWebNotification(TenantId.SYS_TENANT_ID, new SystemAdministratorsFilter(), - notification.toTemplate(), new GeneralNotificationInfo(info)); - } - -} diff --git a/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java b/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java index 16088e83c9..1a4c3ffab2 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java +++ b/dao/src/main/java/org/thingsboard/server/dao/notification/DefaultNotifications.java @@ -372,25 +372,6 @@ public class DefaultNotifications { .build()) .build(); - public static final DefaultNotification queueTypeDeprecation = DefaultNotification.builder() - .name("Queue type deprecation") - .type(NotificationType.GENERAL) - .subject("WARNING: ${queueType} deprecation") - .text("Starting with ThingsBoard 4.0, ${queueType} will no longer be supported as a message queue for microservices. " + - "Please migrate to Apache Kafka. This change will not impact any rule nodes.") - .icon("warning").color(RED_COLOR) - .build(); - - public static final DefaultNotification databaseTypeDeprecation = DefaultNotification.builder() - .name("Database type deprecation") - .type(NotificationType.GENERAL) - .subject("WARNING: ${databaseType} deprecation") - .text("Starting with ThingsBoard 4.0, ${databaseType} will no longer be supported as a storage provider. " + - "Please migrate to Cassandra or PostgreSQL.") - .icon("warning") - .color(RED_COLOR) - .build(); - private final NotificationTemplateService templateService; private final NotificationRuleService ruleService; diff --git a/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/NotificationCenter.java b/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/NotificationCenter.java index b8fb9b61ff..74c98cdec5 100644 --- a/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/NotificationCenter.java +++ b/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/NotificationCenter.java @@ -36,7 +36,7 @@ public interface NotificationCenter { NotificationRequest processNotificationRequest(TenantId tenantId, NotificationRequest notificationRequest, FutureCallback callback); - void sendGeneralWebNotification(TenantId tenantId, UsersFilter recipients, NotificationTemplate template, GeneralNotificationInfo info); + void sendGeneralWebNotification(TenantId tenantId, UsersFilter recipients, NotificationTemplate template, GeneralNotificationInfo info); // for future use void sendSystemNotification(TenantId tenantId, NotificationTargetId targetId, NotificationType type, NotificationInfo info); // for future use and compatibility with PE From 1cdbd2c338ceef94e2b09f161d3cdc605e080a55 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 7 Feb 2025 16:36:06 +0200 Subject: [PATCH 045/100] UI: fixed widget fqn --- .../src/main/data/json/system/widget_types/value_stepper.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/data/json/system/widget_types/value_stepper.json b/application/src/main/data/json/system/widget_types/value_stepper.json index 0126b25470..dea2406539 100644 --- a/application/src/main/data/json/system/widget_types/value_stepper.json +++ b/application/src/main/data/json/system/widget_types/value_stepper.json @@ -1,5 +1,5 @@ { - "fqn": "slider", + "fqn": "value_stepper", "name": "Value stepper", "deprecated": false, "image": "tb-image;/api/images/system/value-stepper-widget.svg", From 1e9d80d39b972ed4df1f406db25a5969d83fc88d Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 7 Feb 2025 16:37:51 +0200 Subject: [PATCH 046/100] Fixed mdc notch unnecessary border --- ui-ngx/src/form.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui-ngx/src/form.scss b/ui-ngx/src/form.scss index 0ae2b9584b..c73a4fc9b4 100644 --- a/ui-ngx/src/form.scss +++ b/ui-ngx/src/form.scss @@ -398,6 +398,9 @@ border-color: rgba(0, 0, 0, 0.12); } } + .mdc-notched-outline__notch { + border-left: none; + } .mdc-floating-label { top: 20px; font-weight: 400; From 44009d4e6cb9058b4489455a752a120ec803a193 Mon Sep 17 00:00:00 2001 From: Ekaterina Chantsova Date: Thu, 6 Feb 2025 19:50:36 +0200 Subject: [PATCH 047/100] UI: Date-time period - improve behaviour on changing start/end time --- .../time/datetime-period.component.html | 6 +- .../time/datetime-period.component.ts | 136 +++++++++++------- 2 files changed, 90 insertions(+), 52 deletions(-) diff --git a/ui-ngx/src/app/shared/components/time/datetime-period.component.html b/ui-ngx/src/app/shared/components/time/datetime-period.component.html index 84f6d29d68..03c5a6ac21 100644 --- a/ui-ngx/src/app/shared/components/time/datetime-period.component.html +++ b/ui-ngx/src/app/shared/components/time/datetime-period.component.html @@ -15,17 +15,17 @@ limitations under the License. --> -
        +
        datetime.from - + datetime.to - +
        diff --git a/ui-ngx/src/app/shared/components/time/datetime-period.component.ts b/ui-ngx/src/app/shared/components/time/datetime-period.component.ts index c0fbaea21e..0e212f7630 100644 --- a/ui-ngx/src/app/shared/components/time/datetime-period.component.ts +++ b/ui-ngx/src/app/shared/components/time/datetime-period.component.ts @@ -14,10 +14,17 @@ /// limitations under the License. /// -import { Component, forwardRef, Input, OnInit } from '@angular/core'; -import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { FixedWindow } from '@shared/models/time/time.models'; +import { Component, forwardRef, Input } from '@angular/core'; +import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { DAY, FixedWindow, MINUTE } from '@shared/models/time/time.models'; import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { distinctUntilChanged } from 'rxjs/operators'; + +interface DateTimePeriod { + startDate: Date; + endDate: Date; +} @Component({ selector: 'tb-datetime-period', @@ -31,7 +38,7 @@ import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form- } ] }) -export class DatetimePeriodComponent implements OnInit, ControlValueAccessor { +export class DatetimePeriodComponent implements ControlValueAccessor { @Input() disabled: boolean; @@ -41,25 +48,45 @@ export class DatetimePeriodComponent implements OnInit, ControlValueAccessor { @Input() appearance: MatFormFieldAppearance = 'fill'; - modelValue: FixedWindow; - - startDate: Date; - endDate: Date; - - endTime: any; + private modelValue: FixedWindow; maxStartDate: Date; - minEndDate: Date; maxEndDate: Date; - changePending = false; + private maxStartDateTs: number; + private minEndDateTs: number; + private maxStartTs: number; + private maxEndTs: number; - private propagateChange = null; + private timeShiftMs = MINUTE; - constructor() { - } + dateTimePeriodFormGroup = this.fb.group({ + startDate: this.fb.control(null), + endDate: this.fb.control(null) + }); + + private changePending = false; - ngOnInit(): void { + private propagateChange = null; + + constructor(private fb: FormBuilder) { + this.dateTimePeriodFormGroup.valueChanges.pipe( + distinctUntilChanged((prevDateTimePeriod, dateTimePeriod) => + prevDateTimePeriod.startDate === dateTimePeriod.startDate && prevDateTimePeriod.endDate === dateTimePeriod.endDate), + takeUntilDestroyed() + ).subscribe((dateTimePeriod: DateTimePeriod) => { + this.updateMinMaxDates(dateTimePeriod); + this.updateView(); + }); + + this.dateTimePeriodFormGroup.get('startDate').valueChanges.pipe( + distinctUntilChanged(), + takeUntilDestroyed() + ).subscribe(startDate => this.onStartDateChange(startDate)); + this.dateTimePeriodFormGroup.get('endDate').valueChanges.pipe( + distinctUntilChanged(), + takeUntilDestroyed() + ).subscribe(endDate => this.onEndDateChange(endDate)); } registerOnChange(fn: any): void { @@ -75,35 +102,38 @@ export class DatetimePeriodComponent implements OnInit, ControlValueAccessor { setDisabledState(isDisabled: boolean): void { this.disabled = isDisabled; + if (this.disabled) { + this.dateTimePeriodFormGroup.disable({emitEvent: false}); + } else { + this.dateTimePeriodFormGroup.enable({emitEvent: false}); + } } writeValue(datePeriod: FixedWindow): void { this.modelValue = datePeriod; if (this.modelValue) { - this.startDate = new Date(this.modelValue.startTimeMs); - this.endDate = new Date(this.modelValue.endTimeMs); + this.dateTimePeriodFormGroup.patchValue({ + startDate: new Date(this.modelValue.startTimeMs), + endDate: new Date(this.modelValue.endTimeMs) + }, {emitEvent: false}); } else { const date = new Date(); - this.startDate = new Date( - date.getFullYear(), - date.getMonth(), - date.getDate() - 1, - date.getHours(), - date.getMinutes(), - date.getSeconds(), - date.getMilliseconds()); - this.endDate = date; + this.dateTimePeriodFormGroup.patchValue({ + startDate: new Date(date.getTime() - DAY), + endDate: date + }, {emitEvent: false}); this.updateView(); } - this.updateMinMaxDates(); + this.updateMinMaxDates(this.dateTimePeriodFormGroup.value); } - updateView() { + private updateView() { let value: FixedWindow = null; - if (this.startDate && this.endDate) { + const dateTimePeriod = this.dateTimePeriodFormGroup.value; + if (dateTimePeriod.startDate && dateTimePeriod.endDate) { value = { - startTimeMs: this.startDate.getTime(), - endTimeMs: this.endDate.getTime() + startTimeMs: dateTimePeriod.startDate.getTime(), + endTimeMs: dateTimePeriod.endDate.getTime() }; } this.modelValue = value; @@ -114,32 +144,40 @@ export class DatetimePeriodComponent implements OnInit, ControlValueAccessor { } } - updateMinMaxDates() { - this.maxStartDate = new Date(this.endDate.getTime() - 1000); - this.minEndDate = new Date(this.startDate.getTime() + 1000); + private updateMinMaxDates(dateTimePeriod: Partial) { this.maxEndDate = new Date(); + this.maxEndTs = this.maxEndDate.getTime(); + this.maxStartTs = this.maxEndTs - this.timeShiftMs; + this.maxStartDate = new Date(this.maxStartTs); + + if (dateTimePeriod.endDate) { + this.maxStartDateTs = dateTimePeriod.endDate.getTime() - this.timeShiftMs; + } + if (dateTimePeriod.startDate) { + this.minEndDateTs = dateTimePeriod.startDate.getTime() + this.timeShiftMs; + } } - onStartDateChange() { - if (this.startDate) { - if (this.startDate.getTime() > this.maxStartDate.getTime()) { - this.startDate = new Date(this.maxStartDate.getTime()); + private onStartDateChange(startDate: Date) { + if (startDate) { + if (startDate.getTime() > this.maxStartTs) { + this.dateTimePeriodFormGroup.get('startDate').patchValue(new Date(this.maxStartTs), { emitEvent: false }); + } + if (startDate.getTime() > this.maxStartDateTs) { + this.dateTimePeriodFormGroup.get('endDate').patchValue(new Date(startDate.getTime() + this.timeShiftMs), { emitEvent: false }); } - this.updateMinMaxDates(); } - this.updateView(); } - onEndDateChange() { - if (this.endDate) { - if (this.endDate.getTime() < this.minEndDate.getTime()) { - this.endDate = new Date(this.minEndDate.getTime()); - } else if (this.endDate.getTime() > this.maxEndDate.getTime()) { - this.endDate = new Date(this.maxEndDate.getTime()); + private onEndDateChange(endDate: Date) { + if (endDate) { + if (endDate.getTime() > this.maxEndTs) { + this.dateTimePeriodFormGroup.get('endDate').patchValue(new Date(this.maxEndTs), { emitEvent: false }); + } + if (endDate.getTime() < this.minEndDateTs) { + this.dateTimePeriodFormGroup.get('startDate').patchValue(new Date(endDate.getTime() - this.timeShiftMs), { emitEvent: false }); } - this.updateMinMaxDates(); } - this.updateView(); } } From bdb44c9e86ba9a0fe2260811a39bfe75ab1b4324 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 7 Feb 2025 18:26:38 +0200 Subject: [PATCH 048/100] UI: Fixed mobile view in details page --- .../app/modules/home/pages/admin/queue/queue.component.html | 2 +- .../home/pages/admin/resource/js-resource.component.html | 4 ++-- .../pages/admin/resource/resources-library.component.html | 4 ++-- .../src/app/modules/home/pages/device/device.component.html | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge.component.html | 2 +- .../modules/home/pages/ota-update/ota-update.component.html | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/queue/queue.component.html b/ui-ngx/src/app/modules/home/pages/admin/queue/queue.component.html index f25cd1c857..68b73e7357 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/queue/queue.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/queue/queue.component.html @@ -22,7 +22,7 @@ [class.!hidden]="isEdit || isDetailsPage"> {{'common.open-details-page' | translate }} - - - - - - - - -
        diff --git a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts index 417fc35bf4..e818e07ee4 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts @@ -14,24 +14,13 @@ /// limitations under the License. /// -import { - AfterViewInit, - Component, - ElementRef, - EventEmitter, - forwardRef, - Input, - OnInit, - Output, - ViewChild -} from '@angular/core'; +import { Component, ElementRef, EventEmitter, forwardRef, Input, OnInit, Output, ViewChild } from '@angular/core'; import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { merge, Observable, of, Subject } from 'rxjs'; +import { firstValueFrom, merge, Observable, of, Subject } from 'rxjs'; import { catchError, debounceTime, map, share, switchMap, tap } from 'rxjs/operators'; import { Store } from '@ngrx/store'; import { AppState } from '@app/core/core.state'; -import { TranslateService } from '@ngx-translate/core'; import { AliasEntityType, EntityType } from '@shared/models/entity-type.models'; import { BaseData } from '@shared/models/base-data'; import { EntityId } from '@shared/models/id/entity-id'; @@ -51,22 +40,22 @@ import { coerceArray, coerceBoolean } from '@shared/decorators/coercion'; multi: true }] }) -export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit, AfterViewInit { +export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit { selectEntityFormGroup: UntypedFormGroup; - modelValue: string | EntityId | null; + private modelValue: string | EntityId | null; - entityTypeValue: EntityType | AliasEntityType; + private entityTypeValue: EntityType | AliasEntityType; - entitySubtypeValue: string; + private entitySubtypeValue: string; - entityText: string; + private entityText: string; noEntitiesMatchingText: string; notFoundEntities = 'entity.no-entities-text'; - entityRequiredText: string; + private entityRequiredText: string; filteredEntities: Observable>>; @@ -78,7 +67,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit private refresh$ = new Subject>>(); - private propagateChange = (v: any) => { }; + private propagateChange: (value: any) => void = () => { }; @Input() set entityType(entityType: EntityType) { @@ -166,7 +155,6 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit constructor(private store: Store, - public translate: TranslateService, private entityService: EntityService, private fb: UntypedFormBuilder) { this.selectEntityFormGroup = this.fb.group({ @@ -178,7 +166,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit this.propagateChange = fn; } - registerOnTouched(fn: any): void { + registerOnTouched(_fn: any): void { } ngOnInit() { @@ -188,7 +176,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit .pipe( debounceTime(150), tap(value => { - let modelValue; + let modelValue: string | EntityId; if (typeof value === 'string' || !value) { modelValue = null; } else { @@ -207,9 +195,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit ); } - ngAfterViewInit(): void {} - - load(): void { + private load(): void { if (this.entityTypeValue) { switch (this.entityTypeValue) { case EntityType.ASSET: @@ -327,7 +313,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit } } - getCurrentEntity(): BaseData | null { + private getCurrentEntity(): BaseData | null { const currentEntity = this.selectEntityFormGroup.get('entity').value; if (currentEntity && typeof currentEntity !== 'string') { return currentEntity as BaseData; @@ -359,16 +345,17 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit } let entity: BaseData = null; try { - entity = await this.entityService.getEntity(targetEntityType, id, {ignoreLoading: true, ignoreErrors: true}).toPromise(); + entity = await firstValueFrom(this.entityService.getEntity(targetEntityType, id, {ignoreLoading: true, ignoreErrors: true})); } catch (e) { this.propagateChange(null); } this.modelValue = entity !== null ? (this.useFullEntityId ? entity.id : entity.id.id) : null; - this.entityURL = getEntityDetailsPageURL(this.modelValue as string, targetEntityType); + this.entityURL = !entity ? '' : getEntityDetailsPageURL(entity.id.id, targetEntityType); this.selectEntityFormGroup.get('entity').patchValue(entity !== null ? entity : '', {emitEvent: false}); this.entityChanged.emit(entity); } else { this.modelValue = null; + this.entityURL = ''; this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); } this.dirty = true; @@ -381,13 +368,14 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit } } - reset() { + private reset() { this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); } - updateView(value: string | null, entity: BaseData | null) { + private updateView(value: string | EntityId | null, entity: BaseData | null) { if (!isEqual(this.modelValue, value)) { this.modelValue = value; + this.entityURL = !entity ? '' : getEntityDetailsPageURL(entity.id.id, entity.id.entityType as EntityType); this.propagateChange(this.modelValue); this.entityChanged.emit(entity); } @@ -397,7 +385,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit return entity ? entity.name : undefined; } - fetchEntities(searchText?: string): Observable>> { + private fetchEntities(searchText?: string): Observable>> { this.searchText = searchText; const targetEntityType = this.checkEntityType(this.entityTypeValue); return this.entityService.getEntitiesByNameFilter(targetEntityType, searchText, @@ -432,7 +420,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit }, 0); } - checkEntityType(entityType: EntityType | AliasEntityType): EntityType { + private checkEntityType(entityType: EntityType | AliasEntityType): EntityType { if (entityType === AliasEntityType.CURRENT_CUSTOMER) { return EntityType.CUSTOMER; } else if (entityType === AliasEntityType.CURRENT_TENANT) { @@ -454,4 +442,8 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit $event.stopPropagation(); this.createNew.emit(); } + + get showEntityLink(): boolean { + return this.selectEntityFormGroup.get('entity').value && this.disabled && this.entityURL !== ''; + } } From 0cda72e6b2847c1baee498d2971bb3431b1d1895 Mon Sep 17 00:00:00 2001 From: devaskim Date: Sun, 9 Feb 2025 17:32:36 +0500 Subject: [PATCH 051/100] Encode username/passwrod pair instead of decoding it while creating request. --- .../java/org/thingsboard/rule/engine/rest/TbHttpClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java index ed1ed4fa83..4745147de8 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java @@ -347,7 +347,7 @@ public class TbHttpClient { if (CredentialsType.BASIC == credentials.getType()) { BasicCredentials basicCredentials = (BasicCredentials) credentials; String authString = basicCredentials.getUsername() + ":" + basicCredentials.getPassword(); - String encodedAuthString = new String(Base64.getDecoder().decode(authString.getBytes(StandardCharsets.UTF_8))); + String encodedAuthString = new String(Base64.getEncoder().encode(authString.getBytes(StandardCharsets.UTF_8))); headers.add("Authorization", "Basic " + encodedAuthString); } } From ec8e7a07268694685cfb047f1fc7724a36e50b2d Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 10 Feb 2025 14:28:46 +0200 Subject: [PATCH 052/100] Added versioning for ApiUsageState entity --- .../src/main/data/upgrade/basic/schema_update.sql | 2 ++ .../thingsboard/server/common/data/ApiUsageState.java | 5 ++++- .../server/dao/model/sql/ApiUsageStateEntity.java | 10 ++++------ dao/src/main/resources/sql/schema-entities.sql | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/application/src/main/data/upgrade/basic/schema_update.sql b/application/src/main/data/upgrade/basic/schema_update.sql index 5d66056701..29b541327a 100644 --- a/application/src/main/data/upgrade/basic/schema_update.sql +++ b/application/src/main/data/upgrade/basic/schema_update.sql @@ -61,3 +61,5 @@ DO $$ $$; -- UPDATE SAVE TIME SERIES NODES END + +ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1; \ No newline at end of file diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java b/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java index b13a9edd74..f6f3d82c09 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java @@ -27,7 +27,7 @@ import org.thingsboard.server.common.data.id.TenantId; @EqualsAndHashCode(callSuper = true) @Getter @Setter -public class ApiUsageState extends BaseData implements HasTenantId { +public class ApiUsageState extends BaseData implements HasTenantId, HasVersion { private static final long serialVersionUID = 8250339805336035966L; @@ -41,6 +41,7 @@ public class ApiUsageState extends BaseData implements HasTenan private ApiUsageStateValue emailExecState; private ApiUsageStateValue smsExecState; private ApiUsageStateValue alarmExecState; + private Long version; public ApiUsageState() { super(); @@ -62,6 +63,7 @@ public class ApiUsageState extends BaseData implements HasTenan this.emailExecState = ur.getEmailExecState(); this.smsExecState = ur.getSmsExecState(); this.alarmExecState = ur.getAlarmExecState(); + this.version = ur.getVersion(); } public boolean isTransportEnabled() { @@ -95,4 +97,5 @@ public class ApiUsageState extends BaseData implements HasTenan public boolean isAlarmCreationEnabled() { return alarmExecState != ApiUsageStateValue.DISABLED; } + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ApiUsageStateEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ApiUsageStateEntity.java index 43b99dd7ac..2a65029742 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ApiUsageStateEntity.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ApiUsageStateEntity.java @@ -28,7 +28,7 @@ import org.thingsboard.server.common.data.id.ApiUsageStateId; import org.thingsboard.server.common.data.id.EntityIdFactory; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.model.BaseEntity; -import org.thingsboard.server.dao.model.BaseSqlEntity; +import org.thingsboard.server.dao.model.BaseVersionedEntity; import org.thingsboard.server.dao.model.ModelConstants; import java.util.UUID; @@ -40,7 +40,7 @@ import java.util.UUID; @EqualsAndHashCode(callSuper = true) @Entity @Table(name = ModelConstants.API_USAGE_STATE_TABLE_NAME) -public class ApiUsageStateEntity extends BaseSqlEntity implements BaseEntity { +public class ApiUsageStateEntity extends BaseVersionedEntity implements BaseEntity { @Column(name = ModelConstants.API_USAGE_STATE_TENANT_ID_COLUMN) private UUID tenantId; @@ -77,10 +77,7 @@ public class ApiUsageStateEntity extends BaseSqlEntity implements } public ApiUsageStateEntity(ApiUsageState ur) { - if (ur.getId() != null) { - this.setUuid(ur.getId().getId()); - } - this.setCreatedTime(ur.getCreatedTime()); + super(ur); if (ur.getTenantId() != null) { this.tenantId = ur.getTenantId().getId(); } @@ -116,6 +113,7 @@ public class ApiUsageStateEntity extends BaseSqlEntity implements ur.setEmailExecState(emailExecState); ur.setSmsExecState(smsExecState); ur.setAlarmExecState(alarmExecState); + ur.setVersion(version); return ur; } diff --git a/dao/src/main/resources/sql/schema-entities.sql b/dao/src/main/resources/sql/schema-entities.sql index 916a5487f8..71afc03081 100644 --- a/dao/src/main/resources/sql/schema-entities.sql +++ b/dao/src/main/resources/sql/schema-entities.sql @@ -702,6 +702,7 @@ CREATE TABLE IF NOT EXISTS api_usage_state ( email_exec varchar(32), sms_exec varchar(32), alarm_exec varchar(32), + version BIGINT DEFAULT 1, CONSTRAINT api_usage_state_unq_key UNIQUE (tenant_id, entity_id) ); From 4cd5e0369d3312b8b2579dbef9fc8af73bf9bda2 Mon Sep 17 00:00:00 2001 From: devaskim Date: Sun, 9 Feb 2025 17:32:36 +0500 Subject: [PATCH 053/100] Encode username/passwrod pair instead of decoding it while creating request. (cherry picked from commit 0cda72e6b2847c1baee498d2971bb3431b1d1895) --- .../java/org/thingsboard/rule/engine/rest/TbHttpClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java index 566430bd8d..b4f5c7f096 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java @@ -343,7 +343,7 @@ public class TbHttpClient { if (CredentialsType.BASIC == credentials.getType()) { BasicCredentials basicCredentials = (BasicCredentials) credentials; String authString = basicCredentials.getUsername() + ":" + basicCredentials.getPassword(); - String encodedAuthString = new String(Base64.getDecoder().decode(authString.getBytes(StandardCharsets.UTF_8))); + String encodedAuthString = new String(Base64.getEncoder().encode(authString.getBytes(StandardCharsets.UTF_8))); headers.add("Authorization", "Basic " + encodedAuthString); } } From 3860d79613fb3b34f186558c9e4cbd246f22c270 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 10 Feb 2025 18:42:25 +0200 Subject: [PATCH 054/100] Improved Edge handling in case connect/disconnect. Speed up initial setup --- .../instructions/upgrade/docker/upgrade_db.md | 17 ++----------- .../service/edge/rpc/EdgeGrpcService.java | 3 +++ .../service/edge/rpc/EdgeGrpcSession.java | 8 ++++-- .../dashboard/BaseDashboardProcessor.java | 5 +++- .../edge/rpc/sync/EdgeRequestsService.java | 5 ++++ .../server/edge/DashboardEdgeTest.java | 25 ++++++++++++++++--- .../provider/KafkaMonolithQueueFactory.java | 2 +- .../provider/KafkaTbCoreQueueFactory.java | 2 +- 8 files changed, 43 insertions(+), 24 deletions(-) diff --git a/application/src/main/data/json/edge/instructions/upgrade/docker/upgrade_db.md b/application/src/main/data/json/edge/instructions/upgrade/docker/upgrade_db.md index a594ebe4e7..386c5f2743 100644 --- a/application/src/main/data/json/edge/instructions/upgrade/docker/upgrade_db.md +++ b/application/src/main/data/json/edge/instructions/upgrade/docker/upgrade_db.md @@ -43,19 +43,6 @@ volumes: Execute the following command to start upgrade process: ```bash -docker compose -f docker-compose-upgrade.yml up +docker compose -f docker-compose-upgrade.yml up --abort-on-container-exit {:copy-code} -``` - -Once upgrade process successfully completed, exit from the docker-compose shell by this combination: - -```text -Ctrl + C -``` - -Execute the following command to stop TB Edge upgrade container: - -```bash -docker compose -f docker-compose-upgrade.yml stop -{:copy-code} -``` +``` \ No newline at end of file diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java index 73a504245d..471c47dafc 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java @@ -404,6 +404,9 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i private void scheduleEdgeEventsCheck(EdgeGrpcSession session) { EdgeId edgeId = session.getEdge().getId(); TenantId tenantId = session.getEdge().getTenantId(); + + cancelScheduleEdgeEventsCheck(edgeId); + if (sessions.containsKey(edgeId)) { ScheduledFuture edgeEventCheckTask = edgeEventProcessingExecutorService.schedule(() -> { try { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index 137c4d5bf5..b8cedf8a56 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -448,7 +448,11 @@ public abstract class EdgeGrpcSession implements Closeable { private void scheduleDownlinkMsgsPackSend(int attempt) { Runnable sendDownlinkMsgsTask = () -> { try { - if (isConnected() && !sessionState.getPendingMsgsMap().values().isEmpty()) { + if (!isConnected()) { + stopCurrentSendDownlinkMsgsTask(true); + return; + } + if (!sessionState.getPendingMsgsMap().values().isEmpty()) { List copy = new ArrayList<>(sessionState.getPendingMsgsMap().values()); if (attempt > 1) { String error = "Failed to deliver the batch"; @@ -525,11 +529,11 @@ public abstract class EdgeGrpcSession implements Closeable { private void onDownlinkResponse(DownlinkResponseMsg msg) { try { if (msg.getSuccess()) { - sessionState.getPendingMsgsMap().remove(msg.getDownlinkMsgId()); log.debug("[{}][{}][{}] Msg has been processed successfully! Msg Id: [{}], Msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg); } else { log.error("[{}][{}][{}] Msg processing failed! Msg Id: [{}], Error msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg.getErrorMsg()); } + sessionState.getPendingMsgsMap().remove(msg.getDownlinkMsgId()); if (sessionState.getPendingMsgsMap().isEmpty()) { log.debug("[{}][{}][{}] Pending msgs map is empty. Stopping current iteration", tenantId, edge.getId(), sessionId); stopCurrentSendDownlinkMsgsTask(false); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java index faf001fbba..39007552ad 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java @@ -41,7 +41,10 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { if (dashboard == null) { throw new RuntimeException("[{" + tenantId + "}] dashboardUpdateMsg {" + dashboardUpdateMsg + "} cannot be converted to dashboard"); } - Set newAssignedCustomers = new HashSet<>(dashboard.getAssignedCustomers()); + Set newAssignedCustomers = new HashSet<>(); + if (dashboard.getAssignedCustomers() != null && !dashboard.getAssignedCustomers().isEmpty()) { + newAssignedCustomers.addAll(dashboard.getAssignedCustomers()); + } Dashboard dashboardById = edgeCtx.getDashboardService().findDashboardById(tenantId, dashboardId); if (dashboardById == null) { created = true; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java index 6d47c16680..e04d4d01af 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java @@ -28,17 +28,22 @@ import org.thingsboard.server.gen.edge.v1.WidgetBundleTypesRequestMsg; public interface EdgeRequestsService { + @Deprecated(since = "3.9.1", forRemoval = true) ListenableFuture processRuleChainMetadataRequestMsg(TenantId tenantId, Edge edge, RuleChainMetadataRequestMsg ruleChainMetadataRequestMsg); ListenableFuture processAttributesRequestMsg(TenantId tenantId, Edge edge, AttributesRequestMsg attributesRequestMsg); ListenableFuture processRelationRequestMsg(TenantId tenantId, Edge edge, RelationRequestMsg relationRequestMsg); + @Deprecated(since = "3.9.1", forRemoval = true) ListenableFuture processDeviceCredentialsRequestMsg(TenantId tenantId, Edge edge, DeviceCredentialsRequestMsg deviceCredentialsRequestMsg); + @Deprecated(since = "3.9.1", forRemoval = true) ListenableFuture processUserCredentialsRequestMsg(TenantId tenantId, Edge edge, UserCredentialsRequestMsg userCredentialsRequestMsg); + @Deprecated(since = "3.9.1", forRemoval = true) ListenableFuture processWidgetBundleTypesRequestMsg(TenantId tenantId, Edge edge, WidgetBundleTypesRequestMsg widgetBundleTypesRequestMsg); + @Deprecated(since = "3.9.1", forRemoval = true) ListenableFuture processEntityViewsRequestMsg(TenantId tenantId, Edge edge, EntityViewsRequestMsg entityViewsRequestMsg); } diff --git a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java index 5b09e05a09..42b75b5a74 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java @@ -48,12 +48,14 @@ public class DashboardEdgeTest extends AbstractEdgeTest { private static final int MOBILE_ORDER = 5; private static final String IMAGE = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4Ij48cGF0aCBkPSJNMTMuMjMgMTAuNTZWMTBjLTEuOTQgMC0zLjk5LjM5LTMuOTkgMi42NyAwIDEuMTYuNjEgMS45NSAxLjYzIDEuOTUuNzYgMCAxLjQzLS40NyAxLjg2LTEuMjIuNTItLjkzLjUtMS44LjUtMi44NG0yLjcgNi41M2MtLjE4LjE2LS40My4xNy0uNjMuMDYtLjg5LS43NC0xLjA1LTEuMDgtMS41NC0xLjc5LTEuNDcgMS41LTIuNTEgMS45NS00LjQyIDEuOTUtMi4yNSAwLTQuMDEtMS4zOS00LjAxLTQuMTcgMC0yLjE4IDEuMTctMy42NCAyLjg2LTQuMzggMS40Ni0uNjQgMy40OS0uNzYgNS4wNC0uOTNWNy41YzAtLjY2LjA1LTEuNDEtLjMzLTEuOTYtLjMyLS40OS0uOTUtLjctMS41LS43LTEuMDIgMC0xLjkzLjUzLTIuMTUgMS42MS0uMDUuMjQtLjI1LjQ4LS40Ny40OWwtMi42LS4yOGMtLjIyLS4wNS0uNDYtLjIyLS40LS41Ni42LTMuMTUgMy40NS00LjEgNi00LjEgMS4zIDAgMyAuMzUgNC4wMyAxLjMzQzE3LjExIDQuNTUgMTcgNi4xOCAxNyA3Ljk1djQuMTdjMCAxLjI1LjUgMS44MSAxIDIuNDguMTcuMjUuMjEuNTQgMCAuNzFsLTIuMDYgMS43OGgtLjAxIj48L3BhdGg+PHBhdGggZD0iTTIwLjE2IDE5LjU0QzE4IDIxLjE0IDE0LjgyIDIyIDEyLjEgMjJjLTMuODEgMC03LjI1LTEuNDEtOS44NS0zLjc2LS4yLS4xOC0uMDItLjQzLjI1LS4yOSAyLjc4IDEuNjMgNi4yNSAyLjYxIDkuODMgMi42MSAyLjQxIDAgNS4wNy0uNSA3LjUxLTEuNTMuMzctLjE2LjY2LjI0LjMyLjUxIj48L3BhdGg+PHBhdGggZD0iTTIxLjA3IDE4LjVjLS4yOC0uMzYtMS44NS0uMTctMi41Ny0uMDgtLjE5LjAyLS4yMi0uMTYtLjAzLS4zIDEuMjQtLjg4IDMuMjktLjYyIDMuNTMtLjMzLjI0LjMtLjA3IDIuMzUtMS4yNCAzLjMyLS4xOC4xNi0uMzUuMDctLjI2LS4xMS4yNi0uNjcuODUtMi4xNC41Ny0yLjV6Ij48L3BhdGg+PC9zdmc+"; + private static final String DASHBOARD_TITLE = "Edge Test Dashboard"; + @Test public void testDashboards() throws Exception { // create dashboard and assign to edge edgeImitator.expectMessageAmount(2); Dashboard dashboard = new Dashboard(); - dashboard.setTitle("Edge Test Dashboard"); + dashboard.setTitle(DASHBOARD_TITLE); dashboard.setMobileHide(true); dashboard.setImage(IMAGE); dashboard.setMobileOrder(MOBILE_ORDER); @@ -200,12 +202,27 @@ public class DashboardEdgeTest extends AbstractEdgeTest { Dashboard foundDashboard = doGet("/api/dashboard/" + dashboard.getUuidId(), Dashboard.class); Assert.assertNotNull(foundDashboard); - Assert.assertEquals("Edge Test Dashboard", foundDashboard.getName()); + Assert.assertEquals(DASHBOARD_TITLE, foundDashboard.getName()); PageData pageData = doGetTypedWithPageLink("/api/customer/" + savedCustomer.getId().toString() + "/dashboards?", new TypeReference<>() {}, new PageLink(100)); Assert.assertEquals(1, pageData.getData().size()); - Assert.assertEquals("Edge Test Dashboard", pageData.getData().get(0).getTitle()); + Assert.assertEquals(DASHBOARD_TITLE, pageData.getData().get(0).getTitle()); + + dashboard.setTitle(DASHBOARD_TITLE + " Updated"); + dashboard.setAssignedCustomers(null); + dashboardUpdateMsgBuilder.setEntity(JacksonUtil.toString(dashboard)); + dashboardUpdateMsgBuilder.setMsgType(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE); + uplinkMsgBuilder = UplinkMsg.newBuilder(); + uplinkMsgBuilder.addDashboardUpdateMsg(dashboardUpdateMsgBuilder.build()); + + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsgBuilder.build()); + + Assert.assertTrue(edgeImitator.waitForResponses()); + + foundDashboard = doGet("/api/dashboard/" + dashboard.getUuidId(), Dashboard.class); + Assert.assertEquals(DASHBOARD_TITLE + " Updated", foundDashboard.getName()); } @Test @@ -256,7 +273,7 @@ public class DashboardEdgeTest extends AbstractEdgeTest { Dashboard dashboard = new Dashboard(); dashboard.setId(new DashboardId(UUID.randomUUID())); dashboard.setTenantId(tenantId); - dashboard.setTitle("Edge Test Dashboard"); + dashboard.setTitle(DASHBOARD_TITLE); dashboard.setAssignedCustomers(Sets.newHashSet(new ShortCustomerInfo(savedCustomer.getId(), savedCustomer.getTitle(), savedCustomer.isPublic()))); return dashboard; } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index dd5d61e834..cd9d577b86 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -472,7 +472,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName("tb_edge_event.notifications." + tenantId + "." + edgeId)); - consumerBuilder.clientId("monolith-to-edge-event-consumer" + serviceInfoProvider.getServiceId()); + consumerBuilder.clientId("monolith-to-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); consumerBuilder.groupId(topicService.buildTopicName("monolith-edge-event-consumer")); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdgeEventNotificationMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(edgeEventAdmin); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java index cc0e044917..dffb127c70 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java @@ -421,7 +421,7 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName("tb_edge_event.notifications." + tenantId + "." + edgeId)); - consumerBuilder.clientId("tb-core-edge-event-consumer" + serviceInfoProvider.getServiceId()); + consumerBuilder.clientId("tb-core-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); consumerBuilder.groupId(topicService.buildTopicName("tb-core-edge-event-consumer")); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdgeEventNotificationMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(edgeEventAdmin); From 1b4930ebafc27bd015fa432969235a56d8dfadce Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 10 Feb 2025 18:51:13 +0200 Subject: [PATCH 055/100] Introduced separate count for edge consumers --- .../server/queue/provider/KafkaMonolithQueueFactory.java | 3 ++- .../server/queue/provider/KafkaTbCoreQueueFactory.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index cd9d577b86..0767e5e303 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -96,6 +96,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi private final TbQueueAdmin edgeEventAdmin; private final AtomicLong consumerCount = new AtomicLong(); + private final AtomicLong edgeConsumerCount = new AtomicLong(); public KafkaMonolithQueueFactory(TopicService topicService, TbKafkaSettings kafkaSettings, TbServiceInfoProvider serviceInfoProvider, @@ -472,7 +473,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName("tb_edge_event.notifications." + tenantId + "." + edgeId)); - consumerBuilder.clientId("monolith-to-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.clientId("monolith-to-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + edgeConsumerCount.incrementAndGet()); consumerBuilder.groupId(topicService.buildTopicName("monolith-edge-event-consumer")); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdgeEventNotificationMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(edgeEventAdmin); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java index dffb127c70..06fd6147a8 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java @@ -95,6 +95,7 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { private final TbQueueAdmin edgeEventAdmin; private final AtomicLong consumerCount = new AtomicLong(); + private final AtomicLong edgeConsumerCount = new AtomicLong(); public KafkaTbCoreQueueFactory(TopicService topicService, TbKafkaSettings kafkaSettings, @@ -421,7 +422,7 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName("tb_edge_event.notifications." + tenantId + "." + edgeId)); - consumerBuilder.clientId("tb-core-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.clientId("tb-core-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + edgeConsumerCount.incrementAndGet()); consumerBuilder.groupId(topicService.buildTopicName("tb-core-edge-event-consumer")); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdgeEventNotificationMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(edgeEventAdmin); From 8a662076c3c4e8927b9dd815c99d03fb7da0d4b9 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Tue, 11 Feb 2025 08:07:36 +0200 Subject: [PATCH 056/100] ack failed downlink if its not timeseries or attibutes failures --- .../server/service/edge/rpc/EdgeGrpcSession.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index b8cedf8a56..2e4d5c8aa5 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -529,11 +529,16 @@ public abstract class EdgeGrpcSession implements Closeable { private void onDownlinkResponse(DownlinkResponseMsg msg) { try { if (msg.getSuccess()) { + sessionState.getPendingMsgsMap().remove(msg.getDownlinkMsgId()); log.debug("[{}][{}][{}] Msg has been processed successfully! Msg Id: [{}], Msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg); } else { log.error("[{}][{}][{}] Msg processing failed! Msg Id: [{}], Error msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg.getErrorMsg()); + DownlinkMsg downlinkMsg = sessionState.getPendingMsgsMap().get(msg.getDownlinkMsgId()); + // if NOT timeseries or attributes failures - ack failed downlink + if (downlinkMsg.getEntityDataCount() == 0) { + sessionState.getPendingMsgsMap().remove(msg.getDownlinkMsgId()); + } } - sessionState.getPendingMsgsMap().remove(msg.getDownlinkMsgId()); if (sessionState.getPendingMsgsMap().isEmpty()) { log.debug("[{}][{}][{}] Pending msgs map is empty. Stopping current iteration", tenantId, edge.getId(), sessionId); stopCurrentSendDownlinkMsgsTask(false); From a315f18195188f7b592dce46d65e4dca90b5606b Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Tue, 11 Feb 2025 08:40:40 +0200 Subject: [PATCH 057/100] Improved GeneralEdgeEventFetcher for case when seqId less maxRecordsReadSize --- .../rpc/fetch/GeneralEdgeEventFetcher.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/fetch/GeneralEdgeEventFetcher.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/fetch/GeneralEdgeEventFetcher.java index b2a1044981..93461f8c39 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/fetch/GeneralEdgeEventFetcher.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/fetch/GeneralEdgeEventFetcher.java @@ -54,23 +54,25 @@ public class GeneralEdgeEventFetcher implements EdgeEventFetcher { log.trace("[{}] Finding general edge events [{}], seqIdStart = {}, pageLink = {}", tenantId, edge.getId(), seqIdStart, pageLink); PageData edgeEvents = edgeEventService.findEdgeEvents(tenantId, edge.getId(), seqIdStart, null, (TimePageLink) pageLink); - if (edgeEvents.getData().isEmpty()) { + if (!edgeEvents.getData().isEmpty()) { + return edgeEvents; + } + if (seqIdStart > this.maxReadRecordsCount) { edgeEvents = edgeEventService.findEdgeEvents(tenantId, edge.getId(), 0L, Math.max(this.maxReadRecordsCount, seqIdStart - this.maxReadRecordsCount), (TimePageLink) pageLink); if (edgeEvents.getData().stream().anyMatch(ee -> ee.getSeqId() < seqIdStart)) { log.info("[{}] seqId column of edge_event table started new cycle [{}]", tenantId, edge.getId()); this.seqIdNewCycleStarted = true; this.seqIdStart = 0L; - } else { - edgeEvents = new PageData<>(); - log.warn("[{}] unexpected edge notification message received. " + - "no new events found and seqId column of edge_event table doesn't started new cycle [{}]", tenantId, edge.getId()); + return edgeEvents; } } - return edgeEvents; + log.info("[{}] Unexpected edge notification message received. " + + "No new events found, and the seqId column of the edge_event table has not started a new cycle [{}].", tenantId, edge.getId()); + return new PageData<>(); } catch (Exception e) { - log.error("[{}] failed to find edge events [{}]", tenantId, edge.getId()); + log.error("[{}] Failed to find edge events [{}]", tenantId, edge.getId(), e); + return new PageData<>(); } - return new PageData<>(); } } From 227c7d7a1564ba802f6e05a5dcde14d67192a0a7 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 11 Feb 2025 11:44:49 +0200 Subject: [PATCH 058/100] Remove Timescale deprecation comment --- application/src/main/resources/thingsboard.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 4301f0f211..507024ae0f 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -212,9 +212,9 @@ ui: database: ts_max_intervals: "${DATABASE_TS_MAX_INTERVALS:700}" # Max number of DB queries generated by a single API call to fetch telemetry records ts: - type: "${DATABASE_TS_TYPE:sql}" # cassandra or sql. timescale option is deprecated and will no longer be supported in ThingsBoard 4.0 + type: "${DATABASE_TS_TYPE:sql}" # cassandra, sql, or timescale (for hybrid mode, DATABASE_TS_TYPE value should be cassandra, or timescale) ts_latest: - type: "${DATABASE_TS_LATEST_TYPE:sql}" # cassandra or sql. timescale option is deprecated and will no longer be supported in ThingsBoard 4.0 + type: "${DATABASE_TS_LATEST_TYPE:sql}" # cassandra, sql, or timescale (for hybrid mode, DATABASE_TS_TYPE value should be cassandra, or timescale) # Cassandra driver configuration parameters cassandra: From 03e3391f6dc8b79f8050b02aaa4db500338f975a Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 11 Feb 2025 14:42:29 +0200 Subject: [PATCH 059/100] UI: Fixed incorrect liquid level widget config selector --- .../basic/indicator/liquid-level-card-basic-config.component.ts | 2 +- .../indicator/liquid-level-card-widget-settings.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.ts index 3f7baa5d7c..0b06c062ef 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.ts @@ -66,7 +66,7 @@ import { UtilsService } from '@core/services/utils.service'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ - selector: 'liquid-level-card-basic-config', + selector: 'tb-liquid-level-card-basic-config', templateUrl: './liquid-level-card-basic-config.component.html', styleUrls: ['../basic-config.scss'] }) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.ts index 70a163ac1a..11454392b4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.ts @@ -56,7 +56,7 @@ import { EntityService } from '@core/http/entity.service'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ - selector: 'liquid-level-card-widget-settings', + selector: 'tb-liquid-level-card-widget-settings', templateUrl: './liquid-level-card-widget-settings.component.html', styleUrls: [] }) From 796a7027a7d04b5a0e2a98e3cf54a45ff179a792 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 11 Feb 2025 15:26:29 +0200 Subject: [PATCH 060/100] UI: Fixed incorrect shape layout settings in liquid level widget --- .../indicator/liquid-level-card-basic-config.component.html | 2 +- .../indicator/liquid-level-card-widget-settings.component.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.html index 9808548bbe..a0776f5aa8 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.html @@ -63,7 +63,7 @@
        -
        +
        widgets.liquid-level-card.shape
        diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.html index a1aae64747..8d787116a8 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.html @@ -18,7 +18,7 @@
        -
        +
        widgets.liquid-level-card.shape
        From 7d00f4ed1db0301afbb1f800ed53d1de7de2e5f2 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 11 Feb 2025 18:36:26 +0200 Subject: [PATCH 061/100] UI: Fixed apply changes button enabled by default in Device Profile Transport configuration tab --- .../device/device-profile-transport-configuration.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/device-profile-transport-configuration.component.ts index 47d782dbdb..a295ef76ab 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/device-profile-transport-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/device-profile-transport-configuration.component.ts @@ -103,7 +103,7 @@ export class DeviceProfileTransportConfigurationComponent implements ControlValu delete configuration.type; } setTimeout(() => { - this.deviceProfileTransportConfigurationFormGroup.patchValue({configuration}); + this.deviceProfileTransportConfigurationFormGroup.patchValue({configuration}, {emitEvent: false}); }, 0); } From 79f856bdca8de91a8ba19cce7289cc1fc1eccf64 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Tue, 11 Feb 2025 18:10:49 +0100 Subject: [PATCH 062/100] fixed 'value too long' for saving TbResource audit logs --- .../server/service/resource/DefaultTbResourceService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java index e3a79a8ba5..5ff589fd2d 100644 --- a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java +++ b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java @@ -80,7 +80,7 @@ public class DefaultTbResourceService extends AbstractTbEntityService implements resource.setResourceKey(resource.getFileName()); } TbResource savedResource = resourceService.saveResource(resource); - logEntityActionService.logEntityAction(tenantId, savedResource.getId(), savedResource, actionType, user); + logEntityActionService.logEntityAction(tenantId, savedResource.getId(), new TbResourceInfo(savedResource), actionType, user); return savedResource; } catch (Exception e) { logEntityActionService.logEntityAction(tenantId, emptyId(EntityType.TB_RESOURCE), From 8d68f2bdbb619933384f3d49ce6ea9252733dc34 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 13 Feb 2025 14:44:33 +0200 Subject: [PATCH 063/100] UI: Imporove description for scada symbols --- .../main/data/json/system/scada_symbols/control-panel-hp.svg | 2 +- .../data/json/system/scada_symbols/horizontal-connector-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/leak-sensor.svg | 2 +- .../json/system/scada_symbols/left-analog-water-level-meter.svg | 2 +- .../src/main/data/json/system/scada_symbols/left-drain-pipe.svg | 2 +- .../data/json/system/scada_symbols/left-elbow-drain-pipe.svg | 2 +- .../main/data/json/system/scada_symbols/long-bottom-filter.svg | 2 +- .../json/system/scada_symbols/long-horizontal-connector-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/long-top-filter.svg | 2 +- .../json/system/scada_symbols/long-vertical-connector-hp.svg | 2 +- .../system/scada_symbols/right-analog-water-level-meter.svg | 2 +- .../main/data/json/system/scada_symbols/right-drain-pipe.svg | 2 +- .../data/json/system/scada_symbols/right-elbow-drain-pipe.svg | 2 +- .../main/data/json/system/scada_symbols/short-bottom-filter.svg | 2 +- .../data/json/system/scada_symbols/short-left-drain-pipe.svg | 2 +- .../data/json/system/scada_symbols/short-right-drain-pipe.svg | 2 +- .../main/data/json/system/scada_symbols/short-top-filter.svg | 2 +- .../data/json/system/scada_symbols/vertical-connector-hp.svg | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/application/src/main/data/json/system/scada_symbols/control-panel-hp.svg b/application/src/main/data/json/system/scada_symbols/control-panel-hp.svg index 630d0faa28..d9b0857156 100644 --- a/application/src/main/data/json/system/scada_symbols/control-panel-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/control-panel-hp.svg @@ -1,6 +1,6 @@ { "title": "HP Control panel", - "description": "Control panel", + "description": "Sends the command to the device or updates attribute/time series when the user pushes the button. Widget settings will enable you to configure behavior, how to fetch the initial state, and what to trigger when power on/off states.", "searchTags": [ "control" ], diff --git a/application/src/main/data/json/system/scada_symbols/horizontal-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/horizontal-connector-hp.svg index 3548d687c5..33b6c0a222 100644 --- a/application/src/main/data/json/system/scada_symbols/horizontal-connector-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/horizontal-connector-hp.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="200" fill="none" version="1.1" viewBox="0 0 200 200"><tb:metadata xmlns=""><![CDATA[{ "title": "HP Horizontal connector", - "description": "Horizontal connector", + "description": "Horizontal connector with an optional directional arrow to visually indicate flow.", "widgetSizeX": 1, "widgetSizeY": 1, "tags": [ diff --git a/application/src/main/data/json/system/scada_symbols/leak-sensor.svg b/application/src/main/data/json/system/scada_symbols/leak-sensor.svg index e2859ea90c..0fce8be608 100644 --- a/application/src/main/data/json/system/scada_symbols/leak-sensor.svg +++ b/application/src/main/data/json/system/scada_symbols/leak-sensor.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="100" height="100" fill="none" version="1.1" viewBox="0 0 100 100"><tb:metadata xmlns=""><![CDATA[{ "title": "Leak sensor", - "description": "Leak sensor", + "description": "Leak sensor for real-time detection and warning of fluid leakage.", "searchTags": [ "leak" ], diff --git a/application/src/main/data/json/system/scada_symbols/left-analog-water-level-meter.svg b/application/src/main/data/json/system/scada_symbols/left-analog-water-level-meter.svg index 18394d3d2c..2cdc9e587a 100644 --- a/application/src/main/data/json/system/scada_symbols/left-analog-water-level-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/left-analog-water-level-meter.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="200" fill="none" version="1.1" viewBox="0 0 200 200"><tb:metadata xmlns=""><![CDATA[{ "title": "Left analog water level meter", - "description": "Left analog water level meter", + "description": "Left analog water level meter with real-time display of fluid levels.", "searchTags": [ "water meter" ], diff --git a/application/src/main/data/json/system/scada_symbols/left-drain-pipe.svg b/application/src/main/data/json/system/scada_symbols/left-drain-pipe.svg index 326a263208..cb7bb26821 100644 --- a/application/src/main/data/json/system/scada_symbols/left-drain-pipe.svg +++ b/application/src/main/data/json/system/scada_symbols/left-drain-pipe.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="400" height="200" fill="none" version="1.1" viewBox="0 0 400 200"> <tb:metadata><![CDATA[{ "title": "Left drain pipe", - "description": "Left drain pipe", + "description": "Left drain pipe with configurable fluid and leak visualizations.", "searchTags": [ "pipe", "drain" diff --git a/application/src/main/data/json/system/scada_symbols/left-elbow-drain-pipe.svg b/application/src/main/data/json/system/scada_symbols/left-elbow-drain-pipe.svg index b9a6aa6057..085830c5e4 100644 --- a/application/src/main/data/json/system/scada_symbols/left-elbow-drain-pipe.svg +++ b/application/src/main/data/json/system/scada_symbols/left-elbow-drain-pipe.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="400" height="200" fill="none" version="1.1" viewBox="0 0 400 200"> <tb:metadata xmlns=""><![CDATA[{ "title": "Left elbow drain pipe", - "description": "Left elbow drain pipe", + "description": "Left elbow drain pipe with configurable fluid and leak visualizations.", "searchTags": [ "pipe", "drain" diff --git a/application/src/main/data/json/system/scada_symbols/long-bottom-filter.svg b/application/src/main/data/json/system/scada_symbols/long-bottom-filter.svg index d9defd33d9..689851529d 100644 --- a/application/src/main/data/json/system/scada_symbols/long-bottom-filter.svg +++ b/application/src/main/data/json/system/scada_symbols/long-bottom-filter.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="600" fill="none" version="1.1" viewBox="0 0 200 600"> <tb:metadata xmlns=""><![CDATA[{ - "title": "Long bottom filter", + "title": "Long bottom filter with configurable click actions for custom operations, dashboard manipulation, etc.", "description": "Long bottom filter", "searchTags": [ "filter" diff --git a/application/src/main/data/json/system/scada_symbols/long-horizontal-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/long-horizontal-connector-hp.svg index 4376bb2348..86bb07a520 100644 --- a/application/src/main/data/json/system/scada_symbols/long-horizontal-connector-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/long-horizontal-connector-hp.svg @@ -1,7 +1,7 @@ <svg width="400" height="200" fill="none" version="1.1" viewBox="0 0 400 200" xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg"> <tb:metadata><![CDATA[{ "title": "HP Long horizontal connector", - "description": "Long horizontal connector", + "description": "Long horizontal connector with an optional directional arrow to visually indicate flow.", "widgetSizeX": 2, "widgetSizeY": 1, "tags": [ diff --git a/application/src/main/data/json/system/scada_symbols/long-top-filter.svg b/application/src/main/data/json/system/scada_symbols/long-top-filter.svg index a63b679f0a..9b287cbe46 100644 --- a/application/src/main/data/json/system/scada_symbols/long-top-filter.svg +++ b/application/src/main/data/json/system/scada_symbols/long-top-filter.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="600" fill="none" version="1.1" viewBox="0 0 200 600"> <tb:metadata xmlns=""><![CDATA[{ - "title": "Long top filter", + "title": "Long top filter with configurable click actions for custom operations, dashboard manipulation, etc.", "description": "Title\nLong top filter\n", "searchTags": [ "filter" diff --git a/application/src/main/data/json/system/scada_symbols/long-vertical-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/long-vertical-connector-hp.svg index 86235ff1c1..d7a0aa8aa7 100644 --- a/application/src/main/data/json/system/scada_symbols/long-vertical-connector-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/long-vertical-connector-hp.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="400" fill="none" version="1.1" viewBox="0 0 200 400"><tb:metadata xmlns=""><![CDATA[{ "title": "HP Long vertical connector", - "description": "Long vertical connector", + "description": "Long vertical connector with an optional directional arrow to visually indicate flow.", "widgetSizeX": 1, "widgetSizeY": 2, "tags": [ diff --git a/application/src/main/data/json/system/scada_symbols/right-analog-water-level-meter.svg b/application/src/main/data/json/system/scada_symbols/right-analog-water-level-meter.svg index 4bd6754f5c..1b1be4f007 100644 --- a/application/src/main/data/json/system/scada_symbols/right-analog-water-level-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/right-analog-water-level-meter.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="200" fill="none" version="1.1" viewBox="0 0 200 200"><tb:metadata xmlns=""><![CDATA[{ "title": "Right analog water level meter", - "description": "Right analog water level meter", + "description": "Right analog water level meter with real-time display of fluid levels.", "searchTags": [ "water meter" ], diff --git a/application/src/main/data/json/system/scada_symbols/right-drain-pipe.svg b/application/src/main/data/json/system/scada_symbols/right-drain-pipe.svg index 093078c69b..a990e023e1 100644 --- a/application/src/main/data/json/system/scada_symbols/right-drain-pipe.svg +++ b/application/src/main/data/json/system/scada_symbols/right-drain-pipe.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="400" height="200" fill="none" version="1.1" viewBox="0 0 400 200"><tb:metadata xmlns=""><![CDATA[{ "title": "Right drain pipe", - "description": "Right drain pipe", + "description": "Right drain pipe with configurable fluid and leak visualizations.", "searchTags": [ "pipe", "drain" diff --git a/application/src/main/data/json/system/scada_symbols/right-elbow-drain-pipe.svg b/application/src/main/data/json/system/scada_symbols/right-elbow-drain-pipe.svg index 63b143eeef..6f5ae5abb9 100644 --- a/application/src/main/data/json/system/scada_symbols/right-elbow-drain-pipe.svg +++ b/application/src/main/data/json/system/scada_symbols/right-elbow-drain-pipe.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="400" height="200" fill="none" version="1.1" viewBox="0 0 400 200"> <tb:metadata xmlns=""><![CDATA[{ "title": "Right elbow drain pipe", - "description": "Right elbow drain pipe", + "description": "Right elbow drain pipe with configurable fluid and leak visualizations.", "searchTags": [ "pipe", "drain" diff --git a/application/src/main/data/json/system/scada_symbols/short-bottom-filter.svg b/application/src/main/data/json/system/scada_symbols/short-bottom-filter.svg index b3235c5906..cf191d40fe 100644 --- a/application/src/main/data/json/system/scada_symbols/short-bottom-filter.svg +++ b/application/src/main/data/json/system/scada_symbols/short-bottom-filter.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="400" fill="none" version="1.1" viewBox="0 0 200 400"> <tb:metadata xmlns=""><![CDATA[{ "title": "Short bottom filter", - "description": "Short bottom filter", + "description": "Short bottom filter with configurable click actions for custom operations, dashboard manipulation, etc.", "searchTags": [ "filter" ], diff --git a/application/src/main/data/json/system/scada_symbols/short-left-drain-pipe.svg b/application/src/main/data/json/system/scada_symbols/short-left-drain-pipe.svg index abf43aacb9..da2273d096 100644 --- a/application/src/main/data/json/system/scada_symbols/short-left-drain-pipe.svg +++ b/application/src/main/data/json/system/scada_symbols/short-left-drain-pipe.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="200" fill="none" version="1.1" viewBox="0 0 200 200"> <tb:metadata><![CDATA[{ "title": "Short left drain pipe", - "description": "Short left drain pipe", + "description": "Short left drain pipe with configurable fluid and leak visualizations.", "searchTags": [ "pipe", "drain" diff --git a/application/src/main/data/json/system/scada_symbols/short-right-drain-pipe.svg b/application/src/main/data/json/system/scada_symbols/short-right-drain-pipe.svg index 1b2ae3934a..1e01fe8b77 100644 --- a/application/src/main/data/json/system/scada_symbols/short-right-drain-pipe.svg +++ b/application/src/main/data/json/system/scada_symbols/short-right-drain-pipe.svg @@ -1,7 +1,7 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="200" fill="none" version="1.1" viewBox="0 0 200 200"> <tb:metadata><![CDATA[{ "title": "Short right drain pipe", - "description": "Short right drain pipe", + "description": "Short right drain pipe with configurable fluid and leak visualizations.", "searchTags": [ "pipe", "drain" diff --git a/application/src/main/data/json/system/scada_symbols/short-top-filter.svg b/application/src/main/data/json/system/scada_symbols/short-top-filter.svg index d50eada2aa..0a77c78f00 100644 --- a/application/src/main/data/json/system/scada_symbols/short-top-filter.svg +++ b/application/src/main/data/json/system/scada_symbols/short-top-filter.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="400" fill="none" version="1.1" viewBox="0 0 200 400"> <tb:metadata xmlns=""><![CDATA[{ - "title": "Short top filter", + "title": "Short top filter with configurable click actions for custom operations, dashboard manipulation, etc.", "description": "Short top filter", "searchTags": [ "filter" diff --git a/application/src/main/data/json/system/scada_symbols/vertical-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/vertical-connector-hp.svg index aea94b0dd2..6ce9336fee 100644 --- a/application/src/main/data/json/system/scada_symbols/vertical-connector-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/vertical-connector-hp.svg @@ -1,6 +1,6 @@ <svg xmlns="http://www.w3.org/2000/svg" xmlns:tb="https://thingsboard.io/svg" width="200" height="200" fill="none" version="1.1" viewBox="0 0 200 200"><tb:metadata xmlns=""><![CDATA[{ "title": "HP Vertical connector", - "description": "Vertical connector", + "description": "Vertical connector with an optional directional arrow to visually indicate flow.", "widgetSizeX": 1, "widgetSizeY": 1, "tags": [ From d2389817a48d69063f18fcc705b65131e09162ad Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko <Dgerik2015@gmail.com> Date: Thu, 13 Feb 2025 15:00:44 +0200 Subject: [PATCH 064/100] UI: Fixed scada bundle order and add hook to general --- .../widget_bundles/general_high_performance_scada_symbols.json | 1 + .../widget_bundles/high_performance_scada_fluid_system.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json b/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json index 33efaacc0c..97768915f7 100644 --- a/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json +++ b/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json @@ -29,6 +29,7 @@ "hp_top_tee_connector", "hp_drawwork", "hp_crane", + "hp_hook", "hp_consumers", "hp_house", "hp_apartments", diff --git a/application/src/main/data/json/system/widget_bundles/high_performance_scada_fluid_system.json b/application/src/main/data/json/system/widget_bundles/high_performance_scada_fluid_system.json index 1e41b22446..29a0571dfa 100644 --- a/application/src/main/data/json/system/widget_bundles/high_performance_scada_fluid_system.json +++ b/application/src/main/data/json/system/widget_bundles/high_performance_scada_fluid_system.json @@ -5,7 +5,7 @@ "image": "tb-image:aHBfc2NhZGFfZmx1aWRfc3lzdGVtX2J1bmRsZV9pbWFnZS5wbmc=:IkhpZ2gtcGVyZm9ybWFuY2UgU0NBREEgZmx1aWQgc3lzdGVtIiBzeXN0ZW0gYnVuZGxlIGltYWdl:SU1BR0U=;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAMAAAB+IdObAAABNVBMVEXe3t7f39/X19cAAADf39/e3t7f39/e3t7e3t7////I3/fr6+vHx8esrKzj4+OcrsHT0tKVlZWvr6/Kysrx8fF0dHT9/f24uLjBwcHc29v39/etra27u7ubm5vt7e2/v7/Dw8OysrKqqqq+1ev6+vrE2/Lh4eHV1dWoqKiQkJCmpqa1yt+2trbu7e2YmJi/1eyurq7B2O9ycXFlZWXT09Ojo6PMzMzIyMjm5eWBgYGenp78/Py0tLSTk5OLi4uwxdq6z+Wous6ioqKGhoZjY2OgoKBoaGheXl5WVlasv9SorrR/fn7R0dGlpaVSUlKhrr13d3evuseTpLWWoq+fn59sbGw+Pj6rv9Tv8veitci4uryAk7vf5O7P1+WQocRgeasvLy8hISG/yd2frsx/k7tvhrNAXZmZOz+XAAAACHRSTlPvICAAv7Cvv9cI9yEAAAzySURBVHja7JttT9pQGIaNe8lTejg9dDRqJEElwFxNN1lIZNko3RrRuoAvUaOf/P+/YkecPq0v0PY5lZZ48dUvV06vm54Ylt4tv1+CovNx+d3ScvE1JFLjAywE8R6rNcg9SzNEama36/R/raxLVmazsfrTrMFcmCYiNrdAb7VX6ht6u91e0+MhdkwGBNSLdDd0ZK/V0mOzYwIBxSLiJ+hhEc71+EBdAAGVIuKzTuIzwUSpyKoeZa/FE5oAAXUijo609D0UiQ+hE3UiTOhIvf5Jb0kSimwIoEIX2dTDIp9wfpOwCXGpHHyfwqiSXgSHNzy/mR1J5RtMYT29SE1HEseOmHMX+aIroT53kdVnToTvJRbZmbtINJE1+bl9tAooYpTCGIZbakhKSTFyJnLlHZZs2x4UXmRC8+vXRRHZXQwRyWKILMCJNO2GvRAiJds7VDy/XZqImVLEHaie35s/LCrSX59CPyrChhe5mV+LW1ZYhVUi+H4lAgNEHPWqVm5itzSN+87LybwcRd9nmmblZn4tTbJ1YCYVMc9XNEmuTuSW7WOWRIQNt6saRWTQcKXIblO5iMatIzZbBOPQNJLIlYHzq1REwg+ceCLObRxEEdt2cX7VikxSqc0WMc+3NMTKz/xqYbb32XQRti/j+E8uY9cwlSki4qjDtRC5m98wbUzlsYjTmcRRiBO5S4U9J2IOMQ6yiDvwshfRqg+poAg7xjhUiGQ4v09TQRFx5GMcKkQuB3amIgg7cFCkG42jAPMbSWXI7kTM4Q/tnkLFfg+XqVQq4tE3R2HmNwzvXYwmcRT7RKSI3+v1MhFxB/YriOAKi8lLCVcu0jyV8zuwbfs1RH4MzfvLR1n5iTQbrza/nS7+kTPKZn53s3u0MA4BYXoWL2DsVbz4Rt7fiza/ZRnHM7BRuVAnwjoOPAJTaSubX9vNVoR3MI6nCEyFKpLp/OL7O/I0FTUijUGG81s+N2EmtVE5540w34FYOCOeY5FqD+OYBZOp5HR+q9tDBnHAi28uT6SGccTFHJVJV91LT70I8/uQAsfn6UUOPeXzi3EkhVkWTytiN1XP7wXGkRz25+a1G/HgBUwg0Y0tMi49It3/R04gW2aLnJSUcAY06CLf1Dxa10CDLiK8yPy6V6lEPCBCF4Egslqul2p+AyBCF4keSVN+Usyvy4AKXQQCeiMVoEMXgbOnIjne3iki4ow4vX+BAF0EEScYRTPpF2JjTPWgiyDB+OHSnvDR8n4DGboIwoKxO9nfRPPbOAsIx6FWBLkOxieeYRinEmM243EQXMNcWIgfuL6J5JE3kX/tneeu0zAUgEEsH8mx3MY0o0naRIiEqK0Q6oDS3h8gJCRA4gcgJJaY7/8I2Bk9GaVJKKOMD6Gbyy3H/myfeKSFU+O/yKnxj4nw/uzBIjY0yY07Dx9eXWuHwHOn1cigPwt/3lWEznyNQRFhrNchfBONZMyn8BOZrjqJPPEp7CNcU9Ek4sNPZdRehJ+5Ar4J1dhhEQo/Fae1iB8LOAilv1OEthSh9xk0wW6wkxd5EkEbAu3ERbCpG2BrccIifCugNWvWKEL38QtE+Ay6ELAGkRXsQYQ/UQQ9jjCpi9D9FfnpIlvoSiBOUWTfJCiCReDOegs36E8Y1Fn/aBERjkeSMRXfLfKE1YJGwU1Odty8Y9Zf4vxIEToynbxAZ9MPv0uEbqp1dM84qdA7q6pQ2kbk7ds3r941icwnlfKk13eIONWXu0nYobudbYLI37oPku/9auy1aBZ5+eHdS3h1WOR6psEN3/dHw8wp9rqKzBiUmDkq6MRl4N2GBBb0VAh6j1WyqFkE3nyCj68PivRp0prBZumAIlxqwySW3lEkKtfuPpcaQVrkLpTJHBXELZsYorlHvrx6/flQjogg0RipUHwKKSvfT2rGuoj4rBT3hgqbu9lzSOEAgVs3oUcnO1NRaV8ANlz6NaZqeLEOIuVM36raziHHyr6ogKxuEoruInUPf1eeZUOCqX4UYys3idQzJOayro91LMgqtJTo8erUuT5SZKIG0AQkaCDh6RSgfijaiiygQECTNvfQhKfxsb94/ANF/KSqnlkRsTzYmTgtRSgtzR+E9JjKDRUQ+2JqFTLoJgNE0GNEGE3TAE0sq9huIiaE83YipfaN08kxM8HGMSBjeuMmIfehgEYVd2oiId2xWtEcBiVcQugU6g3HIWOywho2iCwAYT4hdwBKJrYuf1tYTF92CS3VpQSFDpgqm3fFoYju5e3G1bGJ2UaEG+XAONI8fRcZPTwQi3K+U7pfhF2XvyTXQwbXc+ZiUDnc8fcUhwPATAZJ3EakzwCRCXADv7PSaX2FGTJnAKpLFgKQJ3tFBtg188G4cA1ISIutfZtnItgh6mKCWXJQxAWE3ZTfr1Y611M7007Hq14qit4kfALIep/IoCBy/S6KjAdooppkONRNa5pVe5rlZC5nKiHhELJqIfKsfE9/wLIq65ZKjzS+hR5ZVtwDZNbUI3URHFkaqAzUzUTCSEXyDsk2DiuVx80ii/Kk7gKOWWt6ezq7f3b/eRpQqqXcI+SsqL+3R+4mF04ick2KCMaYkCJ3YYD7GRxZti7DexaEdNTPytFZ5k4IZ00imEjY1IhlPTWXkhtMleQVat4DRPu2yNX3N3IR9uL9C6ZEsEsoITzEOJ6hjx2RnwbYppf7qkxqFgkAmWVeaGYuN+tgubwDlr4rzzyjZMhgh0P3iVyTF/Tq1athJgLsIVPNe21QHFlDKOKNpICdDDEsz7YiQkbNIhogvcwLRZb9W7duPVk+mHhZUH1uAXMIDWv333qP5CiRDCUyqN98cQVq3LolNYYGyy24afuEOEeKnC23UuTRcnJPl8xlSmY3N0qbRK7tEykPLT1taYTC9JaEwcaTWCtT1201lI8SsT2+4jeWaxl4uwywA9qK3G0WCasiI/CUiAWxxbk1tUHSWsQAZJFuFr2VPuf6bds2by2Xs0f3zWW2uMKaDxuH1mBOM5zJtcfjnMe1oZXdf2V36w8A4lu3eri07CISlyd2Vw6hbHNzW7fZ2VKhjaGIIacb0XTXGly7Zmdcu3b32u5yUBLpA9N1k6czoe456eqXQolRq2SfAfIA76vZ7ZY9DZabO2fGFMod5wISVETQJOPu3bvXdqCHmiDo0MrLM+QVc0DiLKGIuCnDNosMAYlwFTU1IcHUYip0sOa8tCZ5AIj/DZHB3UGKvM5c7qo/Km1GJvnqx0yL1YaU+oybhZabq+mmWSQqD35OS6sR3bO8dKniWTqfZrmuykee1UWQpNpKJQcK4H1Vz8ozwEzXvNzUp7gic9osUQQgZ8mmCT2mLN1XWdM8J7m+imQ3sqa1VkVnv8hKVlFkq+p8tWvmu0RbupiWZytdret+xE/3sVMd8gYCj+3WwbiLXAMSOs0iWbdABc4J2aBHUu4K18GS2xbv4c7qoAjxK+v4e+iRDSsF6m4ooQEgwRE7xE1y17QK7QYcKg3nYhUPi7hQ4J468tMho3AOYJvl3TDy7Mit7mbXbrqHxfV3L+Etd4ikTwFhMrO2Aj0kenknuiblDmGLI0TUMHUmUOgQmNupiYHt5rM2IpWF24bjIYkBeWQ0iWllqT8mx4hwjidwlpcYlBtObXRNaCfiisqJKe9hYDxBkaGVR/XM9P5RIuAQvAUXv2RHXSFGbBbhQfUslm9FIaKBk/2aVk4rgNLjRESc/51pLmLnJoa9wmPsBpF6uuNJNa+cKwNTzxucMexN9e4imAQkYjiEbX0nqWao1RRai/CgbnLzbOSBAg+wXRV3MYEiGj1GBE10E0wsLuXxSHlc7/TESpRD3+BE/bNEIaRwO3uoiM8bcL18tAiwmEjcZ3hSgA8V/Wm3Z4g+lIkfEInj3otoyBjdLtybSSW3AkpE9FgRhUh3/X6fpuFNMR/FPBkqrOvD0GrxTMVWcOfm7jKovWpGjhFBTJ8k3BxNJuNJ5PDsIXX35+xxTT281+ME4cMtBQQf0h0tgioIPlTsKoIbDEQY99wHQ2M8HvbkGNsT1SXHiyCm5nCSwZ1gggV2EuEx7IWFNGSwl4g2iHSGjkYOpY4zDo94Uw2NoAN1j9N54xmNunqcqAihbjePkxUhfMugHWJGyQmLEOI2VQOn/tMWIdQV0EjkEHLqIqQXOE2h1i4/EGADP5XHLUVcIceNBg3vjd8eEIkF/ESE3yyC7whkgcH2h9Eo2y30u+fZ8cw3pJUIjbDhjWp9Qk2jIr/uH/wETQPumO7FeNJvgLf93/dKFTccQ9ZdoRmBpoVQYEPJd4J7pTrXV6SBBpF4lBBpddY3JFqdaJRwg3QEPZpNuoss4HsZk248mUwieoBgMknT+dRFaNvP7PwFIph93UUi7Xs5I92IaCMRac25v+UTlecukr+CS+fO/xVdIjUunL9M/nTOXTl/4St0s1h4GZ5DIgAAAABJRU5ErkJggg==", "scada": true, "description": "Bundle with high-performance SCADA symbols for fluid system", - "order": 9350, + "order": 9415, "name": "High-performance SCADA fluid system" }, "widgetTypeFqns": [ From a460570c449adf9a11e23ed9ea4701a3872f0d06 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko <Dgerik2015@gmail.com> Date: Thu, 13 Feb 2025 15:24:12 +0200 Subject: [PATCH 065/100] UI: Fixed scale symbol units --- .../json/system/scada_symbols/dynamic-vertical-scale-hp.svg | 2 +- .../data/json/system/scada_symbols/simple-vertical-scale-hp.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg b/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg index 98185cbc8d..960abed340 100644 --- a/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg @@ -776,7 +776,7 @@ } ] } -Outdoor°C +Outdoor°C diff --git a/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg b/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg index bfc356cca2..fa0c0fc4d1 100644 --- a/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg @@ -704,7 +704,7 @@ } ] }]]> -Outdoor°C +Outdoor°C From fc513c5a5c8b59e11af95f5822f92693639087ab Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Thu, 13 Feb 2025 15:39:38 +0200 Subject: [PATCH 066/100] Add bundles to widget-type-info --- .../server/controller/BaseController.java | 5 ++ .../controller/WidgetTypeController.java | 2 +- .../server/dao/widget/WidgetTypeService.java | 2 + .../common/data/widget/WidgetTypeInfo.java | 24 +++++++ .../server/dao/model/ModelConstants.java | 1 + .../dao/model/sql/WidgetTypeInfoEntity.java | 9 +++ .../dao/sql/widget/JpaWidgetTypeDao.java | 5 ++ .../mapping/AbstractEntityInfosConverter.java | 71 +++++++++++++++++++ .../WidgetBundleEntityInfosConverter.java | 29 ++++++++ .../server/dao/widget/WidgetTypeDao.java | 2 + .../dao/widget/WidgetTypeServiceImpl.java | 7 ++ .../sql/schema-views-and-functions.sql | 11 ++- 12 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java diff --git a/application/src/main/java/org/thingsboard/server/controller/BaseController.java b/application/src/main/java/org/thingsboard/server/controller/BaseController.java index dbe430ba18..2b248e57b3 100644 --- a/application/src/main/java/org/thingsboard/server/controller/BaseController.java +++ b/application/src/main/java/org/thingsboard/server/controller/BaseController.java @@ -125,6 +125,7 @@ import org.thingsboard.server.common.data.rule.RuleNode; import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.common.data.util.ThrowingBiFunction; import org.thingsboard.server.common.data.widget.WidgetTypeDetails; +import org.thingsboard.server.common.data.widget.WidgetTypeInfo; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.dao.alarm.AlarmCommentService; import org.thingsboard.server.dao.asset.AssetProfileService; @@ -759,6 +760,10 @@ public abstract class BaseController { return checkEntityId(widgetTypeId, widgetTypeService::findWidgetTypeDetailsById, operation); } + WidgetTypeInfo checkWidgetTypeInfoId(WidgetTypeId widgetTypeId, Operation operation) throws ThingsboardException { + return checkEntityId(widgetTypeId, widgetTypeService::findWidgetTypeInfoById, operation); + } + Dashboard checkDashboardId(DashboardId dashboardId, Operation operation) throws ThingsboardException { return checkEntityId(dashboardId, dashboardService::findDashboardById, operation); } diff --git a/application/src/main/java/org/thingsboard/server/controller/WidgetTypeController.java b/application/src/main/java/org/thingsboard/server/controller/WidgetTypeController.java index e4973a71c3..2c61ecac79 100644 --- a/application/src/main/java/org/thingsboard/server/controller/WidgetTypeController.java +++ b/application/src/main/java/org/thingsboard/server/controller/WidgetTypeController.java @@ -118,7 +118,7 @@ public class WidgetTypeController extends AutoCommitController { @PathVariable("widgetTypeId") String strWidgetTypeId) throws ThingsboardException { checkParameter("widgetTypeId", strWidgetTypeId); WidgetTypeId widgetTypeId = new WidgetTypeId(toUUID(strWidgetTypeId)); - return new WidgetTypeInfo(checkWidgetTypeId(widgetTypeId, Operation.READ)); + return checkWidgetTypeInfoId(widgetTypeId, Operation.READ); } @ApiOperation(value = "Create Or Update Widget Type (saveWidgetType)", diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeService.java index 9cad249787..c592777142 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeService.java @@ -35,6 +35,8 @@ public interface WidgetTypeService extends EntityDaoService { WidgetTypeDetails findWidgetTypeDetailsById(TenantId tenantId, WidgetTypeId widgetTypeId); + WidgetTypeInfo findWidgetTypeInfoById(TenantId tenantId, WidgetTypeId widgetTypeId); + boolean widgetTypeExistsByTenantIdAndWidgetTypeId(TenantId tenantId, WidgetTypeId widgetTypeId); WidgetTypeDetails saveWidgetType(WidgetTypeDetails widgetType); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java index 1ce8ad6ddc..2ea98f0c17 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java @@ -16,13 +16,22 @@ package org.thingsboard.server.common.data.widget; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; import lombok.Data; +import org.thingsboard.server.common.data.EntityInfo; import org.thingsboard.server.common.data.id.WidgetTypeId; import org.thingsboard.server.common.data.validation.NoXss; +import java.io.Serial; +import java.util.Collections; +import java.util.List; + @Data public class WidgetTypeInfo extends BaseWidgetType { + @Serial + private static final long serialVersionUID = 1343617007959780969L; + @Schema(description = "Base64 encoded widget thumbnail", accessMode = Schema.AccessMode.READ_ONLY) private String image; @NoXss @@ -34,6 +43,9 @@ public class WidgetTypeInfo extends BaseWidgetType { @NoXss @Schema(description = "Type of the widget (timeseries, latest, control, alarm or static)", accessMode = Schema.AccessMode.READ_ONLY) private String widgetType; + @Valid + @Schema(description = "Bundles", accessMode = Schema.AccessMode.READ_ONLY) + private List bundles; public WidgetTypeInfo() { super(); @@ -53,6 +65,16 @@ public class WidgetTypeInfo extends BaseWidgetType { this.description = widgetTypeInfo.getDescription(); this.tags = widgetTypeInfo.getTags(); this.widgetType = widgetTypeInfo.getWidgetType(); + this.bundles = Collections.emptyList(); + } + + public WidgetTypeInfo(WidgetTypeInfo widgetTypeInfo, List bundles) { + super(widgetTypeInfo); + this.image = widgetTypeInfo.getImage(); + this.description = widgetTypeInfo.getDescription(); + this.tags = widgetTypeInfo.getTags(); + this.widgetType = widgetTypeInfo.getWidgetType(); + this.bundles = bundles; } public WidgetTypeInfo(WidgetTypeDetails widgetTypeDetails) { @@ -65,5 +87,7 @@ public class WidgetTypeInfo extends BaseWidgetType { } else { this.widgetType = ""; } + this.bundles = Collections.emptyList(); } + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java index d404c3128c..9628935b55 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java @@ -312,6 +312,7 @@ public class ModelConstants { public static final String WIDGETS_BUNDLE_SCADA_PROPERTY = "scada"; public static final String WIDGETS_BUNDLE_DESCRIPTION = "description"; public static final String WIDGETS_BUNDLE_ORDER = "widgets_bundle_order"; + public static final String WIDGET_BUNDLES_PROPERTY = "bundles"; /** * Widget_type constants. diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java index 7a9e7f35bc..c503632b91 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java @@ -17,17 +17,21 @@ package org.thingsboard.server.dao.model.sql; import io.hypersistence.utils.hibernate.type.array.StringArrayType; import jakarta.persistence.Column; +import jakarta.persistence.Convert; import jakarta.persistence.Entity; import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import org.hibernate.annotations.Immutable; import org.hibernate.annotations.Type; +import org.thingsboard.server.common.data.EntityInfo; import org.thingsboard.server.common.data.widget.BaseWidgetType; import org.thingsboard.server.common.data.widget.WidgetTypeInfo; import org.thingsboard.server.dao.model.ModelConstants; +import org.thingsboard.server.dao.util.mapping.WidgetBundleEntityInfosConverter; import java.util.HashMap; +import java.util.List; import java.util.Map; @Data @@ -58,6 +62,10 @@ public class WidgetTypeInfoEntity extends AbstractWidgetTypeEntity bundles; + public WidgetTypeInfoEntity() { super(); } @@ -70,6 +78,7 @@ public class WidgetTypeInfoEntity extends AbstractWidgetTypeEntity findSystemWidgetTypes(WidgetTypeFilter widgetTypeFilter, PageLink pageLink) { boolean deprecatedFilterEnabled = !DeprecatedFilter.ALL.equals(widgetTypeFilter.getDeprecatedFilter()); diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java new file mode 100644 index 0000000000..b829060f54 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java @@ -0,0 +1,71 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.util.mapping; + +import com.fasterxml.jackson.databind.JsonNode; +import jakarta.persistence.AttributeConverter; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.EntityInfo; +import org.thingsboard.server.common.data.EntityType; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public abstract class AbstractEntityInfosConverter implements AttributeConverter, String> { + + protected abstract EntityType getEntityType(); + + @Override + public String convertToDatabaseColumn(List attribute) { + throw new IllegalArgumentException("Not implemented!"); + } + + @Override + public List convertToEntityAttribute(String s) { + try { + JsonNode node = JacksonUtil.fromBytes(s.getBytes(StandardCharsets.UTF_8)); + if (node.isArray()) { + List entities = new ArrayList<>(); + for (int i = 0; i < node.size(); i++) { + JsonNode row = node.get(i); + UUID id = null; + String name = null; + JsonNode idNode = row.get("id"); + JsonNode nameNode = row.get("name"); + if (idNode != null && nameNode != null) { + try { + id = UUID.fromString(idNode.asText()); + } catch (Exception ignored) {} + name = nameNode.asText(); + } + if (id != null && name != null) { + entities.add(new EntityInfo(id, EntityType.WIDGETS_BUNDLE.name(), name)); + } + } + return entities; + } else { + return Collections.emptyList(); + } + } catch (Exception ex) { + String exception = String.format("Failed to convert String to %s list: %s", getEntityType(), ex.getMessage()); + throw new RuntimeException(exception, ex); + } + } + +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java new file mode 100644 index 0000000000..143de09818 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java @@ -0,0 +1,29 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.util.mapping; + +import jakarta.persistence.Converter; +import org.thingsboard.server.common.data.EntityType; + +@Converter +public class WidgetBundleEntityInfosConverter extends AbstractEntityInfosConverter { + + @Override + protected EntityType getEntityType() { + return EntityType.WIDGETS_BUNDLE; + } + +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeDao.java b/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeDao.java index d5876bbbd9..e61976b6dd 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeDao.java @@ -56,6 +56,8 @@ public interface WidgetTypeDao extends Dao, ExportableEntityD boolean existsByTenantIdAndId(TenantId tenantId, UUID widgetTypeId); + WidgetTypeInfo findWidgetTypeInfoById(TenantId tenantId, UUID widgetTypeId); + PageData findSystemWidgetTypes(WidgetTypeFilter widgetTypeFilter, PageLink pageLink); PageData findAllTenantWidgetTypesByTenantId(WidgetTypeFilter widgetTypeFilter, PageLink pageLink); diff --git a/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeServiceImpl.java index a1e241073f..1b0ecb33a4 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeServiceImpl.java @@ -87,6 +87,13 @@ public class WidgetTypeServiceImpl implements WidgetTypeService { return widgetTypeDao.findById(tenantId, widgetTypeId.getId()); } + @Override + public WidgetTypeInfo findWidgetTypeInfoById(TenantId tenantId, WidgetTypeId widgetTypeId) { + log.trace("Executing findWidgetTypeInfoById [{}]", widgetTypeId); + Validator.validateId(widgetTypeId, id -> "Incorrect widgetTypeId " + id); + return widgetTypeDao.findWidgetTypeInfoById(tenantId, widgetTypeId.getId()); + } + @Override public boolean widgetTypeExistsByTenantIdAndWidgetTypeId(TenantId tenantId, WidgetTypeId widgetTypeId) { log.trace("Executing widgetTypeExistsByTenantIdAndWidgetTypeId, tenantId [{}], widgetTypeId [{}]", tenantId, widgetTypeId); diff --git a/dao/src/main/resources/sql/schema-views-and-functions.sql b/dao/src/main/resources/sql/schema-views-and-functions.sql index 31219ced18..b394742bcd 100644 --- a/dao/src/main/resources/sql/schema-views-and-functions.sql +++ b/dao/src/main/resources/sql/schema-views-and-functions.sql @@ -288,8 +288,15 @@ $$; DROP VIEW IF EXISTS widget_type_info_view CASCADE; CREATE OR REPLACE VIEW widget_type_info_view AS -SELECT t.* - , COALESCE((t.descriptor::json->>'type')::text, '') as widget_type +SELECT t.*, + COALESCE((t.descriptor::json->>'type')::text, '') as widget_type, + array_to_json(ARRAY( + SELECT json_build_object('id', wb.widgets_bundle_id, 'name', b.title) + FROM widgets_bundle_widget wb + JOIN widgets_bundle b ON wb.widgets_bundle_id = b.id + WHERE wb.widget_type_id = t.id + ORDER BY b.title + )) AS bundles FROM widget_type t; CREATE OR REPLACE PROCEDURE cleanup_timeseries_by_ttl(IN null_uuid uuid, From fa304180e6afdf820f1701c858182dc4095a660e Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 13 Feb 2025 22:21:06 +0100 Subject: [PATCH 067/100] added tests and refactoring due to comments --- .../controller/TbResourceController.java | 2 +- .../resource/DefaultTbImageService.java | 2 +- .../resource/DefaultTbResourceService.java | 9 +- .../service/resource/TbResourceService.java | 13 ++- .../controller/AbstractNotifyEntityTest.java | 7 +- .../controller/TbResourceControllerTest.java | 74 ++++++++-------- .../sql/BaseTbResourceServiceTest.java | 88 ++++++++++--------- 7 files changed, 109 insertions(+), 86 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/TbResourceController.java b/application/src/main/java/org/thingsboard/server/controller/TbResourceController.java index 0d4b988771..2f7128f97c 100644 --- a/application/src/main/java/org/thingsboard/server/controller/TbResourceController.java +++ b/application/src/main/java/org/thingsboard/server/controller/TbResourceController.java @@ -217,7 +217,7 @@ public class TbResourceController extends BaseController { @RequestBody TbResource resource) throws Exception { resource.setTenantId(getTenantId()); checkEntity(resource.getId(), resource, Resource.TB_RESOURCE); - return new TbResourceInfo(tbResourceService.save(resource, getCurrentUser())); + return tbResourceService.save(resource, getCurrentUser()); } @ApiOperation(value = "Get Resource Infos (getResources)", diff --git a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbImageService.java b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbImageService.java index 63fe2108f3..a1950b5068 100644 --- a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbImageService.java +++ b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbImageService.java @@ -126,7 +126,7 @@ public class DefaultTbImageService extends AbstractTbEntityService implements Tb return savedImage; } catch (Exception e) { image.setData(null); - logEntityActionService.logEntityAction(tenantId, emptyId(EntityType.TB_RESOURCE), image, actionType, user, e); + logEntityActionService.logEntityAction(tenantId, emptyId(EntityType.TB_RESOURCE), new TbResourceInfo(image), actionType, user, e); throw e; } } diff --git a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java index 5ff589fd2d..f5ab939635 100644 --- a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java +++ b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java @@ -67,7 +67,7 @@ public class DefaultTbResourceService extends AbstractTbEntityService implements private final AccessControlService accessControlService; @Override - public TbResource save(TbResource resource, SecurityUser user) throws ThingsboardException { + public TbResourceInfo save(TbResource resource, SecurityUser user) throws ThingsboardException { if (resource.getResourceType() == ResourceType.IMAGE) { throw new IllegalArgumentException("Image resource type is not supported"); } @@ -79,12 +79,11 @@ public class DefaultTbResourceService extends AbstractTbEntityService implements } else if (resource.getResourceKey() == null) { resource.setResourceKey(resource.getFileName()); } - TbResource savedResource = resourceService.saveResource(resource); - logEntityActionService.logEntityAction(tenantId, savedResource.getId(), new TbResourceInfo(savedResource), actionType, user); + TbResourceInfo savedResource = new TbResourceInfo(resourceService.saveResource(resource)); + logEntityActionService.logEntityAction(tenantId, savedResource.getId(), savedResource, actionType, user); return savedResource; } catch (Exception e) { - logEntityActionService.logEntityAction(tenantId, emptyId(EntityType.TB_RESOURCE), - resource, actionType, user, e); + logEntityActionService.logEntityAction(tenantId, emptyId(EntityType.TB_RESOURCE), new TbResourceInfo(resource), actionType, user, e); throw e; } } diff --git a/application/src/main/java/org/thingsboard/server/service/resource/TbResourceService.java b/application/src/main/java/org/thingsboard/server/service/resource/TbResourceService.java index 0de2cded00..20e6c81a7d 100644 --- a/application/src/main/java/org/thingsboard/server/service/resource/TbResourceService.java +++ b/application/src/main/java/org/thingsboard/server/service/resource/TbResourceService.java @@ -18,17 +18,26 @@ package org.thingsboard.server.service.resource; import org.thingsboard.server.common.data.Dashboard; import org.thingsboard.server.common.data.ResourceExportData; import org.thingsboard.server.common.data.TbResource; +import org.thingsboard.server.common.data.TbResourceInfo; +import org.thingsboard.server.common.data.User; import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.lwm2m.LwM2mObject; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.widget.WidgetTypeDetails; -import org.thingsboard.server.service.entitiy.SimpleTbEntityService; import org.thingsboard.server.service.security.model.SecurityUser; import java.util.List; -public interface TbResourceService extends SimpleTbEntityService { +public interface TbResourceService { + + default TbResourceInfo save(TbResource entity) throws Exception { + return save(entity, null); + } + + TbResourceInfo save(TbResource entity, SecurityUser user) throws Exception; + + void delete(TbResource entity, User user); List findLwM2mObject(TenantId tenantId, String sortOrder, diff --git a/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java b/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java index 238203cdb0..f0e8832116 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java @@ -629,8 +629,11 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { private String entityClassToEntityTypeName(HasName entity) { String entityType = entityClassToString(entity); - return "SAVE_OTA_PACKAGE_INFO_REQUEST".equals(entityType) || "OTA_PACKAGE_INFO".equals(entityType) ? - EntityType.OTA_PACKAGE.name().toUpperCase(Locale.ENGLISH) : entityType; + return switch (entityType) { + case "SAVE_OTA_PACKAGE_INFO_REQUEST", "OTA_PACKAGE_INFO" -> "OTA_PACKAGE"; + case "TB_RESOURCE_INFO" -> "TB_RESOURCE"; + default -> entityType; + }; } private String entityClassToString(HasName entity) { diff --git a/application/src/test/java/org/thingsboard/server/controller/TbResourceControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/TbResourceControllerTest.java index 23f5eadab7..9f2baaa1cd 100644 --- a/application/src/test/java/org/thingsboard/server/controller/TbResourceControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/TbResourceControllerTest.java @@ -104,7 +104,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(DEFAULT_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); testNotifyEntityAllOneTimeLogEntityActionEntityEqClass(savedResource, savedResource.getId(), savedResource.getId(), savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), @@ -119,15 +119,15 @@ public class TbResourceControllerTest extends AbstractControllerTest { Assert.assertEquals(DEFAULT_FILE_NAME, savedResource.getResourceKey()); Assert.assertArrayEquals(resource.getData(), download(savedResource.getId())); - savedResource.setTitle("My new resource"); - savedResource.setData(null); + TbResource foundResource = doGet("/api/resource/" + savedResource.getId().getId().toString(), TbResource.class); + foundResource.setTitle("My new resource"); + foundResource.setData(null); - save(savedResource); + savedResource = save(foundResource); - TbResource foundResource = doGet("/api/resource/" + savedResource.getId().getId().toString(), TbResource.class); Assert.assertEquals(foundResource.getTitle(), savedResource.getTitle()); - testNotifyEntityAllOneTimeLogEntityActionEntityEqClass(foundResource, foundResource.getId(), foundResource.getId(), + testNotifyEntityAllOneTimeLogEntityActionEntityEqClass(savedResource, savedResource.getId(), savedResource.getId(), savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.UPDATED, ActionType.UPDATED); } @@ -147,7 +147,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { .andExpect(status().isBadRequest()) .andExpect(statusReason(containsString(msgError))); - testNotifyEntityEqualsOneTimeServiceNeverError(resource, savedTenant.getId(), + testNotifyEntityEqualsOneTimeServiceNeverError(new TbResourceInfo(resource), savedTenant.getId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED, new DataValidationException(msgError)); } @@ -159,7 +159,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(DEFAULT_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); loginDifferentTenant(); @@ -188,7 +188,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(DEFAULT_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); TbResource foundResource = doGet("/api/resource/" + savedResource.getUuidId(), TbResource.class); Assert.assertNotNull(foundResource); @@ -204,7 +204,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(DEFAULT_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); Mockito.reset(tbClusterService, auditLogService); String resourceIdStr = savedResource.getId().getId().toString(); @@ -229,7 +229,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(DEFAULT_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); Mockito.reset(tbClusterService, auditLogService); String resourceIdStr = savedResource.getId().getId().toString(); @@ -274,7 +274,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { } } while (pageData.hasNext()); - testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new TbResource(), new TbResource(), + testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new TbResourceInfo(), new TbResourceInfo(), savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED, cntEntity, cntEntity, cntEntity); @@ -322,7 +322,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { } } while (pageData.hasNext()); - testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new TbResource(), new TbResource(), + testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new TbResourceInfo(), new TbResourceInfo(), savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED, jksCntEntity + lwm2mCntEntity, jksCntEntity + lwm2mCntEntity, jksCntEntity + lwm2mCntEntity); @@ -414,7 +414,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setResourceType(ResourceType.PKCS_12); resource.setFileName(i + DEFAULT_FILE_NAME_2); resource.setEncodedData(TEST_DATA); - TbResource saved = save(resource); + TbResourceInfo saved = save(resource); lwm2mesources.add(saved); } @@ -536,7 +536,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(JS_TEST_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); testNotifyEntityAllOneTimeLogEntityActionEntityEqClass(savedResource, savedResource.getId(), savedResource.getId(), savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), @@ -567,7 +567,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(JS_TEST_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); //download as public customer Device device = new Device(); @@ -611,7 +611,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setFileName(JS_TEST_FILE_NAME); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); loginDifferentTenant(); loginDifferentTenantCustomer(); @@ -626,17 +626,19 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName("3.pks"); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); + TbResourceInfo savedResource = save(resource); resource.setEtag(savedResource.getEtag()); - savedResource.setEncodedData(TEST_DATA); - doPost("/api/resource", savedResource) + TbResource foundResource = doGet("/api/resource/" + savedResource.getUuidId(), TbResource.class); + + foundResource.setEncodedData(TEST_DATA); + doPost("/api/resource", foundResource) .andExpect(status().isBadRequest()) .andExpect(statusReason(containsString("can't be updated"))); - savedResource.setData(null); - savedResource.setTitle("Updated resource"); - savedResource = doPost("/api/resource", savedResource, TbResource.class); + foundResource.setData(null); + foundResource.setTitle("Updated resource"); + savedResource = doPost("/api/resource", foundResource, TbResource.class); assertThat(savedResource.getTitle()).isEqualTo("Updated resource"); assertThat(savedResource.getFileName()).isEqualTo(resource.getFileName()); assertThat(savedResource.getEtag()).isEqualTo(resource.getEtag()); @@ -650,14 +652,16 @@ public class TbResourceControllerTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName("module.js"); resource.setEncodedData(TEST_DATA); - TbResource savedResource = save(resource); - resource.setEtag(savedResource.getEtag()); + TbResourceInfo savedResource = save(resource); + + TbResource foundResource = doGet("/api/resource/" + savedResource.getUuidId(), TbResource.class); + resource.setEtag(foundResource.getEtag()); String newData = Base64.getEncoder().encodeToString(new byte[]{1, 2, 3}); - savedResource.setEncodedData(newData); - savedResource.setFileName("new-module.js"); - savedResource.setTitle("Updated title"); - savedResource = save(savedResource); + foundResource.setEncodedData(newData); + foundResource.setFileName("new-module.js"); + foundResource.setTitle("Updated title"); + savedResource = save(foundResource); assertThat(savedResource.getTitle()).isEqualTo("Updated title"); assertThat(savedResource.getFileName()).isEqualTo("new-module.js"); @@ -669,7 +673,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { public void testGetLwm2mListObjectsPage() throws Exception { loginTenantAdmin(); - List resources = loadLwm2mResources(); + List resources = loadLwm2mResources(); List objects = doGetTyped("/api/resource/lwm2m/page?pageSize=100&page=0", new TypeReference<>() {}); @@ -683,7 +687,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { public void testGetLwm2mListObjects() throws Exception { loginTenantAdmin(); - List resources = loadLwm2mResources(); + List resources = loadLwm2mResources(); List objects = doGetTyped("/api/resource/lwm2m?sortProperty=id&sortOrder=ASC&objectIds=3_1.2,5_1.2,19_1.1", new TypeReference<>() {}); @@ -693,7 +697,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { removeLoadResources(resources); } - private TbResource save(TbResource tbResource) throws Exception { + private TbResourceInfo save(TbResource tbResource) throws Exception { return doPostWithTypedResponse("/api/resource", tbResource, new TypeReference<>() { }); } @@ -709,10 +713,10 @@ public class TbResourceControllerTest extends AbstractControllerTest { } - private List loadLwm2mResources() throws Exception { + private List loadLwm2mResources() throws Exception { var models = List.of("1", "2", "3", "5", "6", "9", "19", "3303"); - List resources = new ArrayList<>(models.size()); + List resources = new ArrayList<>(models.size()); for (String model : models) { String fileName = model + ".xml"; @@ -728,7 +732,7 @@ public class TbResourceControllerTest extends AbstractControllerTest { return resources; } - private void removeLoadResources(List resources) throws Exception { + private void removeLoadResources(List resources) throws Exception { for (TbResourceInfo resource : resources) { doDelete("/api/resource/" + resource.getId().getId().toString()) .andExpect(status().isOk()); diff --git a/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java b/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java index d7c4a68195..160e12f6a7 100644 --- a/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java @@ -202,7 +202,7 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { } } - private TbResource createResource(String title, String filename) throws Exception { + private TbResourceInfo createResource(String title, String filename) throws Exception { TbResource resource = new TbResource(); resource.setTenantId(tenantId); resource.setTitle(title); @@ -222,25 +222,29 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setFileName(DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - TbResource savedResource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); - Assert.assertNotNull(savedResource); - Assert.assertNotNull(savedResource.getId()); - Assert.assertTrue(savedResource.getCreatedTime() > 0); - assertEquals(resource.getTenantId(), savedResource.getTenantId()); - assertEquals(resource.getTitle(), savedResource.getTitle()); - assertEquals(resource.getResourceKey(), savedResource.getResourceKey()); - assertArrayEquals(TEST_DATA, savedResource.getData()); + TbResource foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); + + Assert.assertNotNull(foundResource); + Assert.assertNotNull(foundResource.getId()); + Assert.assertTrue(foundResource.getCreatedTime() > 0); + assertEquals(resource.getTenantId(), foundResource.getTenantId()); + assertEquals(resource.getTitle(), foundResource.getTitle()); + assertEquals(resource.getResourceKey(), foundResource.getResourceKey()); + assertArrayEquals(TEST_DATA, foundResource.getData()); - savedResource.setTitle("My new resource"); - savedResource.setData(null); + String title = "My new resource"; - tbResourceService.save(savedResource); - TbResource foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); - assertEquals(foundResource.getTitle(), savedResource.getTitle()); + foundResource.setTitle(title); + foundResource.setData(null); + + tbResourceService.save(foundResource); + foundResource = resourceService.findResourceById(tenantId, foundResource.getId()); + assertEquals(title, foundResource.getTitle()); assertArrayEquals(foundResource.getData(), TEST_DATA); - tbResourceService.delete(savedResource, null); + tbResourceService.delete(foundResource, null); } @Test @@ -251,17 +255,19 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setFileName("test_model.xml"); resource.setEncodedData(Base64.getEncoder().encodeToString(LWM2M_TEST_MODEL.getBytes())); - TbResource savedResource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); - Assert.assertNotNull(savedResource); - Assert.assertNotNull(savedResource.getId()); - Assert.assertTrue(savedResource.getCreatedTime() > 0); - assertEquals(resource.getTenantId(), savedResource.getTenantId()); - assertEquals("My first resource id=0 v1.0", savedResource.getTitle()); - assertEquals("0_1.0", savedResource.getResourceKey()); - assertArrayEquals(savedResource.getData(), LWM2M_TEST_MODEL.getBytes()); + TbResource foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); - tbResourceService.delete(savedResource, null); + Assert.assertNotNull(foundResource); + Assert.assertNotNull(foundResource.getId()); + Assert.assertTrue(foundResource.getCreatedTime() > 0); + assertEquals(resource.getTenantId(), foundResource.getTenantId()); + assertEquals("My first resource id=0 v1.0", foundResource.getTitle()); + assertEquals("0_1.0", foundResource.getResourceKey()); + assertArrayEquals(foundResource.getData(), LWM2M_TEST_MODEL.getBytes()); + + tbResourceService.delete(foundResource, null); } @Test @@ -271,11 +277,11 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName(DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - TbResource savedResource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); assertEquals(TenantId.SYS_TENANT_ID, savedResource.getTenantId()); - tbResourceService.delete(savedResource, null); +// tbResourceService.delete(savedResource, null); } @Test @@ -286,7 +292,7 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName(DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - resource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); TbResource resource2 = new TbResource(); resource2.setTenantId(tenantId); @@ -294,11 +300,11 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource2.setTitle("My resource"); resource2.setFileName(DEFAULT_FILE_NAME); resource2.setData(TEST_DATA); - resource2 = tbResourceService.save(resource2); + TbResourceInfo savedResource2 = tbResourceService.save(resource2); - assertThat(resource2.getId()).isNotEqualTo(resource.getId()); - assertThat(resource2.getFileName()).isEqualTo("test.jks"); - assertThat(resource2.getResourceKey()).isEqualTo("test_(1).jks"); + assertThat(savedResource2.getId()).isNotEqualTo(savedResource.getId()); + assertThat(savedResource2.getFileName()).isEqualTo("test.jks"); + assertThat(savedResource2.getResourceKey()).isEqualTo("test_(1).jks"); } @Test @@ -348,12 +354,13 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName(DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - TbResource savedResource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); TbResource foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); Assert.assertNotNull(foundResource); - assertEquals(savedResource, foundResource); - tbResourceService.delete(savedResource, null); + assertEquals(savedResource, new TbResourceInfo(foundResource)); + assertArrayEquals(TEST_DATA, foundResource.getData()); + tbResourceService.delete(foundResource, null); } @Test @@ -364,12 +371,13 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName(DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - TbResource savedResource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); TbResource foundResource = resourceService.findResourceByTenantIdAndKey(tenantId, savedResource.getResourceType(), savedResource.getResourceKey()); Assert.assertNotNull(foundResource); - assertEquals(savedResource, foundResource); - tbResourceService.delete(savedResource, null); + assertEquals(savedResource, new TbResourceInfo(foundResource)); + assertArrayEquals(TEST_DATA, foundResource.getData()); + tbResourceService.delete(foundResource, null); } @Test @@ -379,11 +387,11 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setTitle("My resource"); resource.setFileName(DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - TbResource savedResource = tbResourceService.save(resource); + TbResourceInfo savedResource = tbResourceService.save(resource); TbResource foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); Assert.assertNotNull(foundResource); - tbResourceService.delete(savedResource, null); + tbResourceService.delete(foundResource, null); foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); Assert.assertNull(foundResource); } @@ -471,7 +479,7 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { resource.setResourceType(ResourceType.JKS); resource.setFileName(i + DEFAULT_FILE_NAME); resource.setData(TEST_DATA); - resources.add(new TbResourceInfo(tbResourceService.save(resource))); + resources.add(tbResourceService.save(resource)); } List loadedResources = new ArrayList<>(); From ca12f96e2cca1b15d0b5dbe910f595b51399386d Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 12 Feb 2025 12:41:49 +0200 Subject: [PATCH 068/100] WidgetsBundle - fixed toString --- .../WidgetsBundleControllerTest.java | 2 +- .../common/data/widget/WidgetsBundle.java | 39 ++++--------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java index 03506af95c..ee2fe1dae0 100644 --- a/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/WidgetsBundleControllerTest.java @@ -95,7 +95,7 @@ public class WidgetsBundleControllerTest extends AbstractControllerTest { Assert.assertEquals(widgetsBundle.getTitle(), savedWidgetsBundle.getTitle()); savedWidgetsBundle.setTitle("My new widgets bundle"); - doPost("/api/widgetsBundle", savedWidgetsBundle, WidgetsBundle.class); + savedWidgetsBundle = doPost("/api/widgetsBundle", savedWidgetsBundle, WidgetsBundle.class); WidgetsBundle foundWidgetsBundle = doGet("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString(), WidgetsBundle.class); Assert.assertEquals(foundWidgetsBundle.getTitle(), savedWidgetsBundle.getTitle()); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java index 005e4ca252..82ba041040 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java @@ -17,9 +17,9 @@ package org.thingsboard.server.common.data.widget; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; +import lombok.ToString; import org.thingsboard.server.common.data.BaseData; import org.thingsboard.server.common.data.ExportableEntity; import org.thingsboard.server.common.data.HasImage; @@ -32,58 +32,45 @@ import org.thingsboard.server.common.data.id.WidgetsBundleId; import org.thingsboard.server.common.data.validation.Length; import org.thingsboard.server.common.data.validation.NoXss; +import java.io.Serial; + @Schema +@Data @EqualsAndHashCode(callSuper = true) public class WidgetsBundle extends BaseData implements HasName, HasTenantId, ExportableEntity, HasTitle, HasImage, HasVersion { + @Serial private static final long serialVersionUID = -7627368878362410489L; - @Getter - @Setter @Schema(description = "JSON object with Tenant Id.", accessMode = Schema.AccessMode.READ_ONLY) private TenantId tenantId; @NoXss @Length(fieldName = "alias") - @Getter - @Setter @Schema(description = "Unique alias that is used in widget types as a reference widget bundle", accessMode = Schema.AccessMode.READ_ONLY) private String alias; @NoXss @Length(fieldName = "title") - @Getter - @Setter @Schema(description = "Title used in search and UI", accessMode = Schema.AccessMode.READ_ONLY) private String title; - @Getter - @Setter @Schema(description = "Relative or external image URL. Replaced with image data URL (Base64) in case of relative URL and 'inlineImages' option enabled.", accessMode = Schema.AccessMode.READ_ONLY) + @ToString.Exclude private String image; - @Getter - @Setter @Schema(description = "Whether widgets bundle contains SCADA symbol widget types.", accessMode = Schema.AccessMode.READ_ONLY) private boolean scada; @NoXss @Length(fieldName = "description", max = 1024) - @Getter - @Setter @Schema(description = "Description", accessMode = Schema.AccessMode.READ_ONLY) private String description; - @Getter - @Setter @Schema(description = "Order", accessMode = Schema.AccessMode.READ_ONLY) private Integer order; - @Getter - @Setter private WidgetsBundleId externalId; - @Getter - @Setter private Long version; public WidgetsBundle() { @@ -128,16 +115,4 @@ public class WidgetsBundle extends BaseData implements HasName, public String getName() { return title; } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("WidgetsBundle{"); - sb.append("tenantId=").append(tenantId); - sb.append(", alias='").append(alias).append('\''); - sb.append(", title='").append(title).append('\''); - sb.append(", description='").append(description).append('\''); - sb.append('}'); - return sb.toString(); - } - } From 6d840e3686039d3b7df2f3cd0a34891f39645507 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 14 Feb 2025 10:56:59 +0200 Subject: [PATCH 069/100] Improve AbstractEntityInfosConverter --- .../server/dao/util/mapping/AbstractEntityInfosConverter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java index b829060f54..98b94d17e2 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java +++ b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java @@ -17,6 +17,7 @@ package org.thingsboard.server.dao.util.mapping; import com.fasterxml.jackson.databind.JsonNode; import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EntityInfo; import org.thingsboard.server.common.data.EntityType; @@ -27,6 +28,7 @@ import java.util.Collections; import java.util.List; import java.util.UUID; +@Converter public abstract class AbstractEntityInfosConverter implements AttributeConverter, String> { protected abstract EntityType getEntityType(); @@ -55,7 +57,7 @@ public abstract class AbstractEntityInfosConverter implements AttributeConverter name = nameNode.asText(); } if (id != null && name != null) { - entities.add(new EntityInfo(id, EntityType.WIDGETS_BUNDLE.name(), name)); + entities.add(new EntityInfo(id, getEntityType().name(), name)); } } return entities; From 4ed379db23f5ae724334fe45a2d7b57853e16e18 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 14 Feb 2025 12:11:37 +0200 Subject: [PATCH 070/100] Fix JpaWidgetTypeDaoTest --- .../common/data/widget/WidgetTypeInfo.java | 13 ++++++++ .../dao/sql/widget/JpaWidgetTypeDaoTest.java | 33 ++++++++++--------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java index 2ea98f0c17..803dcbb945 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java @@ -90,4 +90,17 @@ public class WidgetTypeInfo extends BaseWidgetType { this.bundles = Collections.emptyList(); } + public WidgetTypeInfo(WidgetTypeDetails widgetTypeDetails, List bundles) { + super(widgetTypeDetails); + this.image = widgetTypeDetails.getImage(); + this.description = widgetTypeDetails.getDescription(); + this.tags = widgetTypeDetails.getTags(); + if (widgetTypeDetails.getDescriptor() != null && widgetTypeDetails.getDescriptor().has("type")) { + this.widgetType = widgetTypeDetails.getDescriptor().get("type").asText(); + } else { + this.widgetType = ""; + } + this.bundles = bundles; + } + } diff --git a/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java b/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java index 8010eab4cd..ae73b65581 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java @@ -21,6 +21,7 @@ import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.EntityInfo; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.WidgetsBundleId; @@ -51,9 +52,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -/** - * Created by Valerii Sosliuk on 4/30/2017. - */ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { // given search text should find a widget with tags, when searching by tags @@ -78,7 +76,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { final String BUNDLE_ALIAS = "BUNDLE_ALIAS"; final int WIDGET_TYPE_COUNT = 3; - List widgetTypeList; + List widgetTypeList; WidgetsBundle widgetsBundle; @Autowired @@ -107,7 +105,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { widgetTypeList.sort(Comparator.comparing(BaseWidgetType::getName)); } - WidgetTypeDetails createAndSaveWidgetType(TenantId tenantId, int number) { + WidgetTypeInfo createAndSaveWidgetType(TenantId tenantId, int number) { WidgetTypeDetails widgetType = new WidgetTypeDetails(); widgetType.setTenantId(tenantId); widgetType.setName("WIDGET_TYPE_" + number); @@ -119,7 +117,10 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { widgetType.setDescriptor(descriptor); String[] tags = new String[]{"Tag1_"+number, "Tag2_"+number, "TEST_"+number}; widgetType.setTags(tags); - return widgetTypeDao.save(TenantId.SYS_TENANT_ID, widgetType); + WidgetTypeDetails saved = widgetTypeDao.save(TenantId.SYS_TENANT_ID, widgetType); + List bundles = new ArrayList<>(); + bundles.add(new EntityInfo(widgetsBundle.getId(), widgetsBundle.getName())); + return new WidgetTypeInfo(saved, bundles); } WidgetTypeDetails createAndSaveWidgetType(TenantId tenantId, int number, String[] tags) { @@ -139,7 +140,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { @After public void tearDown() { widgetsBundleDao.removeById(TenantId.SYS_TENANT_ID, widgetsBundle.getUuidId()); - for (WidgetType widgetType : widgetTypeList) { + for (WidgetTypeInfo widgetType : widgetTypeList) { widgetTypeDao.removeById(TenantId.SYS_TENANT_ID, widgetType.getUuidId()); } } @@ -160,7 +161,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { .widgetTypes(Collections.singletonList("static")).build(), new PageLink(1024, 0, "TYPE_DESCRIPTION", new SortOrder("createdTime"))); assertEquals(1, widgetTypes.getData().size()); - assertEquals(new WidgetTypeInfo(widgetTypeList.get(1)), widgetTypes.getData().get(0)); + assertEquals(widgetTypeList.get(1), widgetTypes.getData().get(0)); widgetTypes = widgetTypeDao.findSystemWidgetTypes( WidgetTypeFilter.builder() @@ -170,7 +171,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { .widgetTypes(Collections.emptyList()).build(), new PageLink(1024, 0, "hfgfd tag2_2 ghg", new SortOrder("createdTime"))); assertEquals(1, widgetTypes.getData().size()); - assertEquals(new WidgetTypeInfo(widgetTypeList.get(2)), widgetTypes.getData().get(0)); + assertEquals(widgetTypeList.get(2), widgetTypes.getData().get(0)); } @Test @@ -181,7 +182,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { Thread.sleep(2); var widgetType = saveWidgetType(TenantId.SYS_TENANT_ID, "widgetName"); sameNameList.add(widgetType); - widgetTypeList.add(widgetType); + widgetTypeList.add(new WidgetTypeInfo(widgetType)); } sameNameList.sort(Comparator.comparing(BaseWidgetType::getName).thenComparing((BaseWidgetType baseWidgetType) -> baseWidgetType.getId().getId())); List expected = sameNameList.stream().map(WidgetTypeInfo::new).collect(Collectors.toList()); @@ -254,12 +255,12 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { public void testFindTenantWidgetTypesByTenantId() { UUID tenantId = Uuids.timeBased(); for (int i = 0; i < WIDGET_TYPE_COUNT; i++) { - var widgetType = createAndSaveWidgetType(new TenantId(tenantId), i); + var widgetType = createAndSaveWidgetType(TenantId.fromUUID(tenantId), i); widgetTypeList.add(widgetType); } PageData widgetTypes = widgetTypeDao.findTenantWidgetTypesByTenantId( WidgetTypeFilter.builder() - .tenantId(new TenantId(tenantId)) + .tenantId(TenantId.fromUUID(tenantId)) .fullSearch(true) .deprecatedFilter(DeprecatedFilter.ALL) .widgetTypes(null).build(), @@ -363,13 +364,13 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { PageData widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId(TenantId.SYS_TENANT_ID.getId(), widgetsBundle.getUuidId(),true, DeprecatedFilter.ALL, Collections.singletonList("latest"), new PageLink(1024, 0, "TYPE_DESCRIPTION", new SortOrder("createdTime"))); assertEquals(2, widgetTypes.getData().size()); - assertEquals(new WidgetTypeInfo(widgetTypeList.get(0)), widgetTypes.getData().get(0)); - assertEquals(new WidgetTypeInfo(widgetTypeList.get(2)), widgetTypes.getData().get(1)); + assertEquals(widgetTypeList.get(0), widgetTypes.getData().get(0)); + assertEquals(widgetTypeList.get(2), widgetTypes.getData().get(1)); widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId(TenantId.SYS_TENANT_ID.getId(), widgetsBundle.getUuidId(), true, DeprecatedFilter.ALL, Collections.emptyList(), new PageLink(1024, 0, "hfgfd TEST_0 ghg", new SortOrder("createdTime"))); assertEquals(1, widgetTypes.getData().size()); - assertEquals(new WidgetTypeInfo(widgetTypeList.get(0)), widgetTypes.getData().get(0)); + assertEquals(widgetTypeList.get(0), widgetTypes.getData().get(0)); } @Test @@ -410,7 +411,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { @Test public void testFindByTenantIdAndFqn() { - WidgetType result = widgetTypeList.get(0); + WidgetTypeInfo result = widgetTypeList.get(0); assertNotNull(result); WidgetType widgetType = widgetTypeDao.findByTenantIdAndFqn(TenantId.SYS_TENANT_ID.getId(), "FQN_0"); assertEquals(result.getId(), widgetType.getId()); From b332c8ffa9ec1c6a5fb75cccf044e260b4219585 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Fri, 14 Feb 2025 11:50:08 +0100 Subject: [PATCH 071/100] minor test improvement --- .../server/service/resource/sql/BaseTbResourceServiceTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java b/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java index 160e12f6a7..405423dd03 100644 --- a/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java @@ -281,7 +281,8 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { assertEquals(TenantId.SYS_TENANT_ID, savedResource.getTenantId()); -// tbResourceService.delete(savedResource, null); + TbResource foundResource = resourceService.findResourceById(tenantId, savedResource.getId()); + tbResourceService.delete(foundResource, null); } @Test From 0e3edb271f7ed702fcb22ab3c499d03de4d8094a Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 14 Feb 2025 13:03:06 +0200 Subject: [PATCH 072/100] Add tests for widget bundle --- .../dao/sql/widget/JpaWidgetTypeDaoTest.java | 94 ++++++++++++++++--- 1 file changed, 82 insertions(+), 12 deletions(-) diff --git a/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java b/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java index ae73b65581..693bf86d91 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java @@ -50,7 +50,9 @@ import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { @@ -115,7 +117,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { var descriptor = JacksonUtil.newObjectNode(); descriptor.put("type", number % 2 == 0 ? "latest" : "static"); widgetType.setDescriptor(descriptor); - String[] tags = new String[]{"Tag1_"+number, "Tag2_"+number, "TEST_"+number}; + String[] tags = new String[]{"Tag1_" + number, "Tag2_" + number, "TEST_" + number}; widgetType.setTags(tags); WidgetTypeDetails saved = widgetTypeDao.save(TenantId.SYS_TENANT_ID, widgetType); List bundles = new ArrayList<>(); @@ -189,10 +191,10 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { PageData widgetTypesFirstPage = widgetTypeDao.findSystemWidgetTypes( WidgetTypeFilter.builder() - .tenantId(TenantId.SYS_TENANT_ID) - .fullSearch(true) - .deprecatedFilter(DeprecatedFilter.ALL) - .widgetTypes(Collections.singletonList("static")).build(), + .tenantId(TenantId.SYS_TENANT_ID) + .fullSearch(true) + .deprecatedFilter(DeprecatedFilter.ALL) + .widgetTypes(Collections.singletonList("static")).build(), new PageLink(10, 0, null, new SortOrder("name"))); assertEquals(10, widgetTypesFirstPage.getData().size()); assertThat(widgetTypesFirstPage.getData()).containsExactlyElementsOf(expected.subList(0, 10)); @@ -217,10 +219,10 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { PageData widgetTypes = widgetTypeDao.findSystemWidgetTypes( WidgetTypeFilter.builder() - .tenantId(TenantId.SYS_TENANT_ID) - .fullSearch(true) - .deprecatedFilter(DeprecatedFilter.ALL) - .widgetTypes(null).build(), + .tenantId(TenantId.SYS_TENANT_ID) + .fullSearch(true) + .deprecatedFilter(DeprecatedFilter.ALL) + .widgetTypes(null).build(), new PageLink(10, 0, searchText) ); @@ -361,7 +363,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { @Test public void testFindByWidgetTypeInfosByBundleId() { - PageData widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId(TenantId.SYS_TENANT_ID.getId(), widgetsBundle.getUuidId(),true, DeprecatedFilter.ALL, Collections.singletonList("latest"), + PageData widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId(TenantId.SYS_TENANT_ID.getId(), widgetsBundle.getUuidId(), true, DeprecatedFilter.ALL, Collections.singletonList("latest"), new PageLink(1024, 0, "TYPE_DESCRIPTION", new SortOrder("createdTime"))); assertEquals(2, widgetTypes.getData().size()); assertEquals(widgetTypeList.get(0), widgetTypes.getData().get(0)); @@ -427,7 +429,7 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { @Test public void testFindByImageLink() { - TenantId tenantId = new TenantId(UUID.randomUUID()); + TenantId tenantId = TenantId.fromUUID(UUID.randomUUID()); WidgetTypeDetails details = createAndSaveWidgetType(tenantId, 0, new String[]{"a"}); details.setDescriptor(JacksonUtil.newObjectNode().put("bg", "/image/tenant/widget.png")); widgetTypeDao.save(tenantId, details); @@ -438,14 +440,82 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { widgetTypeDao.removeById(tenantId, details.getUuidId()); } + @Test + public void testFindWidgetTypesWithBundles() { + PageData widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId( + TenantId.SYS_TENANT_ID.getId(), + widgetsBundle.getUuidId(), + true, + DeprecatedFilter.ALL, + Collections.singletonList("latest"), + new PageLink(1024, 0, "TYPE_DESCRIPTION", new SortOrder("createdTime")) + ); + + assertEquals(2, widgetTypes.getData().size()); + for (var widgetType : widgetTypes.getData()) { + assertFalse("Bundles should not be empty", widgetType.getBundles().isEmpty()); + assertEquals(BUNDLE_ALIAS, widgetType.getBundles().get(0).getName()); + } + } + + @Test + public void testAddWidgetTypeToNewBundleAndVerifyBundles() { + String newBundleTitle = "New Bundle Title"; + WidgetsBundle newWidgetsBundle = new WidgetsBundle(); + newWidgetsBundle.setAlias("NewBundle"); + newWidgetsBundle.setTitle(newBundleTitle); + newWidgetsBundle.setId(new WidgetsBundleId(UUID.randomUUID())); + newWidgetsBundle.setTenantId(TenantId.SYS_TENANT_ID); + newWidgetsBundle = widgetsBundleDao.save(TenantId.SYS_TENANT_ID, newWidgetsBundle); + + for (int i = 0; i < widgetTypeList.size(); i++) { + WidgetTypeInfo widgetType = widgetTypeList.get(i); + widgetTypeDao.saveWidgetsBundleWidget(new WidgetsBundleWidget(newWidgetsBundle.getId(), widgetType.getId(), i)); + } + + PageData widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId( + TenantId.SYS_TENANT_ID.getId(), + newWidgetsBundle.getUuidId(), + true, + DeprecatedFilter.ALL, + Collections.singletonList("latest"), + new PageLink(1024, 0, "TYPE_DESCRIPTION", new SortOrder("createdTime")) + ); + + assertEquals(2, widgetTypes.getData().size()); + WidgetTypeInfo widgetTypeInfo1 = widgetTypes.getData().get(0); + WidgetTypeInfo widgetTypeInfo2 = widgetTypes.getData().get(1); + + assertEquals(2, widgetTypeInfo1.getBundles().size()); + assertTrue("Bundles should contain 'BUNDLE_ALIAS'", widgetTypeInfo1.getBundles().stream().anyMatch(bundle -> BUNDLE_ALIAS.equals(bundle.getName()))); + assertTrue("Bundles should contain 'New Bundle Title'", widgetTypeInfo1.getBundles().stream().anyMatch(bundle -> newBundleTitle.equals(bundle.getName()))); + + assertEquals(2, widgetTypeInfo2.getBundles().size()); + assertTrue("Bundles should contain 'BUNDLE_ALIAS'", widgetTypeInfo2.getBundles().stream().anyMatch(bundle -> "BUNDLE_ALIAS".equals(bundle.getName()))); + assertTrue("Bundles should contain 'New Bundle Title'", widgetTypeInfo2.getBundles().stream().anyMatch(bundle -> newBundleTitle.equals(bundle.getName()))); + + // cleanup and verify + widgetsBundleDao.removeById(newWidgetsBundle.getTenantId(), newWidgetsBundle.getUuidId()); + widgetTypes = widgetTypeDao.findWidgetTypesInfosByWidgetsBundleId( + TenantId.SYS_TENANT_ID.getId(), + newWidgetsBundle.getUuidId(), + true, + DeprecatedFilter.ALL, + Collections.singletonList("latest"), + new PageLink(1024, 0, "TYPE_DESCRIPTION", new SortOrder("createdTime")) + ); + widgetTypes.getData().forEach(widgetTypeInfo -> assertEquals(1, widgetTypeInfo.getBundles().size())); + } + private WidgetTypeDetails saveWidgetType(TenantId tenantId, String name) { WidgetTypeDetails widgetType = new WidgetTypeDetails(); widgetType.setTenantId(tenantId); widgetType.setDescription("WIDGET_TYPE_DESCRIPTION" + StringUtils.randomAlphabetic(7)); widgetType.setName(name); var descriptor = JacksonUtil.newObjectNode(); - descriptor.put("type","static"); + descriptor.put("type", "static"); widgetType.setDescriptor(descriptor); return widgetTypeDao.save(TenantId.SYS_TENANT_ID, widgetType); } + } From dad0c1fb927750f31a73677b8a367369eb812829 Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Fri, 14 Feb 2025 16:32:48 +0200 Subject: [PATCH 073/100] Version set to 3.9.1-RC --- application/pom.xml | 2 +- common/actor/pom.xml | 2 +- common/cache/pom.xml | 2 +- common/cluster-api/pom.xml | 2 +- common/coap-server/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/edge-api/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/proto/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/script/pom.xml | 2 +- common/script/remote-js-client/pom.xml | 2 +- common/script/script-api/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/lwm2m/pom.xml | 2 +- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/snmp/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- common/version-control/pom.xml | 2 +- dao/pom.xml | 2 +- monitoring/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/js-executor/package.json | 2 +- msa/js-executor/pom.xml | 2 +- msa/monitoring/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/lwm2m/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/transport/snmp/pom.xml | 2 +- msa/vc-executor-docker/pom.xml | 2 +- msa/vc-executor/pom.xml | 2 +- msa/web-ui/package.json | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 ++-- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/lwm2m/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- transport/snmp/pom.xml | 2 +- ui-ngx/package.json | 2 +- ui-ngx/pom.xml | 2 +- 59 files changed, 60 insertions(+), 60 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index c2d80d62ac..e13605f292 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard application diff --git a/common/actor/pom.xml b/common/actor/pom.xml index cbbce12336..05e770888c 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/cache/pom.xml b/common/cache/pom.xml index a4f7dd4f7b..d97b41fed4 100644 --- a/common/cache/pom.xml +++ b/common/cache/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/cluster-api/pom.xml b/common/cluster-api/pom.xml index 4bbe65d99f..d789732519 100644 --- a/common/cluster-api/pom.xml +++ b/common/cluster-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/coap-server/pom.xml b/common/coap-server/pom.xml index 32da47ca08..9bd3fc19d0 100644 --- a/common/coap-server/pom.xml +++ b/common/coap-server/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 7d48a63903..0a84902178 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index e6eca1aa93..6e3d66413a 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/edge-api/pom.xml b/common/edge-api/pom.xml index 68e647642d..e78dff790d 100644 --- a/common/edge-api/pom.xml +++ b/common/edge-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 0614c94bc4..53fbdf97c4 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index 8bd1904d72..9303be4522 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard common diff --git a/common/proto/pom.xml b/common/proto/pom.xml index fded7298e4..215fe27745 100644 --- a/common/proto/pom.xml +++ b/common/proto/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index fab4ff3989..2349d55379 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/script/pom.xml b/common/script/pom.xml index 1aad1dd39e..d2a7a8bfcf 100644 --- a/common/script/pom.xml +++ b/common/script/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/script/remote-js-client/pom.xml b/common/script/remote-js-client/pom.xml index 38a14cd8f3..8aacb3bc59 100644 --- a/common/script/remote-js-client/pom.xml +++ b/common/script/remote-js-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC script org.thingsboard.common.script diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index 4210f1f528..f30adc303a 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC script org.thingsboard.common.script diff --git a/common/stats/pom.xml b/common/stats/pom.xml index 231811144a..4a23faf475 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 0bd4c0d6e3..dc5ecd7905 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index 5a0dd9e4ff..bfb830d8ee 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index ddb9d7a399..d5603a86ca 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 45d228f225..c043d88e20 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 6c4310151d..01fa1c3c4a 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/transport/snmp/pom.xml b/common/transport/snmp/pom.xml index a2b9dd7c84..b1a78519d3 100644 --- a/common/transport/snmp/pom.xml +++ b/common/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.common - 3.9.0-RC + 3.9.1-RC transport diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 8f01cab08b..e05414e77b 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index 194724b70f..b0543bf7fb 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml index 8e3fceff99..16559c2e2c 100644 --- a/common/version-control/pom.xml +++ b/common/version-control/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index c1f5a1f62b..3dbdd086db 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard dao diff --git a/monitoring/pom.xml b/monitoring/pom.xml index e19acb0fe6..3b2f378a17 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index 5563fcc8d8..549d773297 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index 0fb241c558..d05bbaf71c 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-js-executor", "private": true, - "version": "3.9.0", + "version": "3.9.1", "description": "ThingsBoard JavaScript Executor Microservice", "main": "server.ts", "bin": "server.js", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index daea52bfa5..8641384cb0 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index 20f8d90695..a58da78c17 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa diff --git a/msa/pom.xml b/msa/pom.xml index 057f37a575..2ccf92deb3 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index 3ca22bcf55..cc93c0a078 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index 5e79740c8b..dab3a52710 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 089581f1cb..896915082e 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index 4d9e17df5f..483c40c880 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index 94b86d035f..db98c0828f 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 2b637ddd19..26d53f6b2f 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 4f7e0ad030..c9473462d7 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index 94bc03f29d..7c6f267964 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.msa transport - 3.9.0-RC + 3.9.1-RC org.thingsboard.msa.transport diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index f6dc43ea13..8cba9d153b 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index 725c3e40ad..5e86f5dd47 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index 84b1a4a488..deca43eecd 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-web-ui", "private": true, - "version": "3.9.0", + "version": "3.9.1", "description": "ThingsBoard Web UI Microservice", "main": "server.ts", "bin": "server.js", diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index c5a900e004..bfbcb81012 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index d4cd55629d..34a4a3e81a 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard netty-mqtt - 3.9.0-RC + 3.9.1-RC jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index 4de31c1c19..f39fcc0cc9 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 3.9.0-RC + 3.9.1-RC pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index f868acabf5..69cd079e6b 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index fbefcd1de9..5ed4ee9329 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index 3ee6496452..4db9a7c4bf 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 33bb15af00..5b48de2224 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index dce8e1606d..f60289c5f4 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index eef23eae9b..0b147c871a 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index d841c56da7..f8e80627f3 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index cec30fcbc5..43f61039ed 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index edf3727320..0fea251b03 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index d744f7eb2f..e101a84e79 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard transport diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index dcd08c10af..26f68cc598 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.9.0-RC + 3.9.1-RC transport diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 0eff3bbd8d..0d5e086896 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -1,6 +1,6 @@ { "name": "thingsboard", - "version": "3.9.0", + "version": "3.9.1", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --configuration development --host 0.0.0.0 --open", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index 1384b1c3e6..b00064e2fd 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.0-RC + 3.9.1-RC thingsboard org.thingsboard From 61f77f301d2a08d2448b4d8517cbfb720ace32e7 Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Fri, 14 Feb 2025 19:21:03 +0200 Subject: [PATCH 074/100] Resolved review comments --- .../service/apiusage/BaseApiUsageState.java | 3 +- .../DefaultTbApiUsageStateService.java | 3 +- .../DefaultTbApiUsageStateServiceTest.java | 142 ++++++++++++++++++ .../dao/usagerecord/ApiUsageStateService.java | 1 + .../server/common/data/ApiUsageState.java | 4 +- .../server/common/util/ProtoUtils.java | 5 +- common/proto/src/main/proto/queue.proto | 1 + .../usagerecord/ApiUsageStateServiceImpl.java | 1 + .../dao/service/ApiUsageStateServiceTest.java | 47 ++++-- 9 files changed, 189 insertions(+), 18 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/apiusage/BaseApiUsageState.java b/application/src/main/java/org/thingsboard/server/service/apiusage/BaseApiUsageState.java index 9eac721dfb..9db4949d5f 100644 --- a/application/src/main/java/org/thingsboard/server/service/apiusage/BaseApiUsageState.java +++ b/application/src/main/java/org/thingsboard/server/service/apiusage/BaseApiUsageState.java @@ -40,7 +40,8 @@ public abstract class BaseApiUsageState { private final Map gaugesReportCycles = new HashMap<>(); @Getter - private final ApiUsageState apiUsageState; + @Setter + private ApiUsageState apiUsageState; @Getter private volatile long currentCycleTs; @Getter diff --git a/application/src/main/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateService.java b/application/src/main/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateService.java index 3a351528e4..30a3af7f65 100644 --- a/application/src/main/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateService.java @@ -355,7 +355,8 @@ public class DefaultTbApiUsageStateService extends AbstractPartitionBasedService private void persistAndNotify(BaseApiUsageState state, Map result) { log.info("[{}] Detected update of the API state for {}: {}", state.getEntityId(), state.getEntityType(), result); - apiUsageStateService.update(state.getApiUsageState()); + ApiUsageState updatedState = apiUsageStateService.update(state.getApiUsageState()); + state.setApiUsageState(updatedState); long ts = System.currentTimeMillis(); List stateTelemetry = new ArrayList<>(); result.forEach((apiFeature, aState) -> stateTelemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(apiFeature.getApiStateKey(), aState.name())))); diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java index 051214c771..a0f61a4928 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java @@ -15,6 +15,7 @@ */ package org.thingsboard.server.service.apiusage; +import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -23,14 +24,43 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.server.common.data.ApiFeature; +import org.thingsboard.server.common.data.ApiUsageRecordKey; import org.thingsboard.server.common.data.ApiUsageState; +import org.thingsboard.server.common.data.ApiUsageStateValue; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.Tenant; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.notification.rule.trigger.ApiUsageLimitTrigger; +import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; +import org.thingsboard.server.common.msg.queue.TbCallback; +import org.thingsboard.server.dao.tenant.TenantService; +import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; +import org.thingsboard.server.gen.transport.TransportProtos; +import org.thingsboard.server.queue.common.TbProtoQueueMsg; +import org.thingsboard.server.service.mail.MailExecutorService; +import org.thingsboard.server.service.telemetry.InternalTelemetryService; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.UUID; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class DefaultTbApiUsageStateServiceTest { @@ -38,6 +68,21 @@ public class DefaultTbApiUsageStateServiceTest { @Mock TenantApiUsageState tenantUsageStateMock; + @Mock + private NotificationRuleProcessor notificationRuleProcessor; + + @Mock + private ApiUsageStateService apiUsageStateService; + + @Mock + private TenantService tenantService; + + @Mock + private InternalTelemetryService tsWsService; + + @Mock + private MailExecutorService mailExecutor; + TenantId tenantId = TenantId.fromUUID(UUID.fromString("00797a3b-7aeb-4b5b-b57a-c2a810d0f112")); @Spy @@ -46,6 +91,7 @@ public class DefaultTbApiUsageStateServiceTest { @BeforeEach public void setUp() { + ReflectionTestUtils.setField(service, "tsWsService", tsWsService); } @Test @@ -56,4 +102,100 @@ public class DefaultTbApiUsageStateServiceTest { Mockito.verify(service, never()).getOrFetchState(tenantId, tenantId); } + @Test + public void testAllApiFeaturesDisabledWhenLimitReached() { + doReturn(null).when(tsWsService).saveTimeseriesInternal(any()); + + TenantApiUsageState tenantUsageStateMock = mock(TenantApiUsageState.class); + ApiUsageState apiUsageState = getApiUsageState(); + when(tenantUsageStateMock.getApiUsageState()).thenReturn(apiUsageState); + + doReturn(BaseApiUsageState.StatsCalculationResult.builder() + .newValue(200L) + .valueChanged(true) + .newHourlyValue(200L) + .hourlyValueChanged(true) + .build()) + .when(tenantUsageStateMock).calculate(any(ApiUsageRecordKey.class), anyLong(), anyString()); + + doReturn(200L).when(tenantUsageStateMock).getProfileThreshold(any(ApiUsageRecordKey.class)); + doReturn(50L).when(tenantUsageStateMock).getProfileWarnThreshold(any(ApiUsageRecordKey.class)); + doReturn(300L).when(tenantUsageStateMock).get(any(ApiUsageRecordKey.class)); + + when(tenantUsageStateMock.getEntityType()).thenReturn(EntityType.TENANT); + when(tenantUsageStateMock.getEntityId()).thenReturn(tenantId); + + Map expectedResult = getExpectedResult(); + when(tenantUsageStateMock.checkStateUpdatedDueToThreshold(any())).thenReturn(expectedResult); + service.myUsageStates.put(tenantId, tenantUsageStateMock); + + when(apiUsageStateService.update(apiUsageState)).thenReturn(apiUsageState); + + Tenant dummyTenant = new Tenant(); + dummyTenant.setEmail("test@example.com"); + when(tenantService.findTenantById(any())).thenReturn(dummyTenant); + + TransportProtos.ToUsageStatsServiceMsg.Builder msgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder(); + UUID uuid = tenantId.getId(); + msgBuilder.setTenantIdMSB(uuid.getMostSignificantBits()) + .setTenantIdLSB(uuid.getLeastSignificantBits()); + msgBuilder.setCustomerIdMSB(0) + .setCustomerIdLSB(0); + msgBuilder.setServiceId("TEST_SERVICE"); + + List usageStats = new ArrayList<>(); + for (ApiUsageRecordKey recordKey : ApiUsageRecordKey.values()) { + if (recordKey.getApiFeature() != null) { + TransportProtos.UsageStatsKVProto stat = TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(recordKey.name()) + .setValue(1000L) + .build(); + usageStats.add(stat); + msgBuilder.addValues(stat); + } + } + + TransportProtos.ToUsageStatsServiceMsg statsMsg = msgBuilder.build(); + TbProtoQueueMsg queueMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), statsMsg); + TbCallback callback = mock(TbCallback.class); + + service.process(queueMsg, callback); + verify(callback).onSuccess(); + + for (ApiFeature feature : expectedResult.keySet()) { + verify(notificationRuleProcessor, atLeastOnce()).process(argThat(trigger -> + trigger instanceof ApiUsageLimitTrigger && + ((ApiUsageLimitTrigger) trigger).getStatus() == ApiUsageStateValue.DISABLED && + ((ApiUsageLimitTrigger) trigger).getState().getApiFeature().getApiStateKey().equals(feature.getApiStateKey()) + )); + } + } + + + @NotNull + private ApiUsageState getApiUsageState() { + ApiUsageState apiUsageState = new ApiUsageState(); + + apiUsageState.setTenantId(tenantId); + apiUsageState.setTransportState(ApiUsageStateValue.ENABLED); + apiUsageState.setDbStorageState(ApiUsageStateValue.ENABLED); + apiUsageState.setReExecState(ApiUsageStateValue.ENABLED); + apiUsageState.setJsExecState(ApiUsageStateValue.ENABLED); + apiUsageState.setTbelExecState(ApiUsageStateValue.ENABLED); + apiUsageState.setEmailExecState(ApiUsageStateValue.ENABLED); + apiUsageState.setSmsExecState(ApiUsageStateValue.ENABLED); + apiUsageState.setAlarmExecState(ApiUsageStateValue.ENABLED); + return apiUsageState; + } + + private Map getExpectedResult() { + Map expectedResult = new HashMap<>(); + for (ApiUsageRecordKey recordKey : ApiUsageRecordKey.values()) { + if (recordKey.getApiFeature() != null) { + expectedResult.put(recordKey.getApiFeature(), ApiUsageStateValue.DISABLED); + } + } + + return expectedResult; + } } \ No newline at end of file diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateService.java index 3d09247c7e..9512b72ecd 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateService.java @@ -34,4 +34,5 @@ public interface ApiUsageStateService extends EntityDaoService { void deleteApiUsageStateByEntityId(EntityId entityId); ApiUsageState findApiUsageStateById(TenantId tenantId, ApiUsageStateId id); + } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java b/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java index f6f3d82c09..9b2a2b0046 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ApiUsageState.java @@ -86,11 +86,11 @@ public class ApiUsageState extends BaseData implements HasTenan return !ApiUsageStateValue.DISABLED.equals(tbelExecState); } - public boolean isEmailSendEnabled(){ + public boolean isEmailSendEnabled() { return !ApiUsageStateValue.DISABLED.equals(emailExecState); } - public boolean isSmsSendEnabled(){ + public boolean isSmsSendEnabled() { return !ApiUsageStateValue.DISABLED.equals(smsExecState); } diff --git a/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java b/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java index 264b23f118..dd376fe746 100644 --- a/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java +++ b/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java @@ -1019,7 +1019,9 @@ public class ProtoUtils { .setTbelExecState(apiUsageState.getTbelExecState().name()) .setEmailExecState(apiUsageState.getEmailExecState().name()) .setSmsExecState(apiUsageState.getSmsExecState().name()) - .setAlarmExecState(apiUsageState.getAlarmExecState().name()).build(); + .setAlarmExecState(apiUsageState.getAlarmExecState().name()) + .setVersion(apiUsageState.getVersion()) + .build(); } public static ApiUsageState fromProto(TransportProtos.ApiUsageStateProto proto) { @@ -1035,6 +1037,7 @@ public class ProtoUtils { apiUsageState.setEmailExecState(ApiUsageStateValue.valueOf(proto.getEmailExecState())); apiUsageState.setSmsExecState(ApiUsageStateValue.valueOf(proto.getSmsExecState())); apiUsageState.setAlarmExecState(ApiUsageStateValue.valueOf(proto.getAlarmExecState())); + apiUsageState.setVersion(proto.getVersion()); return apiUsageState; } diff --git a/common/proto/src/main/proto/queue.proto b/common/proto/src/main/proto/queue.proto index 228a4039d2..25c1f5dd01 100644 --- a/common/proto/src/main/proto/queue.proto +++ b/common/proto/src/main/proto/queue.proto @@ -325,6 +325,7 @@ message ApiUsageStateProto { string emailExecState = 14; string smsExecState = 15; string alarmExecState = 16; + int64 version = 17; } message RepositorySettingsProto { diff --git a/dao/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateServiceImpl.java index d901ae950e..3d0e0f1309 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateServiceImpl.java @@ -154,6 +154,7 @@ public class ApiUsageStateServiceImpl extends AbstractEntityService implements A log.trace("Executing save [{}]", apiUsageState.getTenantId()); validateId(apiUsageState.getTenantId(), id -> INCORRECT_TENANT_ID + id); validateId(apiUsageState.getId(), "Can't save new usage state. Only update is allowed!"); + apiUsageState.setVersion(null); ApiUsageState savedState = apiUsageStateDao.save(apiUsageState.getTenantId(), apiUsageState); eventPublisher.publishEvent(SaveEntityEvent.builder().tenantId(savedState.getTenantId()).entityId(savedState.getId()) .entity(savedState).build()); diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/ApiUsageStateServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/ApiUsageStateServiceTest.java index 36b138f42a..d3e86a1603 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/ApiUsageStateServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/ApiUsageStateServiceTest.java @@ -20,6 +20,7 @@ import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.server.common.data.ApiUsageState; import org.thingsboard.server.common.data.ApiUsageStateValue; +import org.thingsboard.server.dao.exception.IncorrectParameterException; import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; @@ -30,22 +31,42 @@ public class ApiUsageStateServiceTest extends AbstractServiceTest { ApiUsageStateService apiUsageStateService; @Test - public void testFindApiUsageStateByTenantId() { - ApiUsageState apiUsageState = apiUsageStateService.findTenantApiUsageState(tenantId); - Assert.assertNotNull(apiUsageState); + public void testFindTenantApiUsageState() { + ApiUsageState state = apiUsageStateService.findTenantApiUsageState(tenantId); + Assert.assertNotNull(state); } @Test - public void testUpdateApiUsageState(){ - ApiUsageState apiUsageState = apiUsageStateService.findTenantApiUsageState(tenantId); - Assert.assertNotNull(apiUsageState); - Assert.assertTrue(apiUsageState.isTransportEnabled()); - apiUsageState.setTransportState(ApiUsageStateValue.DISABLED); - apiUsageState = apiUsageStateService.update(apiUsageState); - Assert.assertNotNull(apiUsageState); - apiUsageState = apiUsageStateService.findTenantApiUsageState(tenantId); - Assert.assertNotNull(apiUsageState); - Assert.assertFalse(apiUsageState.isTransportEnabled()); + public void testUpdate() { + ApiUsageState state = apiUsageStateService.findTenantApiUsageState(tenantId); + + state.setTransportState(ApiUsageStateValue.DISABLED); + ApiUsageState updated = apiUsageStateService.update(state); + Assert.assertEquals(ApiUsageStateValue.DISABLED, updated.getTransportState()); + } + + @Test + public void testUpdateWithNullId() { + ApiUsageState newState = new ApiUsageState(); + newState.setTenantId(tenantId); + newState.setTransportState(ApiUsageStateValue.ENABLED); + Assert.assertThrows(IncorrectParameterException.class, () -> apiUsageStateService.update(newState)); + } + + @Test + public void testFindApiUsageStateByEntityId() { + ApiUsageState state = apiUsageStateService.findApiUsageStateByEntityId(tenantId); + Assert.assertNotNull(state); + } + + @Test + public void testDeleteByTenantId() { + ApiUsageState state = apiUsageStateService.findTenantApiUsageState(tenantId); + Assert.assertNotNull(state); + + apiUsageStateService.deleteByTenantId(tenantId); + state = apiUsageStateService.findTenantApiUsageState(tenantId); + Assert.assertNull(state); } } From fcf74a82407ef54236e35eea97d6d838c531bc9f Mon Sep 17 00:00:00 2001 From: nick Date: Sun, 16 Feb 2025 20:15:04 +0200 Subject: [PATCH 075/100] lwm2m: fix bug observe object with "ver = 1.1" --- .../lwm2m/AbstractLwM2MIntegrationTest.java | 11 +- .../transport/lwm2m/Lwm2mTestHelper.java | 3 +- .../lwm2m/client/LwM2MTestClient.java | 21 +- ...LwM2MIntegrationObserve_Ver_1_0_Test.java} | 15 +- ...cLwM2MIntegrationObserve_Ver_1_1_Test.java | 28 ++ ...cLwM2MIntegrationObserve_Ver_1_2_Test.java | 28 ++ .../rpc/AbstractRpcLwM2MIntegrationTest.java | 6 +- ...cLwm2MIntegrationObserveCompositeTest.java | 4 +- .../sql/RpcLwm2mIntegrationObserveTest.java | 4 +- ...cLwm2mIntegrationObserve_Ver_1_0_Test.java | 48 +++ ...cLwm2mIntegrationObserve_Ver_1_1_Test.java | 46 +++ ...cLwm2mIntegrationObserve_Ver_1_2_Test.java | 48 +++ .../src/test/resources/lwm2m/3-1_0.xml | 327 +++++++++++++++++ .../src/test/resources/lwm2m/3-1_1.xml | 331 ++++++++++++++++++ .../lwm2m/server/client/LwM2mClient.java | 40 ++- 15 files changed, 924 insertions(+), 36 deletions(-) rename application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/{AbstractRpcLwM2MIntegrationObserveTest.java => AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test.java} (50%) create mode 100644 application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test.java create mode 100644 application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test.java create mode 100644 application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_0_Test.java create mode 100644 application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_1_Test.java create mode 100644 application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_2_Test.java create mode 100644 application/src/test/resources/lwm2m/3-1_0.xml create mode 100644 application/src/test/resources/lwm2m/3-1_1.xml diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java index 2357ef01f5..2caa8f1e90 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java @@ -89,6 +89,7 @@ import static org.awaitility.Awaitility.await; import static org.eclipse.leshan.client.object.Security.noSec; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -346,7 +347,7 @@ public abstract class AbstractLwM2MIntegrationTest extends AbstractTransportInte public void createNewClient(Security security, Security securityBs, boolean isRpc, String endpoint, Integer clientDtlsCidLength, boolean queueMode, String deviceIdStr) throws Exception { this.clientDestroy(false); - lwM2MTestClient = new LwM2MTestClient(this.executor, endpoint); + lwM2MTestClient = new LwM2MTestClient(this.executor, endpoint, resources); try (ServerSocket socket = new ServerSocket(0)) { int clientPort = socket.getLocalPort(); @@ -359,7 +360,7 @@ public abstract class AbstractLwM2MIntegrationTest extends AbstractTransportInte private void clientDestroy(boolean isAfter) { try { - if (lwM2MTestClient != null) { + if (lwM2MTestClient != null && lwM2MTestClient.getLeshanClient() != null) { if (isAfter) { sendObserveCancelAllWithAwait(lwM2MTestClient.getDeviceIdStr()); awaitDeleteDevice(lwM2MTestClient.getDeviceIdStr()); @@ -457,9 +458,15 @@ public abstract class AbstractLwM2MIntegrationTest extends AbstractTransportInte assertEquals(ResponseCode.CONTENT.getName(), rpcActualResult.get("result").asText()); return rpcActualResult.get("value").asText(); } + protected void sendRpcObserveWithContainsLwM2mSingleResource(String params) throws Exception { + String rpcActualResult = sendRpcObserveOkWithResultValue("Observe", params); + assertTrue(rpcActualResult.contains("LwM2mSingleResource") || rpcActualResult.contains("LwM2mMultipleResource")); + } + protected String sendRpcObserveOk(String method, String params) throws Exception { return sendObserveOK(method, params, lwM2MTestClient.getDeviceIdStr()); } + protected String sendObserveOK(String method, String params, String deviceIdStr) throws Exception { String sendRpcRequest; if (params == null) { diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/Lwm2mTestHelper.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/Lwm2mTestHelper.java index 4aa47eddf5..a40c937de8 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/Lwm2mTestHelper.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/Lwm2mTestHelper.java @@ -17,8 +17,9 @@ package org.thingsboard.server.transport.lwm2m; public class Lwm2mTestHelper { + public static final String[] lwm2mClientResources = new String[]{"3.xml", "5.xml", "6.xml", "9.xml", "19.xml", "3303.xml"}; + // Models - public static final String[] resources = new String[]{"0.xml", "1.xml", "2.xml", "3.xml", "5.xml", "6.xml", "9.xml", "19.xml", "3303.xml"}; public static final int BINARY_APP_DATA_CONTAINER = 19; public static final int TEMPERATURE_SENSOR = 3303; diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java index 1c09825e92..ed846bc375 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java @@ -116,7 +116,7 @@ import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.OBJECT_INST import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.OBJECT_INSTANCE_ID_1; import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.OBJECT_INSTANCE_ID_12; import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.TEMPERATURE_SENSOR; -import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.resources; +import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.lwm2mClientResources; import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.setDtlsConnectorConfigCidLength; @@ -126,6 +126,7 @@ public class LwM2MTestClient { private final ScheduledExecutorService executor; private final String endpoint; + private final String[] modelResources; private LeshanClient leshanClient; private SimpleLwM2MDevice lwM2MDevice; private FwLwM2MDevice fwLwM2MDevice; @@ -147,10 +148,24 @@ public class LwM2MTestClient { Assert.assertNull("client already initialized", leshanClient); this.defaultLwM2mUplinkMsgHandlerTest = defaultLwM2mUplinkMsgHandler; this.clientContext = clientContext; - List models = new ArrayList<>(); - for (String resourceName : resources) { + + List models = ObjectLoader.loadAllDefault(); + for (String resourceName : lwm2mClientResources) { models.addAll(ObjectLoader.loadDdfFile(LwM2MTestClient.class.getClassLoader().getResourceAsStream("lwm2m/" + resourceName), resourceName)); } + if (this.modelResources != null) { + List modelsRes = new ArrayList<>(); + for (String resourceName : this.modelResources) { + modelsRes.addAll(ObjectLoader.loadDdfFile(LwM2MTestClient.class.getClassLoader().getResourceAsStream("lwm2m/" + resourceName), resourceName)); + } + Set idsToRemove = new HashSet<>(); + for (ObjectModel model : modelsRes) { + idsToRemove.add(model.id); + } + models.removeIf(model -> idsToRemove.contains(model.id)); + models.addAll(modelsRes); + } + LwM2mModel model = new StaticModel(models); ObjectsInitializer initializer = new ObjectsInitializer(model); if (securityBs != null && security != null) { diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserveTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test.java similarity index 50% rename from application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserveTest.java rename to application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test.java index 7195b0d229..0b7faafd7b 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserveTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test.java @@ -16,18 +16,13 @@ package org.thingsboard.server.transport.lwm2m.rpc; import org.thingsboard.server.dao.service.DaoSqlTest; -import static org.junit.Assert.assertTrue; @DaoSqlTest -public abstract class AbstractRpcLwM2MIntegrationObserveTest extends AbstractRpcLwM2MIntegrationTest{ - private final String[] RESOURCES_RPC_MULTIPLE_19 = new String[]{"0.xml", "1.xml", "2.xml", "3.xml", "5.xml", "6.xml", "9.xml", "19.xml", "3303.xml"}; +public abstract class AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test extends AbstractRpcLwM2MIntegrationTest{ - public AbstractRpcLwM2MIntegrationObserveTest() { - setResources(this.RESOURCES_RPC_MULTIPLE_19); - } - - protected void sendRpcObserveWithContainsLwM2mSingleResource(String params) throws Exception { - String rpcActualResult = sendRpcObserveOkWithResultValue("Observe", params); - assertTrue(rpcActualResult.contains("LwM2mSingleResource") || rpcActualResult.contains("LwM2mMultipleResource")); + public AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test() { + String[] RESOURCES_RPC_VER_1_1 = new String[]{"3-1_0.xml", "5.xml", "6.xml", "9.xml", "19.xml"}; + setResources(RESOURCES_RPC_VER_1_1); } } + diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test.java new file mode 100644 index 0000000000..0a9290b0c4 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test.java @@ -0,0 +1,28 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.transport.lwm2m.rpc; + +import org.thingsboard.server.dao.service.DaoSqlTest; + +@DaoSqlTest +public abstract class AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test extends AbstractRpcLwM2MIntegrationTest{ + + public AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test() { + String[] RESOURCES_RPC_VER_1_1 = new String[]{"3-1_1.xml", "5.xml", "6.xml", "9.xml", "19.xml"}; + setResources(RESOURCES_RPC_VER_1_1); + } +} + diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test.java new file mode 100644 index 0000000000..e52ca15634 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test.java @@ -0,0 +1,28 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.transport.lwm2m.rpc; + +import org.thingsboard.server.dao.service.DaoSqlTest; + +@DaoSqlTest +public abstract class AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test extends AbstractRpcLwM2MIntegrationTest{ + + public AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test() { + String[] RESOURCES_RPC_VER_1_1 = new String[]{"3.xml", "5.xml", "6.xml", "9.xml", "19.xml"}; + setResources(RESOURCES_RPC_VER_1_1); + } +} + diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java index d5c9683c39..de4845a220 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java @@ -63,7 +63,7 @@ import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID_NAME_3_14; import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID_NAME_3_9; import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.TEMPERATURE_SENSOR; -import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.resources; +import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.lwm2mClientResources; import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.fromVersionedIdToObjectId; @Slf4j @@ -102,7 +102,7 @@ public abstract class AbstractRpcLwM2MIntegrationTest extends AbstractLwM2MInteg protected LwM2mTransportServerHelper lwM2mTransportServerHelperTest; public AbstractRpcLwM2MIntegrationTest() { - setResources(resources); + setResources(lwm2mClientResources); } @Before @@ -110,7 +110,7 @@ public abstract class AbstractRpcLwM2MIntegrationTest extends AbstractLwM2MInteg if (this.getClass().getSimpleName().equals("RpcLwm2mIntegrationWriteCborTest")) { supportFormatOnly_SenMLJSON_SenMLCBOR = true; } - if (this.getClass().getSimpleName().equals("RpcLwm2mIntegrationObserveTest")) { + if (this.getClass().getSimpleName().contains("RpcLwm2mIntegrationObserve")) { initRpc(0); } else if (this.getClass().getSimpleName().equals("RpcLwm2mIntegrationReadCollectedValueTest")) { initRpc(3303); diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2MIntegrationObserveCompositeTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2MIntegrationObserveCompositeTest.java index 56de08e66d..aa05b8073c 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2MIntegrationObserveCompositeTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2MIntegrationObserveCompositeTest.java @@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.leshan.core.ResponseCode; import org.junit.Test; import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserveTest; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationTest; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -50,7 +50,7 @@ import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_IN import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.fromVersionedIdToObjectId; @Slf4j -public class RpcLwm2MIntegrationObserveCompositeTest extends AbstractRpcLwM2MIntegrationObserveTest { +public class RpcLwm2MIntegrationObserveCompositeTest extends AbstractRpcLwM2MIntegrationTest { /** * ObserveComposite {"ids":["5/0/7", "5/0/5", "5/0/3", "3/0/9", "19/1/0/0"]} - Ok diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserveTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserveTest.java index 57213e08cd..425c7a3d6b 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserveTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserveTest.java @@ -24,7 +24,7 @@ import org.eclipse.leshan.server.registration.Registration; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserveTest; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationTest; import static org.eclipse.leshan.core.LwM2mId.ACCESS_CONTROL; import static org.junit.Assert.assertEquals; @@ -41,7 +41,7 @@ import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.fromVersionedIdToObjectId; @Slf4j -public class RpcLwm2mIntegrationObserveTest extends AbstractRpcLwM2MIntegrationObserveTest { +public class RpcLwm2mIntegrationObserveTest extends AbstractRpcLwM2MIntegrationTest { @Before public void setupObserveTest() throws Exception { diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_0_Test.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_0_Test.java new file mode 100644 index 0000000000..9c2fbd3313 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_0_Test.java @@ -0,0 +1,48 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.transport.lwm2m.rpc.sql; + +import lombok.extern.slf4j.Slf4j; +import org.junit.Before; +import org.junit.Test; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test; + +import static org.junit.Assert.assertTrue; +import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID_NAME_3_9; + +@Slf4j +public class RpcLwm2mIntegrationObserve_Ver_1_0_Test extends AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test { + + @Before + public void setupObserveTest() throws Exception { + awaitObserveReadAll(4,lwM2MTestClient.getDeviceIdStr()); + } + + /** + * Observe "3_1.0/0/9" + * @throws Exception + */ + @Test + public void testObserveOneResource_Result_CONTENT_Value_Count_3_After_Cancel_Count_2() throws Exception { + long initSendTelemetryAtCount = countSendParametersOnThingsboardTelemetryResource(RESOURCE_ID_NAME_3_9); + sendObserveCancelAllWithAwait(lwM2MTestClient.getDeviceIdStr()); + sendRpcObserveWithContainsLwM2mSingleResource(idVer_3_0_9); + updateRegAtLeastOnceAfterAction(); + long lastSendTelemetryAtCount = countSendParametersOnThingsboardTelemetryResource(RESOURCE_ID_NAME_3_9); + assertTrue(lastSendTelemetryAtCount > initSendTelemetryAtCount); + } +} diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_1_Test.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_1_Test.java new file mode 100644 index 0000000000..79d09721e9 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_1_Test.java @@ -0,0 +1,46 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.transport.lwm2m.rpc.sql; + +import lombok.extern.slf4j.Slf4j; +import org.junit.Before; +import org.junit.Test; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test; +import static org.junit.Assert.assertTrue; +import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID_NAME_3_9; + +@Slf4j +public class RpcLwm2mIntegrationObserve_Ver_1_1_Test extends AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test { + + @Before + public void setupObserveTest() throws Exception { + awaitObserveReadAll(4,lwM2MTestClient.getDeviceIdStr()); + } + + /** + * Observe "3_1.1/0/9" + * @throws Exception + */ + @Test + public void testObserveOneResource_Result_CONTENT_Value_Count_3_After_Cancel_Count_2() throws Exception { + long initSendTelemetryAtCount = countSendParametersOnThingsboardTelemetryResource(RESOURCE_ID_NAME_3_9); + sendObserveCancelAllWithAwait(lwM2MTestClient.getDeviceIdStr()); + sendRpcObserveWithContainsLwM2mSingleResource(idVer_3_0_9); + updateRegAtLeastOnceAfterAction(); + long lastSendTelemetryAtCount = countSendParametersOnThingsboardTelemetryResource(RESOURCE_ID_NAME_3_9); + assertTrue(lastSendTelemetryAtCount > initSendTelemetryAtCount); + } +} diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_2_Test.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_2_Test.java new file mode 100644 index 0000000000..ec45c2beac --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_2_Test.java @@ -0,0 +1,48 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.transport.lwm2m.rpc.sql; + +import lombok.extern.slf4j.Slf4j; +import org.junit.Before; +import org.junit.Test; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test; +import org.thingsboard.server.transport.lwm2m.rpc.AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test; + +import static org.junit.Assert.assertTrue; +import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.RESOURCE_ID_NAME_3_9; + +@Slf4j +public class RpcLwm2mIntegrationObserve_Ver_1_2_Test extends AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test { + + @Before + public void setupObserveTest() throws Exception { + awaitObserveReadAll(4,lwM2MTestClient.getDeviceIdStr()); + } + + /** + * Observe "3_1.2/0/9" + * @throws Exception + */ + @Test + public void testObserveOneResource_Result_CONTENT_Value_Count_3_After_Cancel_Count_2() throws Exception { + long initSendTelemetryAtCount = countSendParametersOnThingsboardTelemetryResource(RESOURCE_ID_NAME_3_9); + sendObserveCancelAllWithAwait(lwM2MTestClient.getDeviceIdStr()); + sendRpcObserveWithContainsLwM2mSingleResource(idVer_3_0_9); + updateRegAtLeastOnceAfterAction(); + long lastSendTelemetryAtCount = countSendParametersOnThingsboardTelemetryResource(RESOURCE_ID_NAME_3_9); + assertTrue(lastSendTelemetryAtCount > initSendTelemetryAtCount); + } +} diff --git a/application/src/test/resources/lwm2m/3-1_0.xml b/application/src/test/resources/lwm2m/3-1_0.xml new file mode 100644 index 0000000000..4f5261d263 --- /dev/null +++ b/application/src/test/resources/lwm2m/3-1_0.xml @@ -0,0 +1,327 @@ + + + + + + + Device + This LwM2M Object provides a range of device related information which can be queried by the LwM2M Server, and a device reboot and factory reset function. + 3 + urn:oma:lwm2m:oma:3 + Single + Mandatory + + + Manufacturer + R + Single + Optional + String + + + Human readable manufacturer name + + + Model Number + R + Single + Optional + String + + + A model identifier (manufacturer specified string) + + + Serial Number + R + Single + Optional + String + + + Serial Number + + + Firmware Version + R + Single + Optional + String + + + Current firmware version of the Device.The Firmware Management function could rely on this resource. + + + Reboot + E + Single + Mandatory + + + + Reboot the LwM2M Device to restore the Device from unexpected firmware failure. + + + Factory Reset + E + Single + Optional + + + + Perform factory reset of the LwM2M Device to make the LwM2M Device to go through initial deployment sequence where provisioning and bootstrap sequence is performed. This requires client ensuring post factory reset to have minimal information to allow it to carry out one of the bootstrap methods specified in section 5.2.3. +When this Resource is executed, “De-register” operation MAY be sent to the LwM2M Server(s) before factory reset of the LwM2M Device. + + + Available Power Sources + R + Multiple + Optional + Integer + 0-7 + + 0 – DC power +1 – Internal Battery +2 – External Battery +4 – Power over Ethernet +5 – USB +6 – AC (Mains) power +7 – Solar +The same Resource Instance ID MUST be used to associate a given Power Source (Resource ID:6) with its Present Voltage (Resource ID:7) and its Present Current (Resource ID:8) + + + Power Source Voltage + R + Multiple + Optional + Integer + + mV + Present voltage for each Available Power Sources Resource Instance. + + + Power Source Current + R + Multiple + Optional + Integer + + mA + Present current for each Available Power Source. + + + Battery Level + R + Single + Optional + Integer + 0-100 + % + Contains the current battery level as a percentage (with a range from 0 to 100). This value is only valid for the Device internal Battery if present (one Available Power Sources Resource Instance is 1). + + + Memory Free + R + Single + Optional + Integer + + KB + Estimated current available amount of storage space which can store data and software in the LwM2M Device (expressed in kilobytes). + + + Error Code + R + Multiple + Mandatory + Integer + 0-8 + + 0=No error +1=Low battery power +2=External power supply off +3=GPS module failure +4=Low received signal strength +5=Out of memory +6=SMS failure +7=IP connectivity failure +8=Peripheral malfunction + +When the single Device Object Instance is initiated, there is only one error code Resource Instance whose value is equal to 0 that means no error. When the first error happens, the LwM2M Client changes error code Resource Instance to any non-zero value to indicate the error type. When any other error happens, a new error code Resource Instance is created. When an error associated with a Resource Instance is no longer present, that Resource Instance is deleted. When the single existing error is no longer present, the LwM2M Client returns to the original no error state where Instance 0 has value 0. +This error code Resource MAY be observed by the LwM2M Server. How to deal with LwM2M Client’s error report depends on the policy of the LwM2M Server. + + + Reset Error Code + E + Single + Optional + + + + Delete all error code Resource Instances and create only one zero-value error code that implies no error, then re-evaluate all error conditions and update and create Resources Instances to capture all current error conditions. + + + Current Time + RW + Single + Optional + Time + + + Current UNIX time of the LwM2M Client. +The LwM2M Client should be responsible to increase this time value as every second elapses. +The LwM2M Server is able to write this Resource to make the LwM2M Client synchronized with the LwM2M Server. + + + UTC Offset + RW + Single + Optional + String + + + Indicates the UTC offset currently in effect for this LwM2M Device. UTC+X [ISO 8601]. + + + Timezone + RW + Single + Optional + String + + + Indicates in which time zone the LwM2M Device is located, in IANA Timezone (TZ) database format. + + + Supported Binding and Modes + R + Single + Mandatory + String + + + Indicates which bindings and modes are supported in the LwM2M Client. The possible values are those listed in the LwM2M Core Specification. + + Device Type + R + Single + Optional + String + + + Type of the device (manufacturer specified string: e.g. smart meters / dev Class…) + + Hardware Version + R + Single + Optional + String + + + Current hardware version of the device + + Software Version + R + Single + Optional + String + + + Current software version of the device (manufacturer specified string). On elaborated LwM2M device, SW could be split in 2 parts: a firmware one and a higher level software on top. +Both pieces of Software are together managed by LwM2M Firmware Update Object (Object ID 5) + + Battery Status + R + Single + Optional + Integer + 0-6 + + This value is only valid for the Device Internal Battery if present (one Available Power Sources Resource Instance value is 1). +Battery +Status Meaning Description +0 Normal The battery is operating normally and not on power. +1 Charging The battery is currently charging. +2 Charge Complete The battery is fully charged and still on power. +3 Damaged The battery has some problem. +4 Low Battery The battery is low on charge. +5 Not Installed The battery is not installed. +6 Unknown The battery information is not available. + + Memory Total + R + Single + Optional + Integer + + + Total amount of storage space which can store data and software in the LwM2M Device (expressed in kilobytes). + + ExtDevInfo + R + Multiple + Optional + Objlnk + + + Reference to external “Device” object instance containing information. For example, such an external device can be a Host Device, which is a device into which the Device containing the LwM2M client is embedded. This Resource may be used to retrieve information about the Host Device. + + + + diff --git a/application/src/test/resources/lwm2m/3-1_1.xml b/application/src/test/resources/lwm2m/3-1_1.xml new file mode 100644 index 0000000000..01151a57b7 --- /dev/null +++ b/application/src/test/resources/lwm2m/3-1_1.xml @@ -0,0 +1,331 @@ + + + + + + + Device + This LwM2M Object provides a range of device related information which can be queried by the LwM2M Server, and a device reboot and factory reset function. + 3 + urn:oma:lwm2m:oma:3:1.1 + 1.1 + 1.1 + Single + Mandatory + + + Manufacturer + R + Single + Optional + String + + + Human readable manufacturer name + + + Model Number + R + Single + Optional + String + + + A model identifier (manufacturer specified string) + + + Serial Number + R + Single + Optional + String + + + Serial Number + + + Firmware Version + R + Single + Optional + String + + + Current firmware version of the Device.The Firmware Management function could rely on this resource. + + + Reboot + E + Single + Mandatory + + + + Reboot the LwM2M Device to restore the Device from unexpected firmware failure. + + + Factory Reset + E + Single + Optional + + + + Perform factory reset of the LwM2M Device to make the LwM2M Device to go through initial deployment sequence where provisioning and bootstrap sequence is performed. This requires client ensuring post factory reset to have minimal information to allow it to carry out one of the bootstrap methods specified in section 5.2.3. +When this Resource is executed, "De-register" operation MAY be sent to the LwM2M Server(s) before factory reset of the LwM2M Device. + + + Available Power Sources + R + Multiple + Optional + Integer + 0..7 + + 0: DC power +1: Internal Battery +2: External Battery +3: Fuel Cell +4: Power over Ethernet +5: USB +6: AC (Mains) power +7: Solar +The same Resource Instance ID MUST be used to associate a given Power Source (Resource ID:6) with its Present Voltage (Resource ID:7) and its Present Current (Resource ID:8) + + + Power Source Voltage + R + Multiple + Optional + Integer + + + Present voltage for each Available Power Sources Resource Instance. The unit used for this resource is in mV. + + + Power Source Current + R + Multiple + Optional + Integer + + + Present current for each Available Power Source. The unit used for this resource is in mA. + + + Battery Level + R + Single + Optional + Integer + 0..100 + % + Contains the current battery level as a percentage (with a range from 0 to 100). This value is only valid for the Device internal Battery if present (one Available Power Sources Resource Instance is 1). + + + Memory Free + R + Single + Optional + Integer + + + Estimated current available amount of storage space which can store data and software in the LwM2M Device (expressed in kilobytes). + + + Error Code + R + Multiple + Mandatory + Integer + 0..8 + + 0=No error +1=Low battery power +2=External power supply off +3=GPS module failure +4=Low received signal strength +5=Out of memory +6=SMS failure +7=IP connectivity failure +8=Peripheral malfunction + +When the single Device Object Instance is initiated, there is only one error code Resource Instance whose value is equal to 0 that means no error. When the first error happens, the LwM2M Client changes error code Resource Instance to any non-zero value to indicate the error type. When any other error happens, a new error code Resource Instance is created. When an error associated with a Resource Instance is no longer present, that Resource Instance is deleted. When the single existing error is no longer present, the LwM2M Client returns to the original no error state where Instance 0 has value 0. +This error code Resource MAY be observed by the LwM2M Server. How to deal with LwM2M Client’s error report depends on the policy of the LwM2M Server. + + + Reset Error Code + E + Single + Optional + + + + Delete all error code Resource Instances and create only one zero-value error code that implies no error, then re-evaluate all error conditions and update and create Resources Instances to capture all current error conditions. + + + Current Time + RW + Single + Optional + Time + + + Current UNIX time of the LwM2M Client. +The LwM2M Client should be responsible to increase this time value as every second elapses. +The LwM2M Server is able to write this Resource to make the LwM2M Client synchronized with the LwM2M Server. + + + UTC Offset + RW + Single + Optional + String + + + Indicates the UTC offset currently in effect for this LwM2M Device. UTC+X [ISO 8601]. + + + Timezone + RW + Single + Optional + String + + + Indicates in which time zone the LwM2M Device is located, in IANA Timezone (TZ) database format. + + + Supported Binding and Modes + R + Single + Mandatory + String + + + Indicates which bindings and modes are supported in the LwM2M Client. The possible values are those listed in the LwM2M Core Specification. + + Device Type + R + Single + Optional + String + + + Type of the device (manufacturer specified string: e.g. smart meters / dev Class / ...) + + Hardware Version + R + Single + Optional + String + + + Current hardware version of the device + + Software Version + R + Single + Optional + String + + + Current software version of the device (manufacturer specified string). On elaborated LwM2M device, SW could be split in 2 parts: a firmware one and a higher level software on top. +Both pieces of Software are together managed by LwM2M Firmware Update Object (Object ID 5) + + Battery Status + R + Single + Optional + Integer + 0..6 + + This value is only valid for the Device Internal Battery if present (one Available Power Sources Resource Instance value is 1). +Battery +Status Meaning Description +0 Normal The battery is operating normally and not on power. +1 Charging The battery is currently charging. +2 Charge Complete The battery is fully charged and still on power. +3 Damaged The battery has some problem. +4 Low Battery The battery is low on charge. +5 Not Installed The battery is not installed. +6 Unknown The battery information is not available. + + Memory Total + R + Single + Optional + Integer + + + Total amount of storage space which can store data and software in the LwM2M Device (expressed in kilobytes). + + ExtDevInfo + R + Multiple + Optional + Objlnk + + + Reference to external "Device" object instance containing information. For example, such an external device can be a Host Device, which is a device into which the Device containing the LwM2M client is embedded. This Resource may be used to retrieve information about the Host Device. + + + + diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClient.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClient.java index 713d5b9fa8..3146eba95b 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClient.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClient.java @@ -24,6 +24,9 @@ import org.eclipse.leshan.core.LwM2m; import org.eclipse.leshan.core.LwM2m.Version; import org.eclipse.leshan.core.link.Link; import org.eclipse.leshan.core.link.attributes.Attribute; +import org.eclipse.leshan.core.link.lwm2m.MixedLwM2mLink; +import org.eclipse.leshan.core.link.lwm2m.attributes.LwM2mAttribute; +import org.eclipse.leshan.core.link.lwm2m.attributes.LwM2mAttributes; import org.eclipse.leshan.core.model.ObjectModel; import org.eclipse.leshan.core.model.ResourceModel; import org.eclipse.leshan.core.node.LwM2mMultipleResource; @@ -453,22 +456,33 @@ public class LwM2mClient { } private void setSupportedClientObjects(){ - this.supportedClientObjects = new ConcurrentHashMap<>(); - for (Link link: this.registration.getSortedObjectLinks()) { - LwM2mPath lwM2mPath = new LwM2mPath(link.getUriReference()); - if (lwM2mPath.isObject()) { - LwM2m.Version ver; - if (link.getAttributes().get("ver")!= null) { - ver = new LwM2m.Version(link.getAttributes().get("ver").getValue().toString()); - } else { - ver = getDefaultObjectIDVer(); + if (this.registration.getSupportedObject() != null && this.registration.getSupportedObject().size() > 0) { + this.supportedClientObjects = this.registration.getSupportedObject(); + } else { + this.supportedClientObjects = new ConcurrentHashMap<>(); + for (Link link : this.registration.getSortedObjectLinks()) { + if (link instanceof MixedLwM2mLink) { + LwM2mPath path = ((MixedLwM2mLink) link).getPath(); + // add supported objects + if (path.isObject() || path.isObjectInstance()) { + int objectId = path.getObjectId(); + LwM2mAttribute versionParamValue = link.getAttributes().get(LwM2mAttributes.OBJECT_VERSION); + if (versionParamValue != null) { + // if there is a version attribute then use it as version for this object + this.supportedClientObjects.put(objectId, versionParamValue.getValue()); + } else { + // there is no version attribute attached. + // In this case we use the DEFAULT_VERSION only if this object stored as supported object. + Version currentVersion = this.supportedClientObjects.get(objectId); + if (currentVersion == null) { + this.supportedClientObjects.put(objectId, getDefaultObjectIDVer()); + } + } + } } - this.supportedClientObjects.put(lwM2mPath.getObjectId(), ver); - } else if (lwM2mPath.getObjectId() != null && this.supportedClientObjects.get(lwM2mPath.getObjectId()) == null){ - this.supportedClientObjects.put(lwM2mPath.getObjectId(), getDefaultObjectIDVer()); } } } - } + From b6a7c3231b0cffa07bfc55d86bbafd2fa5c392f0 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Mon, 17 Feb 2025 13:24:18 +0200 Subject: [PATCH 076/100] UI: Add Mobile bundle validators (PROD-5516). --- .../bundes/layout/custom-mobile-page.component.html | 8 ++++++++ .../mobile/bundes/layout/custom-mobile-page.component.ts | 2 +- .../mobile/bundes/mobile-bundle-dialog.component.html | 6 ++++++ .../pages/mobile/bundes/mobile-bundle-dialog.component.ts | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 3 +++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.html b/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.html index 1c89c7e06b..b0a44386cd 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.html +++ b/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.html @@ -46,6 +46,14 @@ class="tb-error"> warning + + warning +
        diff --git a/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.ts b/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.ts index e9576f313a..cf57c90a14 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/custom-mobile-page.component.ts @@ -65,7 +65,7 @@ export class CustomMobilePageComponent implements ControlValueAccessor, Validato customMobilePageForm = this.fb.group({ visible: [true], icon: ['star'], - label: ['', [Validators.required, Validators.pattern(/\S/)]], + label: ['', [Validators.required, Validators.pattern(/\S/), Validators.maxLength(255)]], type: [MobilePageType.DASHBOARD], dashboardId: this.fb.control(null, Validators.required), url: [{value:'', disabled: true}, [Validators.required, Validators.pattern(WEB_URL_REGEX)]], diff --git a/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.html b/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.html index 8e029cf9f7..e3352a2eb4 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-dialog.component.html @@ -44,6 +44,12 @@ {{ 'mobile.title-required' | translate }} + + {{ 'mobile.title-cannot-contain-only-spaces' | translate }} + + + {{ 'mobile.title-max-length' | translate }} + Date: Mon, 17 Feb 2025 13:25:53 +0200 Subject: [PATCH 077/100] UI: Remove redundant request after close mobile config dialog (PROD-5525). --- .../mobile/bundes/mobile-bundle-table-config.resolve.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-table-config.resolve.ts b/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-table-config.resolve.ts index ac9445c615..5576117460 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-table-config.resolve.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/bundes/mobile-bundle-table-config.resolve.ts @@ -185,11 +185,7 @@ export class MobileBundleTableConfigResolver { iosApp: data.iosApp } }).afterClosed() - .subscribe(() => { - if (afterAdd) { - this.config.updateData(); - } - }); + .subscribe(); }) } } From 9542c65ca3d00f32d161fdd09ce162d1b50ee024 Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 17 Feb 2025 15:39:59 +0200 Subject: [PATCH 078/100] Fixed api limit tests for ApiUsage service --- .../DefaultTbApiUsageStateServiceTest.java | 260 +++++++++++------- 1 file changed, 153 insertions(+), 107 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java index a0f61a4928..100c98adec 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java @@ -15,7 +15,8 @@ */ package org.thingsboard.server.service.apiusage; -import org.jetbrains.annotations.NotNull; +import com.google.common.util.concurrent.Futures; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -25,42 +26,28 @@ import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.test.util.ReflectionTestUtils; -import org.thingsboard.server.common.data.ApiFeature; -import org.thingsboard.server.common.data.ApiUsageRecordKey; -import org.thingsboard.server.common.data.ApiUsageState; -import org.thingsboard.server.common.data.ApiUsageStateValue; -import org.thingsboard.server.common.data.EntityType; -import org.thingsboard.server.common.data.Tenant; +import org.thingsboard.server.common.data.*; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.notification.rule.trigger.ApiUsageLimitTrigger; +import org.thingsboard.server.common.data.id.TenantProfileId; +import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; +import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; import org.thingsboard.server.common.msg.queue.TbCallback; import org.thingsboard.server.dao.tenant.TenantService; import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.common.TbProtoQueueMsg; +import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.service.mail.MailExecutorService; import org.thingsboard.server.service.telemetry.InternalTelemetryService; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.UUID; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.argThat; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) public class DefaultTbApiUsageStateServiceTest { @@ -80,122 +67,181 @@ public class DefaultTbApiUsageStateServiceTest { @Mock private InternalTelemetryService tsWsService; + @Mock + private PartitionService partitionService; + @Mock private MailExecutorService mailExecutor; - - TenantId tenantId = TenantId.fromUUID(UUID.fromString("00797a3b-7aeb-4b5b-b57a-c2a810d0f112")); @Spy @InjectMocks DefaultTbApiUsageStateService service; + private ApiUsageState dummyUsageState; + private TenantApiUsageState tenantApiUsageState; + private Tenant dummyTenant; + + private static final int MAX_ENABLE_VALUE = 5000; + private static final double WARN_THRESHOLD_VALUE = 0.8; + @BeforeEach public void setUp() { + var tenantId = TenantId.fromUUID(UUID.randomUUID()); + dummyTenant = new Tenant(); + dummyTenant.setId(tenantId); + dummyTenant.setEmail("test@tenant.com"); + + lenient().when(tsWsService.saveTimeseriesInternal(any())).thenReturn(Futures.immediateFuture(0)); + ReflectionTestUtils.setField(service, "tsWsService", tsWsService); + + DefaultTenantProfileConfiguration config = DefaultTenantProfileConfiguration.builder() + .maxJSExecutions(MAX_ENABLE_VALUE) + .maxTransportMessages(MAX_ENABLE_VALUE) + .maxRuleChains(MAX_ENABLE_VALUE) + .maxTbelExecutions(MAX_ENABLE_VALUE) + .maxDPStorageDays(MAX_ENABLE_VALUE) + .maxREExecutions(MAX_ENABLE_VALUE) + .maxEmails(MAX_ENABLE_VALUE) + .maxSms(MAX_ENABLE_VALUE) + .maxCreatedAlarms(MAX_ENABLE_VALUE) + .warnThreshold(WARN_THRESHOLD_VALUE) + .build(); + + TenantProfileData profileData = new TenantProfileData(); + profileData.setConfiguration(config); + + TenantProfile tenantProfile = new TenantProfile(); + tenantProfile.setId(new TenantProfileId(UUID.randomUUID())); + tenantProfile.setProfileData(profileData); + + dummyUsageState = new ApiUsageState(); + dummyUsageState.setTransportState(ApiUsageStateValue.ENABLED); + dummyUsageState.setDbStorageState(ApiUsageStateValue.ENABLED); + dummyUsageState.setReExecState(ApiUsageStateValue.ENABLED); + dummyUsageState.setJsExecState(ApiUsageStateValue.ENABLED); + dummyUsageState.setTbelExecState(ApiUsageStateValue.ENABLED); + dummyUsageState.setEmailExecState(ApiUsageStateValue.ENABLED); + dummyUsageState.setSmsExecState(ApiUsageStateValue.ENABLED); + dummyUsageState.setAlarmExecState(ApiUsageStateValue.ENABLED); + dummyUsageState.setTenantId(tenantId); + dummyUsageState.setEntityId(tenantId); + dummyUsageState.setVersion(1L); + + tenantApiUsageState = new TenantApiUsageState(tenantProfile, dummyUsageState); + + service.myUsageStates.put(tenantId, tenantApiUsageState); + } + + @AfterEach + public void tearDown() { + } @Test public void givenTenantIdFromEntityStatesMap_whenGetApiUsageState() { - service.myUsageStates.put(tenantId, tenantUsageStateMock); - ApiUsageState tenantUsageState = service.getApiUsageState(tenantId); + service.myUsageStates.put(dummyTenant.getTenantId(), tenantUsageStateMock); + ApiUsageState tenantUsageState = service.getApiUsageState(dummyTenant.getTenantId()); assertThat(tenantUsageState, is(tenantUsageStateMock.getApiUsageState())); - Mockito.verify(service, never()).getOrFetchState(tenantId, tenantId); + Mockito.verify(service, never()).getOrFetchState(dummyTenant.getTenantId(), dummyTenant.getTenantId()); } @Test - public void testAllApiFeaturesDisabledWhenLimitReached() { - doReturn(null).when(tsWsService).saveTimeseriesInternal(any()); - - TenantApiUsageState tenantUsageStateMock = mock(TenantApiUsageState.class); - ApiUsageState apiUsageState = getApiUsageState(); - when(tenantUsageStateMock.getApiUsageState()).thenReturn(apiUsageState); - - doReturn(BaseApiUsageState.StatsCalculationResult.builder() - .newValue(200L) - .valueChanged(true) - .newHourlyValue(200L) - .hourlyValueChanged(true) - .build()) - .when(tenantUsageStateMock).calculate(any(ApiUsageRecordKey.class), anyLong(), anyString()); - - doReturn(200L).when(tenantUsageStateMock).getProfileThreshold(any(ApiUsageRecordKey.class)); - doReturn(50L).when(tenantUsageStateMock).getProfileWarnThreshold(any(ApiUsageRecordKey.class)); - doReturn(300L).when(tenantUsageStateMock).get(any(ApiUsageRecordKey.class)); - - when(tenantUsageStateMock.getEntityType()).thenReturn(EntityType.TENANT); - when(tenantUsageStateMock.getEntityId()).thenReturn(tenantId); - - Map expectedResult = getExpectedResult(); - when(tenantUsageStateMock.checkStateUpdatedDueToThreshold(any())).thenReturn(expectedResult); - service.myUsageStates.put(tenantId, tenantUsageStateMock); - - when(apiUsageStateService.update(apiUsageState)).thenReturn(apiUsageState); - - Tenant dummyTenant = new Tenant(); - dummyTenant.setEmail("test@example.com"); - when(tenantService.findTenantById(any())).thenReturn(dummyTenant); - - TransportProtos.ToUsageStatsServiceMsg.Builder msgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder(); - UUID uuid = tenantId.getId(); - msgBuilder.setTenantIdMSB(uuid.getMostSignificantBits()) - .setTenantIdLSB(uuid.getLeastSignificantBits()); - msgBuilder.setCustomerIdMSB(0) - .setCustomerIdLSB(0); - msgBuilder.setServiceId("TEST_SERVICE"); - - List usageStats = new ArrayList<>(); - for (ApiUsageRecordKey recordKey : ApiUsageRecordKey.values()) { - if (recordKey.getApiFeature() != null) { - TransportProtos.UsageStatsKVProto stat = TransportProtos.UsageStatsKVProto.newBuilder() - .setKey(recordKey.name()) - .setValue(1000L) - .build(); - usageStats.add(stat); - msgBuilder.addValues(stat); + public void testProcess_AllFeaturesTransitionToWarning() { + TransportProtos.ToUsageStatsServiceMsg.Builder msgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder() + .setTenantIdMSB(dummyTenant.getId().getId().getMostSignificantBits()) + .setTenantIdLSB(dummyTenant.getId().getId().getLeastSignificantBits()) + .setCustomerIdMSB(0) + .setCustomerIdLSB(0) + .setServiceId("testService"); + + for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { + if (key.getApiFeature() != null) { + msgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(key.name()) + .setValue(4500L) + .build()); } } TransportProtos.ToUsageStatsServiceMsg statsMsg = msgBuilder.build(); - TbProtoQueueMsg queueMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), statsMsg); + TbProtoQueueMsg msg = new TbProtoQueueMsg<>(UUID.randomUUID(), statsMsg); TbCallback callback = mock(TbCallback.class); - service.process(queueMsg, callback); - verify(callback).onSuccess(); + when(apiUsageStateService.update(any(ApiUsageState.class))).thenAnswer(invocation -> { + ApiUsageState state = invocation.getArgument(0); + state.setVersion(2L); + return state; + }); + + when(tenantService.findTenantById(dummyTenant.getTenantId())).thenReturn(dummyTenant); - for (ApiFeature feature : expectedResult.keySet()) { - verify(notificationRuleProcessor, atLeastOnce()).process(argThat(trigger -> - trigger instanceof ApiUsageLimitTrigger && - ((ApiUsageLimitTrigger) trigger).getStatus() == ApiUsageStateValue.DISABLED && - ((ApiUsageLimitTrigger) trigger).getState().getApiFeature().getApiStateKey().equals(feature.getApiStateKey()) - )); + service.process(msg, callback); + + verify(callback, times(1)).onSuccess(); + + for (ApiFeature feature : ApiFeature.values()) { + if (containsFeature(feature)) { + assertEquals(ApiUsageStateValue.WARNING, tenantApiUsageState.getFeatureValue(feature), + "For feature " + feature + " expected state WARNING"); + } } - } + + assertEquals(ApiUsageStateValue.WARNING, tenantApiUsageState.getFeatureValue(ApiFeature.JS)); - @NotNull - private ApiUsageState getApiUsageState() { - ApiUsageState apiUsageState = new ApiUsageState(); - - apiUsageState.setTenantId(tenantId); - apiUsageState.setTransportState(ApiUsageStateValue.ENABLED); - apiUsageState.setDbStorageState(ApiUsageStateValue.ENABLED); - apiUsageState.setReExecState(ApiUsageStateValue.ENABLED); - apiUsageState.setJsExecState(ApiUsageStateValue.ENABLED); - apiUsageState.setTbelExecState(ApiUsageStateValue.ENABLED); - apiUsageState.setEmailExecState(ApiUsageStateValue.ENABLED); - apiUsageState.setSmsExecState(ApiUsageStateValue.ENABLED); - apiUsageState.setAlarmExecState(ApiUsageStateValue.ENABLED); - return apiUsageState; + verify(notificationRuleProcessor, atLeastOnce()).process(any()); + verify(mailExecutor, atLeastOnce()).submit((Runnable) any()); } - private Map getExpectedResult() { - Map expectedResult = new HashMap<>(); - for (ApiUsageRecordKey recordKey : ApiUsageRecordKey.values()) { - if (recordKey.getApiFeature() != null) { - expectedResult.put(recordKey.getApiFeature(), ApiUsageStateValue.DISABLED); + @Test + public void testProcess_AllFeaturesTransitionToDisabled() { + TransportProtos.ToUsageStatsServiceMsg.Builder msgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder() + .setTenantIdMSB(dummyTenant.getId().getId().getMostSignificantBits()) + .setTenantIdLSB(dummyTenant.getId().getId().getLeastSignificantBits()) + .setCustomerIdMSB(0) + .setCustomerIdLSB(0) + .setServiceId("testService"); + + for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { + if (key.getApiFeature() != null) { + msgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(key.name()) + .setValue(5500L) + .build()); + } + } + TransportProtos.ToUsageStatsServiceMsg statsMsg = msgBuilder.build(); + TbProtoQueueMsg msg = new TbProtoQueueMsg<>(UUID.randomUUID(), statsMsg); + TbCallback callback = mock(TbCallback.class); + + when(apiUsageStateService.update(any(ApiUsageState.class))).thenAnswer(invocation -> { + ApiUsageState state = invocation.getArgument(0); + state.setVersion(2L); + return state; + }); + when(tenantService.findTenantById(dummyTenant.getTenantId())).thenReturn(dummyTenant); + + service.process(msg, callback); + verify(callback, times(1)).onSuccess(); + + for (ApiFeature feature : ApiFeature.values()) { + if (containsFeature(feature)) { + assertEquals(ApiUsageStateValue.DISABLED, tenantApiUsageState.getFeatureValue(feature), + "For feature " + feature + " expected state DISABLED"); } } + verify(notificationRuleProcessor, atLeastOnce()).process(any()); + verify(mailExecutor, atLeastOnce()).submit((Runnable) any()); + } - return expectedResult; + private boolean containsFeature(ApiFeature feature) { + for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { + if (key.getApiFeature() != null && key.getApiFeature().equals(feature)) { + return true; + } + } + return false; } + } \ No newline at end of file From 9792c28545d5070431a6b77fcec4415e4bf1171e Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 17 Feb 2025 16:13:09 +0200 Subject: [PATCH 079/100] Refactored import format --- .../apiusage/DefaultTbApiUsageStateServiceTest.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java index 100c98adec..c9abb8e1c0 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java @@ -46,8 +46,14 @@ import java.util.UUID; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class DefaultTbApiUsageStateServiceTest { @@ -143,7 +149,7 @@ public class DefaultTbApiUsageStateServiceTest { service.myUsageStates.put(dummyTenant.getTenantId(), tenantUsageStateMock); ApiUsageState tenantUsageState = service.getApiUsageState(dummyTenant.getTenantId()); assertThat(tenantUsageState, is(tenantUsageStateMock.getApiUsageState())); - Mockito.verify(service, never()).getOrFetchState(dummyTenant.getTenantId(), dummyTenant.getTenantId()); + verify(service, never()).getOrFetchState(dummyTenant.getTenantId(), dummyTenant.getTenantId()); } @Test From 5ced8457f16241b71894d31b5a471d25159b37bf Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 17 Feb 2025 20:53:49 +0200 Subject: [PATCH 080/100] Added new test cases --- .../DefaultTbApiUsageStateServiceTest.java | 168 +++++++++++++++--- 1 file changed, 144 insertions(+), 24 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java index c9abb8e1c0..8fefde0f6c 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java @@ -16,13 +16,12 @@ package org.thingsboard.server.service.apiusage; import com.google.common.util.concurrent.Futures; -import org.junit.jupiter.api.AfterEach; +import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.test.util.ReflectionTestUtils; @@ -33,6 +32,8 @@ import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileCon import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; import org.thingsboard.server.common.msg.queue.TbCallback; +import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; +import org.thingsboard.server.dao.tenant.TbTenantProfileCache; import org.thingsboard.server.dao.tenant.TenantService; import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; import org.thingsboard.server.gen.transport.TransportProtos; @@ -46,8 +47,11 @@ import java.util.UUID; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -58,9 +62,6 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class DefaultTbApiUsageStateServiceTest { - @Mock - TenantApiUsageState tenantUsageStateMock; - @Mock private NotificationRuleProcessor notificationRuleProcessor; @@ -73,21 +74,27 @@ public class DefaultTbApiUsageStateServiceTest { @Mock private InternalTelemetryService tsWsService; + @Mock + private MailExecutorService mailExecutor; + @Mock private PartitionService partitionService; @Mock - private MailExecutorService mailExecutor; + private TbTenantProfileCache tbTenantProfileCache; @Spy @InjectMocks DefaultTbApiUsageStateService service; - private ApiUsageState dummyUsageState; private TenantApiUsageState tenantApiUsageState; private Tenant dummyTenant; private static final int MAX_ENABLE_VALUE = 5000; + private static final long VALUE_WARNING = 4500L; + private static final long VALUE_DISABLE = 5500L; + private static final int NEW_MAX_ENABLE_VALUE = 4000; + private static final double NEW_WARN_THRESHOLD_VALUE = 0.9; private static final double WARN_THRESHOLD_VALUE = 0.8; @BeforeEach @@ -117,11 +124,20 @@ public class DefaultTbApiUsageStateServiceTest { TenantProfileData profileData = new TenantProfileData(); profileData.setConfiguration(config); - TenantProfile tenantProfile = new TenantProfile(); - tenantProfile.setId(new TenantProfileId(UUID.randomUUID())); - tenantProfile.setProfileData(profileData); + TenantProfile dummyTenantProfile = new TenantProfile(); + dummyTenantProfile.setId(new TenantProfileId(UUID.randomUUID())); + dummyTenantProfile.setProfileData(profileData); + + ApiUsageState dummyUsageState = getApiUsageState(tenantId); + + tenantApiUsageState = new TenantApiUsageState(dummyTenantProfile, dummyUsageState); - dummyUsageState = new ApiUsageState(); + service.myUsageStates.put(tenantId, tenantApiUsageState); + } + + @NotNull + private static ApiUsageState getApiUsageState(TenantId tenantId) { + ApiUsageState dummyUsageState = new ApiUsageState(); dummyUsageState.setTransportState(ApiUsageStateValue.ENABLED); dummyUsageState.setDbStorageState(ApiUsageStateValue.ENABLED); dummyUsageState.setReExecState(ApiUsageStateValue.ENABLED); @@ -133,23 +149,61 @@ public class DefaultTbApiUsageStateServiceTest { dummyUsageState.setTenantId(tenantId); dummyUsageState.setEntityId(tenantId); dummyUsageState.setVersion(1L); + return dummyUsageState; + } - tenantApiUsageState = new TenantApiUsageState(tenantProfile, dummyUsageState); - - service.myUsageStates.put(tenantId, tenantApiUsageState); + @Test + public void givenTenantIdFromEntityStatesMap_whenGetApiUsageState() { + ApiUsageState tenantUsageState = service.getApiUsageState(dummyTenant.getTenantId()); + assertThat(tenantUsageState, is(tenantApiUsageState.getApiUsageState())); + verify(service, never()).getOrFetchState(dummyTenant.getTenantId(), dummyTenant.getTenantId()); } - @AfterEach - public void tearDown() { + @Test + public void testGetApiUsageState_fromOtherUsageStates() { + TenantId tenantId = dummyTenant.getTenantId(); + service.myUsageStates.remove(tenantId); + ApiUsageState otherState = new ApiUsageState(); + otherState.setTenantId(tenantId); + service.otherUsageStates.put(tenantId, otherState); + ApiUsageState result = service.getApiUsageState(tenantId); + assertThat(result, is(otherState)); + } + @Test + public void testGetApiUsageState_whenMyPartition() { + TenantId tenantId = dummyTenant.getTenantId(); + service.myUsageStates.remove(tenantId); + service.otherUsageStates.remove(tenantId); + + TopicPartitionInfo tpi = mock(TopicPartitionInfo.class); + when(tpi.isMyPartition()).thenReturn(true); + when(partitionService.resolve(any(), eq(dummyTenant.getId()), eq(dummyTenant.getId()))).thenReturn(tpi); + + TenantApiUsageState fetchedState = tenantApiUsageState; + doReturn(fetchedState).when(service).getOrFetchState(tenantId, tenantId); + ApiUsageState result = service.getApiUsageState(tenantId); + assertThat(result, is(fetchedState.getApiUsageState())); } @Test - public void givenTenantIdFromEntityStatesMap_whenGetApiUsageState() { - service.myUsageStates.put(dummyTenant.getTenantId(), tenantUsageStateMock); - ApiUsageState tenantUsageState = service.getApiUsageState(dummyTenant.getTenantId()); - assertThat(tenantUsageState, is(tenantUsageStateMock.getApiUsageState())); - verify(service, never()).getOrFetchState(dummyTenant.getTenantId(), dummyTenant.getTenantId()); + public void testGetApiUsageState_whenNotMyPartition() { + TenantId tenantId = dummyTenant.getTenantId(); + service.myUsageStates.remove(tenantId); + service.otherUsageStates.remove(tenantId); + + TopicPartitionInfo tpi = mock(TopicPartitionInfo.class); + when(tpi.isMyPartition()).thenReturn(false); + when(partitionService.resolve(any(), eq(tenantId), eq(tenantId))).thenReturn(tpi); + + ApiUsageState foundState = new ApiUsageState(); + foundState.setTenantId(tenantId); + when(apiUsageStateService.findTenantApiUsageState(tenantId)).thenReturn(foundState); + + ApiUsageState result = service.getApiUsageState(tenantId); + assertThat(result, is(foundState)); + + assertThat(service.otherUsageStates.get(tenantId), is(foundState)); } @Test @@ -165,7 +219,7 @@ public class DefaultTbApiUsageStateServiceTest { if (key.getApiFeature() != null) { msgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() .setKey(key.name()) - .setValue(4500L) + .setValue(VALUE_WARNING) .build()); } } @@ -195,7 +249,6 @@ public class DefaultTbApiUsageStateServiceTest { assertEquals(ApiUsageStateValue.WARNING, tenantApiUsageState.getFeatureValue(ApiFeature.JS)); - verify(notificationRuleProcessor, atLeastOnce()).process(any()); verify(mailExecutor, atLeastOnce()).submit((Runnable) any()); } @@ -213,7 +266,7 @@ public class DefaultTbApiUsageStateServiceTest { if (key.getApiFeature() != null) { msgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() .setKey(key.name()) - .setValue(5500L) + .setValue(VALUE_DISABLE) .build()); } } @@ -241,6 +294,73 @@ public class DefaultTbApiUsageStateServiceTest { verify(mailExecutor, atLeastOnce()).submit((Runnable) any()); } + @Test + public void testOnTenantProfileUpdate_updatesStateForMatchingTenant() { + TenantProfileId currentProfileId = tenantApiUsageState.getTenantProfileId(); + + TenantProfileData newProfileData = new TenantProfileData(); + DefaultTenantProfileConfiguration newConfig = DefaultTenantProfileConfiguration.builder() + .maxJSExecutions(NEW_MAX_ENABLE_VALUE) + .maxTransportMessages(MAX_ENABLE_VALUE) + .maxRuleChains(MAX_ENABLE_VALUE) + .maxTbelExecutions(MAX_ENABLE_VALUE) + .maxDPStorageDays(NEW_MAX_ENABLE_VALUE) + .maxREExecutions(MAX_ENABLE_VALUE) + .maxEmails(NEW_MAX_ENABLE_VALUE) + .maxSms(MAX_ENABLE_VALUE) + .maxCreatedAlarms(MAX_ENABLE_VALUE) + .warnThreshold(NEW_WARN_THRESHOLD_VALUE) + .build(); + + newProfileData.setConfiguration(newConfig); + + TenantProfile newProfile = new TenantProfile(); + newProfile.setId(currentProfileId); + newProfile.setProfileData(newProfileData); + + when(tbTenantProfileCache.get(currentProfileId)).thenReturn(newProfile); + + service.onTenantProfileUpdate(currentProfileId); + + assertEquals(currentProfileId, tenantApiUsageState.getTenantProfileId()); + assertEquals(newProfileData, tenantApiUsageState.getTenantProfileData()); + } + + @Test + public void testOnTenantUpdate_updatesStateWhenProfileChanged() { + TenantProfileId oldProfileId = tenantApiUsageState.getTenantProfileId(); + + TenantProfileId newProfileId = new TenantProfileId(UUID.randomUUID()); + TenantProfileData newProfileData = new TenantProfileData(); + DefaultTenantProfileConfiguration newConfig = DefaultTenantProfileConfiguration.builder() + .maxJSExecutions(NEW_MAX_ENABLE_VALUE) + .maxTransportMessages(MAX_ENABLE_VALUE) + .maxRuleChains(MAX_ENABLE_VALUE) + .maxTbelExecutions(NEW_MAX_ENABLE_VALUE) + .maxDPStorageDays(MAX_ENABLE_VALUE) + .maxREExecutions(NEW_MAX_ENABLE_VALUE) + .maxEmails(MAX_ENABLE_VALUE) + .maxSms(MAX_ENABLE_VALUE) + .maxCreatedAlarms(MAX_ENABLE_VALUE) + .warnThreshold(NEW_WARN_THRESHOLD_VALUE) + .build(); + + newProfileData.setConfiguration(newConfig); + + TenantProfile newProfile = new TenantProfile(); + newProfile.setId(newProfileId); + newProfile.setProfileData(newProfileData); + + when(tbTenantProfileCache.get(dummyTenant.getTenantId())).thenReturn(newProfile); + + assertNotEquals(oldProfileId, newProfileId); + + service.onTenantUpdate(dummyTenant.getTenantId()); + + assertEquals(newProfileId, tenantApiUsageState.getTenantProfileId()); + assertEquals(newProfileData, tenantApiUsageState.getTenantProfileData()); + } + private boolean containsFeature(ApiFeature feature) { for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { if (key.getApiFeature() != null && key.getApiFeature().equals(feature)) { From eb9d929ccff3767c5b3a23304d1eaae416abfd53 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Tue, 18 Feb 2025 11:09:43 +0200 Subject: [PATCH 081/100] UI: Add property decimals for flow meter symbol --- .../scada_symbols/bottom-flow-meter.svg | 108 +++++------------- .../horizontal-inline-flow-meter.svg | 108 +++++------------- .../system/scada_symbols/left-flow-meter.svg | 104 +++-------------- .../system/scada_symbols/right-flow-meter.svg | 104 +++-------------- .../system/scada_symbols/top-flow-meter.svg | 108 +++++------------- .../vertical-inline-flow-meter.svg | 108 +++++------------- .../assets/locale/locale.constant-en_US.json | 1 + 7 files changed, 147 insertions(+), 494 deletions(-) diff --git a/application/src/main/data/json/system/scada_symbols/bottom-flow-meter.svg b/application/src/main/data/json/system/scada_symbols/bottom-flow-meter.svg index 7d22c90abf..794e6e61d9 100644 --- a/application/src/main/data/json/system/scada_symbols/bottom-flow-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/bottom-flow-meter.svg @@ -57,7 +57,7 @@ }, { "tag": "value", - "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n", + "stateRenderFunction": "var value = ctx.api.formatValue(ctx.values.value, ctx.properties.valueDecimals, '', false);\nctx.api.text(element, value);\n", "actions": { "click": { "actionFunction": "ctx.api.callAction(event, 'displayClick');" @@ -463,16 +463,20 @@ "name": "{i18n:scada.symbol.units}", "type": "units", "default": "m³/hr", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", "fieldClass": "medium-width", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true + }, + { + "id": "valueDecimals", + "name": "{i18n:scada.symbol.decimals}", + "type": "number", + "default": 0, + "fieldClass": "medium-width", + "min": 0, + "step": 1, + "disabled": false, + "visible": true }, { "id": "defaultBorderColor", @@ -511,16 +515,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "activeBorderColor", @@ -559,16 +555,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "warningBorderColor", @@ -607,16 +595,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "criticalBorderColor", @@ -655,16 +635,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "backgroundColor", @@ -703,48 +675,24 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "fluidColor", "name": "{i18n:scada.symbol.fluid-color}", "type": "color", "default": "#1EC1F480", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "pipeColor", "name": "{i18n:scada.symbol.pipe-color}", "type": "color", "default": "#FFFFFF", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true } ] }]]> diff --git a/application/src/main/data/json/system/scada_symbols/horizontal-inline-flow-meter.svg b/application/src/main/data/json/system/scada_symbols/horizontal-inline-flow-meter.svg index 4ad766764a..5e0c781941 100644 --- a/application/src/main/data/json/system/scada_symbols/horizontal-inline-flow-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/horizontal-inline-flow-meter.svg @@ -57,7 +57,7 @@ }, { "tag": "value", - "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n", + "stateRenderFunction": "var value = ctx.api.formatValue(ctx.values.value, ctx.properties.valueDecimals, '', false);\nctx.api.text(element, value);\n", "actions": { "click": { "actionFunction": "ctx.api.callAction(event, 'displayClick');" @@ -463,16 +463,20 @@ "name": "{i18n:scada.symbol.units}", "type": "units", "default": "m³/hr", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", "fieldClass": "medium-width", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true + }, + { + "id": "valueDecimals", + "name": "{i18n:scada.symbol.decimals}", + "type": "number", + "default": 0, + "fieldClass": "medium-width", + "min": 0, + "step": 1, + "disabled": false, + "visible": true }, { "id": "defaultBorderColor", @@ -511,16 +515,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "activeBorderColor", @@ -559,16 +555,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "warningBorderColor", @@ -607,16 +595,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "criticalBorderColor", @@ -655,16 +635,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "backgroundColor", @@ -703,48 +675,24 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "fluidColor", "name": "{i18n:scada.symbol.fluid-color}", "type": "color", "default": "#1EC1F480", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "pipeColor", "name": "{i18n:scada.symbol.pipe-color}", "type": "color", "default": "#FFFFFF", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true } ] }]]> diff --git a/application/src/main/data/json/system/scada_symbols/left-flow-meter.svg b/application/src/main/data/json/system/scada_symbols/left-flow-meter.svg index 12ec888e66..1c29a79479 100644 --- a/application/src/main/data/json/system/scada_symbols/left-flow-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/left-flow-meter.svg @@ -57,7 +57,7 @@ }, { "tag": "value", - "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n", + "stateRenderFunction": "var value = ctx.api.formatValue(ctx.values.value, ctx.properties.valueDecimals, '', false);\nctx.api.text(element, value);\n", "actions": { "click": { "actionFunction": "ctx.api.callAction(event, 'displayClick');" @@ -463,16 +463,16 @@ "name": "{i18n:scada.symbol.units}", "type": "units", "default": "m³/hr", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", + "fieldClass": "medium-width" + }, + { + "id": "valueDecimals", + "name": "{i18n:scada.symbol.decimals}", + "type": "number", + "default": 0, "fieldClass": "medium-width", - "min": null, - "max": null, - "step": null + "min": 0, + "step": 1 }, { "id": "defaultBorderColor", @@ -510,17 +510,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "activeBorderColor", @@ -558,17 +548,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "warningBorderColor", @@ -606,17 +586,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "criticalBorderColor", @@ -654,17 +624,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "backgroundColor", @@ -702,49 +662,19 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "fluidColor", "name": "{i18n:scada.symbol.fluid-color}", "type": "color", - "default": "#1EC1F480", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "default": "#1EC1F480" }, { "id": "pipeColor", "name": "{i18n:scada.symbol.pipe-color}", "type": "color", - "default": "#FFFFFF", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "default": "#FFFFFF" } ] }]]> diff --git a/application/src/main/data/json/system/scada_symbols/right-flow-meter.svg b/application/src/main/data/json/system/scada_symbols/right-flow-meter.svg index 9be5ec5857..6a201111ef 100644 --- a/application/src/main/data/json/system/scada_symbols/right-flow-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/right-flow-meter.svg @@ -57,7 +57,7 @@ }, { "tag": "value", - "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n", + "stateRenderFunction": "var value = ctx.api.formatValue(ctx.values.value, ctx.properties.valueDecimals, '', false);\nctx.api.text(element, value);\n", "actions": { "click": { "actionFunction": "ctx.api.callAction(event, 'displayClick');" @@ -463,16 +463,16 @@ "name": "{i18n:scada.symbol.units}", "type": "units", "default": "m³/hr", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", + "fieldClass": "medium-width" + }, + { + "id": "valueDecimals", + "name": "{i18n:scada.symbol.decimals}", + "type": "number", + "default": 0, "fieldClass": "medium-width", - "min": null, - "max": null, - "step": null + "min": 0, + "step": 1 }, { "id": "defaultBorderColor", @@ -510,17 +510,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "activeBorderColor", @@ -558,17 +548,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "warningBorderColor", @@ -606,17 +586,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "criticalBorderColor", @@ -654,17 +624,7 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "backgroundColor", @@ -702,49 +662,19 @@ "rangeAdvanced": [] }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" - }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + } }, { "id": "fluidColor", "name": "{i18n:scada.symbol.fluid-color}", "type": "color", - "default": "#1EC1F480", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "default": "#1EC1F480" }, { "id": "pipeColor", "name": "{i18n:scada.symbol.pipe-color}", "type": "color", - "default": "#FFFFFF", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "default": "#FFFFFF" } ] }]]> diff --git a/application/src/main/data/json/system/scada_symbols/top-flow-meter.svg b/application/src/main/data/json/system/scada_symbols/top-flow-meter.svg index 619bb48ef8..9c09a6067e 100644 --- a/application/src/main/data/json/system/scada_symbols/top-flow-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/top-flow-meter.svg @@ -57,7 +57,7 @@ }, { "tag": "value", - "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n", + "stateRenderFunction": "var value = ctx.api.formatValue(ctx.values.value, ctx.properties.valueDecimals, '', false);\nctx.api.text(element, value);\n", "actions": { "click": { "actionFunction": "ctx.api.callAction(event, 'displayClick');" @@ -463,16 +463,20 @@ "name": "{i18n:scada.symbol.units}", "type": "units", "default": "m³/hr", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", "fieldClass": "medium-width", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true + }, + { + "id": "valueDecimals", + "name": "{i18n:scada.symbol.decimals}", + "type": "number", + "default": 0, + "fieldClass": "medium-width", + "min": 0, + "step": 1, + "disabled": false, + "visible": true }, { "id": "defaultBorderColor", @@ -511,16 +515,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "activeBorderColor", @@ -559,16 +555,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "warningBorderColor", @@ -607,16 +595,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "criticalBorderColor", @@ -655,16 +635,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "backgroundColor", @@ -703,48 +675,24 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "fluidColor", "name": "{i18n:scada.symbol.fluid-color}", "type": "color", "default": "#1EC1F480", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "pipeColor", "name": "{i18n:scada.symbol.pipe-color}", "type": "color", "default": "#FFFFFF", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true } ] }]]> diff --git a/application/src/main/data/json/system/scada_symbols/vertical-inline-flow-meter.svg b/application/src/main/data/json/system/scada_symbols/vertical-inline-flow-meter.svg index fff4819e1e..8f9a30e576 100644 --- a/application/src/main/data/json/system/scada_symbols/vertical-inline-flow-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/vertical-inline-flow-meter.svg @@ -57,7 +57,7 @@ }, { "tag": "value", - "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n", + "stateRenderFunction": "var value = ctx.api.formatValue(ctx.values.value, ctx.properties.valueDecimals, '', false);\nctx.api.text(element, value);\n", "actions": { "click": { "actionFunction": "ctx.api.callAction(event, 'displayClick');" @@ -463,16 +463,20 @@ "name": "{i18n:scada.symbol.units}", "type": "units", "default": "m³/hr", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", "fieldClass": "medium-width", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true + }, + { + "id": "valueDecimals", + "name": "{i18n:scada.symbol.decimals}", + "type": "number", + "default": 0, + "fieldClass": "medium-width", + "min": 0, + "step": 1, + "disabled": false, + "visible": true }, { "id": "defaultBorderColor", @@ -511,16 +515,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "activeBorderColor", @@ -559,16 +555,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "warningBorderColor", @@ -607,16 +595,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "criticalBorderColor", @@ -655,16 +635,8 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "backgroundColor", @@ -703,48 +675,24 @@ }, "colorFunction": "var temperature = value;\nif (typeof temperature !== undefined) {\n var percent = (temperature + 60)/120 * 100;\n return tinycolor.mix('blue', 'red', percent).toHexString();\n}\nreturn 'blue';" }, - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "fluidColor", "name": "{i18n:scada.symbol.fluid-color}", "type": "color", "default": "#1EC1F480", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true }, { "id": "pipeColor", "name": "{i18n:scada.symbol.pipe-color}", "type": "color", "default": "#FFFFFF", - "required": null, - "subLabel": null, - "divider": null, - "fieldSuffix": null, - "disableOnProperty": null, - "rowClass": "", - "fieldClass": "", - "min": null, - "max": null, - "step": null + "disabled": false, + "visible": true } ] }]]> diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 4ebe2c7a2f..3713bca3a6 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -3218,6 +3218,7 @@ "bottom-fluid-color": "Bottom fluid color", "display": "Display", "value": "Value", + "decimals": "Decimals", "units": "Units", "flow-meter-value-hint": "Double value showing on flow meter display", "value-hint": "Double value indicating the current value", From 2530c77268ff4d1da50d060fa0816320f38cff0e Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 19 Feb 2025 12:32:41 +0200 Subject: [PATCH 082/100] UI: Refactoring --- .../lib/rpc/power-button-widget.component.ts | 6 ++-- .../rpc/value-stepper-widget.component.html | 2 +- .../rpc/value-stepper-widget.component.scss | 3 -- .../lib/rpc/value-stepper-widget.component.ts | 33 ++++++++++--------- .../lib/rpc/value-stepper-widget.models.ts | 31 ++++++++++++----- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts index 262a532163..cab9b9d572 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.component.ts @@ -18,7 +18,8 @@ import { AfterViewInit, ChangeDetectorRef, Component, - ElementRef, NgZone, + ElementRef, + NgZone, OnDestroy, OnInit, Renderer2, @@ -33,7 +34,8 @@ import { DomSanitizer } from '@angular/platform-browser'; import { ValueType } from '@shared/models/constants'; import { powerButtonDefaultSettings, - PowerButtonShape, powerButtonShapeSize, + PowerButtonShape, + powerButtonShapeSize, PowerButtonWidgetSettings } from '@home/components/widget/lib/rpc/power-button-widget.models'; import { SVG, Svg } from '@svgdotjs/svg.js'; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html index 6b28d44066..6ce4387c1a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.component.html @@ -30,7 +30,7 @@ [class.tb-value-stepper-value-box-disabled]="(disabledState$ | async) === true">
        {{ valueText }}
        ; - @ViewChild('rightButton', {static: false}) + @ViewChild('rightButton', {static: true}) rightButton: ElementRef; - @ViewChild('stepperContent', {static: false}) + @ViewChild('stepperContent', {static: true}) stepperContent: ElementRef; - @ViewChild('valueBoxContainer', {static: false}) + @ViewChild('valueBoxContainer', {static: true}) valueBox: ElementRef; - @ViewChild('value', {static: false}) + @ViewChild('value', {static: true}) valueElement: ElementRef; settings: ValueStepperWidgetSettings; @@ -79,6 +81,8 @@ export class ValueStepperWidgetComponent extends padding: string; valueStyle: ComponentStyle = {}; + valueStyleColor = ''; + disabledColor = 'rgba(0, 0, 0, 0.38)'; value: number = null; autoScale = false; @@ -108,7 +112,8 @@ export class ValueStepperWidgetComponent extends private leftDisabledState$ = new BehaviorSubject(false); private rightDisabledState$ = new BehaviorSubject(false); - private readonly destroy$ = new Subject(); + + protected destroyRef = inject(DestroyRef); constructor(protected imagePipe: ImagePipe, protected sanitizer: DomSanitizer, @@ -135,7 +140,7 @@ export class ValueStepperWidgetComponent extends this.showLeftButton = this.settings.buttonAppearance.leftButton.showButton; this.showRightButton = this.settings.buttonAppearance.rightButton.showButton; this.valueStyle = textStyle(this.settings.appearance.valueFont); - this.valueStyle.color = this.settings.appearance.valueColor; + this.valueStyleColor = this.settings.appearance.valueColor; if (this.showValueBox) { const valueBoxCss = `.tb-value-stepper-value-box {\n`+ @@ -171,7 +176,7 @@ export class ValueStepperWidgetComponent extends this.disabledState$.asObservable(), this.leftDisabledState$.asObservable() ]).pipe( - takeUntil(this.destroy$) + takeUntilDestroyed(this.destroyRef) ).subscribe(value => { const state = value.includes(true); this.updateLeftDisabledState(state) @@ -182,7 +187,7 @@ export class ValueStepperWidgetComponent extends this.disabledState$.asObservable(), this.rightDisabledState$.asObservable() ]).pipe( - takeUntil(this.destroy$) + takeUntilDestroyed(this.destroyRef) ).subscribe(value => { const state = value.includes(true); this.updateRightDisabledState(state) @@ -200,8 +205,6 @@ export class ValueStepperWidgetComponent extends if (this.shapeResize$) { this.shapeResize$.disconnect(); } - this.destroy$.next(); - this.destroy$.complete(); super.ngOnDestroy(); } @@ -220,12 +223,12 @@ export class ValueStepperWidgetComponent extends private onValue(value: number): void { this.value = value; this.prevValue = value; - if ((this.value + this.settings.appearance.valueStep) >= this.settings.appearance.maxValueRange) { + if ((this.value + this.settings.appearance.valueStep) > this.settings.appearance.maxValueRange) { this.rightDisabledState$.next(true); } else { this.rightDisabledState$.next(false); } - if ((this.value - this.settings.appearance.valueStep) <= this.settings.appearance.minValueRange) { + if ((this.value - this.settings.appearance.valueStep) < this.settings.appearance.minValueRange) { this.leftDisabledState$.next(true); } else { this.leftDisabledState$.next(false); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts index 02471bfc05..9ec5ff5d65 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/value-stepper-widget.models.ts @@ -1,19 +1,32 @@ +/// +/// Copyright © 2016-2024 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + + import { DataToValueType, GetValueAction, - GetValueSettings, SetValueAction, - SetValueSettings, ValueToDataType + GetValueSettings, + SetValueAction, + SetValueSettings, + ValueToDataType } from '@shared/models/action-widget-settings.models'; -import { defaultWidgetAction, WidgetAction } from '@shared/models/widget.models'; -import { - ButtonToggleAppearance, segmentedButtonDefaultAppearance, - SegmentedButtonWidgetSettings -} from '@home/components/widget/lib/button/segmented-button-widget.models'; -import { WidgetButtonCustomStyles, WidgetButtonType } from '@shared/components/button/widget-button.models'; +import { WidgetButtonCustomStyles } from '@shared/components/button/widget-button.models'; import { BackgroundSettings, BackgroundType, cssUnit, Font } from '@shared/models/widget-settings.models'; import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; - const defaultMainColor = '#305680'; export enum ValueStepperType { From 3e4e027f3921f18b0726bf26f0be9e7075ffe004 Mon Sep 17 00:00:00 2001 From: Ekaterina Chantsova Date: Wed, 19 Feb 2025 19:00:27 +0200 Subject: [PATCH 083/100] Widget types list: widget bundles info added --- .../home/components/entity/entities-table.component.html | 3 ++- .../home/components/entity/entity-chips.component.ts | 9 +++++++-- .../home/models/entity/entities-table-config.models.ts | 3 ++- .../pages/widget/widget-types-table-config.resolver.ts | 5 ++++- ui-ngx/src/app/shared/models/widget.models.ts | 3 ++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html index a6b204b279..1754b94e62 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html @@ -192,7 +192,8 @@ (click)="$event.stopPropagation();"> - + diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts index 6aad28c638..ebece2186b 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts @@ -18,7 +18,7 @@ import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { BaseData } from '@shared/models/base-data'; import { EntityId } from '@shared/models/id/entity-id'; import { baseDetailsPageByEntityType, EntityType } from '@app/shared/public-api'; -import { isEqual, isObject } from '@core/utils'; +import { isEqual, isNotEmptyStr, isObject } from '@core/utils'; @Component({ selector: 'tb-entity-chips', @@ -33,6 +33,9 @@ export class EntityChipsComponent implements OnChanges { @Input() key: string; + @Input() + detailsPagePrefixUrl: string; + entityDetailsPrefixUrl: string; subEntities: Array> = []; @@ -52,7 +55,9 @@ export class EntityChipsComponent implements OnChanges { if (isObject(entitiesList) && !Array.isArray(entitiesList)) { entitiesList = [entitiesList]; } - if (Array.isArray(entitiesList)) { + if (isNotEmptyStr(this.detailsPagePrefixUrl)) { + this.entityDetailsPrefixUrl = this.detailsPagePrefixUrl; + } else if (Array.isArray(entitiesList)) { if (entitiesList.length) { this.entityDetailsPrefixUrl = baseDetailsPageByEntityType.get(entitiesList[0].id.entityType as EntityType); } diff --git a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts index dbdcdcd61e..7e1a25d61a 100644 --- a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts +++ b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts @@ -144,7 +144,8 @@ export class DateEntityTableColumn> extends EntityTabl export class EntityChipsEntityTableColumn> extends BaseEntityTableColumn { constructor(public key: string, public title: string, - public width: string = '0px') { + public width: string = '0px', + public entityURL?: (entity) => string) { super('entityChips', key, title, width, false); } } diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-types-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/widget/widget-types-table-config.resolver.ts index eac0817875..60b6f70ac7 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widget-types-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widget-types-table-config.resolver.ts @@ -20,6 +20,7 @@ import { Router } from '@angular/router'; import { checkBoxCell, DateEntityTableColumn, + EntityChipsEntityTableColumn, EntityTableColumn, EntityTableConfig } from '@home/models/entity/entities-table-config.models'; @@ -75,7 +76,9 @@ export class WidgetTypesTableConfigResolver { this.config.columns.push( new DateEntityTableColumn('createdTime', 'common.created-time', this.datePipe, '150px'), - new EntityTableColumn('name', 'widget.title', '100%'), + new EntityTableColumn('name', 'widget.title', '60%'), + new EntityChipsEntityTableColumn( 'bundles', 'entity.type-widgets-bundles', '40%', + () => '/resources/widgets-library/widgets-bundles'), new EntityTableColumn('widgetType', 'widget.type', '150px', entity => entity?.widgetType ? this.translate.instant(widgetTypesData.get(entity.widgetType).name) : '', undefined, false), new EntityTableColumn('tenantId', 'widget.system', '60px', diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index 5950dcf911..6e45e8705a 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -41,7 +41,7 @@ import { isNotEmptyStr, mergeDeepIgnoreArray } from '@core/utils'; import { WidgetConfigComponentData } from '@home/models/widget-component.models'; import { ComponentStyle, Font, TimewindowStyle } from '@shared/models/widget-settings.models'; import { NULL_UUID } from '@shared/models/id/has-uuid'; -import { HasTenantId, HasVersion } from '@shared/models/entity.models'; +import { EntityInfoData, HasTenantId, HasVersion } from '@shared/models/entity.models'; import { DataKeysCallbacks, DataKeySettingsFunction } from '@home/components/widget/config/data-keys.component.models'; import { WidgetConfigCallbacks } from '@home/components/widget/config/widget-config.component.models'; import { TbFunction } from '@shared/models/js-function.models'; @@ -270,6 +270,7 @@ export interface WidgetTypeInfo extends BaseWidgetType { description: string; tags: string[]; widgetType: widgetType; + bundles?: EntityInfoData[]; } export interface WidgetTypeDetails extends WidgetType, ExportableEntity { From 8287321ec78e0e27c3b4220d3f388de0810e2e73 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 20 Feb 2025 15:41:39 +0200 Subject: [PATCH 084/100] UI: SCADA Oil and gas extraction --- .../scada_symbols/electrical-engine-hp.svg | 360 +++++++++++++++++ .../system/scada_symbols/gas-preventer-hp.svg | 361 +++++++++++++++++ .../system/scada_symbols/gas-wellhead-hp.svg | 363 +++++++++++++++++ .../scada_symbols/heat-exchanger-hp.svg | 363 +++++++++++++++++ ...arge-horizontal-separator-connector-hp.svg | 342 ++++++++++++++++ .../large-horizontal-separator-hp.svg | 350 ++++++++++++++++ .../large-vertical-separator-connector-hp.svg | 350 ++++++++++++++++ .../large-vertical-separator-hp.svg | 350 ++++++++++++++++ .../json/system/scada_symbols/oil-pump-hp.svg | 357 +++++++++++++++++ ...mall-horizontal-separator-connector-hp.svg | 342 ++++++++++++++++ .../small-horizontal-separator-hp.svg | 342 ++++++++++++++++ .../small-vertical-separator-connector-hp.svg | 342 ++++++++++++++++ .../small-vertical-separator-hp.svg | 342 ++++++++++++++++ .../json/system/scada_symbols/turbine-hp.svg | 377 ++++++++++++++++++ ...eneral_high_performance_scada_symbols.json | 3 +- .../high_performance_scada_oil_gas.json | 16 +- 16 files changed, 4958 insertions(+), 2 deletions(-) create mode 100644 application/src/main/data/json/system/scada_symbols/electrical-engine-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/gas-wellhead-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/large-horizontal-separator-connector-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/large-vertical-separator-connector-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/small-horizontal-separator-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg create mode 100644 application/src/main/data/json/system/scada_symbols/turbine-hp.svg diff --git a/application/src/main/data/json/system/scada_symbols/electrical-engine-hp.svg b/application/src/main/data/json/system/scada_symbols/electrical-engine-hp.svg new file mode 100644 index 0000000000..a41de55142 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/electrical-engine-hp.svg @@ -0,0 +1,360 @@ +{ + "title": "HP Electrical engine", + "description": "Electrical engine with various states.", + "searchTags": [ + "extraction", + "power" + ], + "widgetSizeX": 3, + "widgetSizeY": 2, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg b/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg new file mode 100644 index 0000000000..ea5a479eda --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg @@ -0,0 +1,361 @@ +{ + "title": "HP Gas preventer", + "description": "Gas preventer with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 1, + "widgetSizeY": 1, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/gas-wellhead-hp.svg b/application/src/main/data/json/system/scada_symbols/gas-wellhead-hp.svg new file mode 100644 index 0000000000..c2fee0f7ac --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/gas-wellhead-hp.svg @@ -0,0 +1,363 @@ +{ + "title": "HP Gas wellhead", + "description": "Gas wellhead with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 4, + "widgetSizeY": 5, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg b/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg new file mode 100644 index 0000000000..797220ea96 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg @@ -0,0 +1,363 @@ +{ + "title": "HP Heat exchanger", + "description": "Heat exchanger with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 3, + "widgetSizeY": 3, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-connector-hp.svg new file mode 100644 index 0000000000..ae1c604e9a --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-connector-hp.svg @@ -0,0 +1,342 @@ +{ + "title": "HP Large horizontal separator with connector", + "description": "Large horizontal separator with connector with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 5, + "widgetSizeY": 3, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg new file mode 100644 index 0000000000..79f6745a73 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg @@ -0,0 +1,350 @@ +{ + "title": "HP Large horizontal separator", + "description": "Large horizontal separator with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 5, + "widgetSizeY": 3, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/large-vertical-separator-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/large-vertical-separator-connector-hp.svg new file mode 100644 index 0000000000..df463b12a4 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/large-vertical-separator-connector-hp.svg @@ -0,0 +1,350 @@ +{ + "title": "HP Large vertical separator with connector", + "description": "Large vertical separator with connector with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 3, + "widgetSizeY": 5, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg new file mode 100644 index 0000000000..99ff420530 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg @@ -0,0 +1,350 @@ +{ + "title": "HP Large vertical separator", + "description": "Large vertical separator with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 3, + "widgetSizeY": 5, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg b/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg new file mode 100644 index 0000000000..e7dfa8f0c8 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg @@ -0,0 +1,357 @@ +{ + "title": "HP Oil pump", + "description": "Oil pump with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 5, + "widgetSizeY": 6, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg new file mode 100644 index 0000000000..dedc4dc81e --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg @@ -0,0 +1,342 @@ +{ + "title": "HP Small horizontal separator with connector", + "description": "Small horizontal separator with connector with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 5, + "widgetSizeY": 2, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-hp.svg new file mode 100644 index 0000000000..2bb0b1b244 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-hp.svg @@ -0,0 +1,342 @@ +{ + "title": "HP Small horizontal separator", + "description": "Small horizontal separator with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 5, + "widgetSizeY": 2, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg new file mode 100644 index 0000000000..b248996612 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg @@ -0,0 +1,342 @@ +{ + "title": "HP Small vertical separator with connector", + "description": "Small vertical separator with connector with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 2, + "widgetSizeY": 5, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg new file mode 100644 index 0000000000..25aec080b3 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg @@ -0,0 +1,342 @@ +{ + "title": "HP Small vertical separator", + "description": "Small vertical separator with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 2, + "widgetSizeY": 5, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null + } + ] +} + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/turbine-hp.svg b/application/src/main/data/json/system/scada_symbols/turbine-hp.svg new file mode 100644 index 0000000000..d798b09477 --- /dev/null +++ b/application/src/main/data/json/system/scada_symbols/turbine-hp.svg @@ -0,0 +1,377 @@ +{ + "title": "HP Turbine", + "description": "Turbine with various states.", + "searchTags": [ + "extraction" + ], + "widgetSizeX": 4, + "widgetSizeY": 2, + "tags": [ + { + "tag": "background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = ctx.properties.runningColor;\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "clickArea", + "stateRenderFunction": null, + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'click');" + } + } + }, + { + "tag": "critical", + "stateRenderFunction": "element.attr({fill: ctx.properties.criticalColor});\nif (ctx.values.critical) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = ctx.values.critical && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'criticalClick');" + } + } + }, + { + "tag": "secondary-background", + "stateRenderFunction": "var color = ctx.properties.stoppedColor;\nif (ctx.values.running) {\n color = '#999';\n}\nelement.attr({fill: color});", + "actions": null + }, + { + "tag": "warning", + "stateRenderFunction": "element.attr({fill: ctx.properties.warningColor});\nvar warning = ctx.values.warning && !(ctx.values.warning && ctx.values.critical)\nif (warning) {\n element.show();\n} else {\n element.hide();\n}\n\nvar elementCriticalAnimation = element.remember('criticalAnimation');\nvar criticalAnimation = warning && ctx.values.criticalAnimation;\n\nif (elementCriticalAnimation !== criticalAnimation) {\n element.remember('criticalAnimation', criticalAnimation);\n if (criticalAnimation) {\n ctx.api.cssAnimate(element, 500).attr({opacity: 0.15}).loop(0, true);\n } else {\n ctx.api.resetCssAnimation(element);\n }\n}\n", + "actions": { + "click": { + "actionFunction": "ctx.api.callAction(event, 'warningClick');" + } + } + } + ], + "behavior": [ + { + "id": "running", + "name": "{i18n:scada.symbol.running}", + "hint": "{i18n:scada.symbol.running-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.running}", + "defaultGetValueSettings": { + "action": "GET_ATTRIBUTE", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": "SHARED_SCOPE", + "key": "running" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": null, + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warning", + "name": "{i18n:scada.symbol.warning}", + "hint": "{i18n:scada.symbol.warning-state-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.warning}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "MAJOR", + "MINOR", + "WARNING", + "INDETERMINATE" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "warningClick", + "name": "{i18n:scada.symbol.warning-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.warning-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "critical", + "name": "{i18n:scada.symbol.critical}", + "hint": "{i18n:scada.symbol.critical-state-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.critical}", + "defaultGetValueSettings": { + "action": "GET_ALARM_STATUS", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "scope": null, + "key": "state" + }, + "getTimeSeries": { + "key": "state" + }, + "getAlarmStatus": { + "severityList": [ + "CRITICAL" + ], + "typeList": null + }, + "dataToValue": { + "type": "NONE", + "dataToValueFunction": "/* Should return boolean value */\nreturn data;", + "compareToValue": true + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "criticalClick", + "name": "{i18n:scada.symbol.critical-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": "{i18n:scada.symbol.critical-state}", + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + }, + { + "id": "criticalAnimation", + "name": "{i18n:scada.symbol.warning-critical-state-animation}", + "hint": "{i18n:scada.symbol.warning-critical-state-animation-hint}", + "group": null, + "type": "value", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": "{i18n:scada.symbol.animation}", + "defaultGetValueSettings": { + "action": "DO_NOTHING", + "defaultValue": false, + "executeRpc": { + "method": "getState", + "requestTimeout": 5000, + "requestPersistent": false, + "persistentPollingInterval": 1000 + }, + "getAttribute": { + "key": "state", + "scope": null + }, + "getTimeSeries": { + "key": "state" + }, + "dataToValue": { + "type": "NONE", + "compareToValue": true, + "dataToValueFunction": "/* Should return boolean value */\nreturn data;" + } + }, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": null + }, + { + "id": "click", + "name": "{i18n:scada.symbol.on-click}", + "hint": "{i18n:scada.symbol.on-click-hint}", + "group": null, + "type": "widgetAction", + "valueType": "BOOLEAN", + "trueLabel": null, + "falseLabel": null, + "stateLabel": null, + "defaultGetValueSettings": null, + "defaultSetValueSettings": null, + "defaultWidgetActionSettings": { + "type": "doNothing", + "targetDashboardStateId": null, + "openRightLayout": false, + "setEntityId": false, + "stateEntityParamName": null + } + } + ], + "properties": [ + { + "id": "runningColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#FFFFFF", + "required": null, + "subLabel": "{i18n:scada.symbol.running}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "stoppedColor", + "name": "{i18n:scada.symbol.colors}", + "type": "color", + "default": "#666666", + "required": null, + "subLabel": "{i18n:scada.symbol.stopped}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "warningColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#FAA405", + "required": null, + "subLabel": "{i18n:scada.symbol.warning}", + "divider": true, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + }, + { + "id": "criticalColor", + "name": "{i18n:scada.symbol.alarm-colors}", + "type": "color", + "default": "#D12730", + "required": null, + "subLabel": "{i18n:scada.symbol.critical}", + "divider": null, + "fieldSuffix": null, + "disableOnProperty": null, + "rowClass": "", + "fieldClass": "", + "min": null, + "max": null, + "step": null, + "disabled": false, + "visible": true + } + ] +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json b/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json index 97768915f7..5fbbd8b066 100644 --- a/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json +++ b/application/src/main/data/json/system/widget_bundles/general_high_performance_scada_symbols.json @@ -33,6 +33,7 @@ "hp_consumers", "hp_house", "hp_apartments", - "hp_manufacture" + "hp_manufacture", + "hp_electrical_engine" ] } \ No newline at end of file diff --git a/application/src/main/data/json/system/widget_bundles/high_performance_scada_oil_gas.json b/application/src/main/data/json/system/widget_bundles/high_performance_scada_oil_gas.json index 87b778be21..21ee5d7f05 100644 --- a/application/src/main/data/json/system/widget_bundles/high_performance_scada_oil_gas.json +++ b/application/src/main/data/json/system/widget_bundles/high_performance_scada_oil_gas.json @@ -15,6 +15,20 @@ "hp_preventer", "hp_drill", "hp_drilling_line", - "hp_platform" + "hp_platform", + "hp_electrical_engine", + "hp_oil_pump", + "hp_gas_wellhead", + "hp_gas_preventer", + "hp_heat_exchanger", + "hp_turbine", + "hp_large_vertical_separator", + "hp_large_vertical_separator_with_connector", + "hp_large_horizontal_separator", + "hp_large_horizontal_separator_with_connector", + "hp_small_vertical_separator", + "hp_small_vertical_separator_with_connector", + "hp_small_horizontal_separator", + "hp_small_horizontal_separator_with_connector" ] } \ No newline at end of file From a118c44cf51d0f1daa0a8896e0d5fb490675c5d8 Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Wed, 19 Feb 2025 18:26:34 +0200 Subject: [PATCH 085/100] Added tests on api usage --- .../server/service/apiusage/ApiUsageTest.java | 144 +++++++ .../DefaultTbApiUsageStateServiceTest.java | 358 +++--------------- 2 files changed, 199 insertions(+), 303 deletions(-) create mode 100644 application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java new file mode 100644 index 0000000000..c708525a1d --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java @@ -0,0 +1,144 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.apiusage; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.TestPropertySource; +import org.thingsboard.server.common.data.ApiUsageStateValue; +import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.SaveDeviceWithCredentialsRequest; +import org.thingsboard.server.common.data.Tenant; +import org.thingsboard.server.common.data.TenantProfile; +import org.thingsboard.server.common.data.User; +import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.common.data.security.DeviceCredentials; +import org.thingsboard.server.common.data.security.DeviceCredentialsType; +import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; +import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; +import org.thingsboard.server.controller.AbstractControllerTest; +import org.thingsboard.server.controller.TbUrlConstants; +import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; + +import java.util.concurrent.TimeUnit; + +import static org.awaitility.Awaitility.await; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@DaoSqlTest +@TestPropertySource(properties = { + "usage.stats.report.enabled=true", + "usage.stats.report.interval=2", + "usage.stats.gauge_report_interval=1", +}) +public class ApiUsageTest extends AbstractControllerTest { + + private Tenant savedTenant; + private User tenantAdmin; + + private static final int MAX_DP_ENABLE_VALUE = 12; + private static final double WARN_THRESHOLD_VALUE = 0.5; + @Autowired + private ApiUsageStateService apiUsageStateService; + + @Before + public void beforeTest() throws Exception { + loginSysAdmin(); + + TenantProfile tenantProfile = createTenantProfile(); + TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class); + assertNotNull(savedTenantProfile); + + Tenant tenant = new Tenant(); + tenant.setTitle("My tenant"); + tenant.setTenantProfileId(savedTenantProfile.getId()); + savedTenant = saveTenant(tenant); + tenantId = savedTenant.getId(); + assertNotNull(savedTenant); + + tenantAdmin = new User(); + tenantAdmin.setAuthority(Authority.TENANT_ADMIN); + tenantAdmin.setTenantId(savedTenant.getId()); + tenantAdmin.setEmail("tenant2@thingsboard.org"); + + tenantAdmin = createUserAndLogin(tenantAdmin, "testPassword1"); + } + + @Test + public void testTelemetryApiCall() throws Exception { + Device device = createDevice(); + assertNotNull(device); + String telemetryPayload = "{\"temperature\":25, \"humidity\":60}"; + String url = TbUrlConstants.TELEMETRY_URL_PREFIX + "/DEVICE/" + device.getId() + "/timeseries/ANY"; + + long VALUE_WARNING = (long) (MAX_DP_ENABLE_VALUE * WARN_THRESHOLD_VALUE) / 2; + + for (int i = 0; i < VALUE_WARNING; i++) { + doPostAsync(url, telemetryPayload, String.class, status().isOk()); + } + + await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> assertEquals(ApiUsageStateValue.WARNING, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState())); + + long VALUE_DISABLE = (long) (MAX_DP_ENABLE_VALUE - (MAX_DP_ENABLE_VALUE * WARN_THRESHOLD_VALUE)) / 2; + + for (int i = 0; i < VALUE_DISABLE; i++) { + doPostAsync(url, telemetryPayload, String.class, status().isOk()); + } + + await().atMost(5, TimeUnit.SECONDS) + .untilAsserted(() -> { + assertEquals(ApiUsageStateValue.DISABLED, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState()); + }); + } + + private TenantProfile createTenantProfile() { + TenantProfile tenantProfile = new TenantProfile(); + tenantProfile.setName("Tenant Profile"); + tenantProfile.setDescription("Tenant Profile" + " Test"); + + TenantProfileData tenantProfileData = new TenantProfileData(); + DefaultTenantProfileConfiguration config = DefaultTenantProfileConfiguration.builder() + .maxDPStorageDays(MAX_DP_ENABLE_VALUE) + .warnThreshold(WARN_THRESHOLD_VALUE) + .build(); + + tenantProfileData.setConfiguration(config); + tenantProfile.setProfileData(tenantProfileData); + return tenantProfile; + } + + private Device createDevice() throws Exception { + String testToken = "TEST_TOKEN"; + + Device device = new Device(); + device.setName("My device"); + device.setType("default"); + device.setTenantId(tenantId); + + DeviceCredentials deviceCredentials = new DeviceCredentials(); + deviceCredentials.setCredentialsType(DeviceCredentialsType.ACCESS_TOKEN); + deviceCredentials.setCredentialsId(testToken); + + SaveDeviceWithCredentialsRequest saveRequest = new SaveDeviceWithCredentialsRequest(device, deviceCredentials); + + return readResponse(doPost("/api/device-with-credentials", saveRequest).andExpect(status().isOk()), Device.class); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java index 8fefde0f6c..8d4c1b849b 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java @@ -15,359 +15,111 @@ */ package org.thingsboard.server.service.apiusage; -import com.google.common.util.concurrent.Futures; -import org.jetbrains.annotations.NotNull; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.test.util.ReflectionTestUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.server.common.data.*; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.id.TenantProfileId; import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; -import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; import org.thingsboard.server.common.msg.queue.TbCallback; -import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; -import org.thingsboard.server.dao.tenant.TbTenantProfileCache; -import org.thingsboard.server.dao.tenant.TenantService; +import org.thingsboard.server.controller.AbstractControllerTest; +import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.common.TbProtoQueueMsg; -import org.thingsboard.server.queue.discovery.PartitionService; -import org.thingsboard.server.service.mail.MailExecutorService; -import org.thingsboard.server.service.telemetry.InternalTelemetryService; import java.util.UUID; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.lenient; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.junit.Assert.assertEquals; -@ExtendWith(MockitoExtension.class) -public class DefaultTbApiUsageStateServiceTest { +@DaoSqlTest +public class DefaultTbApiUsageStateServiceTest extends AbstractControllerTest { - @Mock - private NotificationRuleProcessor notificationRuleProcessor; + @Autowired + DefaultTbApiUsageStateService service; - @Mock + @Autowired private ApiUsageStateService apiUsageStateService; - @Mock - private TenantService tenantService; - - @Mock - private InternalTelemetryService tsWsService; - - @Mock - private MailExecutorService mailExecutor; - - @Mock - private PartitionService partitionService; - - @Mock - private TbTenantProfileCache tbTenantProfileCache; - - @Spy - @InjectMocks - DefaultTbApiUsageStateService service; - - private TenantApiUsageState tenantApiUsageState; - private Tenant dummyTenant; + private TenantId tenantId; + private Tenant savedTenant; private static final int MAX_ENABLE_VALUE = 5000; private static final long VALUE_WARNING = 4500L; private static final long VALUE_DISABLE = 5500L; - private static final int NEW_MAX_ENABLE_VALUE = 4000; - private static final double NEW_WARN_THRESHOLD_VALUE = 0.9; private static final double WARN_THRESHOLD_VALUE = 0.8; - @BeforeEach - public void setUp() { - var tenantId = TenantId.fromUUID(UUID.randomUUID()); - dummyTenant = new Tenant(); - dummyTenant.setId(tenantId); - dummyTenant.setEmail("test@tenant.com"); - - lenient().when(tsWsService.saveTimeseriesInternal(any())).thenReturn(Futures.immediateFuture(0)); - - ReflectionTestUtils.setField(service, "tsWsService", tsWsService); - - DefaultTenantProfileConfiguration config = DefaultTenantProfileConfiguration.builder() - .maxJSExecutions(MAX_ENABLE_VALUE) - .maxTransportMessages(MAX_ENABLE_VALUE) - .maxRuleChains(MAX_ENABLE_VALUE) - .maxTbelExecutions(MAX_ENABLE_VALUE) - .maxDPStorageDays(MAX_ENABLE_VALUE) - .maxREExecutions(MAX_ENABLE_VALUE) - .maxEmails(MAX_ENABLE_VALUE) - .maxSms(MAX_ENABLE_VALUE) - .maxCreatedAlarms(MAX_ENABLE_VALUE) - .warnThreshold(WARN_THRESHOLD_VALUE) - .build(); - - TenantProfileData profileData = new TenantProfileData(); - profileData.setConfiguration(config); - - TenantProfile dummyTenantProfile = new TenantProfile(); - dummyTenantProfile.setId(new TenantProfileId(UUID.randomUUID())); - dummyTenantProfile.setProfileData(profileData); + @Before + public void init() throws Exception { + loginSysAdmin(); - ApiUsageState dummyUsageState = getApiUsageState(tenantId); + TenantProfile tenantProfile = createTenantProfile(); + TenantProfile savedTenantProfile = doPost("/api/tenantProfile", tenantProfile, TenantProfile.class); + Assert.assertNotNull(savedTenantProfile); - tenantApiUsageState = new TenantApiUsageState(dummyTenantProfile, dummyUsageState); - - service.myUsageStates.put(tenantId, tenantApiUsageState); - } - - @NotNull - private static ApiUsageState getApiUsageState(TenantId tenantId) { - ApiUsageState dummyUsageState = new ApiUsageState(); - dummyUsageState.setTransportState(ApiUsageStateValue.ENABLED); - dummyUsageState.setDbStorageState(ApiUsageStateValue.ENABLED); - dummyUsageState.setReExecState(ApiUsageStateValue.ENABLED); - dummyUsageState.setJsExecState(ApiUsageStateValue.ENABLED); - dummyUsageState.setTbelExecState(ApiUsageStateValue.ENABLED); - dummyUsageState.setEmailExecState(ApiUsageStateValue.ENABLED); - dummyUsageState.setSmsExecState(ApiUsageStateValue.ENABLED); - dummyUsageState.setAlarmExecState(ApiUsageStateValue.ENABLED); - dummyUsageState.setTenantId(tenantId); - dummyUsageState.setEntityId(tenantId); - dummyUsageState.setVersion(1L); - return dummyUsageState; - } - - @Test - public void givenTenantIdFromEntityStatesMap_whenGetApiUsageState() { - ApiUsageState tenantUsageState = service.getApiUsageState(dummyTenant.getTenantId()); - assertThat(tenantUsageState, is(tenantApiUsageState.getApiUsageState())); - verify(service, never()).getOrFetchState(dummyTenant.getTenantId(), dummyTenant.getTenantId()); - } - - @Test - public void testGetApiUsageState_fromOtherUsageStates() { - TenantId tenantId = dummyTenant.getTenantId(); - service.myUsageStates.remove(tenantId); - ApiUsageState otherState = new ApiUsageState(); - otherState.setTenantId(tenantId); - service.otherUsageStates.put(tenantId, otherState); - ApiUsageState result = service.getApiUsageState(tenantId); - assertThat(result, is(otherState)); + Tenant tenant = new Tenant(); + tenant.setTitle("My tenant"); + tenant.setTenantProfileId(savedTenantProfile.getId()); + savedTenant = saveTenant(tenant); + tenantId = savedTenant.getId(); + Assert.assertNotNull(savedTenant); } @Test - public void testGetApiUsageState_whenMyPartition() { - TenantId tenantId = dummyTenant.getTenantId(); - service.myUsageStates.remove(tenantId); - service.otherUsageStates.remove(tenantId); - - TopicPartitionInfo tpi = mock(TopicPartitionInfo.class); - when(tpi.isMyPartition()).thenReturn(true); - when(partitionService.resolve(any(), eq(dummyTenant.getId()), eq(dummyTenant.getId()))).thenReturn(tpi); - - TenantApiUsageState fetchedState = tenantApiUsageState; - doReturn(fetchedState).when(service).getOrFetchState(tenantId, tenantId); - ApiUsageState result = service.getApiUsageState(tenantId); - assertThat(result, is(fetchedState.getApiUsageState())); - } - - @Test - public void testGetApiUsageState_whenNotMyPartition() { - TenantId tenantId = dummyTenant.getTenantId(); - service.myUsageStates.remove(tenantId); - service.otherUsageStates.remove(tenantId); - - TopicPartitionInfo tpi = mock(TopicPartitionInfo.class); - when(tpi.isMyPartition()).thenReturn(false); - when(partitionService.resolve(any(), eq(tenantId), eq(tenantId))).thenReturn(tpi); - - ApiUsageState foundState = new ApiUsageState(); - foundState.setTenantId(tenantId); - when(apiUsageStateService.findTenantApiUsageState(tenantId)).thenReturn(foundState); - - ApiUsageState result = service.getApiUsageState(tenantId); - assertThat(result, is(foundState)); - - assertThat(service.otherUsageStates.get(tenantId), is(foundState)); - } - - @Test - public void testProcess_AllFeaturesTransitionToWarning() { - TransportProtos.ToUsageStatsServiceMsg.Builder msgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder() - .setTenantIdMSB(dummyTenant.getId().getId().getMostSignificantBits()) - .setTenantIdLSB(dummyTenant.getId().getId().getLeastSignificantBits()) + public void testProcess_transitionFromWarningToDisabled() { + TransportProtos.ToUsageStatsServiceMsg.Builder warningMsgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) .setCustomerIdMSB(0) .setCustomerIdLSB(0) .setServiceId("testService"); - for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { - if (key.getApiFeature() != null) { - msgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() - .setKey(key.name()) + warningMsgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(ApiUsageRecordKey.STORAGE_DP_COUNT.name()) .setValue(VALUE_WARNING) .build()); - } - } - - TransportProtos.ToUsageStatsServiceMsg statsMsg = msgBuilder.build(); - TbProtoQueueMsg msg = new TbProtoQueueMsg<>(UUID.randomUUID(), statsMsg); - TbCallback callback = mock(TbCallback.class); - - when(apiUsageStateService.update(any(ApiUsageState.class))).thenAnswer(invocation -> { - ApiUsageState state = invocation.getArgument(0); - state.setVersion(2L); - return state; - }); - - when(tenantService.findTenantById(dummyTenant.getTenantId())).thenReturn(dummyTenant); - - service.process(msg, callback); - - verify(callback, times(1)).onSuccess(); - for (ApiFeature feature : ApiFeature.values()) { - if (containsFeature(feature)) { - assertEquals(ApiUsageStateValue.WARNING, tenantApiUsageState.getFeatureValue(feature), - "For feature " + feature + " expected state WARNING"); - } - } + TransportProtos.ToUsageStatsServiceMsg warningStatsMsg = warningMsgBuilder.build(); + TbProtoQueueMsg warningMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), warningStatsMsg); - assertEquals(ApiUsageStateValue.WARNING, tenantApiUsageState.getFeatureValue(ApiFeature.JS)); + service.process(warningMsg, TbCallback.EMPTY); + assertEquals(ApiUsageStateValue.WARNING, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState()); - verify(notificationRuleProcessor, atLeastOnce()).process(any()); - verify(mailExecutor, atLeastOnce()).submit((Runnable) any()); - } - - @Test - public void testProcess_AllFeaturesTransitionToDisabled() { - TransportProtos.ToUsageStatsServiceMsg.Builder msgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder() - .setTenantIdMSB(dummyTenant.getId().getId().getMostSignificantBits()) - .setTenantIdLSB(dummyTenant.getId().getId().getLeastSignificantBits()) + TransportProtos.ToUsageStatsServiceMsg.Builder disableMsgBuilder = TransportProtos.ToUsageStatsServiceMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) .setCustomerIdMSB(0) .setCustomerIdLSB(0) .setServiceId("testService"); - for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { - if (key.getApiFeature() != null) { - msgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() - .setKey(key.name()) + disableMsgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(ApiUsageRecordKey.STORAGE_DP_COUNT.name()) .setValue(VALUE_DISABLE) .build()); - } - } - TransportProtos.ToUsageStatsServiceMsg statsMsg = msgBuilder.build(); - TbProtoQueueMsg msg = new TbProtoQueueMsg<>(UUID.randomUUID(), statsMsg); - TbCallback callback = mock(TbCallback.class); - - when(apiUsageStateService.update(any(ApiUsageState.class))).thenAnswer(invocation -> { - ApiUsageState state = invocation.getArgument(0); - state.setVersion(2L); - return state; - }); - when(tenantService.findTenantById(dummyTenant.getTenantId())).thenReturn(dummyTenant); - service.process(msg, callback); - verify(callback, times(1)).onSuccess(); + TransportProtos.ToUsageStatsServiceMsg disableStatsMsg = disableMsgBuilder.build(); + TbProtoQueueMsg disableMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), disableStatsMsg); - for (ApiFeature feature : ApiFeature.values()) { - if (containsFeature(feature)) { - assertEquals(ApiUsageStateValue.DISABLED, tenantApiUsageState.getFeatureValue(feature), - "For feature " + feature + " expected state DISABLED"); - } - } - verify(notificationRuleProcessor, atLeastOnce()).process(any()); - verify(mailExecutor, atLeastOnce()).submit((Runnable) any()); + service.process(disableMsg, TbCallback.EMPTY); + assertEquals(ApiUsageStateValue.DISABLED, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState()); } - @Test - public void testOnTenantProfileUpdate_updatesStateForMatchingTenant() { - TenantProfileId currentProfileId = tenantApiUsageState.getTenantProfileId(); - - TenantProfileData newProfileData = new TenantProfileData(); - DefaultTenantProfileConfiguration newConfig = DefaultTenantProfileConfiguration.builder() - .maxJSExecutions(NEW_MAX_ENABLE_VALUE) - .maxTransportMessages(MAX_ENABLE_VALUE) - .maxRuleChains(MAX_ENABLE_VALUE) - .maxTbelExecutions(MAX_ENABLE_VALUE) - .maxDPStorageDays(NEW_MAX_ENABLE_VALUE) - .maxREExecutions(MAX_ENABLE_VALUE) - .maxEmails(NEW_MAX_ENABLE_VALUE) - .maxSms(MAX_ENABLE_VALUE) - .maxCreatedAlarms(MAX_ENABLE_VALUE) - .warnThreshold(NEW_WARN_THRESHOLD_VALUE) - .build(); - - newProfileData.setConfiguration(newConfig); + private TenantProfile createTenantProfile() { + TenantProfile tenantProfile = new TenantProfile(); + tenantProfile.setName("Tenant Profile"); + tenantProfile.setDescription("Tenant Profile" + " Test"); - TenantProfile newProfile = new TenantProfile(); - newProfile.setId(currentProfileId); - newProfile.setProfileData(newProfileData); - - when(tbTenantProfileCache.get(currentProfileId)).thenReturn(newProfile); - - service.onTenantProfileUpdate(currentProfileId); - - assertEquals(currentProfileId, tenantApiUsageState.getTenantProfileId()); - assertEquals(newProfileData, tenantApiUsageState.getTenantProfileData()); - } - - @Test - public void testOnTenantUpdate_updatesStateWhenProfileChanged() { - TenantProfileId oldProfileId = tenantApiUsageState.getTenantProfileId(); - - TenantProfileId newProfileId = new TenantProfileId(UUID.randomUUID()); - TenantProfileData newProfileData = new TenantProfileData(); - DefaultTenantProfileConfiguration newConfig = DefaultTenantProfileConfiguration.builder() - .maxJSExecutions(NEW_MAX_ENABLE_VALUE) - .maxTransportMessages(MAX_ENABLE_VALUE) - .maxRuleChains(MAX_ENABLE_VALUE) - .maxTbelExecutions(NEW_MAX_ENABLE_VALUE) + TenantProfileData tenantProfileData = new TenantProfileData(); + DefaultTenantProfileConfiguration config = DefaultTenantProfileConfiguration.builder() .maxDPStorageDays(MAX_ENABLE_VALUE) - .maxREExecutions(NEW_MAX_ENABLE_VALUE) - .maxEmails(MAX_ENABLE_VALUE) - .maxSms(MAX_ENABLE_VALUE) - .maxCreatedAlarms(MAX_ENABLE_VALUE) - .warnThreshold(NEW_WARN_THRESHOLD_VALUE) + .warnThreshold(WARN_THRESHOLD_VALUE) .build(); - newProfileData.setConfiguration(newConfig); - - TenantProfile newProfile = new TenantProfile(); - newProfile.setId(newProfileId); - newProfile.setProfileData(newProfileData); - - when(tbTenantProfileCache.get(dummyTenant.getTenantId())).thenReturn(newProfile); - - assertNotEquals(oldProfileId, newProfileId); - - service.onTenantUpdate(dummyTenant.getTenantId()); - - assertEquals(newProfileId, tenantApiUsageState.getTenantProfileId()); - assertEquals(newProfileData, tenantApiUsageState.getTenantProfileData()); - } - - private boolean containsFeature(ApiFeature feature) { - for (ApiUsageRecordKey key : ApiUsageRecordKey.values()) { - if (key.getApiFeature() != null && key.getApiFeature().equals(feature)) { - return true; - } - } - return false; + tenantProfileData.setConfiguration(config); + tenantProfile.setProfileData(tenantProfileData); + return tenantProfile; } } \ No newline at end of file From f3c93104f61c0ba7e7f18252442a0ae3b395f626 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 20 Feb 2025 16:53:35 +0100 Subject: [PATCH 086/100] fixed coap.enabled property config --- application/src/main/resources/thingsboard.yml | 5 +++-- .../server/transport/coap/AbstractCoapIntegrationTest.java | 2 +- .../coap/security/AbstractCoapSecurityIntegrationTest.java | 2 +- application/src/test/resources/application-test.properties | 2 +- .../thingsboard/server/coapserver/TbCoapServerComponent.java | 2 +- .../server/coapserver/TbCoapTransportComponent.java | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 27478c8a01..991e060f1f 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1277,8 +1277,9 @@ transport: # CoAP server parameters coap: - # Enable/disable coap server. - enabled: "${COAP_SERVER_ENABLED:true}" + server: + # Enable/disable coap server. + enabled: "${COAP_SERVER_ENABLED:true}" # CoAP bind address bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}" # CoAP bind port diff --git a/application/src/test/java/org/thingsboard/server/transport/coap/AbstractCoapIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/coap/AbstractCoapIntegrationTest.java index 2b0d87527b..931944521c 100644 --- a/application/src/test/java/org/thingsboard/server/transport/coap/AbstractCoapIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/coap/AbstractCoapIntegrationTest.java @@ -45,7 +45,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @TestPropertySource(properties = { - "coap.enabled=true", + "coap.server.enabled=true", "service.integrations.supported=ALL", "transport.coap.enabled=true", }) diff --git a/application/src/test/java/org/thingsboard/server/transport/coap/security/AbstractCoapSecurityIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/coap/security/AbstractCoapSecurityIntegrationTest.java index 8413c6f32b..fea5b2484e 100644 --- a/application/src/test/java/org/thingsboard/server/transport/coap/security/AbstractCoapSecurityIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/coap/security/AbstractCoapSecurityIntegrationTest.java @@ -61,7 +61,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @Slf4j @TestPropertySource(properties = { - "coap.enabled=true", + "coap.server.enabled=true", "coap.dtls.enabled=true", "coap.dtls.credentials.pem.cert_file=coap/credentials/server/cert.pem", "device.connectivity.coaps.enabled=true", diff --git a/application/src/test/resources/application-test.properties b/application/src/test/resources/application-test.properties index 9951caa876..a5cc50f5d1 100644 --- a/application/src/test/resources/application-test.properties +++ b/application/src/test/resources/application-test.properties @@ -19,7 +19,7 @@ transport.mqtt.enabled=false transport.coap.enabled=false transport.lwm2m.enabled=false transport.snmp.enabled=false -coap.enabled=false +coap.server.enabled=false integrations.rpc.enabled=false service.integrations.supported=NONE diff --git a/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapServerComponent.java b/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapServerComponent.java index 2d94de2682..a5beca9142 100644 --- a/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapServerComponent.java +++ b/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapServerComponent.java @@ -21,6 +21,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) -@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${coap.enabled}'=='true')") +@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${coap.server.enabled}'=='true')") public @interface TbCoapServerComponent { } diff --git a/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapTransportComponent.java b/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapTransportComponent.java index 33f4b36b70..765415f750 100644 --- a/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapTransportComponent.java +++ b/common/coap-server/src/main/java/org/thingsboard/server/coapserver/TbCoapTransportComponent.java @@ -22,6 +22,6 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) @ConditionalOnExpression("'${service.type:null}'=='tb-transport' || " + - "('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${coap.enabled}'=='true' && '${transport.coap.enabled}'=='true')") + "('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${coap.server.enabled}'=='true' && '${transport.coap.enabled}'=='true')") public @interface TbCoapTransportComponent { } From e6174a93862b928b7429f1ade41d802e8efaebe1 Mon Sep 17 00:00:00 2001 From: Ekaterina Chantsova Date: Fri, 21 Feb 2025 12:21:26 +0200 Subject: [PATCH 087/100] Fixed empty url function parameter --- .../home/components/entity/entities-table.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html index 1754b94e62..c56aae3476 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html @@ -193,7 +193,7 @@ + [detailsPagePrefixUrl]="column.entityURL ? column.entityURL(entity) : ''"> From 46d9d82f4e7342a7339b6827124c5690537955f9 Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 24 Feb 2025 12:04:28 +0200 Subject: [PATCH 088/100] Fix: SNMP request failed to send --- application/src/main/resources/thingsboard.yml | 4 +++- .../transport/snmp/service/SnmpTransportService.java | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 368367bbab..183523e6ce 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1242,8 +1242,10 @@ transport: snmp: # Enable/disable SNMP transport protocol enabled: "${SNMP_ENABLED:true}" + # Snmp bind address + bind_address: "${SNMP_BIND_ADDRESS:0.0.0.0}" # Snmp bind port - bind_port: "${SNMP_BIND_PORT:1620}" + bind_port: "${SNMP_BIND_PORT:0}" response_processing: # parallelism level for executor (workStealingPool) that is responsible for handling responses from SNMP devices parallelism_level: "${SNMP_RESPONSE_PROCESSING_PARALLELISM_LEVEL:4}" diff --git a/common/transport/snmp/src/main/java/org/thingsboard/server/transport/snmp/service/SnmpTransportService.java b/common/transport/snmp/src/main/java/org/thingsboard/server/transport/snmp/service/SnmpTransportService.java index 04f113b918..66c14ca8ee 100644 --- a/common/transport/snmp/src/main/java/org/thingsboard/server/transport/snmp/service/SnmpTransportService.java +++ b/common/transport/snmp/src/main/java/org/thingsboard/server/transport/snmp/service/SnmpTransportService.java @@ -67,6 +67,7 @@ import org.thingsboard.server.transport.snmp.session.DeviceSessionContext; import org.thingsboard.server.transport.snmp.session.ScheduledTask; import java.io.IOException; +import java.net.InetAddress; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -97,8 +98,10 @@ public class SnmpTransportService implements TbTransportService, CommandResponde private final Map responseDataMappers = new EnumMap<>(SnmpCommunicationSpec.class); private final Map responseProcessors = new EnumMap<>(SnmpCommunicationSpec.class); - @Value("${transport.snmp.bind_port:1620}") + @Value("${transport.snmp.bind_port:0}") private Integer snmpBindPort; + @Value("${transport.snmp.bind_address:0.0.0.0}") + private String snmpBindAddress; @Value("${transport.snmp.response_processing.parallelism_level:4}") private int responseProcessingThreadPoolSize; @Value("${transport.snmp.scheduler_thread_pool_size:4}") @@ -134,10 +137,10 @@ public class SnmpTransportService implements TbTransportService, CommandResponde TransportMapping transportMapping; switch (snmpUnderlyingProtocol) { case "udp": - transportMapping = new DefaultUdpTransportMapping(new UdpAddress(snmpBindPort)); + transportMapping = new DefaultUdpTransportMapping(new UdpAddress(InetAddress.getByName(snmpBindAddress), snmpBindPort)); break; case "tcp": - transportMapping = new DefaultTcpTransportMapping(new TcpAddress(snmpBindPort)); + transportMapping = new DefaultTcpTransportMapping(new TcpAddress(InetAddress.getByName(snmpBindAddress), snmpBindPort)); break; default: throw new IllegalArgumentException("Underlying protocol " + snmpUnderlyingProtocol + " for SNMP is not supported"); From 28ee01a7dd926db85ea9144e777d39583426b68a Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 24 Feb 2025 13:47:11 +0200 Subject: [PATCH 089/100] Fixed DefaultTbApiUsageStateServiceTest file formatting --- .../DefaultTbApiUsageStateServiceTest.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java index 8d4c1b849b..4e53cfa449 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateServiceTest.java @@ -19,7 +19,10 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.thingsboard.server.common.data.*; +import org.thingsboard.server.common.data.ApiUsageRecordKey; +import org.thingsboard.server.common.data.ApiUsageStateValue; +import org.thingsboard.server.common.data.Tenant; +import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; @@ -76,10 +79,10 @@ public class DefaultTbApiUsageStateServiceTest extends AbstractControllerTest { .setCustomerIdLSB(0) .setServiceId("testService"); - warningMsgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() - .setKey(ApiUsageRecordKey.STORAGE_DP_COUNT.name()) - .setValue(VALUE_WARNING) - .build()); + warningMsgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(ApiUsageRecordKey.STORAGE_DP_COUNT.name()) + .setValue(VALUE_WARNING) + .build()); TransportProtos.ToUsageStatsServiceMsg warningStatsMsg = warningMsgBuilder.build(); TbProtoQueueMsg warningMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), warningStatsMsg); @@ -94,10 +97,10 @@ public class DefaultTbApiUsageStateServiceTest extends AbstractControllerTest { .setCustomerIdLSB(0) .setServiceId("testService"); - disableMsgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() - .setKey(ApiUsageRecordKey.STORAGE_DP_COUNT.name()) - .setValue(VALUE_DISABLE) - .build()); + disableMsgBuilder.addValues(TransportProtos.UsageStatsKVProto.newBuilder() + .setKey(ApiUsageRecordKey.STORAGE_DP_COUNT.name()) + .setValue(VALUE_DISABLE) + .build()); TransportProtos.ToUsageStatsServiceMsg disableStatsMsg = disableMsgBuilder.build(); TbProtoQueueMsg disableMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), disableStatsMsg); From 9a93a279435d2b3b50cacdbe682f238221e321b1 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 24 Feb 2025 14:06:04 +0200 Subject: [PATCH 090/100] Refactoring after review --- .../common/data/widget/WidgetBundleInfo.java | 39 ++++++++++ .../common/data/widget/WidgetTypeInfo.java | 25 ++----- .../dao/model/sql/WidgetTypeInfoEntity.java | 13 ++-- .../mapping/AbstractEntityInfosConverter.java | 73 ------------------- .../WidgetBundleEntityInfosConverter.java | 29 -------- 5 files changed, 51 insertions(+), 128 deletions(-) create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetBundleInfo.java delete mode 100644 dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java delete mode 100644 dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetBundleInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetBundleInfo.java new file mode 100644 index 0000000000..f7e43fdad0 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetBundleInfo.java @@ -0,0 +1,39 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.widget; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import lombok.Value; +import org.thingsboard.server.common.data.EntityInfo; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.id.EntityIdFactory; + +import java.io.Serial; +import java.util.UUID; + +@Value +@EqualsAndHashCode(callSuper = true) +public class WidgetBundleInfo extends EntityInfo { + + @Serial + private static final long serialVersionUID = 2132305394634509820L; + + public WidgetBundleInfo(@JsonProperty("id") UUID uuid, @JsonProperty("name") String name) { + super(EntityIdFactory.getByTypeAndUuid(EntityType.WIDGETS_BUNDLE, uuid), name); + } + +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java index 803dcbb945..f7260052a9 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeInfo.java @@ -18,7 +18,6 @@ package org.thingsboard.server.common.data.widget; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.Valid; import lombok.Data; -import org.thingsboard.server.common.data.EntityInfo; import org.thingsboard.server.common.data.id.WidgetTypeId; import org.thingsboard.server.common.data.validation.NoXss; @@ -45,7 +44,7 @@ public class WidgetTypeInfo extends BaseWidgetType { private String widgetType; @Valid @Schema(description = "Bundles", accessMode = Schema.AccessMode.READ_ONLY) - private List bundles; + private List bundles; public WidgetTypeInfo() { super(); @@ -60,15 +59,10 @@ public class WidgetTypeInfo extends BaseWidgetType { } public WidgetTypeInfo(WidgetTypeInfo widgetTypeInfo) { - super(widgetTypeInfo); - this.image = widgetTypeInfo.getImage(); - this.description = widgetTypeInfo.getDescription(); - this.tags = widgetTypeInfo.getTags(); - this.widgetType = widgetTypeInfo.getWidgetType(); - this.bundles = Collections.emptyList(); + this(widgetTypeInfo, Collections.emptyList()); } - public WidgetTypeInfo(WidgetTypeInfo widgetTypeInfo, List bundles) { + public WidgetTypeInfo(WidgetTypeInfo widgetTypeInfo, List bundles) { super(widgetTypeInfo); this.image = widgetTypeInfo.getImage(); this.description = widgetTypeInfo.getDescription(); @@ -78,19 +72,10 @@ public class WidgetTypeInfo extends BaseWidgetType { } public WidgetTypeInfo(WidgetTypeDetails widgetTypeDetails) { - super(widgetTypeDetails); - this.image = widgetTypeDetails.getImage(); - this.description = widgetTypeDetails.getDescription(); - this.tags = widgetTypeDetails.getTags(); - if (widgetTypeDetails.getDescriptor() != null && widgetTypeDetails.getDescriptor().has("type")) { - this.widgetType = widgetTypeDetails.getDescriptor().get("type").asText(); - } else { - this.widgetType = ""; - } - this.bundles = Collections.emptyList(); + this(widgetTypeDetails, Collections.emptyList()); } - public WidgetTypeInfo(WidgetTypeDetails widgetTypeDetails, List bundles) { + public WidgetTypeInfo(WidgetTypeDetails widgetTypeDetails, List bundles) { super(widgetTypeDetails); this.image = widgetTypeDetails.getImage(); this.description = widgetTypeDetails.getDescription(); diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java index c503632b91..d718e5613d 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java @@ -15,6 +15,8 @@ */ package org.thingsboard.server.dao.model.sql; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; import io.hypersistence.utils.hibernate.type.array.StringArrayType; import jakarta.persistence.Column; import jakarta.persistence.Convert; @@ -24,14 +26,13 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.hibernate.annotations.Immutable; import org.hibernate.annotations.Type; -import org.thingsboard.server.common.data.EntityInfo; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.widget.BaseWidgetType; import org.thingsboard.server.common.data.widget.WidgetTypeInfo; import org.thingsboard.server.dao.model.ModelConstants; -import org.thingsboard.server.dao.util.mapping.WidgetBundleEntityInfosConverter; +import org.thingsboard.server.dao.util.mapping.JsonConverter; import java.util.HashMap; -import java.util.List; import java.util.Map; @Data @@ -62,9 +63,9 @@ public class WidgetTypeInfoEntity extends AbstractWidgetTypeEntity bundles; + private JsonNode bundles; public WidgetTypeInfoEntity() { super(); @@ -78,7 +79,7 @@ public class WidgetTypeInfoEntity extends AbstractWidgetTypeEntity() {})); return widgetTypeInfo; } diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java deleted file mode 100644 index 98b94d17e2..0000000000 --- a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/AbstractEntityInfosConverter.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.dao.util.mapping; - -import com.fasterxml.jackson.databind.JsonNode; -import jakarta.persistence.AttributeConverter; -import jakarta.persistence.Converter; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityInfo; -import org.thingsboard.server.common.data.EntityType; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -@Converter -public abstract class AbstractEntityInfosConverter implements AttributeConverter, String> { - - protected abstract EntityType getEntityType(); - - @Override - public String convertToDatabaseColumn(List attribute) { - throw new IllegalArgumentException("Not implemented!"); - } - - @Override - public List convertToEntityAttribute(String s) { - try { - JsonNode node = JacksonUtil.fromBytes(s.getBytes(StandardCharsets.UTF_8)); - if (node.isArray()) { - List entities = new ArrayList<>(); - for (int i = 0; i < node.size(); i++) { - JsonNode row = node.get(i); - UUID id = null; - String name = null; - JsonNode idNode = row.get("id"); - JsonNode nameNode = row.get("name"); - if (idNode != null && nameNode != null) { - try { - id = UUID.fromString(idNode.asText()); - } catch (Exception ignored) {} - name = nameNode.asText(); - } - if (id != null && name != null) { - entities.add(new EntityInfo(id, getEntityType().name(), name)); - } - } - return entities; - } else { - return Collections.emptyList(); - } - } catch (Exception ex) { - String exception = String.format("Failed to convert String to %s list: %s", getEntityType(), ex.getMessage()); - throw new RuntimeException(exception, ex); - } - } - -} diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java b/dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java deleted file mode 100644 index 143de09818..0000000000 --- a/dao/src/main/java/org/thingsboard/server/dao/util/mapping/WidgetBundleEntityInfosConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright © 2016-2024 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.dao.util.mapping; - -import jakarta.persistence.Converter; -import org.thingsboard.server.common.data.EntityType; - -@Converter -public class WidgetBundleEntityInfosConverter extends AbstractEntityInfosConverter { - - @Override - protected EntityType getEntityType() { - return EntityType.WIDGETS_BUNDLE; - } - -} From 0b6afdc6e91b3d372fb9b7e50ac6e8da11a5f9b2 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 24 Feb 2025 14:18:36 +0200 Subject: [PATCH 091/100] Fix test --- .../server/dao/sql/widget/JpaWidgetTypeDaoTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java b/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java index 693bf86d91..27376964f5 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/sql/widget/JpaWidgetTypeDaoTest.java @@ -21,7 +21,6 @@ import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.EntityInfo; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.WidgetsBundleId; @@ -30,6 +29,7 @@ import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.page.SortOrder; import org.thingsboard.server.common.data.widget.BaseWidgetType; import org.thingsboard.server.common.data.widget.DeprecatedFilter; +import org.thingsboard.server.common.data.widget.WidgetBundleInfo; import org.thingsboard.server.common.data.widget.WidgetType; import org.thingsboard.server.common.data.widget.WidgetTypeDetails; import org.thingsboard.server.common.data.widget.WidgetTypeFilter; @@ -120,8 +120,8 @@ public class JpaWidgetTypeDaoTest extends AbstractJpaDaoTest { String[] tags = new String[]{"Tag1_" + number, "Tag2_" + number, "TEST_" + number}; widgetType.setTags(tags); WidgetTypeDetails saved = widgetTypeDao.save(TenantId.SYS_TENANT_ID, widgetType); - List bundles = new ArrayList<>(); - bundles.add(new EntityInfo(widgetsBundle.getId(), widgetsBundle.getName())); + List bundles = new ArrayList<>(); + bundles.add(new WidgetBundleInfo(widgetsBundle.getUuidId(), widgetsBundle.getName())); return new WidgetTypeInfo(saved, bundles); } From 545ea89713bdf3b4f31b3275d42b5c5f5e5575ae Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 24 Feb 2025 14:59:54 +0200 Subject: [PATCH 092/100] Increased timeout to 30 seconds --- .../org/thingsboard/server/service/apiusage/ApiUsageTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java index c708525a1d..84a6fb9931 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java @@ -94,7 +94,7 @@ public class ApiUsageTest extends AbstractControllerTest { doPostAsync(url, telemetryPayload, String.class, status().isOk()); } - await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> assertEquals(ApiUsageStateValue.WARNING, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState())); + await().atMost(TIMEOUT, TimeUnit.SECONDS).untilAsserted(() -> assertEquals(ApiUsageStateValue.WARNING, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState())); long VALUE_DISABLE = (long) (MAX_DP_ENABLE_VALUE - (MAX_DP_ENABLE_VALUE * WARN_THRESHOLD_VALUE)) / 2; @@ -102,7 +102,7 @@ public class ApiUsageTest extends AbstractControllerTest { doPostAsync(url, telemetryPayload, String.class, status().isOk()); } - await().atMost(5, TimeUnit.SECONDS) + await().atMost(TIMEOUT, TimeUnit.SECONDS) .untilAsserted(() -> { assertEquals(ApiUsageStateValue.DISABLED, apiUsageStateService.findTenantApiUsageState(tenantId).getDbStorageState()); }); From 9823f8db8b59bb21028f48273f0e2fdb4ae1463e Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 24 Feb 2025 15:03:15 +0200 Subject: [PATCH 093/100] Updated comments --- application/src/main/resources/thingsboard.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 183523e6ce..ca71968183 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1242,9 +1242,9 @@ transport: snmp: # Enable/disable SNMP transport protocol enabled: "${SNMP_ENABLED:true}" - # Snmp bind address + # SNMP bind address bind_address: "${SNMP_BIND_ADDRESS:0.0.0.0}" - # Snmp bind port + # SNMP bind port. Zero (random) by default. When using SNMP TRAPs - make sure to specify some static value, e.g. 1620 bind_port: "${SNMP_BIND_PORT:0}" response_processing: # parallelism level for executor (workStealingPool) that is responsible for handling responses from SNMP devices From 6a0fff0737bd111df9ef44e310b54d0f885cb1ec Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Feb 2025 09:27:01 +0200 Subject: [PATCH 094/100] Version set to 3.9.1-RC --- application/pom.xml | 2 +- common/actor/pom.xml | 2 +- common/cache/pom.xml | 2 +- common/cluster-api/pom.xml | 2 +- common/coap-server/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/edge-api/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/proto/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/script/pom.xml | 2 +- common/script/remote-js-client/pom.xml | 2 +- common/script/script-api/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/lwm2m/pom.xml | 2 +- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/snmp/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- common/version-control/pom.xml | 2 +- dao/pom.xml | 2 +- monitoring/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/js-executor/pom.xml | 2 +- msa/monitoring/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/lwm2m/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/transport/snmp/pom.xml | 2 +- msa/vc-executor-docker/pom.xml | 2 +- msa/vc-executor/pom.xml | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 ++-- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/lwm2m/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- transport/snmp/pom.xml | 2 +- ui-ngx/pom.xml | 2 +- 56 files changed, 57 insertions(+), 57 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index d97f6d92e3..e13605f292 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard application diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 9b0053e0b6..05e770888c 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/cache/pom.xml b/common/cache/pom.xml index fd9802a689..d97b41fed4 100644 --- a/common/cache/pom.xml +++ b/common/cache/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/cluster-api/pom.xml b/common/cluster-api/pom.xml index d53ac4904d..d789732519 100644 --- a/common/cluster-api/pom.xml +++ b/common/cluster-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/coap-server/pom.xml b/common/coap-server/pom.xml index 30001c929d..9bd3fc19d0 100644 --- a/common/coap-server/pom.xml +++ b/common/coap-server/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 0bd0f476ec..0a84902178 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index f7c559c728..6e3d66413a 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/edge-api/pom.xml b/common/edge-api/pom.xml index 4f0fe5aac0..e78dff790d 100644 --- a/common/edge-api/pom.xml +++ b/common/edge-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 0e290d1e01..53fbdf97c4 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index 4c8f56cbce..9303be4522 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard common diff --git a/common/proto/pom.xml b/common/proto/pom.xml index 9a9b262d82..215fe27745 100644 --- a/common/proto/pom.xml +++ b/common/proto/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index 44e2239e05..9f895986dd 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/script/pom.xml b/common/script/pom.xml index 8c4ea360cf..d2a7a8bfcf 100644 --- a/common/script/pom.xml +++ b/common/script/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/script/remote-js-client/pom.xml b/common/script/remote-js-client/pom.xml index 2b780bf489..8aacb3bc59 100644 --- a/common/script/remote-js-client/pom.xml +++ b/common/script/remote-js-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC script org.thingsboard.common.script diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index ed93701513..f30adc303a 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC script org.thingsboard.common.script diff --git a/common/stats/pom.xml b/common/stats/pom.xml index 7cc67d5821..4a23faf475 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 86459e9821..dc5ecd7905 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index 8ab2243ceb..bfb830d8ee 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index a6e7209f21..d5603a86ca 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index d074afc6b5..c043d88e20 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index fdd3ad21d5..01fa1c3c4a 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/transport/snmp/pom.xml b/common/transport/snmp/pom.xml index 5d4d37547f..b1a78519d3 100644 --- a/common/transport/snmp/pom.xml +++ b/common/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC transport diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index e2f03b060a..e05414e77b 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index dc75047267..b0543bf7fb 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml index ea568dfcd9..16559c2e2c 100644 --- a/common/version-control/pom.xml +++ b/common/version-control/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index 5021742154..3dbdd086db 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard dao diff --git a/monitoring/pom.xml b/monitoring/pom.xml index d30a9ca71f..3b2f378a17 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index c1c0980b64..549d773297 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 62545f5ad6..8641384cb0 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index 1b03765586..a58da78c17 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa diff --git a/msa/pom.xml b/msa/pom.xml index ff394295f4..2ccf92deb3 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index 6142c3c5d8..cc93c0a078 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index 0c6046c09e..dab3a52710 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 325d4d45fa..896915082e 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index 945c523455..483c40c880 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index 4d0370c1cf..db98c0828f 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 20791ad61c..26d53f6b2f 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 0b92e1fa97..c9473462d7 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index b16469523e..7c6f267964 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.msa transport - 4.0.0-SNAPSHOT + 3.9.1-RC org.thingsboard.msa.transport diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index 72995b05ab..8cba9d153b 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index 1b88a41692..5e86f5dd47 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index 361487b516..bfbcb81012 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index f7361a686d..34a4a3e81a 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard netty-mqtt - 4.0.0-SNAPSHOT + 3.9.1-RC jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index e70a57fbbf..5d46c743cd 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index c8232512f7..69cd079e6b 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index bd14daf22e..5ed4ee9329 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index 886a2169f3..4db9a7c4bf 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 750701894f..5b48de2224 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index 4f7c3f48a6..f60289c5f4 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index 452ef6ec9a..0b147c871a 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index 2408340792..f8e80627f3 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index 3ba43f5b53..43f61039ed 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index e31d618890..0fea251b03 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index dd1c415e6c..e101a84e79 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard transport diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index 08f23d2c2d..26f68cc598 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC transport diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index 9515f3b3ec..b00064e2fd 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 3.9.1-RC thingsboard org.thingsboard From b7750bc342401114cdaaca10ab76dd3987b3a348 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Feb 2025 09:28:44 +0200 Subject: [PATCH 095/100] Version set to 4.0.0-SNAPSHOT --- application/pom.xml | 2 +- common/actor/pom.xml | 2 +- common/cache/pom.xml | 2 +- common/cluster-api/pom.xml | 2 +- common/coap-server/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/edge-api/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/proto/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/script/pom.xml | 2 +- common/script/remote-js-client/pom.xml | 2 +- common/script/script-api/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/lwm2m/pom.xml | 2 +- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/snmp/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- common/version-control/pom.xml | 2 +- dao/pom.xml | 2 +- monitoring/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/js-executor/pom.xml | 2 +- msa/monitoring/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/lwm2m/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/transport/snmp/pom.xml | 2 +- msa/vc-executor-docker/pom.xml | 2 +- msa/vc-executor/pom.xml | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 ++-- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/lwm2m/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- transport/snmp/pom.xml | 2 +- ui-ngx/pom.xml | 2 +- 56 files changed, 57 insertions(+), 57 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index e13605f292..d97f6d92e3 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard application diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 05e770888c..9b0053e0b6 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/cache/pom.xml b/common/cache/pom.xml index d97b41fed4..fd9802a689 100644 --- a/common/cache/pom.xml +++ b/common/cache/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/cluster-api/pom.xml b/common/cluster-api/pom.xml index d789732519..d53ac4904d 100644 --- a/common/cluster-api/pom.xml +++ b/common/cluster-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/coap-server/pom.xml b/common/coap-server/pom.xml index 9bd3fc19d0..30001c929d 100644 --- a/common/coap-server/pom.xml +++ b/common/coap-server/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 0a84902178..0bd0f476ec 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index 6e3d66413a..f7c559c728 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/edge-api/pom.xml b/common/edge-api/pom.xml index e78dff790d..4f0fe5aac0 100644 --- a/common/edge-api/pom.xml +++ b/common/edge-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 53fbdf97c4..0e290d1e01 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index 9303be4522..4c8f56cbce 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard common diff --git a/common/proto/pom.xml b/common/proto/pom.xml index 215fe27745..9a9b262d82 100644 --- a/common/proto/pom.xml +++ b/common/proto/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index 9f895986dd..44e2239e05 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/script/pom.xml b/common/script/pom.xml index d2a7a8bfcf..8c4ea360cf 100644 --- a/common/script/pom.xml +++ b/common/script/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/script/remote-js-client/pom.xml b/common/script/remote-js-client/pom.xml index 8aacb3bc59..2b780bf489 100644 --- a/common/script/remote-js-client/pom.xml +++ b/common/script/remote-js-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT script org.thingsboard.common.script diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index f30adc303a..ed93701513 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT script org.thingsboard.common.script diff --git a/common/stats/pom.xml b/common/stats/pom.xml index 4a23faf475..7cc67d5821 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index dc5ecd7905..86459e9821 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index bfb830d8ee..8ab2243ceb 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index d5603a86ca..a6e7209f21 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index c043d88e20..d074afc6b5 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 01fa1c3c4a..fdd3ad21d5 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/snmp/pom.xml b/common/transport/snmp/pom.xml index b1a78519d3..5d4d37547f 100644 --- a/common/transport/snmp/pom.xml +++ b/common/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT transport diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index e05414e77b..e2f03b060a 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index b0543bf7fb..dc75047267 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml index 16559c2e2c..ea568dfcd9 100644 --- a/common/version-control/pom.xml +++ b/common/version-control/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index 3dbdd086db..5021742154 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard dao diff --git a/monitoring/pom.xml b/monitoring/pom.xml index 3b2f378a17..d30a9ca71f 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index 549d773297..c1c0980b64 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 8641384cb0..62545f5ad6 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index a58da78c17..1b03765586 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa diff --git a/msa/pom.xml b/msa/pom.xml index 2ccf92deb3..ff394295f4 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index cc93c0a078..6142c3c5d8 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index dab3a52710..0c6046c09e 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 896915082e..325d4d45fa 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index 483c40c880..945c523455 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index db98c0828f..4d0370c1cf 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 26d53f6b2f..20791ad61c 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index c9473462d7..0b92e1fa97 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index 7c6f267964..b16469523e 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.msa transport - 3.9.1-RC + 4.0.0-SNAPSHOT org.thingsboard.msa.transport diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index 8cba9d153b..72995b05ab 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index 5e86f5dd47..1b88a41692 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index bfbcb81012..361487b516 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index 34a4a3e81a..f7361a686d 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard netty-mqtt - 3.9.1-RC + 4.0.0-SNAPSHOT jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index 5d46c743cd..e70a57fbbf 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index 69cd079e6b..c8232512f7 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index 5ed4ee9329..bd14daf22e 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index 4db9a7c4bf..886a2169f3 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 5b48de2224..750701894f 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index f60289c5f4..4f7c3f48a6 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index 0b147c871a..452ef6ec9a 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index f8e80627f3..2408340792 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index 43f61039ed..3ba43f5b53 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index 0fea251b03..e31d618890 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index e101a84e79..dd1c415e6c 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard transport diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index 26f68cc598..08f23d2c2d 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT transport diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index b00064e2fd..9515f3b3ec 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.9.1-RC + 4.0.0-SNAPSHOT thingsboard org.thingsboard From 5cf26d485143c27f8d445a6f5c91d0d71dab69ec Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Feb 2025 09:39:16 +0200 Subject: [PATCH 096/100] Update license header --- .github/release.yml | 2 +- .github/workflows/check-configuration-files.yml | 2 +- .github/workflows/license-header-format.yml | 2 +- application/pom.xml | 2 +- application/src/main/conf/logback.xml | 2 +- application/src/main/conf/thingsboard.conf | 2 +- application/src/main/data/upgrade/basic/schema_update.sql | 2 +- .../converter/xml/MappingJackson2XmlHttpMessageConverter.java | 2 +- .../org/thingsboard/server/ThingsboardInstallApplication.java | 2 +- .../org/thingsboard/server/ThingsboardServerApplication.java | 2 +- .../java/org/thingsboard/server/actors/ActorSystemContext.java | 2 +- .../server/actors/TbEntityTypeActorIdPredicate.java | 2 +- .../main/java/org/thingsboard/server/actors/app/AppActor.java | 2 +- .../java/org/thingsboard/server/actors/app/AppInitMsg.java | 2 +- .../java/org/thingsboard/server/actors/device/DeviceActor.java | 2 +- .../thingsboard/server/actors/device/DeviceActorCreator.java | 2 +- .../server/actors/device/DeviceActorMessageProcessor.java | 2 +- .../java/org/thingsboard/server/actors/device/SessionInfo.java | 2 +- .../thingsboard/server/actors/device/SessionInfoMetaData.java | 2 +- .../server/actors/device/SessionTimeoutCheckMsg.java | 2 +- .../server/actors/device/ToDeviceRpcRequestMetadata.java | 2 +- .../server/actors/device/ToServerRpcRequestMetadata.java | 2 +- .../server/actors/device/TransportSessionCloseReason.java | 2 +- .../thingsboard/server/actors/ruleChain/DefaultTbContext.java | 2 +- .../thingsboard/server/actors/ruleChain/RuleChainActor.java | 2 +- .../actors/ruleChain/RuleChainActorMessageProcessor.java | 2 +- .../thingsboard/server/actors/ruleChain/RuleChainInputMsg.java | 2 +- .../server/actors/ruleChain/RuleChainManagerActor.java | 2 +- .../server/actors/ruleChain/RuleChainOutputMsg.java | 2 +- .../server/actors/ruleChain/RuleChainToRuleChainMsg.java | 2 +- .../server/actors/ruleChain/RuleChainToRuleNodeMsg.java | 2 +- .../server/actors/ruleChain/RuleEngineComponentActor.java | 2 +- .../org/thingsboard/server/actors/ruleChain/RuleNodeActor.java | 2 +- .../server/actors/ruleChain/RuleNodeActorMessageProcessor.java | 2 +- .../org/thingsboard/server/actors/ruleChain/RuleNodeCtx.java | 2 +- .../thingsboard/server/actors/ruleChain/RuleNodeRelation.java | 2 +- .../actors/ruleChain/RuleNodeToRuleChainTellNextMsg.java | 2 +- .../thingsboard/server/actors/ruleChain/RuleNodeToSelfMsg.java | 2 +- .../server/actors/ruleChain/TbToRuleChainActorMsg.java | 2 +- .../server/actors/ruleChain/TbToRuleNodeActorMsg.java | 2 +- .../org/thingsboard/server/actors/service/ActorService.java | 2 +- .../org/thingsboard/server/actors/service/ComponentActor.java | 2 +- .../thingsboard/server/actors/service/ContextAwareActor.java | 2 +- .../thingsboard/server/actors/service/ContextBasedCreator.java | 2 +- .../thingsboard/server/actors/service/DefaultActorService.java | 2 +- .../server/actors/shared/AbstractContextAwareMsgProcessor.java | 2 +- .../thingsboard/server/actors/shared/ActorTerminationMsg.java | 2 +- .../server/actors/shared/ComponentMsgProcessor.java | 2 +- .../thingsboard/server/actors/shared/RuleChainErrorActor.java | 2 +- .../java/org/thingsboard/server/actors/stats/StatsActor.java | 2 +- .../org/thingsboard/server/actors/stats/StatsPersistMsg.java | 2 +- .../org/thingsboard/server/actors/stats/StatsPersistTick.java | 2 +- .../thingsboard/server/actors/tenant/DebugTbRateLimits.java | 2 +- .../java/org/thingsboard/server/actors/tenant/TenantActor.java | 2 +- .../main/java/org/thingsboard/server/config/CryptoConfig.java | 2 +- .../config/CustomOAuth2AuthorizationRequestResolver.java | 2 +- .../java/org/thingsboard/server/config/MvcCorsProperties.java | 2 +- .../thingsboard/server/config/RateLimitProcessingFilter.java | 2 +- .../org/thingsboard/server/config/SchedulingConfiguration.java | 2 +- .../org/thingsboard/server/config/SwaggerConfiguration.java | 2 +- .../server/config/TbRuleEngineSecurityConfiguration.java | 2 +- .../server/config/ThingsboardMessageConfiguration.java | 2 +- .../server/config/ThingsboardSecurityConfiguration.java | 2 +- .../src/main/java/org/thingsboard/server/config/WebConfig.java | 2 +- .../org/thingsboard/server/config/WebSocketConfiguration.java | 2 +- .../thingsboard/server/config/annotations/ApiOperation.java | 2 +- .../thingsboard/server/controller/AbstractRpcController.java | 2 +- .../org/thingsboard/server/controller/AdminController.java | 2 +- .../thingsboard/server/controller/AlarmCommentController.java | 2 +- .../org/thingsboard/server/controller/AlarmController.java | 2 +- .../org/thingsboard/server/controller/AssetController.java | 2 +- .../thingsboard/server/controller/AssetProfileController.java | 2 +- .../org/thingsboard/server/controller/AuditLogController.java | 2 +- .../java/org/thingsboard/server/controller/AuthController.java | 2 +- .../thingsboard/server/controller/AutoCommitController.java | 2 +- .../java/org/thingsboard/server/controller/BaseController.java | 2 +- .../server/controller/ComponentDescriptorController.java | 2 +- .../org/thingsboard/server/controller/ControllerConstants.java | 2 +- .../org/thingsboard/server/controller/CustomerController.java | 2 +- .../org/thingsboard/server/controller/DashboardController.java | 2 +- .../server/controller/DeviceConnectivityController.java | 2 +- .../org/thingsboard/server/controller/DeviceController.java | 2 +- .../thingsboard/server/controller/DeviceProfileController.java | 2 +- .../org/thingsboard/server/controller/DomainController.java | 2 +- .../java/org/thingsboard/server/controller/EdgeController.java | 2 +- .../org/thingsboard/server/controller/EdgeEventController.java | 2 +- .../server/controller/EntitiesVersionControlController.java | 2 +- .../thingsboard/server/controller/EntityQueryController.java | 2 +- .../server/controller/EntityRelationController.java | 2 +- .../thingsboard/server/controller/EntityViewController.java | 2 +- .../org/thingsboard/server/controller/EventController.java | 2 +- .../thingsboard/server/controller/HttpValidationCallback.java | 2 +- .../org/thingsboard/server/controller/ImageController.java | 2 +- .../org/thingsboard/server/controller/Lwm2mController.java | 2 +- .../server/controller/MailConfigTemplateController.java | 2 +- .../server/controller/MobileAppBundleController.java | 2 +- .../org/thingsboard/server/controller/MobileAppController.java | 2 +- .../thingsboard/server/controller/NotificationController.java | 2 +- .../server/controller/NotificationRuleController.java | 2 +- .../server/controller/NotificationTargetController.java | 2 +- .../server/controller/NotificationTemplateController.java | 2 +- .../server/controller/OAuth2ConfigTemplateController.java | 2 +- .../org/thingsboard/server/controller/OAuth2Controller.java | 2 +- .../thingsboard/server/controller/OtaPackageController.java | 2 +- .../server/controller/QrCodeSettingsController.java | 2 +- .../org/thingsboard/server/controller/QueueController.java | 2 +- .../thingsboard/server/controller/QueueStatsController.java | 2 +- .../org/thingsboard/server/controller/RpcV1Controller.java | 2 +- .../org/thingsboard/server/controller/RpcV2Controller.java | 2 +- .../org/thingsboard/server/controller/RuleChainController.java | 2 +- .../thingsboard/server/controller/RuleEngineController.java | 2 +- .../thingsboard/server/controller/SystemInfoController.java | 2 +- .../thingsboard/server/controller/TbResourceController.java | 2 +- .../java/org/thingsboard/server/controller/TbUrlConstants.java | 2 +- .../org/thingsboard/server/controller/TelemetryController.java | 2 +- .../org/thingsboard/server/controller/TenantController.java | 2 +- .../thingsboard/server/controller/TenantProfileController.java | 2 +- .../server/controller/TwoFactorAuthConfigController.java | 2 +- .../thingsboard/server/controller/TwoFactorAuthController.java | 2 +- .../thingsboard/server/controller/UiSettingsController.java | 2 +- .../org/thingsboard/server/controller/UsageInfoController.java | 2 +- .../java/org/thingsboard/server/controller/UserController.java | 2 +- .../thingsboard/server/controller/WidgetTypeController.java | 2 +- .../thingsboard/server/controller/WidgetsBundleController.java | 2 +- .../server/controller/plugin/TbWebSocketHandler.java | 2 +- .../thingsboard/server/controller/plugin/TbWebSocketMsg.java | 2 +- .../server/controller/plugin/TbWebSocketMsgType.java | 2 +- .../server/controller/plugin/TbWebSocketPingMsg.java | 2 +- .../server/controller/plugin/TbWebSocketTextMsg.java | 2 +- .../thingsboard/server/exception/AccessDeniedException.java | 2 +- .../thingsboard/server/exception/EntityNotFoundException.java | 2 +- .../thingsboard/server/exception/InternalErrorException.java | 2 +- .../server/exception/InvalidParametersException.java | 2 +- .../exception/ThingsboardCredentialsExpiredResponse.java | 2 +- .../exception/ThingsboardCredentialsViolationResponse.java | 2 +- .../thingsboard/server/exception/ThingsboardErrorResponse.java | 2 +- .../server/exception/ThingsboardErrorResponseHandler.java | 2 +- .../thingsboard/server/exception/ToErrorResponseEntity.java | 2 +- .../thingsboard/server/exception/UnauthorizedException.java | 2 +- .../thingsboard/server/exception/UncheckedApiException.java | 2 +- .../server/install/ThingsboardInstallConfiguration.java | 2 +- .../server/install/ThingsboardInstallException.java | 2 +- .../thingsboard/server/install/ThingsboardInstallService.java | 2 +- .../thingsboard/server/service/action/EntityActionService.java | 2 +- .../thingsboard/server/service/apiusage/BaseApiUsageState.java | 2 +- .../server/service/apiusage/CustomerApiUsageState.java | 2 +- .../server/service/apiusage/DefaultTbApiUsageStateService.java | 2 +- .../server/service/apiusage/TbApiUsageStateService.java | 2 +- .../server/service/apiusage/TenantApiUsageState.java | 2 +- .../server/service/asset/AssetBulkImportService.java | 2 +- .../service/component/AnnotationComponentDiscoveryService.java | 2 +- .../server/service/component/ComponentDiscoveryService.java | 2 +- .../server/service/component/RuleNodeClassInfo.java | 2 +- .../server/service/device/ClaimDevicesServiceImpl.java | 2 +- .../server/service/device/DeviceBulkImportService.java | 2 +- .../server/service/device/DeviceProvisionServiceImpl.java | 2 +- .../thingsboard/server/service/edge/EdgeBulkImportService.java | 2 +- .../thingsboard/server/service/edge/EdgeContextComponent.java | 2 +- .../server/service/edge/EdgeEventSourcingListener.java | 2 +- .../server/service/edge/EdgeMsgConstructorUtils.java | 2 +- .../server/service/edge/RelatedEdgesSourcingListener.java | 2 +- .../BaseEdgeInstallUpgradeInstructionsService.java | 2 +- .../instructions/DefaultEdgeInstallInstructionsService.java | 2 +- .../instructions/DefaultEdgeUpgradeInstructionsService.java | 2 +- .../edge/instructions/EdgeInstallInstructionsService.java | 2 +- .../edge/instructions/EdgeUpgradeInstructionsService.java | 2 +- .../server/service/edge/rpc/EdgeEventStorageSettings.java | 2 +- .../thingsboard/server/service/edge/rpc/EdgeGrpcService.java | 2 +- .../thingsboard/server/service/edge/rpc/EdgeGrpcSession.java | 2 +- .../thingsboard/server/service/edge/rpc/EdgeRpcService.java | 2 +- .../thingsboard/server/service/edge/rpc/EdgeSessionState.java | 2 +- .../thingsboard/server/service/edge/rpc/EdgeSyncCursor.java | 2 +- .../server/service/edge/rpc/KafkaEdgeEventService.java | 2 +- .../server/service/edge/rpc/KafkaEdgeGrpcSession.java | 2 +- .../server/service/edge/rpc/PostgresEdgeGrpcSession.java | 2 +- .../service/edge/rpc/fetch/AdminSettingsEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/AssetProfilesEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/AssetsEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/BasePageableEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/BaseUsersEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/BaseWidgetTypesEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/BaseWidgetsBundlesEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/CustomerEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/CustomerUsersEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/DashboardsEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/DefaultProfilesEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/DeviceProfilesEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/DevicesEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/EdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/EntityViewsEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/GeneralEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/NotificationRuleEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/NotificationTargetEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/NotificationTemplateEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/OAuth2EdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/OtaPackagesEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/QueuesEdgeEventFetcher.java | 2 +- .../service/edge/rpc/fetch/RuleChainsEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/SystemWidgetTypesEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/SystemWidgetsBundlesEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/TenantAdminUsersEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/fetch/TenantEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/TenantResourcesEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/TenantWidgetTypesEdgeEventFetcher.java | 2 +- .../edge/rpc/fetch/TenantWidgetsBundlesEdgeEventFetcher.java | 2 +- .../server/service/edge/rpc/processor/BaseEdgeProcessor.java | 2 +- .../server/service/edge/rpc/processor/EdgeProcessor.java | 2 +- .../service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/alarm/AlarmProcessor.java | 2 +- .../service/edge/rpc/processor/alarm/BaseAlarmProcessor.java | 2 +- .../rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java | 2 +- .../rpc/processor/alarm/comment/AlarmCommentProcessor.java | 2 +- .../service/edge/rpc/processor/asset/AssetEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/asset/AssetProcessor.java | 2 +- .../service/edge/rpc/processor/asset/BaseAssetProcessor.java | 2 +- .../rpc/processor/asset/profile/AssetProfileEdgeProcessor.java | 2 +- .../rpc/processor/asset/profile/AssetProfileProcessor.java | 2 +- .../rpc/processor/asset/profile/BaseAssetProfileProcessor.java | 2 +- .../edge/rpc/processor/customer/CustomerEdgeProcessor.java | 2 +- .../edge/rpc/processor/dashboard/BaseDashboardProcessor.java | 2 +- .../edge/rpc/processor/dashboard/DashboardEdgeProcessor.java | 2 +- .../edge/rpc/processor/dashboard/DashboardProcessor.java | 2 +- .../service/edge/rpc/processor/device/BaseDeviceProcessor.java | 2 +- .../service/edge/rpc/processor/device/DeviceEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/device/DeviceProcessor.java | 2 +- .../processor/device/profile/BaseDeviceProfileProcessor.java | 2 +- .../processor/device/profile/DeviceProfileEdgeProcessor.java | 2 +- .../rpc/processor/device/profile/DeviceProfileProcessor.java | 2 +- .../service/edge/rpc/processor/edge/EdgeEntityProcessor.java | 2 +- .../edge/rpc/processor/entityview/BaseEntityViewProcessor.java | 2 +- .../edge/rpc/processor/entityview/EntityViewEdgeProcessor.java | 2 +- .../edge/rpc/processor/entityview/EntityViewProcessor.java | 2 +- .../processor/notification/NotificationRuleEdgeProcessor.java | 2 +- .../notification/NotificationTargetEdgeProcessor.java | 2 +- .../notification/NotificationTemplateEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java | 2 +- .../edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java | 2 +- .../edge/rpc/processor/ota/OtaPackageEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/queue/QueueEdgeProcessor.java | 2 +- .../edge/rpc/processor/relation/BaseRelationProcessor.java | 2 +- .../edge/rpc/processor/relation/RelationEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/relation/RelationProcessor.java | 2 +- .../edge/rpc/processor/resource/BaseResourceProcessor.java | 2 +- .../edge/rpc/processor/resource/ResourceEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/resource/ResourceProcessor.java | 2 +- .../edge/rpc/processor/rule/RuleChainEdgeProcessor.java | 2 +- .../rpc/processor/rule/RuleChainMetadataEdgeProcessor.java | 2 +- .../rpc/processor/settings/AdminSettingsEdgeProcessor.java | 2 +- .../edge/rpc/processor/telemetry/BaseTelemetryProcessor.java | 2 +- .../edge/rpc/processor/telemetry/TelemetryEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/tenant/TenantEdgeProcessor.java | 2 +- .../edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java | 2 +- .../service/edge/rpc/processor/user/UserEdgeProcessor.java | 2 +- .../edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java | 2 +- .../edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java | 2 +- .../service/edge/rpc/sync/DefaultEdgeRequestsService.java | 2 +- .../server/service/edge/rpc/sync/EdgeRequestsService.java | 2 +- .../server/service/edge/rpc/utils/EdgeVersionUtils.java | 2 +- .../server/service/entitiy/AbstractTbEntityService.java | 2 +- .../service/entitiy/DefaultTbLogEntityActionService.java | 2 +- .../server/service/entitiy/EntityStateSourcingListener.java | 2 +- .../server/service/entitiy/SimpleTbEntityService.java | 2 +- .../server/service/entitiy/TbLogEntityActionService.java | 2 +- .../service/entitiy/alarm/DefaultTbAlarmCommentService.java | 2 +- .../server/service/entitiy/alarm/DefaultTbAlarmService.java | 2 +- .../server/service/entitiy/alarm/TbAlarmCommentService.java | 2 +- .../server/service/entitiy/alarm/TbAlarmService.java | 2 +- .../server/service/entitiy/asset/DefaultTbAssetService.java | 2 +- .../server/service/entitiy/asset/TbAssetService.java | 2 +- .../entitiy/asset/profile/DefaultTbAssetProfileService.java | 2 +- .../service/entitiy/asset/profile/TbAssetProfileService.java | 2 +- .../service/entitiy/customer/DefaultTbCustomerService.java | 2 +- .../server/service/entitiy/customer/TbCustomerService.java | 2 +- .../server/service/entitiy/dashboard/DashboardSyncService.java | 2 +- .../service/entitiy/dashboard/DefaultTbDashboardService.java | 2 +- .../server/service/entitiy/dashboard/TbDashboardService.java | 2 +- .../server/service/entitiy/device/DefaultTbDeviceService.java | 2 +- .../server/service/entitiy/device/TbDeviceService.java | 2 +- .../entitiy/device/profile/DefaultTbDeviceProfileService.java | 2 +- .../service/entitiy/device/profile/TbDeviceProfileService.java | 2 +- .../server/service/entitiy/domain/DefaultTbDomainService.java | 2 +- .../server/service/entitiy/domain/TbDomainService.java | 2 +- .../server/service/entitiy/edge/DefaultTbEdgeService.java | 2 +- .../thingsboard/server/service/entitiy/edge/TbEdgeService.java | 2 +- .../entity/relation/DefaultTbEntityRelationService.java | 2 +- .../entitiy/entity/relation/TbEntityRelationService.java | 2 +- .../service/entitiy/entityview/DefaultTbEntityViewService.java | 2 +- .../server/service/entitiy/entityview/TbEntityViewService.java | 2 +- .../entitiy/mobile/DefaultTbMobileAppBundleService.java | 2 +- .../service/entitiy/mobile/DefaultTbMobileAppService.java | 2 +- .../service/entitiy/mobile/TbMobileAppBundleService.java | 2 +- .../server/service/entitiy/mobile/TbMobileAppService.java | 2 +- .../entitiy/oauth2client/DefaultTbOauth2ClientService.java | 2 +- .../service/entitiy/oauth2client/TbOauth2ClientService.java | 2 +- .../server/service/entitiy/ota/DefaultTbOtaPackageService.java | 2 +- .../server/service/entitiy/ota/TbOtaPackageService.java | 2 +- .../server/service/entitiy/queue/DefaultTbQueueService.java | 2 +- .../server/service/entitiy/queue/TbQueueService.java | 2 +- .../server/service/entitiy/tenant/DefaultTbTenantService.java | 2 +- .../server/service/entitiy/tenant/TbTenantService.java | 2 +- .../entitiy/tenant/profile/DefaultTbTenantProfileService.java | 2 +- .../service/entitiy/tenant/profile/TbTenantProfileService.java | 2 +- .../service/entitiy/user/DefaultTbUserSettingsService.java | 2 +- .../server/service/entitiy/user/DefaultUserService.java | 2 +- .../thingsboard/server/service/entitiy/user/TbUserService.java | 2 +- .../server/service/entitiy/user/TbUserSettingsService.java | 2 +- .../entitiy/widgets/bundle/DefaultWidgetsBundleService.java | 2 +- .../service/entitiy/widgets/bundle/TbWidgetsBundleService.java | 2 +- .../service/entitiy/widgets/type/DefaultWidgetTypeService.java | 2 +- .../service/entitiy/widgets/type/TbWidgetTypeService.java | 2 +- .../server/service/executors/DbCallbackExecutorService.java | 2 +- .../server/service/executors/ExternalCallExecutorService.java | 2 +- .../server/service/executors/GrpcCallbackExecutorService.java | 2 +- .../server/service/executors/NotificationExecutorService.java | 2 +- .../service/executors/PubSubRuleNodeExecutorProvider.java | 2 +- .../server/service/executors/SharedEventLoopGroupService.java | 2 +- .../server/service/executors/VersionControlExecutor.java | 2 +- .../gateway_device/DefaultGatewayNotificationsService.java | 2 +- .../service/gateway_device/GatewayNotificationsService.java | 2 +- .../service/housekeeper/HousekeeperReprocessingService.java | 2 +- .../server/service/housekeeper/HousekeeperService.java | 2 +- .../housekeeper/processor/AlarmsDeletionTaskProcessor.java | 2 +- .../housekeeper/processor/AlarmsUnassignTaskProcessor.java | 2 +- .../housekeeper/processor/AttributesDeletionTaskProcessor.java | 2 +- .../housekeeper/processor/EntitiesDeletionTaskProcessor.java | 2 +- .../housekeeper/processor/EventsDeletionTaskProcessor.java | 2 +- .../housekeeper/processor/HousekeeperTaskProcessor.java | 2 +- .../housekeeper/processor/LatestTsDeletionTaskProcessor.java | 2 +- .../housekeeper/processor/TelemetryDeletionTaskProcessor.java | 2 +- .../processor/TenantEntitiesDeletionTaskProcessor.java | 2 +- .../housekeeper/processor/TsHistoryDeletionTaskProcessor.java | 2 +- .../service/housekeeper/stats/HousekeeperStatsService.java | 2 +- .../install/AbstractCassandraDatabaseUpgradeService.java | 2 +- .../install/CassandraAbstractDatabaseSchemaService.java | 2 +- .../server/service/install/CassandraKeyspaceService.java | 2 +- .../service/install/CassandraTsDatabaseSchemaService.java | 2 +- .../install/CassandraTsLatestDatabaseSchemaService.java | 2 +- .../server/service/install/DatabaseEntitiesUpgradeService.java | 2 +- .../server/service/install/DatabaseSchemaService.java | 2 +- .../server/service/install/DatabaseSchemaSettingsService.java | 2 +- .../server/service/install/DbUpgradeExecutorService.java | 2 +- .../service/install/DefaultDatabaseSchemaSettingsService.java | 2 +- .../server/service/install/DefaultSystemDataLoaderService.java | 2 +- .../server/service/install/EntityDatabaseSchemaService.java | 2 +- .../org/thingsboard/server/service/install/InstallScripts.java | 2 +- .../server/service/install/NoSqlKeyspaceService.java | 2 +- .../org/thingsboard/server/service/install/ProjectInfo.java | 2 +- .../service/install/SqlAbstractDatabaseSchemaService.java | 2 +- .../server/service/install/SqlDatabaseUpgradeService.java | 2 +- .../server/service/install/SqlEntityDatabaseSchemaService.java | 2 +- .../server/service/install/SqlTsDatabaseSchemaService.java | 2 +- .../server/service/install/SystemDataLoaderService.java | 2 +- .../service/install/TimescaleTsDatabaseSchemaService.java | 2 +- .../server/service/install/TsDatabaseSchemaService.java | 2 +- .../server/service/install/TsLatestDatabaseSchemaService.java | 2 +- .../server/service/install/cql/CQLStatementsParser.java | 2 +- .../server/service/install/migrate/CassandraToSqlColumn.java | 2 +- .../service/install/migrate/CassandraToSqlColumnData.java | 2 +- .../service/install/migrate/CassandraToSqlColumnType.java | 2 +- .../server/service/install/migrate/CassandraToSqlTable.java | 2 +- .../install/migrate/CassandraTsLatestToSqlMigrateService.java | 2 +- .../server/service/install/migrate/TsLatestMigrateService.java | 2 +- .../server/service/install/update/CacheCleanupService.java | 2 +- .../server/service/install/update/DataUpdateService.java | 2 +- .../service/install/update/DefaultCacheCleanupService.java | 2 +- .../service/install/update/DefaultDataUpdateService.java | 2 +- .../server/service/install/update/PaginatedUpdater.java | 2 +- .../server/service/install/update/ResourcesUpdater.java | 2 +- .../org/thingsboard/server/service/lwm2m/LwM2MService.java | 2 +- .../org/thingsboard/server/service/lwm2m/LwM2MServiceImpl.java | 2 +- .../thingsboard/server/service/mail/DefaultMailService.java | 2 +- .../service/mail/DefaultTbMailConfigTemplateService.java | 2 +- .../thingsboard/server/service/mail/MailExecutorService.java | 2 +- .../server/service/mail/MailSenderInternalExecutorService.java | 2 +- .../server/service/mail/PasswordResetExecutorService.java | 2 +- .../server/service/mail/RefreshTokenExpCheckService.java | 2 +- .../server/service/mail/TbMailConfigTemplateService.java | 2 +- .../server/service/mail/TbMailContextComponent.java | 2 +- .../java/org/thingsboard/server/service/mail/TbMailSender.java | 2 +- .../server/service/mobile/secret/MobileAppSecretService.java | 2 +- .../service/mobile/secret/MobileAppSecretServiceImpl.java | 2 +- .../service/mobile/secret/MobileSecretCaffeineCache.java | 2 +- .../server/service/mobile/secret/MobileSecretEvictEvent.java | 2 +- .../server/service/mobile/secret/MobileSecretRedisCache.java | 2 +- .../server/service/notification/DefaultNotificationCenter.java | 2 +- .../notification/DefaultNotificationSchedulerService.java | 2 +- .../service/notification/NotificationProcessingContext.java | 2 +- .../service/notification/NotificationSchedulerService.java | 2 +- .../notification/channels/EmailNotificationChannel.java | 2 +- .../channels/MicrosoftTeamsNotificationChannel.java | 2 +- .../notification/channels/MobileAppNotificationChannel.java | 2 +- .../service/notification/channels/NotificationChannel.java | 2 +- .../notification/channels/SlackNotificationChannel.java | 2 +- .../service/notification/channels/SmsNotificationChannel.java | 2 +- .../service/notification/channels/TeamsAdaptiveCard.java | 2 +- .../server/service/notification/channels/TeamsMessageCard.java | 2 +- .../service/notification/provider/DefaultFirebaseService.java | 2 +- .../service/notification/provider/DefaultSlackService.java | 2 +- .../notification/rule/DefaultNotificationRuleProcessor.java | 2 +- .../notification/rule/cache/DefaultNotificationRulesCache.java | 2 +- .../notification/rule/cache/NotificationRulesCache.java | 2 +- .../rule/trigger/AlarmAssignmentTriggerProcessor.java | 2 +- .../rule/trigger/AlarmCommentTriggerProcessor.java | 2 +- .../notification/rule/trigger/AlarmTriggerProcessor.java | 2 +- .../rule/trigger/ApiUsageLimitTriggerProcessor.java | 2 +- .../rule/trigger/DeviceActivityTriggerProcessor.java | 2 +- .../rule/trigger/EdgeCommunicationFailureTriggerProcessor.java | 2 +- .../rule/trigger/EdgeConnectionTriggerProcessor.java | 2 +- .../rule/trigger/EntitiesLimitTriggerProcessor.java | 2 +- .../rule/trigger/EntityActionTriggerProcessor.java | 2 +- .../rule/trigger/NewPlatformVersionTriggerProcessor.java | 2 +- .../rule/trigger/NotificationRuleTriggerProcessor.java | 2 +- .../notification/rule/trigger/RateLimitsTriggerProcessor.java | 2 +- .../RuleEngineComponentLifecycleEventTriggerProcessor.java | 2 +- .../rule/trigger/TaskProcessingFailureTriggerProcessor.java | 2 +- .../server/service/ota/DefaultOtaPackageStateService.java | 2 +- .../thingsboard/server/service/ota/OtaPackageStateService.java | 2 +- .../service/partition/AbstractPartitionBasedService.java | 2 +- .../server/service/partition/TbCoreStartupService.java | 2 +- .../server/service/profile/DefaultTbAssetProfileCache.java | 2 +- .../server/service/profile/DefaultTbDeviceProfileCache.java | 2 +- .../server/service/profile/TbAssetProfileCache.java | 2 +- .../server/service/profile/TbDeviceProfileCache.java | 2 +- .../server/service/query/DefaultEntityQueryService.java | 2 +- .../thingsboard/server/service/query/EntityQueryService.java | 2 +- .../server/service/queue/DefaultQueueRoutingInfoService.java | 2 +- .../server/service/queue/DefaultTbClusterService.java | 2 +- .../server/service/queue/DefaultTbCoreConsumerService.java | 2 +- .../server/service/queue/DefaultTbEdgeConsumerService.java | 2 +- .../service/queue/DefaultTbRuleEngineConsumerService.java | 2 +- .../server/service/queue/DefaultTenantRoutingInfoService.java | 2 +- .../thingsboard/server/service/queue/EdgeConsumerStats.java | 2 +- .../server/service/queue/TbCoreConsumerService.java | 2 +- .../thingsboard/server/service/queue/TbCoreConsumerStats.java | 2 +- .../server/service/queue/TbEdgeConsumerService.java | 2 +- .../thingsboard/server/service/queue/TbMsgPackCallback.java | 2 +- .../server/service/queue/TbMsgPackProcessingContext.java | 2 +- .../thingsboard/server/service/queue/TbMsgProfilerInfo.java | 2 +- .../org/thingsboard/server/service/queue/TbPackCallback.java | 2 +- .../server/service/queue/TbPackProcessingContext.java | 2 +- .../server/service/queue/TbRuleEngineConsumerService.java | 2 +- .../server/service/queue/TbRuleEngineConsumerStats.java | 2 +- .../server/service/queue/TbRuleNodeProfilerInfo.java | 2 +- .../server/service/queue/TbTenantRuleEngineStats.java | 2 +- .../server/service/queue/TbTopicWithConsumerPerPartition.java | 2 +- .../service/queue/consumer/MainQueueConsumerManager.java | 2 +- .../service/queue/processing/AbstractConsumerService.java | 2 +- .../queue/processing/AbstractTbRuleEngineSubmitStrategy.java | 2 +- .../queue/processing/BatchTbRuleEngineSubmitStrategy.java | 2 +- .../queue/processing/BurstTbRuleEngineSubmitStrategy.java | 2 +- .../thingsboard/server/service/queue/processing/IdMsgPair.java | 2 +- .../SequentialByEntityIdTbRuleEngineSubmitStrategy.java | 2 +- .../SequentialByOriginatorIdTbRuleEngineSubmitStrategy.java | 2 +- .../SequentialByTenantIdTbRuleEngineSubmitStrategy.java | 2 +- .../queue/processing/SequentialTbRuleEngineSubmitStrategy.java | 2 +- .../queue/processing/TbRuleEngineProcessingDecision.java | 2 +- .../service/queue/processing/TbRuleEngineProcessingResult.java | 2 +- .../queue/processing/TbRuleEngineProcessingStrategy.java | 2 +- .../processing/TbRuleEngineProcessingStrategyFactory.java | 2 +- .../service/queue/processing/TbRuleEngineSubmitStrategy.java | 2 +- .../queue/processing/TbRuleEngineSubmitStrategyFactory.java | 2 +- .../server/service/queue/ruleengine/QueueEvent.java | 2 +- .../service/queue/ruleengine/TbQueueConsumerManagerTask.java | 2 +- .../server/service/queue/ruleengine/TbQueueConsumerTask.java | 2 +- .../service/queue/ruleengine/TbRuleEngineConsumerContext.java | 2 +- .../queue/ruleengine/TbRuleEngineQueueConsumerManager.java | 2 +- .../server/service/resource/DefaultTbImageService.java | 2 +- .../server/service/resource/DefaultTbResourceService.java | 2 +- .../thingsboard/server/service/resource/TbImageService.java | 2 +- .../thingsboard/server/service/resource/TbResourceService.java | 2 +- .../server/service/rpc/DefaultTbCoreDeviceRpcService.java | 2 +- .../server/service/rpc/DefaultTbRuleEngineRpcService.java | 2 +- .../thingsboard/server/service/rpc/LocalRequestMetaData.java | 2 +- .../org/thingsboard/server/service/rpc/RpcSubmitStrategy.java | 2 +- .../thingsboard/server/service/rpc/TbCoreDeviceRpcService.java | 2 +- .../java/org/thingsboard/server/service/rpc/TbRpcService.java | 2 +- .../server/service/rpc/TbRuleEngineDeviceRpcService.java | 2 +- .../server/service/rule/DefaultTbRuleChainService.java | 2 +- .../thingsboard/server/service/rule/TbRuleChainService.java | 2 +- .../service/ruleengine/DefaultRuleEngineCallService.java | 2 +- .../server/service/ruleengine/RuleEngineCallService.java | 2 +- .../server/service/script/RuleNodeJsScriptEngine.java | 2 +- .../server/service/script/RuleNodeScriptEngine.java | 2 +- .../server/service/script/RuleNodeTbelScriptEngine.java | 2 +- .../thingsboard/server/service/security/AccessValidator.java | 2 +- .../server/service/security/ValidationCallback.java | 2 +- .../thingsboard/server/service/security/ValidationResult.java | 2 +- .../server/service/security/ValidationResultCode.java | 2 +- .../service/security/auth/AbstractJwtAuthenticationToken.java | 2 +- .../service/security/auth/DefaultTokenOutdatingService.java | 2 +- .../server/service/security/auth/JwtAuthenticationToken.java | 2 +- .../server/service/security/auth/MfaAuthenticationToken.java | 2 +- .../service/security/auth/RefreshAuthenticationToken.java | 2 +- .../server/service/security/auth/TokenOutdatingService.java | 2 +- .../service/security/auth/jwt/JwtAuthenticationProvider.java | 2 +- .../auth/jwt/JwtTokenAuthenticationProcessingFilter.java | 2 +- .../security/auth/jwt/RefreshTokenAuthenticationProvider.java | 2 +- .../security/auth/jwt/RefreshTokenProcessingFilter.java | 2 +- .../server/service/security/auth/jwt/RefreshTokenRequest.java | 2 +- .../service/security/auth/jwt/SkipPathRequestMatcher.java | 2 +- .../security/auth/jwt/extractor/JwtHeaderTokenExtractor.java | 2 +- .../security/auth/jwt/extractor/JwtQueryTokenExtractor.java | 2 +- .../service/security/auth/jwt/extractor/TokenExtractor.java | 2 +- .../security/auth/jwt/settings/DefaultJwtSettingsService.java | 2 +- .../auth/jwt/settings/DefaultJwtSettingsValidator.java | 2 +- .../auth/jwt/settings/InstallJwtSettingsValidator.java | 2 +- .../service/security/auth/jwt/settings/JwtSettingsService.java | 2 +- .../security/auth/jwt/settings/JwtSettingsValidator.java | 2 +- .../service/security/auth/mfa/DefaultTwoFactorAuthService.java | 2 +- .../server/service/security/auth/mfa/TwoFactorAuthService.java | 2 +- .../security/auth/mfa/config/DefaultTwoFaConfigManager.java | 2 +- .../service/security/auth/mfa/config/TwoFaConfigManager.java | 2 +- .../service/security/auth/mfa/provider/TwoFaProvider.java | 2 +- .../auth/mfa/provider/impl/BackupCodeTwoFaProvider.java | 2 +- .../security/auth/mfa/provider/impl/EmailTwoFaProvider.java | 2 +- .../security/auth/mfa/provider/impl/OtpBasedTwoFaProvider.java | 2 +- .../security/auth/mfa/provider/impl/SmsTwoFaProvider.java | 2 +- .../security/auth/mfa/provider/impl/TotpTwoFaProvider.java | 2 +- .../security/auth/oauth2/AbstractOAuth2ClientMapper.java | 2 +- .../service/security/auth/oauth2/AppleOAuth2ClientMapper.java | 2 +- .../server/service/security/auth/oauth2/BasicMapperUtils.java | 2 +- .../service/security/auth/oauth2/BasicOAuth2ClientMapper.java | 2 +- .../server/service/security/auth/oauth2/CookieUtils.java | 2 +- .../service/security/auth/oauth2/CustomOAuth2ClientMapper.java | 2 +- .../service/security/auth/oauth2/GithubOAuth2ClientMapper.java | 2 +- .../oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java | 2 +- .../service/security/auth/oauth2/OAuth2ClientMapper.java | 2 +- .../security/auth/oauth2/OAuth2ClientMapperProvider.java | 2 +- .../auth/oauth2/Oauth2AuthenticationFailureHandler.java | 2 +- .../auth/oauth2/Oauth2AuthenticationSuccessHandler.java | 2 +- .../service/security/auth/oauth2/TbOAuth2ParameterNames.java | 2 +- .../server/service/security/auth/rest/LoginRequest.java | 2 +- .../server/service/security/auth/rest/LoginResponse.java | 2 +- .../server/service/security/auth/rest/PublicLoginRequest.java | 2 +- .../service/security/auth/rest/RestAuthenticationDetails.java | 2 +- .../security/auth/rest/RestAuthenticationDetailsSource.java | 2 +- .../service/security/auth/rest/RestAuthenticationProvider.java | 2 +- .../auth/rest/RestAwareAuthenticationFailureHandler.java | 2 +- .../auth/rest/RestAwareAuthenticationSuccessHandler.java | 2 +- .../service/security/auth/rest/RestLoginProcessingFilter.java | 2 +- .../security/auth/rest/RestPublicLoginProcessingFilter.java | 2 +- .../service/security/device/DefaultDeviceAuthService.java | 2 +- .../security/exception/AuthMethodNotSupportedException.java | 2 +- .../service/security/exception/JwtExpiredTokenException.java | 2 +- .../security/exception/UserPasswordExpiredException.java | 2 +- .../security/exception/UserPasswordNotValidException.java | 2 +- .../server/service/security/model/ActivateUserRequest.java | 2 +- .../server/service/security/model/ChangePasswordRequest.java | 2 +- .../service/security/model/ResetPasswordEmailRequest.java | 2 +- .../server/service/security/model/ResetPasswordRequest.java | 2 +- .../server/service/security/model/SecurityUser.java | 2 +- .../server/service/security/model/UserPrincipal.java | 2 +- .../server/service/security/model/token/AccessJwtToken.java | 2 +- .../server/service/security/model/token/JwtTokenFactory.java | 2 +- .../service/security/model/token/OAuth2AppTokenFactory.java | 2 +- .../server/service/security/model/token/RawAccessJwtToken.java | 2 +- .../service/security/permission/AbstractPermissions.java | 2 +- .../service/security/permission/AccessControlService.java | 2 +- .../service/security/permission/CustomerUserPermissions.java | 2 +- .../security/permission/DefaultAccessControlService.java | 2 +- .../server/service/security/permission/Operation.java | 2 +- .../server/service/security/permission/PermissionChecker.java | 2 +- .../server/service/security/permission/Permissions.java | 2 +- .../server/service/security/permission/Resource.java | 2 +- .../service/security/permission/SysAdminPermissions.java | 2 +- .../service/security/permission/TenantAdminPermissions.java | 2 +- .../service/security/system/DefaultSystemSecurityService.java | 2 +- .../server/service/security/system/SystemSecurityService.java | 2 +- .../service/session/DefaultDeviceSessionCacheService.java | 2 +- .../server/service/session/DeviceSessionCacheService.java | 2 +- .../server/service/session/SessionCaffeineCache.java | 2 +- .../thingsboard/server/service/session/SessionRedisCache.java | 2 +- .../org/thingsboard/server/service/sms/AbstractSmsSender.java | 2 +- .../server/service/sms/DefaultSmsSenderFactory.java | 2 +- .../org/thingsboard/server/service/sms/DefaultSmsService.java | 2 +- .../org/thingsboard/server/service/sms/SmsExecutorService.java | 2 +- .../org/thingsboard/server/service/sms/aws/AwsSmsSender.java | 2 +- .../org/thingsboard/server/service/sms/smpp/SmppSmsSender.java | 2 +- .../thingsboard/server/service/sms/twilio/TwilioSmsSender.java | 2 +- .../server/service/state/DefaultDeviceStateService.java | 2 +- .../service/state/DefaultRuleEngineDeviceStateManager.java | 2 +- .../java/org/thingsboard/server/service/state/DeviceState.java | 2 +- .../org/thingsboard/server/service/state/DeviceStateData.java | 2 +- .../thingsboard/server/service/state/DeviceStateService.java | 2 +- .../thingsboard/server/service/stats/DefaultJsInvokeStats.java | 2 +- .../service/stats/DefaultRuleEngineStatisticsService.java | 2 +- .../server/service/stats/RuleEngineStatisticsService.java | 2 +- .../subscription/DefaultSubscriptionManagerService.java | 2 +- .../subscription/DefaultTbEntityDataSubscriptionService.java | 2 +- .../subscription/DefaultTbLocalSubscriptionService.java | 2 +- .../server/service/subscription/ReadTsKvQueryInfo.java | 2 +- .../server/service/subscription/SubscriptionErrorCode.java | 2 +- .../service/subscription/SubscriptionManagerService.java | 2 +- .../service/subscription/SubscriptionModificationResult.java | 2 +- .../service/subscription/SubscriptionSchedulerComponent.java | 2 +- .../service/subscription/SubscriptionServiceStatistics.java | 2 +- .../server/service/subscription/TbAbstractDataSubCtx.java | 2 +- .../service/subscription/TbAbstractEntityQuerySubCtx.java | 2 +- .../server/service/subscription/TbAbstractSubCtx.java | 2 +- .../server/service/subscription/TbAlarmCountSubCtx.java | 2 +- .../server/service/subscription/TbAlarmDataSubCtx.java | 2 +- .../server/service/subscription/TbAlarmStatusSubCtx.java | 2 +- .../server/service/subscription/TbAlarmStatusSubscription.java | 2 +- .../server/service/subscription/TbAlarmsSubscription.java | 2 +- .../server/service/subscription/TbAttributeSubscription.java | 2 +- .../service/subscription/TbAttributeSubscriptionScope.java | 2 +- .../server/service/subscription/TbEntityCountSubCtx.java | 2 +- .../server/service/subscription/TbEntityDataSubCtx.java | 2 +- .../service/subscription/TbEntityDataSubscriptionService.java | 2 +- .../server/service/subscription/TbEntityLocalSubsInfo.java | 2 +- .../server/service/subscription/TbEntityRemoteSubsInfo.java | 2 +- .../server/service/subscription/TbEntitySubEvent.java | 2 +- .../server/service/subscription/TbEntityUpdatesInfo.java | 2 +- .../service/subscription/TbLocalSubscriptionService.java | 2 +- .../server/service/subscription/TbSubscription.java | 2 +- .../server/service/subscription/TbSubscriptionType.java | 2 +- .../server/service/subscription/TbSubscriptionUtils.java | 2 +- .../server/service/subscription/TbSubscriptionsInfo.java | 2 +- .../server/service/subscription/TbTimeSeriesSubscription.java | 2 +- .../thingsboard/server/service/sync/DefaultGitSyncService.java | 2 +- .../org/thingsboard/server/service/sync/GitSyncService.java | 2 +- .../service/sync/ie/DefaultEntitiesExportImportService.java | 2 +- .../server/service/sync/ie/EntitiesExportImportService.java | 2 +- .../sync/ie/exporting/DefaultExportableEntitiesService.java | 2 +- .../server/service/sync/ie/exporting/EntityExportService.java | 2 +- .../service/sync/ie/exporting/ExportableEntitiesService.java | 2 +- .../service/sync/ie/exporting/impl/AssetExportService.java | 2 +- .../sync/ie/exporting/impl/AssetProfileExportService.java | 2 +- .../sync/ie/exporting/impl/BaseEntityExportService.java | 2 +- .../service/sync/ie/exporting/impl/DashboardExportService.java | 2 +- .../sync/ie/exporting/impl/DefaultEntityExportService.java | 2 +- .../service/sync/ie/exporting/impl/DeviceExportService.java | 2 +- .../sync/ie/exporting/impl/DeviceProfileExportService.java | 2 +- .../sync/ie/exporting/impl/EntityViewExportService.java | 2 +- .../sync/ie/exporting/impl/NotificationRuleExportService.java | 2 +- .../ie/exporting/impl/NotificationTargetExportService.java | 2 +- .../ie/exporting/impl/NotificationTemplateExportService.java | 2 +- .../service/sync/ie/exporting/impl/ResourceExportService.java | 2 +- .../service/sync/ie/exporting/impl/RuleChainExportService.java | 2 +- .../sync/ie/exporting/impl/WidgetTypeExportService.java | 2 +- .../sync/ie/exporting/impl/WidgetsBundleExportService.java | 2 +- .../server/service/sync/ie/importing/EntityImportService.java | 2 +- .../sync/ie/importing/csv/AbstractBulkImportService.java | 2 +- .../service/sync/ie/importing/csv/ImportedEntityInfo.java | 2 +- .../service/sync/ie/importing/impl/AssetImportService.java | 2 +- .../sync/ie/importing/impl/AssetProfileImportService.java | 2 +- .../sync/ie/importing/impl/BaseEntityImportService.java | 2 +- .../service/sync/ie/importing/impl/CustomerImportService.java | 2 +- .../service/sync/ie/importing/impl/DashboardImportService.java | 2 +- .../service/sync/ie/importing/impl/DeviceImportService.java | 2 +- .../sync/ie/importing/impl/DeviceProfileImportService.java | 2 +- .../sync/ie/importing/impl/EntityViewImportService.java | 2 +- .../service/sync/ie/importing/impl/ImportServiceException.java | 2 +- .../service/sync/ie/importing/impl/MissingEntityException.java | 2 +- .../sync/ie/importing/impl/NotificationRuleImportService.java | 2 +- .../ie/importing/impl/NotificationTargetImportService.java | 2 +- .../ie/importing/impl/NotificationTemplateImportService.java | 2 +- .../service/sync/ie/importing/impl/ResourceImportService.java | 2 +- .../service/sync/ie/importing/impl/RuleChainImportService.java | 2 +- .../sync/ie/importing/impl/WidgetTypeImportService.java | 2 +- .../sync/ie/importing/impl/WidgetsBundleImportService.java | 2 +- .../service/sync/vc/DefaultEntitiesVersionControlService.java | 2 +- .../service/sync/vc/DefaultGitVersionControlQueueService.java | 2 +- .../server/service/sync/vc/EntitiesVersionControlService.java | 2 +- .../server/service/sync/vc/GitVersionControlQueueService.java | 2 +- .../server/service/sync/vc/LoadEntityException.java | 2 +- .../sync/vc/TbAbstractVersionControlSettingsService.java | 2 +- .../server/service/sync/vc/VersionControlTaskCacheEntry.java | 2 +- .../service/sync/vc/VersionControlTaskCaffeineCache.java | 2 +- .../server/service/sync/vc/VersionControlTaskRedisCache.java | 2 +- .../sync/vc/autocommit/AutoCommitSettingsCaffeineCache.java | 2 +- .../sync/vc/autocommit/AutoCommitSettingsRedisCache.java | 2 +- .../sync/vc/autocommit/DefaultTbAutoCommitSettingsService.java | 2 +- .../sync/vc/autocommit/TbAutoCommitSettingsService.java | 2 +- .../server/service/sync/vc/data/ClearRepositoryGitRequest.java | 2 +- .../server/service/sync/vc/data/CommitGitRequest.java | 2 +- .../server/service/sync/vc/data/ComplexEntitiesExportCtx.java | 2 +- .../server/service/sync/vc/data/ContentsDiffGitRequest.java | 2 +- .../server/service/sync/vc/data/EntitiesContentGitRequest.java | 2 +- .../server/service/sync/vc/data/EntitiesExportCtx.java | 2 +- .../server/service/sync/vc/data/EntitiesImportCtx.java | 2 +- .../server/service/sync/vc/data/EntityContentGitRequest.java | 2 +- .../server/service/sync/vc/data/EntityTypeExportCtx.java | 2 +- .../server/service/sync/vc/data/ListBranchesGitRequest.java | 2 +- .../server/service/sync/vc/data/ListEntitiesGitRequest.java | 2 +- .../server/service/sync/vc/data/ListVersionsGitRequest.java | 2 +- .../server/service/sync/vc/data/PendingGitRequest.java | 2 +- .../thingsboard/server/service/sync/vc/data/ReimportTask.java | 2 +- .../server/service/sync/vc/data/SimpleEntitiesExportCtx.java | 2 +- .../server/service/sync/vc/data/VersionsDiffGitRequest.java | 2 +- .../server/service/sync/vc/data/VoidGitRequest.java | 2 +- .../sync/vc/repository/DefaultTbRepositorySettingsService.java | 2 +- .../sync/vc/repository/RepositorySettingsCaffeineCache.java | 2 +- .../sync/vc/repository/RepositorySettingsRedisCache.java | 2 +- .../sync/vc/repository/TbRepositorySettingsService.java | 2 +- .../server/service/system/DefaultSystemInfoService.java | 2 +- .../thingsboard/server/service/system/SystemInfoService.java | 2 +- .../server/service/telemetry/AbstractSubscriptionService.java | 2 +- .../server/service/telemetry/AlarmSubscriptionService.java | 2 +- .../thingsboard/server/service/telemetry/AttributeData.java | 2 +- .../service/telemetry/DefaultAlarmSubscriptionService.java | 2 +- .../service/telemetry/DefaultTelemetrySubscriptionService.java | 2 +- .../server/service/telemetry/InternalTelemetryService.java | 2 +- .../server/service/telemetry/TelemetrySubscriptionService.java | 2 +- .../java/org/thingsboard/server/service/telemetry/TsData.java | 2 +- .../service/transport/BasicCredentialsValidationResult.java | 2 +- .../service/transport/DefaultTbCoreToTransportService.java | 2 +- .../server/service/transport/DefaultTransportApiService.java | 2 +- .../server/service/transport/TbCoreToTransportService.java | 2 +- .../server/service/transport/TbCoreTransportApiService.java | 2 +- .../server/service/transport/TransportApiService.java | 2 +- .../transport/msg/TransportToDeviceActorMsgWrapper.java | 2 +- .../thingsboard/server/service/ttl/AbstractCleanUpService.java | 2 +- .../thingsboard/server/service/ttl/AlarmsCleanUpService.java | 2 +- .../server/service/ttl/AuditLogsCleanUpService.java | 2 +- .../server/service/ttl/EdgeEventsCleanUpService.java | 2 +- .../thingsboard/server/service/ttl/EventsCleanUpService.java | 2 +- .../server/service/ttl/KafkaEdgeTopicsCleanUpService.java | 2 +- .../server/service/ttl/NotificationsCleanUpService.java | 2 +- .../server/service/ttl/TimeseriesCleanUpService.java | 2 +- .../thingsboard/server/service/ttl/rpc/RpcCleanUpService.java | 2 +- .../server/service/update/DefaultUpdateService.java | 2 +- .../org/thingsboard/server/service/update/UpdateService.java | 2 +- .../main/java/org/thingsboard/server/service/ws/AuthCmd.java | 2 +- .../thingsboard/server/service/ws/DefaultWebSocketService.java | 2 +- .../java/org/thingsboard/server/service/ws/SessionEvent.java | 2 +- .../thingsboard/server/service/ws/WebSocketMsgEndpoint.java | 2 +- .../org/thingsboard/server/service/ws/WebSocketService.java | 2 +- .../org/thingsboard/server/service/ws/WebSocketSessionRef.java | 2 +- .../thingsboard/server/service/ws/WebSocketSessionType.java | 2 +- .../src/main/java/org/thingsboard/server/service/ws/WsCmd.java | 2 +- .../main/java/org/thingsboard/server/service/ws/WsCmdType.java | 2 +- .../org/thingsboard/server/service/ws/WsCommandsWrapper.java | 2 +- .../org/thingsboard/server/service/ws/WsSessionMetaData.java | 2 +- .../ws/notification/DefaultNotificationCommandsHandler.java | 2 +- .../service/ws/notification/NotificationCommandsHandler.java | 2 +- .../ws/notification/cmd/MarkAllNotificationsAsReadCmd.java | 2 +- .../ws/notification/cmd/MarkNotificationsAsReadCmd.java | 2 +- .../service/ws/notification/cmd/NotificationCmdsWrapper.java | 2 +- .../service/ws/notification/cmd/NotificationsCountSubCmd.java | 2 +- .../service/ws/notification/cmd/NotificationsSubCmd.java | 2 +- .../service/ws/notification/cmd/NotificationsUnsubCmd.java | 2 +- .../ws/notification/cmd/UnreadNotificationsCountUpdate.java | 2 +- .../service/ws/notification/cmd/UnreadNotificationsUpdate.java | 2 +- .../ws/notification/sub/AbstractNotificationSubscription.java | 2 +- .../service/ws/notification/sub/NotificationRequestUpdate.java | 2 +- .../server/service/ws/notification/sub/NotificationUpdate.java | 2 +- .../ws/notification/sub/NotificationsCountSubscription.java | 2 +- .../service/ws/notification/sub/NotificationsSubscription.java | 2 +- .../ws/notification/sub/NotificationsSubscriptionUpdate.java | 2 +- .../server/service/ws/telemetry/TelemetryFeature.java | 2 +- .../server/service/ws/telemetry/TelemetryWebSocketTextMsg.java | 2 +- .../server/service/ws/telemetry/cmd/TelemetryCmdsWrapper.java | 2 +- .../service/ws/telemetry/cmd/v1/AttributesSubscriptionCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v1/GetHistoryCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v1/SubscriptionCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v1/TelemetryPluginCmd.java | 2 +- .../service/ws/telemetry/cmd/v1/TimeseriesSubscriptionCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AggHistoryCmd.java | 2 +- .../thingsboard/server/service/ws/telemetry/cmd/v2/AggKey.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AggTimeSeriesCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AlarmCountCmd.java | 2 +- .../service/ws/telemetry/cmd/v2/AlarmCountUnsubscribeCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AlarmCountUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AlarmDataCmd.java | 2 +- .../service/ws/telemetry/cmd/v2/AlarmDataUnsubscribeCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AlarmDataUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AlarmStatusCmd.java | 2 +- .../service/ws/telemetry/cmd/v2/AlarmStatusUnsubscribeCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/AlarmStatusUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/CmdUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/CmdUpdateType.java | 2 +- .../server/service/ws/telemetry/cmd/v2/DataCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/DataUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/EntityCountCmd.java | 2 +- .../service/ws/telemetry/cmd/v2/EntityCountUnsubscribeCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/EntityCountUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/EntityDataCmd.java | 2 +- .../service/ws/telemetry/cmd/v2/EntityDataUnsubscribeCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/EntityDataUpdate.java | 2 +- .../server/service/ws/telemetry/cmd/v2/EntityHistoryCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/GetTsCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/LatestValueCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/TimeSeriesCmd.java | 2 +- .../server/service/ws/telemetry/cmd/v2/UnsubscribeCmd.java | 2 +- .../service/ws/telemetry/sub/AlarmSubscriptionUpdate.java | 2 +- .../server/service/ws/telemetry/sub/SubscriptionState.java | 2 +- .../service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java | 2 +- .../src/main/java/org/thingsboard/server/utils/CsvUtils.java | 2 +- .../org/thingsboard/server/utils/LwM2mObjectModelUtils.java | 2 +- .../src/main/java/org/thingsboard/server/utils/MiscUtils.java | 2 +- .../java/org/thingsboard/server/utils/TbNodeUpgradeUtils.java | 2 +- application/src/main/resources/logback.xml | 2 +- .../src/main/resources/templates/2fa.verification.code.ftl | 2 +- application/src/main/resources/templates/account.activated.ftl | 2 +- application/src/main/resources/templates/account.lockout.ftl | 2 +- application/src/main/resources/templates/activation.ftl | 2 +- .../src/main/resources/templates/password.was.reset.ftl | 2 +- application/src/main/resources/templates/reset.password.ftl | 2 +- application/src/main/resources/templates/state.disabled.ftl | 2 +- application/src/main/resources/templates/state.enabled.ftl | 2 +- application/src/main/resources/templates/state.warning.ftl | 2 +- application/src/main/resources/templates/test.ftl | 2 +- application/src/main/resources/thingsboard.yml | 2 +- .../server/actors/device/DeviceActorMessageProcessorTest.java | 2 +- .../thingsboard/server/actors/rule/DefaultTbContextTest.java | 2 +- .../org/thingsboard/server/actors/stats/StatsActorTest.java | 2 +- .../thingsboard/server/actors/stats/StatsPersistMsgTest.java | 2 +- .../org/thingsboard/server/actors/tenant/TenantActorTest.java | 2 +- .../server/cache/CaffeineCacheDefaultConfigurationTest.java | 2 +- .../thingsboard/server/controller/AbstractControllerTest.java | 2 +- .../server/controller/AbstractInMemoryStorageTest.java | 2 +- .../server/controller/AbstractNotifyEntityTest.java | 2 +- .../server/controller/AbstractRuleEngineControllerTest.java | 2 +- .../org/thingsboard/server/controller/AbstractWebTest.java | 2 +- .../org/thingsboard/server/controller/AdminControllerTest.java | 2 +- .../server/controller/AlarmCommentControllerTest.java | 2 +- .../org/thingsboard/server/controller/AlarmControllerTest.java | 2 +- .../org/thingsboard/server/controller/AssetControllerTest.java | 2 +- .../server/controller/AssetProfileControllerTest.java | 2 +- .../thingsboard/server/controller/AuditLogControllerTest.java | 2 +- .../AuditLogControllerTest_DedicatedEventsDataSource.java | 2 +- .../org/thingsboard/server/controller/AuthControllerTest.java | 2 +- .../thingsboard/server/controller/BaseQueueControllerTest.java | 2 +- .../server/controller/ComponentDescriptorControllerTest.java | 2 +- .../thingsboard/server/controller/CustomerControllerTest.java | 2 +- .../thingsboard/server/controller/DashboardControllerTest.java | 2 +- .../server/controller/DeviceConnectivityControllerTest.java | 2 +- .../thingsboard/server/controller/DeviceControllerTest.java | 2 +- .../server/controller/DeviceProfileControllerTest.java | 2 +- .../thingsboard/server/controller/DomainControllerTest.java | 2 +- .../org/thingsboard/server/controller/EdgeControllerTest.java | 2 +- .../thingsboard/server/controller/EdgeEventControllerTest.java | 2 +- .../server/controller/EntityQueryControllerTest.java | 2 +- .../server/controller/EntityRelationControllerTest.java | 2 +- .../server/controller/EntityViewControllerTest.java | 2 +- .../org/thingsboard/server/controller/HomePageApiTest.java | 2 +- .../org/thingsboard/server/controller/ImageControllerTest.java | 2 +- .../server/controller/MobileAppBundleControllerTest.java | 2 +- .../thingsboard/server/controller/MobileAppControllerTest.java | 2 +- .../server/controller/Oauth2ClientControllerTest.java | 2 +- .../server/controller/OtaPackageControllerTest.java | 2 +- .../server/controller/QrCodeSettingsControllerTest.java | 2 +- .../org/thingsboard/server/controller/RpcControllerTest.java | 2 +- .../thingsboard/server/controller/RuleChainControllerTest.java | 2 +- .../server/controller/RuleEngineControllerTest.java | 2 +- .../server/controller/TbResourceControllerTest.java | 2 +- .../thingsboard/server/controller/TbTestWebSocketClient.java | 2 +- .../thingsboard/server/controller/TelemetryControllerTest.java | 2 +- .../thingsboard/server/controller/TenantControllerTest.java | 2 +- .../server/controller/TenantProfileControllerTest.java | 2 +- .../thingsboard/server/controller/TwoFactorAuthConfigTest.java | 2 +- .../org/thingsboard/server/controller/TwoFactorAuthTest.java | 2 +- .../org/thingsboard/server/controller/UserControllerTest.java | 2 +- .../org/thingsboard/server/controller/WebsocketApiTest.java | 2 +- .../server/controller/WidgetTypeControllerTest.java | 2 +- .../server/controller/WidgetsBundleControllerTest.java | 2 +- .../server/controller/plugin/TbWebSocketHandlerTest.java | 2 +- .../java/org/thingsboard/server/edge/AbstractEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/AlarmEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/AssetEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/AssetProfileEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/CustomerEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/DashboardEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/DeviceEdgeTest.java | 2 +- .../org/thingsboard/server/edge/DeviceProfileEdgeTest.java | 2 +- .../src/test/java/org/thingsboard/server/edge/EdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/EntityViewEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/NotificationEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/OAuth2EdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/OtaPackageEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/QueueEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/RelationEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/ResourceEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/RuleChainEdgeTest.java | 2 +- .../java/org/thingsboard/server/edge/TelemetryEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/TenantEdgeTest.java | 2 +- .../org/thingsboard/server/edge/TenantProfileEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/UserEdgeTest.java | 2 +- .../test/java/org/thingsboard/server/edge/WidgetEdgeTest.java | 2 +- .../org/thingsboard/server/edge/imitator/EdgeImitator.java | 2 +- .../server/queue/discovery/HashPartitionServiceTest.java | 2 +- .../rules/flow/AbstractRuleEngineFlowIntegrationTest.java | 2 +- .../rules/flow/sql/RuleEngineFlowSqlIntegrationTest.java | 2 +- .../lifecycle/AbstractRuleEngineLifecycleIntegrationTest.java | 2 +- .../lifecycle/sql/RuleEngineLifecycleSqlIntegrationTest.java | 2 +- .../service/apiusage/DefaultTbApiUsageStateServiceTest.java | 2 +- .../service/device/provision/DeviceProvisionServiceTest.java | 2 +- .../service/entitiy/alarm/DefaultTbAlarmServiceTest.java | 2 +- .../entitiy/alarmComment/DefaultTbAlarmCommentServiceTest.java | 2 +- .../service/entitiy/dashboard/DashboardSyncServiceTest.java | 2 +- .../entitiy/entityview/DefaultTbEntityViewServiceTest.java | 2 +- .../server/service/housekeeper/HousekeeperServiceTest.java | 2 +- .../thingsboard/server/service/install/InstallScriptsTest.java | 2 +- .../service/install/SqlEntityDatabaseSchemaServiceTest.java | 2 +- .../service/install/update/DefaultDataUpdateServiceTest.java | 2 +- .../server/service/limits/RateLimitServiceTest.java | 2 +- .../org/thingsboard/server/service/mail/TbMailSenderTest.java | 2 +- .../service/notification/AbstractNotificationApiTest.java | 2 +- .../server/service/notification/NotificationApiTest.java | 2 +- .../server/service/notification/NotificationApiWsClient.java | 2 +- .../server/service/notification/NotificationRuleApiTest.java | 2 +- .../server/service/notification/NotificationTargetApiTest.java | 2 +- .../service/notification/NotificationTemplateApiTest.java | 2 +- .../service/notification/TestNotificationSettingsService.java | 2 +- .../server/service/queue/DefaultTbClusterServiceTest.java | 2 +- .../server/service/queue/DefaultTbCoreConsumerServiceTest.java | 2 +- .../server/service/queue/TbMsgPackCallbackTest.java | 2 +- .../server/service/queue/TbMsgPackProcessingContextTest.java | 2 +- .../queue/ruleengine/TbRuleEngineQueueConsumerManagerTest.java | 2 +- .../service/queue/ruleengine/TbRuleEngineStrategyTest.java | 2 +- .../server/service/resource/sql/BaseTbResourceServiceTest.java | 2 +- .../server/service/rpc/DefaultTbRuleEngineRpcServiceTest.java | 2 +- .../thingsboard/server/service/rpc/RpcSubmitStrategyTest.java | 2 +- .../service/ruleengine/DefaultRuleEngineCallServiceTest.java | 2 +- .../server/service/script/AbstractTbelInvokeTest.java | 2 +- .../thingsboard/server/service/script/MockJsInvokeService.java | 2 +- .../server/service/script/NashornJsInvokeServiceTest.java | 2 +- .../server/service/script/RemoteJsInvokeServiceTest.java | 2 +- .../server/service/script/TbelInvokeDocsIoTest.java | 2 +- .../server/service/script/TbelInvokeServiceTest.java | 2 +- .../server/service/security/auth/JwtTokenFactoryTest.java | 2 +- .../server/service/security/auth/TokenOutdatingTest.java | 2 +- .../server/service/security/auth/oauth2/CookieUtilsTest.java | 2 +- .../auth/oauth2/Oauth2AuthenticationSuccessHandlerTest.java | 2 +- .../thingsboard/server/service/sms/DefaultSmsServiceTest.java | 2 +- .../thingsboard/server/service/sms/smpp/SmppSmsSenderTest.java | 2 +- .../service/sql/SequentialTimeseriesPersistenceTest.java | 2 +- .../server/service/state/DefaultDeviceStateServiceTest.java | 2 +- .../service/state/DefaultRuleEngineDeviceStateManagerTest.java | 2 +- .../server/service/stats/DevicesStatisticsTest.java | 2 +- .../subscription/DefaultTbLocalSubscriptionServiceTest.java | 2 +- .../server/service/subscription/TbEntityLocalSubsInfoTest.java | 2 +- .../server/service/sync/ie/ExportImportServiceSqlTest.java | 2 +- .../thingsboard/server/service/sync/vc/VersionControlTest.java | 2 +- .../telemetry/DefaultTelemetrySubscriptionServiceTest.java | 2 +- .../service/transport/DefaultTransportApiServiceTest.java | 2 +- .../server/service/ttl/AlarmsCleanUpServiceTest.java | 2 +- .../server/service/ttl/EventsCleanUpServiceTest.java | 2 +- .../org/thingsboard/server/system/BaseHttpDeviceApiTest.java | 2 +- .../org/thingsboard/server/system/BaseRestApiLimitsTest.java | 2 +- .../thingsboard/server/system/RestTemplateConvertersTest.java | 2 +- .../org/thingsboard/server/system/sql/DeviceApiSqlTest.java | 2 +- .../thingsboard/server/system/sql/RestApiLimitsSqlTest.java | 2 +- .../server/transport/AbstractTransportIntegrationTest.java | 2 +- .../thingsboard/server/transport/TransportNoSqlTestSuite.java | 2 +- .../server/transport/coap/AbstractCoapIntegrationTest.java | 2 +- .../thingsboard/server/transport/coap/CoapTestCallback.java | 2 +- .../org/thingsboard/server/transport/coap/CoapTestClient.java | 2 +- .../server/transport/coap/CoapTestConfigProperties.java | 2 +- .../coap/attributes/AbstractCoapAttributesIntegrationTest.java | 2 +- .../request/CoapAttributesRequestIntegrationTest.java | 2 +- .../request/CoapAttributesRequestJsonIntegrationTest.java | 2 +- .../request/CoapAttributesRequestProtoIntegrationTest.java | 2 +- .../updates/CoapAttributesUpdatesIntegrationTest.java | 2 +- .../updates/CoapAttributesUpdatesJsonIntegrationTest.java | 2 +- .../updates/CoapAttributesUpdatesProtoIntegrationTest.java | 2 +- .../server/transport/coap/claim/CoapClaimDeviceTest.java | 2 +- .../server/transport/coap/claim/CoapClaimJsonDeviceTest.java | 2 +- .../server/transport/coap/claim/CoapClaimProtoDeviceTest.java | 2 +- .../transport/coap/client/CoapClientIntegrationTest.java | 2 +- .../transport/coap/provision/CoapProvisionJsonDeviceTest.java | 2 +- .../transport/coap/provision/CoapProvisionProtoDeviceTest.java | 2 +- .../coap/rpc/AbstractCoapServerSideRpcIntegrationTest.java | 2 +- .../coap/rpc/CoapServerSideRpcDefaultIntegrationTest.java | 2 +- .../coap/rpc/CoapServerSideRpcJsonIntegrationTest.java | 2 +- .../coap/rpc/CoapServerSideRpcProtoIntegrationTest.java | 2 +- .../coap/security/AbstractCoapSecurityIntegrationTest.java | 2 +- .../security/sql/CoapClientX509SecurityJksIntegrationTest.java | 2 +- .../security/sql/CoapClientX509SecurityPemIntegrationTest.java | 2 +- .../telemetry/attributes/CoapAttributesIntegrationTest.java | 2 +- .../attributes/CoapAttributesJsonIntegrationTest.java | 2 +- .../attributes/CoapAttributesProtoIntegrationTest.java | 2 +- .../timeseries/AbstractCoapTimeseriesIntegrationTest.java | 2 +- .../timeseries/AbstractCoapTimeseriesJsonIntegrationTest.java | 2 +- .../timeseries/AbstractCoapTimeseriesProtoIntegrationTest.java | 2 +- .../timeseries/nosql/CoapTimeseriesNoSqlIntegrationTest.java | 2 +- .../nosql/CoapTimeseriesNoSqlJsonIntegrationTest.java | 2 +- .../nosql/CoapTimeseriesNoSqlProtoIntegrationTest.java | 2 +- .../timeseries/sql/CoapTimeseriesSqlIntegrationTest.java | 2 +- .../timeseries/sql/CoapTimeseriesSqlJsonIntegrationTest.java | 2 +- .../timeseries/sql/CoapTimeseriesSqlProtoIntegrationTest.java | 2 +- .../thingsboard/server/transport/coap/x509/CertPrivateKey.java | 2 +- .../server/transport/coap/x509/CoapClientX509Test.java | 2 +- .../transport/coap/x509/TbAdvancedCertificateVerifier.java | 2 +- .../server/transport/lwm2m/AbstractLwM2MIntegrationTest.java | 2 +- .../thingsboard/server/transport/lwm2m/Lwm2mTestHelper.java | 2 +- .../lwm2m/attributes/DefaultLwM2mAttributeParserTest.java | 2 +- .../transport/lwm2m/attributes/DefaultLwM2mLinkParserTest.java | 2 +- .../server/transport/lwm2m/attributes/LwM2mAttributesTest.java | 2 +- .../server/transport/lwm2m/client/DtlsSessionLogger.java | 2 +- .../server/transport/lwm2m/client/FwLwM2MDevice.java | 2 +- .../server/transport/lwm2m/client/LwM2MLocationParams.java | 2 +- .../server/transport/lwm2m/client/LwM2MTestClient.java | 2 +- .../transport/lwm2m/client/LwM2mBinaryAppDataContainer.java | 2 +- .../server/transport/lwm2m/client/LwM2mLocation.java | 2 +- .../server/transport/lwm2m/client/LwM2mTemperatureSensor.java | 2 +- .../thingsboard/server/transport/lwm2m/client/Lwm2mServer.java | 2 +- .../server/transport/lwm2m/client/SimpleLwM2MDevice.java | 2 +- .../server/transport/lwm2m/client/SwLwM2MDevice.java | 2 +- .../transport/lwm2m/ota/AbstractOtaLwM2MIntegrationTest.java | 2 +- .../transport/lwm2m/ota/sql/Ota5LwM2MIntegrationTest.java | 2 +- .../transport/lwm2m/ota/sql/Ota9LwM2MIntegrationTest.java | 2 +- .../rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_0_Test.java | 2 +- .../rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_1_Test.java | 2 +- .../rpc/AbstractRpcLwM2MIntegrationObserve_Ver_1_2_Test.java | 2 +- .../transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2MIntegrationObserveCompositeTest.java | 2 +- .../transport/lwm2m/rpc/sql/RpcLwm2mIntegrationCreateTest.java | 2 +- .../transport/lwm2m/rpc/sql/RpcLwm2mIntegrationDeleteTest.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationDiscoverTest.java | 2 +- .../sql/RpcLwm2mIntegrationDiscoverWriteAttributesTest.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationExecuteTest.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationObserveTest.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_0_Test.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_1_Test.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationObserve_Ver_1_2_Test.java | 2 +- .../rpc/sql/RpcLwm2mIntegrationReadCollectedValueTest.java | 2 +- .../transport/lwm2m/rpc/sql/RpcLwm2mIntegrationReadTest.java | 2 +- .../lwm2m/rpc/sql/RpcLwm2mIntegrationWriteCborTest.java | 2 +- .../transport/lwm2m/rpc/sql/RpcLwm2mIntegrationWriteTest.java | 2 +- .../lwm2m/security/AbstractSecurityLwM2MIntegrationTest.java | 2 +- .../AbstractSecurityLwM2MIntegrationDtlsCidLength0Test.java | 2 +- .../AbstractSecurityLwM2MIntegrationDtlsCidLength3Test.java | 2 +- .../AbstractSecurityLwM2MIntegrationDtlsCidLengthNullTest.java | 2 +- .../cid/AbstractSecurityLwM2MIntegrationDtlsCidLengthTest.java | 2 +- .../NoSecLwM2MIntegrationDtlsCidLengthTest.java | 2 +- .../PskLwm2mIntegrationDtlsCidLengthTest.java | 2 +- .../NoSecLwM2MIntegrationDtlsCidLengthTest.java | 2 +- .../PskLwm2mIntegrationDtlsCidLengthTest.java | 2 +- .../NoSecLwM2MIntegrationDtlsCidLengthTest.java | 2 +- .../PskLwm2mIntegrationDtlsCidLengthTest.java | 2 +- .../diffPort/AbstractLwM2MIntegrationDiffPortTest.java | 2 +- .../lwm2m/security/diffPort/LwM2MIntegrationDiffPortTest.java | 2 +- .../lwm2m/security/sql/NoSecLwM2MIntegrationTest.java | 2 +- .../transport/lwm2m/security/sql/PskLwm2mIntegrationTest.java | 2 +- .../transport/lwm2m/security/sql/RpkLwM2MIntegrationTest.java | 2 +- .../lwm2m/security/sql/X509_NoTrustLwM2MIntegrationTest.java | 2 +- .../lwm2m/security/sql/X509_TrustLwM2MIntegrationTest.java | 2 +- .../transport/lwm2m/server/LwM2mTransportServerHelperTest.java | 2 +- .../server/transport/mqtt/AbstractMqttIntegrationTest.java | 2 +- .../server/transport/mqtt/MqttGatewayRateLimitsTest.java | 2 +- .../server/transport/mqtt/MqttTestConfigProperties.java | 2 +- .../server/transport/mqtt/mqttv3/MqttTestCallback.java | 2 +- .../server/transport/mqtt/mqttv3/MqttTestClient.java | 2 +- .../mqtt/mqttv3/MqttTestSubscribeOnTopicCallback.java | 2 +- .../attributes/AbstractMqttAttributesIntegrationTest.java | 2 +- ...tAttributesRequestBackwardCompatibilityIntegrationTest.java | 2 +- .../request/MqttAttributesRequestIntegrationTest.java | 2 +- .../request/MqttAttributesRequestJsonIntegrationTest.java | 2 +- .../request/MqttAttributesRequestProtoIntegrationTest.java | 2 +- ...tAttributesUpdatesBackwardCompatibilityIntegrationTest.java | 2 +- .../updates/MqttAttributesUpdatesIntegrationTest.java | 2 +- .../updates/MqttAttributesUpdatesJsonIntegrationTest.java | 2 +- .../updates/MqttAttributesUpdatesProtoIntegrationTest.java | 2 +- .../mqttv3/claim/MqttClaimBackwardCompatibilityDeviceTest.java | 2 +- .../transport/mqtt/mqttv3/claim/MqttClaimDeviceTest.java | 2 +- .../transport/mqtt/mqttv3/claim/MqttClaimJsonDeviceTest.java | 2 +- .../transport/mqtt/mqttv3/claim/MqttClaimProtoDeviceTest.java | 2 +- .../mqtt/mqttv3/client/AbstractMqttClientConnectionTest.java | 2 +- .../transport/mqtt/mqttv3/client/MqttClientConnectionTest.java | 2 +- .../mqtt/mqttv3/credentials/BasicMqttCredentialsTest.java | 2 +- .../mqtt/mqttv3/provision/MqttProvisionJsonDeviceTest.java | 2 +- .../mqtt/mqttv3/provision/MqttProvisionProtoDeviceTest.java | 2 +- .../mqttv3/rpc/AbstractMqttServerSideRpcIntegrationTest.java | 2 +- .../mqtt/mqttv3/rpc/MqttClientSideRpcIntegrationTest.java | 2 +- .../MqttServerSideRpcBackwardCompatibilityIntegrationTest.java | 2 +- .../mqttv3/rpc/MqttServerSideRpcDefaultIntegrationTest.java | 2 +- .../mqtt/mqttv3/rpc/MqttServerSideRpcJsonIntegrationTest.java | 2 +- .../mqtt/mqttv3/rpc/MqttServerSideRpcProtoIntegrationTest.java | 2 +- .../rpc/MqttServerSideRpcSequenceOnAckIntegrationTest.java | 2 +- .../MqttServerSideRpcSequenceOnResponseIntegrationTest.java | 2 +- .../telemetry/attributes/MqttAttributesIntegrationTest.java | 2 +- .../attributes/MqttAttributesJsonIntegrationTest.java | 2 +- .../attributes/MqttAttributesProtoIntegrationTest.java | 2 +- .../timeseries/AbstractMqttTimeseriesIntegrationTest.java | 2 +- .../timeseries/AbstractMqttTimeseriesJsonIntegrationTest.java | 2 +- .../timeseries/AbstractMqttTimeseriesProtoIntegrationTest.java | 2 +- .../timeseries/nosql/MqttTimeseriesNoSqlIntegrationTest.java | 2 +- .../nosql/MqttTimeseriesNoSqlJsonIntegrationTest.java | 2 +- .../nosql/MqttTimeseriesNoSqlProtoIntegrationTest.java | 2 +- .../timeseries/sql/MqttTimeseriesSqlIntegrationTest.java | 2 +- .../timeseries/sql/MqttTimeseriesSqlJsonIntegrationTest.java | 2 +- .../timeseries/sql/MqttTimeseriesSqlProtoIntegrationTest.java | 2 +- .../server/transport/mqtt/mqttv5/AbstractMqttV5Test.java | 2 +- .../server/transport/mqtt/mqttv5/MqttV5TestCallback.java | 2 +- .../server/transport/mqtt/mqttv5/MqttV5TestClient.java | 2 +- .../mqtt/mqttv5/attributes/AbstractAttributesMqttV5Test.java | 2 +- .../mqtt/mqttv5/attributes/updates/AttributesUpdatesTest.java | 2 +- .../mqtt/mqttv5/attributes/upload/AttributesPublishTest.java | 2 +- .../transport/mqtt/mqttv5/claim/AbstractMqttV5ClaimTest.java | 2 +- .../server/transport/mqtt/mqttv5/claim/MqttV5ClaimTest.java | 2 +- .../client/connection/AbstractMqttV5ClientConnectionTest.java | 2 +- .../mqttv5/client/connection/MqttV5ClientConnectionTest.java | 2 +- .../mqttv5/client/publish/AbstractMqttV5ClientPublishTest.java | 2 +- .../mqtt/mqttv5/client/publish/MqttV5ClientPublishTest.java | 2 +- .../client/subscribe/AbstractMqttV5ClientSubscriptionTest.java | 2 +- .../mqttv5/client/subscribe/MqttV5ClientSubscriptionTest.java | 2 +- .../unsubscribe/AbstractMqttV5ClientUnsubscribeTest.java | 2 +- .../mqttv5/client/unsubscribe/MqttV5ClientUnsubscribeTest.java | 2 +- .../mqtt/mqttv5/provision/MqttV5ProvisionDeviceTest.java | 2 +- .../transport/mqtt/mqttv5/rpc/AbstractMqttV5RpcTest.java | 2 +- ...oseTransportSessionOnRpcDeliveryTimeoutIntegrationTest.java | 2 +- .../server/transport/mqtt/mqttv5/rpc/MqttV5RpcTest.java | 2 +- .../mqtt/mqttv5/timeseries/AbstractMqttV5TimeseriesTest.java | 2 +- .../transport/mqtt/mqttv5/timeseries/MqttV5TimeseriesTest.java | 2 +- .../mqtt/sparkplug/AbstractMqttV5ClientSparkplugTest.java | 2 +- .../AbstractMqttV5ClientSparkplugAttributesTest.java | 2 +- .../MqttV5ClientSparkplugBAttributesInProfileTest.java | 2 +- .../attributes/MqttV5ClientSparkplugBAttributesTest.java | 2 +- .../AbstractMqttV5ClientSparkplugConnectionTest.java | 2 +- .../connection/MqttV5ClientSparkplugBConnectionTest.java | 2 +- .../mqtt/sparkplug/rpc/AbstractMqttV5RpcSparkplugTest.java | 2 +- .../transport/mqtt/sparkplug/rpc/MqttV5RpcSparkplugTest.java | 2 +- .../timeseries/AbstractMqttV5ClientSparkplugTelemetryTest.java | 2 +- .../timeseries/MqttV5ClientSparkplugBTelemetryTest.java | 2 +- .../org/thingsboard/server/utils/TbNodeUpgradeUtilsTest.java | 2 +- build.sh | 2 +- build_proto.sh | 2 +- common/actor/pom.xml | 2 +- .../java/org/thingsboard/server/actors/AbstractTbActor.java | 2 +- .../org/thingsboard/server/actors/DefaultTbActorSystem.java | 2 +- .../main/java/org/thingsboard/server/actors/Dispatcher.java | 2 +- .../org/thingsboard/server/actors/InitFailureStrategy.java | 2 +- .../main/java/org/thingsboard/server/actors/JsInvokeStats.java | 2 +- .../org/thingsboard/server/actors/ProcessFailureStrategy.java | 2 +- .../src/main/java/org/thingsboard/server/actors/TbActor.java | 2 +- .../java/org/thingsboard/server/actors/TbActorCreator.java | 2 +- .../main/java/org/thingsboard/server/actors/TbActorCtx.java | 2 +- .../java/org/thingsboard/server/actors/TbActorException.java | 2 +- .../src/main/java/org/thingsboard/server/actors/TbActorId.java | 2 +- .../java/org/thingsboard/server/actors/TbActorMailbox.java | 2 +- .../server/actors/TbActorNotRegisteredException.java | 2 +- .../main/java/org/thingsboard/server/actors/TbActorRef.java | 2 +- .../main/java/org/thingsboard/server/actors/TbActorSystem.java | 2 +- .../org/thingsboard/server/actors/TbActorSystemSettings.java | 2 +- .../java/org/thingsboard/server/actors/TbEntityActorId.java | 2 +- .../thingsboard/server/actors/TbRuleNodeUpdateException.java | 2 +- .../java/org/thingsboard/server/actors/TbStringActorId.java | 2 +- .../java/org/thingsboard/server/actors/ActorSystemTest.java | 2 +- .../test/java/org/thingsboard/server/actors/ActorTestCtx.java | 2 +- .../java/org/thingsboard/server/actors/FailedToInitActor.java | 2 +- .../test/java/org/thingsboard/server/actors/IntTbActorMsg.java | 2 +- .../java/org/thingsboard/server/actors/SlowCreateActor.java | 2 +- .../test/java/org/thingsboard/server/actors/SlowInitActor.java | 2 +- .../test/java/org/thingsboard/server/actors/TestRootActor.java | 2 +- common/cache/pom.xml | 2 +- .../src/main/java/org/thingsboard/server/cache/CacheSpecs.java | 2 +- .../main/java/org/thingsboard/server/cache/CacheSpecsMap.java | 2 +- .../thingsboard/server/cache/CaffeineTbCacheTransaction.java | 2 +- .../thingsboard/server/cache/CaffeineTbTransactionalCache.java | 2 +- .../java/org/thingsboard/server/cache/RedisSslCredentials.java | 2 +- .../org/thingsboard/server/cache/RedisTbCacheTransaction.java | 2 +- .../thingsboard/server/cache/RedisTbTransactionalCache.java | 2 +- .../thingsboard/server/cache/SimpleTbCacheValueWrapper.java | 2 +- .../thingsboard/server/cache/TBRedisCacheConfiguration.java | 2 +- .../thingsboard/server/cache/TBRedisClusterConfiguration.java | 2 +- .../thingsboard/server/cache/TBRedisSentinelConfiguration.java | 2 +- .../server/cache/TBRedisStandaloneConfiguration.java | 2 +- .../java/org/thingsboard/server/cache/TbCacheTransaction.java | 2 +- .../java/org/thingsboard/server/cache/TbCacheValueWrapper.java | 2 +- .../thingsboard/server/cache/TbCaffeineCacheConfiguration.java | 2 +- .../org/thingsboard/server/cache/TbJavaRedisSerializer.java | 2 +- .../org/thingsboard/server/cache/TbJsonRedisSerializer.java | 2 +- .../java/org/thingsboard/server/cache/TbRedisSerializer.java | 2 +- .../org/thingsboard/server/cache/TbTransactionalCache.java | 2 +- .../thingsboard/server/cache/TbTypedJsonRedisSerializer.java | 2 +- .../java/org/thingsboard/server/cache/VersionedCacheKey.java | 2 +- .../org/thingsboard/server/cache/VersionedCaffeineTbCache.java | 2 +- .../org/thingsboard/server/cache/VersionedRedisTbCache.java | 2 +- .../java/org/thingsboard/server/cache/VersionedTbCache.java | 2 +- .../server/cache/customer/CustomerCacheEvictEvent.java | 2 +- .../thingsboard/server/cache/customer/CustomerCacheKey.java | 2 +- .../server/cache/customer/CustomerCaffeineCache.java | 2 +- .../thingsboard/server/cache/customer/CustomerRedisCache.java | 2 +- .../thingsboard/server/cache/device/DeviceCacheEvictEvent.java | 2 +- .../org/thingsboard/server/cache/device/DeviceCacheKey.java | 2 +- .../thingsboard/server/cache/device/DeviceCaffeineCache.java | 2 +- .../org/thingsboard/server/cache/device/DeviceRedisCache.java | 2 +- .../org/thingsboard/server/cache/edge/EdgeCacheEvictEvent.java | 2 +- .../java/org/thingsboard/server/cache/edge/EdgeCacheKey.java | 2 +- .../org/thingsboard/server/cache/edge/EdgeCaffeineCache.java | 2 +- .../java/org/thingsboard/server/cache/edge/EdgeRedisCache.java | 2 +- .../thingsboard/server/cache/edge/RelatedEdgesCacheKey.java | 2 +- .../thingsboard/server/cache/edge/RelatedEdgesCacheValue.java | 2 +- .../server/cache/edge/RelatedEdgesCaffeineCache.java | 2 +- .../thingsboard/server/cache/edge/RelatedEdgesEvictEvent.java | 2 +- .../thingsboard/server/cache/edge/RelatedEdgesRedisCache.java | 2 +- .../server/cache/limits/DefaultRateLimitService.java | 2 +- .../org/thingsboard/server/cache/limits/RateLimitService.java | 2 +- .../thingsboard/server/cache/limits/TenantProfileProvider.java | 2 +- .../thingsboard/server/cache/ota/CaffeineOtaPackageCache.java | 2 +- .../org/thingsboard/server/cache/ota/OtaPackageDataCache.java | 2 +- .../thingsboard/server/cache/ota/RedisOtaPackageDataCache.java | 2 +- .../server/cache/resourceInfo/ResourceInfoCacheKey.java | 2 +- .../server/cache/resourceInfo/ResourceInfoCaffeineCache.java | 2 +- .../server/cache/resourceInfo/ResourceInfoEvictEvent.java | 2 +- .../server/cache/resourceInfo/ResourceInfoRedisCache.java | 2 +- .../org/thingsboard/server/cache/user/UserCacheEvictEvent.java | 2 +- .../java/org/thingsboard/server/cache/user/UserCacheKey.java | 2 +- .../org/thingsboard/server/cache/user/UserCaffeineCache.java | 2 +- .../java/org/thingsboard/server/cache/user/UserRedisCache.java | 2 +- .../usersUpdateTime/UsersSessionInvalidationCaffeineCache.java | 2 +- .../usersUpdateTime/UsersSessionInvalidationRedisCache.java | 2 +- .../java/org/thingsboard/server/cache/CacheSpecsMapTest.java | 2 +- .../org/thingsboard/server/cache/TsLatestRedisCacheTest.java | 2 +- common/cluster-api/pom.xml | 2 +- .../java/org/thingsboard/server/cluster/TbClusterService.java | 2 +- .../main/java/org/thingsboard/server/queue/TbQueueAdmin.java | 2 +- .../java/org/thingsboard/server/queue/TbQueueCallback.java | 2 +- .../org/thingsboard/server/queue/TbQueueClusterService.java | 2 +- .../java/org/thingsboard/server/queue/TbQueueConsumer.java | 2 +- .../main/java/org/thingsboard/server/queue/TbQueueHandler.java | 2 +- .../src/main/java/org/thingsboard/server/queue/TbQueueMsg.java | 2 +- .../java/org/thingsboard/server/queue/TbQueueMsgDecoder.java | 2 +- .../java/org/thingsboard/server/queue/TbQueueMsgHeaders.java | 2 +- .../java/org/thingsboard/server/queue/TbQueueMsgMetadata.java | 2 +- .../java/org/thingsboard/server/queue/TbQueueProducer.java | 2 +- .../org/thingsboard/server/queue/TbQueueRequestTemplate.java | 2 +- .../org/thingsboard/server/queue/TbQueueResponseTemplate.java | 2 +- common/coap-server/pom.xml | 2 +- .../org/thingsboard/server/coapserver/CoapServerContext.java | 2 +- .../org/thingsboard/server/coapserver/CoapServerService.java | 2 +- .../server/coapserver/DefaultCoapServerService.java | 2 +- .../server/coapserver/TbCoapDtlsCertificateVerifier.java | 2 +- .../server/coapserver/TbCoapDtlsSessionInMemoryStorage.java | 2 +- .../thingsboard/server/coapserver/TbCoapDtlsSessionInfo.java | 2 +- .../thingsboard/server/coapserver/TbCoapDtlsSessionKey.java | 2 +- .../org/thingsboard/server/coapserver/TbCoapDtlsSettings.java | 2 +- .../thingsboard/server/coapserver/TbCoapServerComponent.java | 2 +- .../server/coapserver/TbCoapServerMessageDeliverer.java | 2 +- .../server/coapserver/TbCoapTransportComponent.java | 2 +- .../thingsboard/server/coapserver/TbCoapDtlsSettingsTest.java | 2 +- common/dao-api/pom.xml | 2 +- .../org/thingsboard/server/dao/alarm/AlarmCommentService.java | 2 +- .../java/org/thingsboard/server/dao/alarm/AlarmService.java | 2 +- .../org/thingsboard/server/dao/asset/AssetProfileService.java | 2 +- .../java/org/thingsboard/server/dao/asset/AssetService.java | 2 +- .../thingsboard/server/dao/attributes/AttributesService.java | 2 +- .../java/org/thingsboard/server/dao/audit/AuditLogService.java | 2 +- .../server/dao/cassandra/AbstractCassandraCluster.java | 2 +- .../org/thingsboard/server/dao/cassandra/CassandraCluster.java | 2 +- .../server/dao/cassandra/CassandraDriverOptions.java | 2 +- .../server/dao/cassandra/CassandraInstallCluster.java | 2 +- .../server/dao/cassandra/guava/DefaultGuavaSession.java | 2 +- .../server/dao/cassandra/guava/GuavaDriverContext.java | 2 +- .../server/dao/cassandra/guava/GuavaMultiPageResultSet.java | 2 +- .../server/dao/cassandra/guava/GuavaRequestAsyncProcessor.java | 2 +- .../thingsboard/server/dao/cassandra/guava/GuavaSession.java | 2 +- .../server/dao/cassandra/guava/GuavaSessionBuilder.java | 2 +- .../server/dao/cassandra/guava/GuavaSessionUtils.java | 2 +- .../server/dao/component/ComponentDescriptorService.java | 2 +- .../org/thingsboard/server/dao/customer/CustomerService.java | 2 +- .../org/thingsboard/server/dao/dashboard/DashboardService.java | 2 +- .../org/thingsboard/server/dao/device/ClaimDevicesService.java | 2 +- .../server/dao/device/DeviceConnectivityService.java | 2 +- .../server/dao/device/DeviceCredentialsService.java | 2 +- .../thingsboard/server/dao/device/DeviceProfileService.java | 2 +- .../thingsboard/server/dao/device/DeviceProvisionService.java | 2 +- .../java/org/thingsboard/server/dao/device/DeviceService.java | 2 +- .../org/thingsboard/server/dao/device/claim/ClaimData.java | 2 +- .../org/thingsboard/server/dao/device/claim/ClaimResponse.java | 2 +- .../org/thingsboard/server/dao/device/claim/ClaimResult.java | 2 +- .../org/thingsboard/server/dao/device/claim/ReclaimResult.java | 2 +- .../server/dao/device/provision/ProvisionFailedException.java | 2 +- .../server/dao/device/provision/ProvisionRequest.java | 2 +- .../server/dao/device/provision/ProvisionResponse.java | 2 +- .../server/dao/device/provision/ProvisionResponseStatus.java | 2 +- .../java/org/thingsboard/server/dao/domain/DomainService.java | 2 +- .../java/org/thingsboard/server/dao/edge/EdgeEventService.java | 2 +- .../main/java/org/thingsboard/server/dao/edge/EdgeService.java | 2 +- .../server/dao/edge/EdgeSynchronizationManager.java | 2 +- .../org/thingsboard/server/dao/edge/RelatedEdgesService.java | 2 +- .../org/thingsboard/server/dao/entity/EntityCountService.java | 2 +- .../org/thingsboard/server/dao/entity/EntityDaoService.java | 2 +- .../java/org/thingsboard/server/dao/entity/EntityService.java | 2 +- .../thingsboard/server/dao/entity/EntityServiceRegistry.java | 2 +- .../thingsboard/server/dao/entityview/EntityViewService.java | 2 +- .../java/org/thingsboard/server/dao/event/EventService.java | 2 +- .../thingsboard/server/dao/mobile/MobileAppBundleService.java | 2 +- .../org/thingsboard/server/dao/mobile/MobileAppService.java | 2 +- .../thingsboard/server/dao/nosql/CassandraStatementTask.java | 2 +- .../java/org/thingsboard/server/dao/nosql/TbResultSet.java | 2 +- .../org/thingsboard/server/dao/nosql/TbResultSetFuture.java | 2 +- .../server/dao/notification/NotificationRequestService.java | 2 +- .../server/dao/notification/NotificationRuleService.java | 2 +- .../server/dao/notification/NotificationService.java | 2 +- .../server/dao/notification/NotificationSettingsService.java | 2 +- .../server/dao/notification/NotificationTargetService.java | 2 +- .../server/dao/notification/NotificationTemplateService.java | 2 +- .../org/thingsboard/server/dao/oauth2/OAuth2ClientService.java | 2 +- .../server/dao/oauth2/OAuth2ConfigTemplateService.java | 2 +- .../java/org/thingsboard/server/dao/oauth2/OAuth2User.java | 2 +- .../java/org/thingsboard/server/dao/ota/OtaPackageService.java | 2 +- .../java/org/thingsboard/server/dao/queue/QueueService.java | 2 +- .../org/thingsboard/server/dao/queue/QueueStatsService.java | 2 +- .../org/thingsboard/server/dao/relation/RelationService.java | 2 +- .../java/org/thingsboard/server/dao/resource/ImageService.java | 2 +- .../org/thingsboard/server/dao/resource/ResourceService.java | 2 +- .../main/java/org/thingsboard/server/dao/rpc/RpcService.java | 2 +- .../java/org/thingsboard/server/dao/rule/RuleChainService.java | 2 +- .../org/thingsboard/server/dao/rule/RuleNodeStateService.java | 2 +- .../thingsboard/server/dao/settings/AdminSettingsService.java | 2 +- .../thingsboard/server/dao/tenant/TbTenantProfileCache.java | 2 +- .../thingsboard/server/dao/tenant/TenantProfileService.java | 2 +- .../java/org/thingsboard/server/dao/tenant/TenantService.java | 2 +- .../thingsboard/server/dao/timeseries/TimeseriesService.java | 2 +- .../org/thingsboard/server/dao/usage/UsageInfoService.java | 2 +- .../thingsboard/server/dao/usagerecord/ApiLimitService.java | 2 +- .../server/dao/usagerecord/ApiUsageStateService.java | 2 +- .../main/java/org/thingsboard/server/dao/user/UserService.java | 2 +- .../org/thingsboard/server/dao/user/UserSettingsService.java | 2 +- .../main/java/org/thingsboard/server/dao/util/AsyncTask.java | 2 +- .../org/thingsboard/server/dao/util/DbTypeInfoComponent.java | 2 +- .../server/dao/util/DefaultDbTypeInfoComponent.java | 2 +- .../main/java/org/thingsboard/server/dao/util/NoSqlAnyDao.java | 2 +- .../org/thingsboard/server/dao/util/NoSqlAnyDaoNonCloud.java | 2 +- .../main/java/org/thingsboard/server/dao/util/NoSqlTsDao.java | 2 +- .../java/org/thingsboard/server/dao/util/NoSqlTsLatestDao.java | 2 +- .../src/main/java/org/thingsboard/server/dao/util/SqlDao.java | 2 +- .../main/java/org/thingsboard/server/dao/util/SqlTsDao.java | 2 +- .../org/thingsboard/server/dao/util/SqlTsLatestAnyDao.java | 2 +- .../server/dao/util/SqlTsLatestAnyDaoCachedRedis.java | 2 +- .../java/org/thingsboard/server/dao/util/SqlTsLatestDao.java | 2 +- .../org/thingsboard/server/dao/util/SqlTsOrTsLatestAnyDao.java | 2 +- .../org/thingsboard/server/dao/util/TbAutoConfiguration.java | 2 +- .../java/org/thingsboard/server/dao/util/TimescaleDBTsDao.java | 2 +- .../thingsboard/server/dao/util/TimescaleDBTsLatestDao.java | 2 +- .../server/dao/util/TimescaleDBTsOrTsLatestDao.java | 2 +- .../org/thingsboard/server/dao/widget/WidgetTypeService.java | 2 +- .../thingsboard/server/dao/widget/WidgetsBundleService.java | 2 +- common/data/pom.xml | 2 +- .../java/org/thingsboard/server/common/data/AdminSettings.java | 2 +- .../java/org/thingsboard/server/common/data/ApiFeature.java | 2 +- .../org/thingsboard/server/common/data/ApiUsageRecordKey.java | 2 +- .../thingsboard/server/common/data/ApiUsageRecordState.java | 2 +- .../java/org/thingsboard/server/common/data/ApiUsageState.java | 2 +- .../org/thingsboard/server/common/data/ApiUsageStateValue.java | 2 +- .../org/thingsboard/server/common/data/AttributeScope.java | 2 +- .../main/java/org/thingsboard/server/common/data/BaseData.java | 2 +- .../server/common/data/BaseDataWithAdditionalInfo.java | 2 +- .../org/thingsboard/server/common/data/CacheConstants.java | 2 +- .../java/org/thingsboard/server/common/data/ClaimRequest.java | 2 +- .../org/thingsboard/server/common/data/CoapDeviceType.java | 2 +- .../java/org/thingsboard/server/common/data/ContactBased.java | 2 +- .../main/java/org/thingsboard/server/common/data/Customer.java | 2 +- .../java/org/thingsboard/server/common/data/Dashboard.java | 2 +- .../java/org/thingsboard/server/common/data/DashboardInfo.java | 2 +- .../java/org/thingsboard/server/common/data/DataConstants.java | 2 +- .../main/java/org/thingsboard/server/common/data/Device.java | 2 +- .../java/org/thingsboard/server/common/data/DeviceIdInfo.java | 2 +- .../java/org/thingsboard/server/common/data/DeviceInfo.java | 2 +- .../org/thingsboard/server/common/data/DeviceInfoFilter.java | 2 +- .../java/org/thingsboard/server/common/data/DeviceProfile.java | 2 +- .../org/thingsboard/server/common/data/DeviceProfileInfo.java | 2 +- .../server/common/data/DeviceProfileProvisionType.java | 2 +- .../org/thingsboard/server/common/data/DeviceProfileType.java | 2 +- .../thingsboard/server/common/data/DeviceTransportType.java | 2 +- .../org/thingsboard/server/common/data/DynamicProtoUtils.java | 2 +- .../org/thingsboard/server/common/data/EdgeUpgradeInfo.java | 2 +- .../org/thingsboard/server/common/data/EdgeUpgradeMessage.java | 2 +- .../java/org/thingsboard/server/common/data/EdgeUtils.java | 2 +- .../org/thingsboard/server/common/data/EntityFieldsData.java | 2 +- .../java/org/thingsboard/server/common/data/EntityInfo.java | 2 +- .../java/org/thingsboard/server/common/data/EntitySubtype.java | 2 +- .../java/org/thingsboard/server/common/data/EntityType.java | 2 +- .../java/org/thingsboard/server/common/data/EntityView.java | 2 +- .../org/thingsboard/server/common/data/EntityViewInfo.java | 2 +- .../java/org/thingsboard/server/common/data/EventInfo.java | 2 +- .../org/thingsboard/server/common/data/ExportableEntity.java | 2 +- .../java/org/thingsboard/server/common/data/FeaturesInfo.java | 2 +- .../org/thingsboard/server/common/data/FstStatsService.java | 2 +- .../org/thingsboard/server/common/data/HasAdditionalInfo.java | 2 +- .../java/org/thingsboard/server/common/data/HasCustomerId.java | 2 +- .../org/thingsboard/server/common/data/HasDebugSettings.java | 2 +- .../org/thingsboard/server/common/data/HasDefaultOption.java | 2 +- .../main/java/org/thingsboard/server/common/data/HasEmail.java | 2 +- .../main/java/org/thingsboard/server/common/data/HasImage.java | 2 +- .../main/java/org/thingsboard/server/common/data/HasLabel.java | 2 +- .../main/java/org/thingsboard/server/common/data/HasName.java | 2 +- .../java/org/thingsboard/server/common/data/HasOtaPackage.java | 2 +- .../thingsboard/server/common/data/HasRuleEngineProfile.java | 2 +- .../java/org/thingsboard/server/common/data/HasTenantId.java | 2 +- .../main/java/org/thingsboard/server/common/data/HasTitle.java | 2 +- .../java/org/thingsboard/server/common/data/HasVersion.java | 2 +- .../java/org/thingsboard/server/common/data/HomeDashboard.java | 2 +- .../org/thingsboard/server/common/data/HomeDashboardInfo.java | 2 +- .../org/thingsboard/server/common/data/ImageDescriptor.java | 2 +- .../org/thingsboard/server/common/data/JavaSerDesUtil.java | 2 +- .../java/org/thingsboard/server/common/data/OtaPackage.java | 2 +- .../org/thingsboard/server/common/data/OtaPackageInfo.java | 2 +- .../org/thingsboard/server/common/data/ResourceExportData.java | 2 +- .../org/thingsboard/server/common/data/ResourceSubType.java | 2 +- .../java/org/thingsboard/server/common/data/ResourceType.java | 2 +- .../java/org/thingsboard/server/common/data/ResourceUtils.java | 2 +- .../server/common/data/SaveDeviceWithCredentialsRequest.java | 2 +- .../server/common/data/SaveOtaPackageInfoRequest.java | 2 +- .../org/thingsboard/server/common/data/ShortCustomerInfo.java | 2 +- .../java/org/thingsboard/server/common/data/StringUtils.java | 2 +- .../java/org/thingsboard/server/common/data/SystemInfo.java | 2 +- .../org/thingsboard/server/common/data/SystemInfoData.java | 2 +- .../java/org/thingsboard/server/common/data/SystemParams.java | 2 +- .../thingsboard/server/common/data/TbImageDeleteResult.java | 2 +- .../java/org/thingsboard/server/common/data/TbProperty.java | 2 +- .../java/org/thingsboard/server/common/data/TbResource.java | 2 +- .../org/thingsboard/server/common/data/TbResourceInfo.java | 2 +- .../thingsboard/server/common/data/TbResourceInfoFilter.java | 2 +- .../org/thingsboard/server/common/data/TbTransportService.java | 2 +- .../main/java/org/thingsboard/server/common/data/Tenant.java | 2 +- .../java/org/thingsboard/server/common/data/TenantInfo.java | 2 +- .../java/org/thingsboard/server/common/data/TenantProfile.java | 2 +- .../org/thingsboard/server/common/data/TenantProfileType.java | 2 +- .../thingsboard/server/common/data/TransportPayloadType.java | 2 +- .../java/org/thingsboard/server/common/data/UUIDConverter.java | 2 +- .../java/org/thingsboard/server/common/data/UpdateMessage.java | 2 +- .../java/org/thingsboard/server/common/data/UsageInfo.java | 2 +- .../src/main/java/org/thingsboard/server/common/data/User.java | 2 +- .../org/thingsboard/server/common/data/UserActivationLink.java | 2 +- .../java/org/thingsboard/server/common/data/UserEmailInfo.java | 2 +- .../main/java/org/thingsboard/server/common/data/Views.java | 2 +- .../java/org/thingsboard/server/common/data/alarm/Alarm.java | 2 +- .../server/common/data/alarm/AlarmApiCallResult.java | 2 +- .../thingsboard/server/common/data/alarm/AlarmAssignee.java | 2 +- .../server/common/data/alarm/AlarmAssigneeUpdate.java | 2 +- .../org/thingsboard/server/common/data/alarm/AlarmComment.java | 2 +- .../thingsboard/server/common/data/alarm/AlarmCommentInfo.java | 2 +- .../thingsboard/server/common/data/alarm/AlarmCommentType.java | 2 +- .../common/data/alarm/AlarmCreateOrUpdateActiveRequest.java | 2 +- .../org/thingsboard/server/common/data/alarm/AlarmInfo.java | 2 +- .../server/common/data/alarm/AlarmModificationRequest.java | 2 +- .../server/common/data/alarm/AlarmPropagationInfo.java | 2 +- .../org/thingsboard/server/common/data/alarm/AlarmQuery.java | 2 +- .../org/thingsboard/server/common/data/alarm/AlarmQueryV2.java | 2 +- .../server/common/data/alarm/AlarmSearchStatus.java | 2 +- .../thingsboard/server/common/data/alarm/AlarmSeverity.java | 2 +- .../org/thingsboard/server/common/data/alarm/AlarmStatus.java | 2 +- .../server/common/data/alarm/AlarmStatusFilter.java | 2 +- .../server/common/data/alarm/AlarmUpdateRequest.java | 2 +- .../org/thingsboard/server/common/data/alarm/EntityAlarm.java | 2 +- .../java/org/thingsboard/server/common/data/asset/Asset.java | 2 +- .../org/thingsboard/server/common/data/asset/AssetInfo.java | 2 +- .../org/thingsboard/server/common/data/asset/AssetProfile.java | 2 +- .../thingsboard/server/common/data/asset/AssetProfileInfo.java | 2 +- .../thingsboard/server/common/data/asset/AssetSearchQuery.java | 2 +- .../org/thingsboard/server/common/data/audit/ActionStatus.java | 2 +- .../org/thingsboard/server/common/data/audit/ActionType.java | 2 +- .../org/thingsboard/server/common/data/audit/AuditLog.java | 2 +- .../thingsboard/server/common/data/debug/DebugSettings.java | 2 +- .../server/common/data/device/DeviceSearchQuery.java | 2 +- .../common/data/device/credentials/BasicMqttCredentials.java | 2 +- .../device/credentials/ProvisionDeviceCredentialsData.java | 2 +- .../lwm2m/AbstractLwM2MBootstrapClientCredentialWithKeys.java | 2 +- .../credentials/lwm2m/AbstractLwM2MClientCredential.java | 2 +- .../lwm2m/AbstractLwM2MClientSecurityCredential.java | 2 +- .../credentials/lwm2m/LwM2MBootstrapClientCredential.java | 2 +- .../credentials/lwm2m/LwM2MBootstrapClientCredentials.java | 2 +- .../data/device/credentials/lwm2m/LwM2MClientCredential.java | 2 +- .../data/device/credentials/lwm2m/LwM2MDeviceCredentials.java | 2 +- .../data/device/credentials/lwm2m/LwM2MSecurityMode.java | 2 +- .../credentials/lwm2m/NoSecBootstrapClientCredential.java | 2 +- .../data/device/credentials/lwm2m/NoSecClientCredential.java | 2 +- .../device/credentials/lwm2m/PSKBootstrapClientCredential.java | 2 +- .../data/device/credentials/lwm2m/PSKClientCredential.java | 2 +- .../device/credentials/lwm2m/RPKBootstrapClientCredential.java | 2 +- .../data/device/credentials/lwm2m/RPKClientCredential.java | 2 +- .../credentials/lwm2m/X509BootstrapClientCredential.java | 2 +- .../data/device/credentials/lwm2m/X509ClientCredential.java | 2 +- .../data/device/data/CoapDeviceTransportConfiguration.java | 2 +- .../common/data/device/data/DefaultDeviceConfiguration.java | 2 +- .../data/device/data/DefaultDeviceTransportConfiguration.java | 2 +- .../server/common/data/device/data/DeviceConfiguration.java | 2 +- .../thingsboard/server/common/data/device/data/DeviceData.java | 2 +- .../common/data/device/data/DeviceTransportConfiguration.java | 2 +- .../data/device/data/Lwm2mDeviceTransportConfiguration.java | 2 +- .../data/device/data/MqttDeviceTransportConfiguration.java | 2 +- .../thingsboard/server/common/data/device/data/PowerMode.java | 2 +- .../common/data/device/data/PowerSavingConfiguration.java | 2 +- .../data/device/data/SnmpDeviceTransportConfiguration.java | 2 +- .../server/common/data/device/profile/AlarmCondition.java | 2 +- .../common/data/device/profile/AlarmConditionFilter.java | 2 +- .../common/data/device/profile/AlarmConditionFilterKey.java | 2 +- .../common/data/device/profile/AlarmConditionKeyType.java | 2 +- .../server/common/data/device/profile/AlarmConditionSpec.java | 2 +- .../common/data/device/profile/AlarmConditionSpecType.java | 2 +- .../server/common/data/device/profile/AlarmRule.java | 2 +- .../server/common/data/device/profile/AlarmSchedule.java | 2 +- .../server/common/data/device/profile/AlarmScheduleType.java | 2 +- ...lowCreateNewDevicesDeviceProfileProvisionConfiguration.java | 2 +- .../server/common/data/device/profile/AnyTimeSchedule.java | 2 +- ...eProvisionedDevicesDeviceProfileProvisionConfiguration.java | 2 +- .../profile/CoapDeviceProfileTransportConfiguration.java | 2 +- .../data/device/profile/CoapDeviceTypeConfiguration.java | 2 +- .../server/common/data/device/profile/CustomTimeSchedule.java | 2 +- .../common/data/device/profile/CustomTimeScheduleItem.java | 2 +- .../device/profile/DefaultCoapDeviceTypeConfiguration.java | 2 +- .../data/device/profile/DefaultDeviceProfileConfiguration.java | 2 +- .../profile/DefaultDeviceProfileTransportConfiguration.java | 2 +- .../server/common/data/device/profile/DeviceProfileAlarm.java | 2 +- .../common/data/device/profile/DeviceProfileConfiguration.java | 2 +- .../server/common/data/device/profile/DeviceProfileData.java | 2 +- .../device/profile/DeviceProfileProvisionConfiguration.java | 2 +- .../device/profile/DeviceProfileTransportConfiguration.java | 2 +- .../profile/DisabledDeviceProfileProvisionConfiguration.java | 2 +- .../common/data/device/profile/DurationAlarmConditionSpec.java | 2 +- .../data/device/profile/EfentoCoapDeviceTypeConfiguration.java | 2 +- .../data/device/profile/JsonTransportPayloadConfiguration.java | 2 +- .../profile/Lwm2mDeviceProfileTransportConfiguration.java | 2 +- .../profile/MqttDeviceProfileTransportConfiguration.java | 2 +- .../server/common/data/device/profile/MqttTopics.java | 2 +- .../device/profile/ProtoTransportPayloadConfiguration.java | 2 +- .../data/device/profile/ProvisionDeviceProfileCredentials.java | 2 +- .../data/device/profile/RepeatingAlarmConditionSpec.java | 2 +- .../common/data/device/profile/SimpleAlarmConditionSpec.java | 2 +- .../profile/SnmpDeviceProfileTransportConfiguration.java | 2 +- .../common/data/device/profile/SpecificTimeSchedule.java | 2 +- .../data/device/profile/TransportPayloadTypeConfiguration.java | 2 +- .../profile/X509CertificateChainProvisionConfiguration.java | 2 +- .../common/data/device/profile/lwm2m/ObjectAttributes.java | 2 +- .../common/data/device/profile/lwm2m/OtherConfiguration.java | 2 +- .../device/profile/lwm2m/TelemetryMappingConfiguration.java | 2 +- .../bootstrap/AbstractLwM2MBootstrapServerCredential.java | 2 +- .../lwm2m/bootstrap/LwM2MBootstrapServerCredential.java | 2 +- .../profile/lwm2m/bootstrap/LwM2MServerSecurityConfig.java | 2 +- .../lwm2m/bootstrap/LwM2MServerSecurityConfigDefault.java | 2 +- .../lwm2m/bootstrap/NoSecLwM2MBootstrapServerCredential.java | 2 +- .../lwm2m/bootstrap/PSKLwM2MBootstrapServerCredential.java | 2 +- .../lwm2m/bootstrap/RPKLwM2MBootstrapServerCredential.java | 2 +- .../lwm2m/bootstrap/X509LwM2MBootstrapServerCredential.java | 2 +- .../java/org/thingsboard/server/common/data/domain/Domain.java | 2 +- .../org/thingsboard/server/common/data/domain/DomainInfo.java | 2 +- .../server/common/data/domain/DomainOauth2Client.java | 2 +- .../java/org/thingsboard/server/common/data/edge/Edge.java | 2 +- .../org/thingsboard/server/common/data/edge/EdgeEvent.java | 2 +- .../server/common/data/edge/EdgeEventActionType.java | 2 +- .../org/thingsboard/server/common/data/edge/EdgeEventType.java | 2 +- .../java/org/thingsboard/server/common/data/edge/EdgeInfo.java | 2 +- .../thingsboard/server/common/data/edge/EdgeInstructions.java | 2 +- .../thingsboard/server/common/data/edge/EdgeSearchQuery.java | 2 +- .../server/common/data/entityview/EntityViewSearchQuery.java | 2 +- .../thingsboard/server/common/data/event/DebugEventFilter.java | 2 +- .../org/thingsboard/server/common/data/event/ErrorEvent.java | 2 +- .../thingsboard/server/common/data/event/ErrorEventFilter.java | 2 +- .../java/org/thingsboard/server/common/data/event/Event.java | 2 +- .../org/thingsboard/server/common/data/event/EventFilter.java | 2 +- .../org/thingsboard/server/common/data/event/EventType.java | 2 +- .../server/common/data/event/LifeCycleEventFilter.java | 2 +- .../thingsboard/server/common/data/event/LifecycleEvent.java | 2 +- .../server/common/data/event/RuleChainDebugEvent.java | 2 +- .../server/common/data/event/RuleChainDebugEventFilter.java | 2 +- .../server/common/data/event/RuleNodeDebugEvent.java | 2 +- .../server/common/data/event/RuleNodeDebugEventFilter.java | 2 +- .../thingsboard/server/common/data/event/StatisticsEvent.java | 2 +- .../server/common/data/event/StatisticsEventFilter.java | 2 +- .../common/data/exception/AbstractRateLimitException.java | 2 +- .../common/data/exception/ApiUsageLimitsExceededException.java | 2 +- .../common/data/exception/EntityVersionMismatchException.java | 2 +- .../common/data/exception/RateLimitExceededException.java | 2 +- .../server/common/data/exception/TenantNotFoundException.java | 2 +- .../common/data/exception/TenantProfileNotFoundException.java | 2 +- .../server/common/data/exception/ThingsboardErrorCode.java | 2 +- .../server/common/data/exception/ThingsboardException.java | 2 +- .../common/data/exception/ThingsboardKafkaClientError.java | 2 +- .../common/data/housekeeper/AlarmsDeletionHousekeeperTask.java | 2 +- .../common/data/housekeeper/AlarmsUnassignHousekeeperTask.java | 2 +- .../data/housekeeper/EntitiesDeletionHousekeeperTask.java | 2 +- .../server/common/data/housekeeper/HousekeeperTask.java | 2 +- .../server/common/data/housekeeper/HousekeeperTaskType.java | 2 +- .../data/housekeeper/LatestTsDeletionHousekeeperTask.java | 2 +- .../housekeeper/TenantEntitiesDeletionHousekeeperTask.java | 2 +- .../data/housekeeper/TsHistoryDeletionHousekeeperTask.java | 2 +- .../org/thingsboard/server/common/data/id/AdminSettingsId.java | 2 +- .../org/thingsboard/server/common/data/id/AlarmCommentId.java | 2 +- .../java/org/thingsboard/server/common/data/id/AlarmId.java | 2 +- .../org/thingsboard/server/common/data/id/ApiUsageStateId.java | 2 +- .../java/org/thingsboard/server/common/data/id/AssetId.java | 2 +- .../org/thingsboard/server/common/data/id/AssetProfileId.java | 2 +- .../java/org/thingsboard/server/common/data/id/AuditLogId.java | 2 +- .../server/common/data/id/ComponentDescriptorId.java | 2 +- .../java/org/thingsboard/server/common/data/id/CustomerId.java | 2 +- .../org/thingsboard/server/common/data/id/DashboardId.java | 2 +- .../thingsboard/server/common/data/id/DeviceCredentialsId.java | 2 +- .../java/org/thingsboard/server/common/data/id/DeviceId.java | 2 +- .../org/thingsboard/server/common/data/id/DeviceProfileId.java | 2 +- .../java/org/thingsboard/server/common/data/id/DomainId.java | 2 +- .../org/thingsboard/server/common/data/id/EdgeEventId.java | 2 +- .../java/org/thingsboard/server/common/data/id/EdgeId.java | 2 +- .../java/org/thingsboard/server/common/data/id/EntityId.java | 2 +- .../server/common/data/id/EntityIdDeserializer.java | 2 +- .../org/thingsboard/server/common/data/id/EntityIdFactory.java | 2 +- .../thingsboard/server/common/data/id/EntityIdSerializer.java | 2 +- .../org/thingsboard/server/common/data/id/EntityViewId.java | 2 +- .../java/org/thingsboard/server/common/data/id/EventId.java | 2 +- .../main/java/org/thingsboard/server/common/data/id/HasId.java | 2 +- .../java/org/thingsboard/server/common/data/id/HasUUID.java | 2 +- .../java/org/thingsboard/server/common/data/id/IdBased.java | 2 +- .../thingsboard/server/common/data/id/MobileAppBundleId.java | 2 +- .../org/thingsboard/server/common/data/id/MobileAppId.java | 2 +- .../server/common/data/id/NameLabelAndCustomerDetails.java | 2 +- .../java/org/thingsboard/server/common/data/id/NodeId.java | 2 +- .../org/thingsboard/server/common/data/id/NotificationId.java | 2 +- .../server/common/data/id/NotificationRequestId.java | 2 +- .../thingsboard/server/common/data/id/NotificationRuleId.java | 2 +- .../server/common/data/id/NotificationTargetId.java | 2 +- .../server/common/data/id/NotificationTemplateId.java | 2 +- .../org/thingsboard/server/common/data/id/OAuth2ClientId.java | 2 +- .../common/data/id/OAuth2ClientRegistrationTemplateId.java | 2 +- .../org/thingsboard/server/common/data/id/OAuth2ParamsId.java | 2 +- .../org/thingsboard/server/common/data/id/OtaPackageId.java | 2 +- .../thingsboard/server/common/data/id/QrCodeSettingsId.java | 2 +- .../java/org/thingsboard/server/common/data/id/QueueId.java | 2 +- .../org/thingsboard/server/common/data/id/QueueStatsId.java | 2 +- .../main/java/org/thingsboard/server/common/data/id/RpcId.java | 2 +- .../org/thingsboard/server/common/data/id/RuleChainId.java | 2 +- .../java/org/thingsboard/server/common/data/id/RuleNodeId.java | 2 +- .../org/thingsboard/server/common/data/id/RuleNodeStateId.java | 2 +- .../org/thingsboard/server/common/data/id/TbResourceId.java | 2 +- .../java/org/thingsboard/server/common/data/id/TenantId.java | 2 +- .../org/thingsboard/server/common/data/id/TenantProfileId.java | 2 +- .../java/org/thingsboard/server/common/data/id/UUIDBased.java | 2 +- .../thingsboard/server/common/data/id/UserAuthSettingsId.java | 2 +- .../thingsboard/server/common/data/id/UserCredentialsId.java | 2 +- .../java/org/thingsboard/server/common/data/id/UserId.java | 2 +- .../org/thingsboard/server/common/data/id/WidgetTypeId.java | 2 +- .../org/thingsboard/server/common/data/id/WidgetsBundleId.java | 2 +- .../org/thingsboard/server/common/data/kv/AggTsKvEntry.java | 2 +- .../org/thingsboard/server/common/data/kv/Aggregation.java | 2 +- .../thingsboard/server/common/data/kv/AggregationParams.java | 2 +- .../org/thingsboard/server/common/data/kv/AttributeKey.java | 2 +- .../thingsboard/server/common/data/kv/AttributeKvEntry.java | 2 +- .../server/common/data/kv/BaseAttributeKvEntry.java | 2 +- .../thingsboard/server/common/data/kv/BaseDeleteTsKvQuery.java | 2 +- .../thingsboard/server/common/data/kv/BaseReadTsKvQuery.java | 2 +- .../org/thingsboard/server/common/data/kv/BaseTsKvQuery.java | 2 +- .../org/thingsboard/server/common/data/kv/BasicKvEntry.java | 2 +- .../org/thingsboard/server/common/data/kv/BasicTsKvEntry.java | 2 +- .../thingsboard/server/common/data/kv/BooleanDataEntry.java | 2 +- .../java/org/thingsboard/server/common/data/kv/DataType.java | 2 +- .../org/thingsboard/server/common/data/kv/DeleteTsKvQuery.java | 2 +- .../org/thingsboard/server/common/data/kv/DoubleDataEntry.java | 2 +- .../org/thingsboard/server/common/data/kv/IntervalType.java | 2 +- .../org/thingsboard/server/common/data/kv/JsonDataEntry.java | 2 +- .../java/org/thingsboard/server/common/data/kv/KvEntry.java | 2 +- .../org/thingsboard/server/common/data/kv/LongDataEntry.java | 2 +- .../org/thingsboard/server/common/data/kv/ReadTsKvQuery.java | 2 +- .../thingsboard/server/common/data/kv/ReadTsKvQueryResult.java | 2 +- .../org/thingsboard/server/common/data/kv/StringDataEntry.java | 2 +- .../java/org/thingsboard/server/common/data/kv/TsKvEntry.java | 2 +- .../thingsboard/server/common/data/kv/TsKvEntryAggWrapper.java | 2 +- .../server/common/data/kv/TsKvLatestRemovingResult.java | 2 +- .../java/org/thingsboard/server/common/data/kv/TsKvQuery.java | 2 +- .../org/thingsboard/server/common/data/limit/LimitedApi.java | 2 +- .../thingsboard/server/common/data/lwm2m/LwM2mConstants.java | 2 +- .../thingsboard/server/common/data/lwm2m/LwM2mInstance.java | 2 +- .../org/thingsboard/server/common/data/lwm2m/LwM2mObject.java | 2 +- .../server/common/data/lwm2m/LwM2mResourceObserve.java | 2 +- .../server/common/data/mail/MailOauth2Provider.java | 2 +- .../thingsboard/server/common/data/mobile/LoginMobileInfo.java | 2 +- .../server/common/data/mobile/MobileSessionInfo.java | 2 +- .../thingsboard/server/common/data/mobile/UserMobileInfo.java | 2 +- .../server/common/data/mobile/UserMobileSessionInfo.java | 2 +- .../thingsboard/server/common/data/mobile/app/MobileApp.java | 2 +- .../server/common/data/mobile/app/MobileAppStatus.java | 2 +- .../server/common/data/mobile/app/MobileAppVersionInfo.java | 2 +- .../thingsboard/server/common/data/mobile/app/StoreInfo.java | 2 +- .../server/common/data/mobile/bundle/MobileAppBundle.java | 2 +- .../server/common/data/mobile/bundle/MobileAppBundleInfo.java | 2 +- .../common/data/mobile/bundle/MobileAppBundleOauth2Client.java | 2 +- .../server/common/data/mobile/layout/AbstractMobilePage.java | 2 +- .../server/common/data/mobile/layout/CustomMobilePage.java | 2 +- .../server/common/data/mobile/layout/DashboardPage.java | 2 +- .../server/common/data/mobile/layout/DefaultMobilePage.java | 2 +- .../server/common/data/mobile/layout/DefaultPageId.java | 2 +- .../server/common/data/mobile/layout/MobileLayoutConfig.java | 2 +- .../server/common/data/mobile/layout/MobilePage.java | 2 +- .../server/common/data/mobile/layout/MobilePageType.java | 2 +- .../server/common/data/mobile/layout/WebViewPage.java | 2 +- .../common/data/mobile/qrCodeSettings/BadgePosition.java | 2 +- .../server/common/data/mobile/qrCodeSettings/QRCodeConfig.java | 2 +- .../common/data/mobile/qrCodeSettings/QrCodeSettings.java | 2 +- .../java/org/thingsboard/server/common/data/msg/TbMsgType.java | 2 +- .../server/common/data/msg/TbNodeConnectionType.java | 2 +- .../server/common/data/notification/AlreadySentException.java | 2 +- .../server/common/data/notification/Notification.java | 2 +- .../common/data/notification/NotificationDeliveryMethod.java | 2 +- .../server/common/data/notification/NotificationRequest.java | 2 +- .../common/data/notification/NotificationRequestConfig.java | 2 +- .../common/data/notification/NotificationRequestInfo.java | 2 +- .../common/data/notification/NotificationRequestPreview.java | 2 +- .../common/data/notification/NotificationRequestStats.java | 2 +- .../common/data/notification/NotificationRequestStatus.java | 2 +- .../server/common/data/notification/NotificationStatus.java | 2 +- .../server/common/data/notification/NotificationType.java | 2 +- .../notification/info/AlarmAssignmentNotificationInfo.java | 2 +- .../data/notification/info/AlarmCommentNotificationInfo.java | 2 +- .../common/data/notification/info/AlarmNotificationInfo.java | 2 +- .../data/notification/info/ApiUsageLimitNotificationInfo.java | 2 +- .../data/notification/info/DeviceActivityNotificationInfo.java | 2 +- .../info/EdgeCommunicationFailureNotificationInfo.java | 2 +- .../data/notification/info/EdgeConnectionNotificationInfo.java | 2 +- .../data/notification/info/EntitiesLimitNotificationInfo.java | 2 +- .../data/notification/info/EntityActionNotificationInfo.java | 2 +- .../common/data/notification/info/GeneralNotificationInfo.java | 2 +- .../notification/info/NewPlatformVersionNotificationInfo.java | 2 +- .../server/common/data/notification/info/NotificationInfo.java | 2 +- .../data/notification/info/RateLimitsNotificationInfo.java | 2 +- .../RuleEngineComponentLifecycleEventNotificationInfo.java | 2 +- .../info/RuleEngineOriginatedNotificationInfo.java | 2 +- .../data/notification/info/RuleOriginatedNotificationInfo.java | 2 +- .../info/TaskProcessingFailureNotificationInfo.java | 2 +- .../rule/DefaultNotificationRuleRecipientsConfig.java | 2 +- .../rule/EscalatedNotificationRuleRecipientsConfig.java | 2 +- .../server/common/data/notification/rule/NotificationRule.java | 2 +- .../common/data/notification/rule/NotificationRuleConfig.java | 2 +- .../common/data/notification/rule/NotificationRuleInfo.java | 2 +- .../notification/rule/NotificationRuleRecipientsConfig.java | 2 +- .../data/notification/rule/trigger/AlarmAssignmentTrigger.java | 2 +- .../data/notification/rule/trigger/AlarmCommentTrigger.java | 2 +- .../common/data/notification/rule/trigger/AlarmTrigger.java | 2 +- .../data/notification/rule/trigger/ApiUsageLimitTrigger.java | 2 +- .../data/notification/rule/trigger/DeviceActivityTrigger.java | 2 +- .../rule/trigger/EdgeCommunicationFailureTrigger.java | 2 +- .../data/notification/rule/trigger/EdgeConnectionTrigger.java | 2 +- .../data/notification/rule/trigger/EntitiesLimitTrigger.java | 2 +- .../data/notification/rule/trigger/EntityActionTrigger.java | 2 +- .../notification/rule/trigger/NewPlatformVersionTrigger.java | 2 +- .../notification/rule/trigger/NotificationRuleTrigger.java | 2 +- .../data/notification/rule/trigger/RateLimitsTrigger.java | 2 +- .../rule/trigger/RuleEngineComponentLifecycleEventTrigger.java | 2 +- .../rule/trigger/TaskProcessingFailureTrigger.java | 2 +- .../config/AlarmAssignmentNotificationRuleTriggerConfig.java | 2 +- .../config/AlarmCommentNotificationRuleTriggerConfig.java | 2 +- .../trigger/config/AlarmNotificationRuleTriggerConfig.java | 2 +- .../config/ApiUsageLimitNotificationRuleTriggerConfig.java | 2 +- .../config/DeviceActivityNotificationRuleTriggerConfig.java | 2 +- .../EdgeCommunicationFailureNotificationRuleTriggerConfig.java | 2 +- .../config/EdgeConnectionNotificationRuleTriggerConfig.java | 2 +- .../config/EntitiesLimitNotificationRuleTriggerConfig.java | 2 +- .../config/EntityActionNotificationRuleTriggerConfig.java | 2 +- .../NewPlatformVersionNotificationRuleTriggerConfig.java | 2 +- .../rule/trigger/config/NotificationRuleTriggerConfig.java | 2 +- .../rule/trigger/config/NotificationRuleTriggerType.java | 2 +- .../config/RateLimitsNotificationRuleTriggerConfig.java | 2 +- ...neComponentLifecycleEventNotificationRuleTriggerConfig.java | 2 +- .../TaskProcessingFailureNotificationRuleTriggerConfig.java | 2 +- .../notification/settings/AccountNotificationSettings.java | 2 +- .../settings/MobileAppNotificationDeliveryMethodConfig.java | 2 +- .../settings/NotificationDeliveryMethodConfig.java | 2 +- .../data/notification/settings/NotificationSettings.java | 2 +- .../settings/SlackNotificationDeliveryMethodConfig.java | 2 +- .../data/notification/settings/UserNotificationSettings.java | 2 +- .../targets/MicrosoftTeamsNotificationTargetConfig.java | 2 +- .../data/notification/targets/NotificationRecipient.java | 2 +- .../common/data/notification/targets/NotificationTarget.java | 2 +- .../data/notification/targets/NotificationTargetConfig.java | 2 +- .../data/notification/targets/NotificationTargetType.java | 2 +- .../targets/platform/AffectedTenantAdministratorsFilter.java | 2 +- .../data/notification/targets/platform/AffectedUserFilter.java | 2 +- .../data/notification/targets/platform/AllUsersFilter.java | 2 +- .../notification/targets/platform/CustomerUsersFilter.java | 2 +- .../targets/platform/OriginatorEntityOwnerUsersFilter.java | 2 +- .../platform/PlatformUsersNotificationTargetConfig.java | 2 +- .../targets/platform/SystemAdministratorsFilter.java | 2 +- .../targets/platform/TenantAdministratorsFilter.java | 2 +- .../data/notification/targets/platform/UserListFilter.java | 2 +- .../common/data/notification/targets/platform/UsersFilter.java | 2 +- .../data/notification/targets/platform/UsersFilterType.java | 2 +- .../data/notification/targets/slack/SlackConversation.java | 2 +- .../data/notification/targets/slack/SlackConversationType.java | 2 +- .../targets/slack/SlackNotificationTargetConfig.java | 2 +- .../template/DeliveryMethodNotificationTemplate.java | 2 +- .../template/EmailDeliveryMethodNotificationTemplate.java | 2 +- .../server/common/data/notification/template/HasSubject.java | 2 +- .../MicrosoftTeamsDeliveryMethodNotificationTemplate.java | 2 +- .../template/MobileAppDeliveryMethodNotificationTemplate.java | 2 +- .../data/notification/template/NotificationTemplate.java | 2 +- .../data/notification/template/NotificationTemplateConfig.java | 2 +- .../template/SlackDeliveryMethodNotificationTemplate.java | 2 +- .../template/SmsDeliveryMethodNotificationTemplate.java | 2 +- .../common/data/notification/template/TemplatableValue.java | 2 +- .../template/WebDeliveryMethodNotificationTemplate.java | 2 +- .../org/thingsboard/server/common/data/oauth2/MapperType.java | 2 +- .../server/common/data/oauth2/OAuth2BasicMapperConfig.java | 2 +- .../thingsboard/server/common/data/oauth2/OAuth2Client.java | 2 +- .../server/common/data/oauth2/OAuth2ClientInfo.java | 2 +- .../server/common/data/oauth2/OAuth2ClientLoginInfo.java | 2 +- .../common/data/oauth2/OAuth2ClientRegistrationTemplate.java | 2 +- .../server/common/data/oauth2/OAuth2CustomMapperConfig.java | 2 +- .../server/common/data/oauth2/OAuth2MapperConfig.java | 2 +- .../thingsboard/server/common/data/oauth2/OAuth2Params.java | 2 +- .../thingsboard/server/common/data/oauth2/PlatformType.java | 2 +- .../org/thingsboard/server/common/data/oauth2/SchemeType.java | 2 +- .../server/common/data/oauth2/TenantNameStrategyType.java | 2 +- .../server/common/data/objects/AttributesEntityView.java | 2 +- .../server/common/data/objects/TelemetryEntityView.java | 2 +- .../thingsboard/server/common/data/ota/ChecksumAlgorithm.java | 2 +- .../org/thingsboard/server/common/data/ota/OtaPackageKey.java | 2 +- .../org/thingsboard/server/common/data/ota/OtaPackageType.java | 2 +- .../server/common/data/ota/OtaPackageUpdateStatus.java | 2 +- .../org/thingsboard/server/common/data/ota/OtaPackageUtil.java | 2 +- .../server/common/data/page/BasePageDataIterable.java | 2 +- .../java/org/thingsboard/server/common/data/page/PageData.java | 2 +- .../thingsboard/server/common/data/page/PageDataIterable.java | 2 +- .../server/common/data/page/PageDataIterableByTenant.java | 2 +- .../common/data/page/PageDataIterableByTenantIdEntityId.java | 2 +- .../java/org/thingsboard/server/common/data/page/PageLink.java | 2 +- .../org/thingsboard/server/common/data/page/SortOrder.java | 2 +- .../org/thingsboard/server/common/data/page/TimePageLink.java | 2 +- .../server/common/data/plugin/ComponentClusteringMode.java | 2 +- .../server/common/data/plugin/ComponentDescriptor.java | 2 +- .../server/common/data/plugin/ComponentLifecycleEvent.java | 2 +- .../server/common/data/plugin/ComponentLifecycleState.java | 2 +- .../thingsboard/server/common/data/plugin/ComponentScope.java | 2 +- .../thingsboard/server/common/data/plugin/ComponentType.java | 2 +- .../server/common/data/query/AbstractDataQuery.java | 2 +- .../thingsboard/server/common/data/query/AlarmCountQuery.java | 2 +- .../org/thingsboard/server/common/data/query/AlarmData.java | 2 +- .../server/common/data/query/AlarmDataPageLink.java | 2 +- .../thingsboard/server/common/data/query/AlarmDataQuery.java | 2 +- .../server/common/data/query/ApiUsageStateFilter.java | 2 +- .../server/common/data/query/AssetSearchQueryFilter.java | 2 +- .../thingsboard/server/common/data/query/AssetTypeFilter.java | 2 +- .../server/common/data/query/BooleanFilterPredicate.java | 2 +- .../server/common/data/query/ComparisonTsValue.java | 2 +- .../server/common/data/query/ComplexFilterPredicate.java | 2 +- .../server/common/data/query/DeviceSearchQueryFilter.java | 2 +- .../thingsboard/server/common/data/query/DeviceTypeFilter.java | 2 +- .../org/thingsboard/server/common/data/query/DynamicValue.java | 2 +- .../server/common/data/query/DynamicValueSourceType.java | 2 +- .../server/common/data/query/EdgeSearchQueryFilter.java | 2 +- .../thingsboard/server/common/data/query/EdgeTypeFilter.java | 2 +- .../thingsboard/server/common/data/query/EntityCountQuery.java | 2 +- .../org/thingsboard/server/common/data/query/EntityData.java | 2 +- .../server/common/data/query/EntityDataPageLink.java | 2 +- .../thingsboard/server/common/data/query/EntityDataQuery.java | 2 +- .../server/common/data/query/EntityDataSortOrder.java | 2 +- .../org/thingsboard/server/common/data/query/EntityFilter.java | 2 +- .../thingsboard/server/common/data/query/EntityFilterType.java | 2 +- .../org/thingsboard/server/common/data/query/EntityKey.java | 2 +- .../thingsboard/server/common/data/query/EntityKeyType.java | 2 +- .../server/common/data/query/EntityKeyValueType.java | 2 +- .../thingsboard/server/common/data/query/EntityListFilter.java | 2 +- .../thingsboard/server/common/data/query/EntityNameFilter.java | 2 +- .../server/common/data/query/EntitySearchQueryFilter.java | 2 +- .../thingsboard/server/common/data/query/EntityTypeFilter.java | 2 +- .../server/common/data/query/EntityViewSearchQueryFilter.java | 2 +- .../server/common/data/query/EntityViewTypeFilter.java | 2 +- .../server/common/data/query/FilterPredicateType.java | 2 +- .../server/common/data/query/FilterPredicateValue.java | 2 +- .../org/thingsboard/server/common/data/query/KeyFilter.java | 2 +- .../server/common/data/query/KeyFilterPredicate.java | 2 +- .../server/common/data/query/NumericFilterPredicate.java | 2 +- .../server/common/data/query/OriginatorAlarmFilter.java | 2 +- .../server/common/data/query/RelationsQueryFilter.java | 2 +- .../server/common/data/query/SimpleKeyFilterPredicate.java | 2 +- .../server/common/data/query/SingleEntityFilter.java | 2 +- .../server/common/data/query/StringFilterPredicate.java | 2 +- .../java/org/thingsboard/server/common/data/query/TsValue.java | 2 +- .../server/common/data/queue/ProcessingStrategy.java | 2 +- .../server/common/data/queue/ProcessingStrategyType.java | 2 +- .../java/org/thingsboard/server/common/data/queue/Queue.java | 2 +- .../org/thingsboard/server/common/data/queue/QueueConfig.java | 2 +- .../org/thingsboard/server/common/data/queue/QueueStats.java | 2 +- .../thingsboard/server/common/data/queue/SubmitStrategy.java | 2 +- .../server/common/data/queue/SubmitStrategyType.java | 2 +- .../server/common/data/relation/EntityRelation.java | 2 +- .../server/common/data/relation/EntityRelationInfo.java | 2 +- .../server/common/data/relation/EntityRelationsQuery.java | 2 +- .../server/common/data/relation/EntitySearchDirection.java | 2 +- .../server/common/data/relation/RelationEntityTypeFilter.java | 2 +- .../server/common/data/relation/RelationTypeGroup.java | 2 +- .../server/common/data/relation/RelationsSearchParameters.java | 2 +- .../main/java/org/thingsboard/server/common/data/rpc/Rpc.java | 2 +- .../java/org/thingsboard/server/common/data/rpc/RpcError.java | 2 +- .../java/org/thingsboard/server/common/data/rpc/RpcStatus.java | 2 +- .../server/common/data/rpc/ToDeviceRpcRequestBody.java | 2 +- .../server/common/data/rule/DefaultRuleChainCreateRequest.java | 2 +- .../server/common/data/rule/NodeConnectionInfo.java | 2 +- .../org/thingsboard/server/common/data/rule/RuleChain.java | 2 +- .../server/common/data/rule/RuleChainConnectionInfo.java | 2 +- .../org/thingsboard/server/common/data/rule/RuleChainData.java | 2 +- .../server/common/data/rule/RuleChainImportResult.java | 2 +- .../thingsboard/server/common/data/rule/RuleChainMetaData.java | 2 +- .../server/common/data/rule/RuleChainOutputLabelsUsage.java | 2 +- .../org/thingsboard/server/common/data/rule/RuleChainType.java | 2 +- .../server/common/data/rule/RuleChainUpdateResult.java | 2 +- .../java/org/thingsboard/server/common/data/rule/RuleNode.java | 2 +- .../org/thingsboard/server/common/data/rule/RuleNodeState.java | 2 +- .../server/common/data/rule/RuleNodeUpdateResult.java | 2 +- .../java/org/thingsboard/server/common/data/rule/RuleType.java | 2 +- .../java/org/thingsboard/server/common/data/rule/Scope.java | 2 +- .../thingsboard/server/common/data/script/ScriptLanguage.java | 2 +- .../org/thingsboard/server/common/data/security/Authority.java | 2 +- .../server/common/data/security/DeviceCredentials.java | 2 +- .../server/common/data/security/DeviceCredentialsFilter.java | 2 +- .../server/common/data/security/DeviceCredentialsType.java | 2 +- .../server/common/data/security/DeviceTokenCredentials.java | 2 +- .../server/common/data/security/DeviceX509Credentials.java | 2 +- .../server/common/data/security/UserAuthSettings.java | 2 +- .../server/common/data/security/UserCredentials.java | 2 +- .../common/data/security/event/UserAuthDataChangedEvent.java | 2 +- .../data/security/event/UserCredentialsInvalidationEvent.java | 2 +- .../data/security/event/UserSessionInvalidationEvent.java | 2 +- .../thingsboard/server/common/data/security/model/JwtPair.java | 2 +- .../server/common/data/security/model/JwtSettings.java | 2 +- .../server/common/data/security/model/JwtToken.java | 2 +- .../server/common/data/security/model/SecuritySettings.java | 2 +- .../server/common/data/security/model/UserPasswordPolicy.java | 2 +- .../common/data/security/model/mfa/PlatformTwoFaSettings.java | 2 +- .../data/security/model/mfa/account/AccountTwoFaSettings.java | 2 +- .../model/mfa/account/BackupCodeTwoFaAccountConfig.java | 2 +- .../security/model/mfa/account/EmailTwoFaAccountConfig.java | 2 +- .../security/model/mfa/account/OtpBasedTwoFaAccountConfig.java | 2 +- .../data/security/model/mfa/account/SmsTwoFaAccountConfig.java | 2 +- .../security/model/mfa/account/TotpTwoFaAccountConfig.java | 2 +- .../data/security/model/mfa/account/TwoFaAccountConfig.java | 2 +- .../model/mfa/provider/BackupCodeTwoFaProviderConfig.java | 2 +- .../security/model/mfa/provider/EmailTwoFaProviderConfig.java | 2 +- .../model/mfa/provider/OtpBasedTwoFaProviderConfig.java | 2 +- .../security/model/mfa/provider/SmsTwoFaProviderConfig.java | 2 +- .../security/model/mfa/provider/TotpTwoFaProviderConfig.java | 2 +- .../data/security/model/mfa/provider/TwoFaProviderConfig.java | 2 +- .../data/security/model/mfa/provider/TwoFaProviderType.java | 2 +- .../server/common/data/settings/AbstractUserDashboardInfo.java | 2 +- .../server/common/data/settings/LastVisitedDashboardInfo.java | 2 +- .../server/common/data/settings/StarredDashboardInfo.java | 2 +- .../server/common/data/settings/UserDashboardAction.java | 2 +- .../server/common/data/settings/UserDashboardsInfo.java | 2 +- .../thingsboard/server/common/data/settings/UserSettings.java | 2 +- .../server/common/data/settings/UserSettingsCompositeKey.java | 2 +- .../server/common/data/settings/UserSettingsType.java | 2 +- .../common/data/sms/config/AwsSnsSmsProviderConfiguration.java | 2 +- .../common/data/sms/config/SmppSmsProviderConfiguration.java | 2 +- .../common/data/sms/config/SmsProviderConfiguration.java | 2 +- .../server/common/data/sms/config/SmsProviderType.java | 2 +- .../server/common/data/sms/config/TestSmsRequest.java | 2 +- .../common/data/sms/config/TwilioSmsProviderConfiguration.java | 2 +- .../org/thingsboard/server/common/data/sync/JsonTbEntity.java | 2 +- .../server/common/data/sync/ie/AttributeExportData.java | 2 +- .../server/common/data/sync/ie/DeviceExportData.java | 2 +- .../server/common/data/sync/ie/EntityExportData.java | 2 +- .../server/common/data/sync/ie/EntityExportSettings.java | 2 +- .../server/common/data/sync/ie/EntityImportResult.java | 2 +- .../server/common/data/sync/ie/EntityImportSettings.java | 2 +- .../server/common/data/sync/ie/RuleChainExportData.java | 2 +- .../server/common/data/sync/ie/WidgetTypeExportData.java | 2 +- .../server/common/data/sync/ie/WidgetsBundleExportData.java | 2 +- .../data/sync/ie/importing/csv/BulkImportColumnType.java | 2 +- .../common/data/sync/ie/importing/csv/BulkImportRequest.java | 2 +- .../common/data/sync/ie/importing/csv/BulkImportResult.java | 2 +- .../server/common/data/sync/vc/AutoCommitSettings.java | 2 +- .../org/thingsboard/server/common/data/sync/vc/BranchInfo.java | 2 +- .../thingsboard/server/common/data/sync/vc/EntityDataDiff.java | 2 +- .../thingsboard/server/common/data/sync/vc/EntityDataInfo.java | 2 +- .../server/common/data/sync/vc/EntityLoadError.java | 2 +- .../server/common/data/sync/vc/EntityTypeLoadResult.java | 2 +- .../thingsboard/server/common/data/sync/vc/EntityVersion.java | 2 +- .../server/common/data/sync/vc/EntityVersionsDiff.java | 2 +- .../server/common/data/sync/vc/RepositoryAuthMethod.java | 2 +- .../server/common/data/sync/vc/RepositorySettings.java | 2 +- .../server/common/data/sync/vc/RepositorySettingsInfo.java | 2 +- .../org/thingsboard/server/common/data/sync/vc/VcUtils.java | 2 +- .../server/common/data/sync/vc/VersionCreationResult.java | 2 +- .../server/common/data/sync/vc/VersionLoadResult.java | 2 +- .../server/common/data/sync/vc/VersionedEntityInfo.java | 2 +- .../data/sync/vc/request/create/AutoVersionCreateConfig.java | 2 +- .../sync/vc/request/create/ComplexVersionCreateRequest.java | 2 +- .../sync/vc/request/create/EntityTypeVersionCreateConfig.java | 2 +- .../vc/request/create/SingleEntityVersionCreateRequest.java | 2 +- .../common/data/sync/vc/request/create/SyncStrategy.java | 2 +- .../data/sync/vc/request/create/VersionCreateConfig.java | 2 +- .../data/sync/vc/request/create/VersionCreateRequest.java | 2 +- .../data/sync/vc/request/create/VersionCreateRequestType.java | 2 +- .../data/sync/vc/request/load/EntityTypeVersionLoadConfig.java | 2 +- .../sync/vc/request/load/EntityTypeVersionLoadRequest.java | 2 +- .../sync/vc/request/load/SingleEntityVersionLoadRequest.java | 2 +- .../common/data/sync/vc/request/load/VersionLoadConfig.java | 2 +- .../common/data/sync/vc/request/load/VersionLoadRequest.java | 2 +- .../data/sync/vc/request/load/VersionLoadRequestType.java | 2 +- .../data/tenant/profile/DefaultTenantProfileConfiguration.java | 2 +- .../common/data/tenant/profile/TenantProfileConfiguration.java | 2 +- .../server/common/data/tenant/profile/TenantProfileData.java | 2 +- .../data/tenant/profile/TenantProfileQueueConfiguration.java | 2 +- .../server/common/data/transport/resource/ResourceType.java | 2 +- .../common/data/transport/snmp/AuthenticationProtocol.java | 2 +- .../server/common/data/transport/snmp/PrivacyProtocol.java | 2 +- .../common/data/transport/snmp/SnmpCommunicationSpec.java | 2 +- .../server/common/data/transport/snmp/SnmpMapping.java | 2 +- .../server/common/data/transport/snmp/SnmpMethod.java | 2 +- .../server/common/data/transport/snmp/SnmpProtocolVersion.java | 2 +- .../snmp/config/MultipleMappingsSnmpCommunicationConfig.java | 2 +- .../snmp/config/RepeatingQueryingSnmpCommunicationConfig.java | 2 +- .../data/transport/snmp/config/SnmpCommunicationConfig.java | 2 +- .../snmp/config/ToServerRpcRequestSnmpCommunicationConfig.java | 2 +- .../impl/ClientAttributesQueryingSnmpCommunicationConfig.java | 2 +- .../impl/SharedAttributesSettingSnmpCommunicationConfig.java | 2 +- .../config/impl/TelemetryQueryingSnmpCommunicationConfig.java | 2 +- .../config/impl/ToDeviceRpcRequestSnmpCommunicationConfig.java | 2 +- .../thingsboard/server/common/data/util/CollectionsUtil.java | 2 +- .../thingsboard/server/common/data/util/ReflectionUtils.java | 2 +- .../thingsboard/server/common/data/util/TbDDFFileParser.java | 2 +- .../server/common/data/util/TbDefaultDDFFileValidator.java | 2 +- .../java/org/thingsboard/server/common/data/util/TbPair.java | 2 +- .../org/thingsboard/server/common/data/util/TemplateUtils.java | 2 +- .../server/common/data/util/ThrowingBiFunction.java | 2 +- .../thingsboard/server/common/data/util/ThrowingRunnable.java | 2 +- .../thingsboard/server/common/data/util/ThrowingSupplier.java | 2 +- .../org/thingsboard/server/common/data/util/TypeCastUtil.java | 2 +- .../org/thingsboard/server/common/data/validation/Length.java | 2 +- .../org/thingsboard/server/common/data/validation/NoXss.java | 2 +- .../thingsboard/server/common/data/widget/BaseWidgetType.java | 2 +- .../server/common/data/widget/DeprecatedFilter.java | 2 +- .../server/common/data/widget/WidgetBundleInfo.java | 2 +- .../org/thingsboard/server/common/data/widget/WidgetType.java | 2 +- .../server/common/data/widget/WidgetTypeDetails.java | 2 +- .../server/common/data/widget/WidgetTypeFilter.java | 2 +- .../thingsboard/server/common/data/widget/WidgetTypeInfo.java | 2 +- .../thingsboard/server/common/data/widget/WidgetsBundle.java | 2 +- .../server/common/data/widget/WidgetsBundleFilter.java | 2 +- .../server/common/data/widget/WidgetsBundleWidget.java | 2 +- .../thingsboard/server/common/data/DynamicProtoUtilsTest.java | 2 +- .../org/thingsboard/server/common/data/EntityTypeTest.java | 2 +- .../org/thingsboard/server/common/data/StringUtilsTest.java | 2 +- .../org/thingsboard/server/common/data/UUIDConverterTest.java | 2 +- .../thingsboard/server/common/data/audit/ActionTypeTest.java | 2 +- .../org/thingsboard/server/common/data/id/EntityIdTest.java | 2 +- .../org/thingsboard/server/common/data/msg/TbMsgTypeTest.java | 2 +- .../org/thingsboard/server/common/data/rpc/RpcStatusTest.java | 2 +- common/edge-api/pom.xml | 2 +- .../thingsboard/edge/exception/EdgeConnectionException.java | 2 +- .../src/main/java/org/thingsboard/edge/rpc/EdgeGrpcClient.java | 2 +- .../src/main/java/org/thingsboard/edge/rpc/EdgeRpcClient.java | 2 +- common/edge-api/src/main/proto/edge.proto | 2 +- common/message/pom.xml | 2 +- .../java/org/thingsboard/server/common/msg/EncryptionUtil.java | 2 +- .../main/java/org/thingsboard/server/common/msg/MsgType.java | 2 +- .../java/org/thingsboard/server/common/msg/TbActorError.java | 2 +- .../java/org/thingsboard/server/common/msg/TbActorMsg.java | 2 +- .../org/thingsboard/server/common/msg/TbActorStopReason.java | 2 +- .../src/main/java/org/thingsboard/server/common/msg/TbMsg.java | 2 +- .../java/org/thingsboard/server/common/msg/TbMsgDataType.java | 2 +- .../java/org/thingsboard/server/common/msg/TbMsgMetaData.java | 2 +- .../org/thingsboard/server/common/msg/TbMsgProcessingCtx.java | 2 +- .../server/common/msg/TbMsgProcessingStackItem.java | 2 +- .../thingsboard/server/common/msg/TbRuleEngineActorMsg.java | 2 +- .../server/common/msg/ToDeviceActorNotificationMsg.java | 2 +- .../thingsboard/server/common/msg/aware/CustomerAwareMsg.java | 2 +- .../thingsboard/server/common/msg/aware/DeviceAwareMsg.java | 2 +- .../org/thingsboard/server/common/msg/aware/NodeAwareMsg.java | 2 +- .../thingsboard/server/common/msg/aware/RuleChainAwareMsg.java | 2 +- .../thingsboard/server/common/msg/aware/TenantAwareMsg.java | 2 +- .../thingsboard/server/common/msg/cluster/ToAllNodesMsg.java | 2 +- .../thingsboard/server/common/msg/edge/EdgeEventUpdateMsg.java | 2 +- .../server/common/msg/edge/EdgeHighPriorityMsg.java | 2 +- .../org/thingsboard/server/common/msg/edge/EdgeSessionMsg.java | 2 +- .../server/common/msg/edge/FromEdgeSyncResponse.java | 2 +- .../thingsboard/server/common/msg/edge/ToEdgeSyncRequest.java | 2 +- .../server/common/msg/gateway/metrics/GatewayMetadata.java | 2 +- .../server/common/msg/housekeeper/HousekeeperClient.java | 2 +- .../common/msg/notification/NotificationRuleProcessor.java | 2 +- .../server/common/msg/plugin/ComponentLifecycleListener.java | 2 +- .../server/common/msg/plugin/ComponentLifecycleMsg.java | 2 +- .../server/common/msg/plugin/RuleNodeUpdatedMsg.java | 2 +- .../server/common/msg/queue/PartitionChangeMsg.java | 2 +- .../server/common/msg/queue/QueueToRuleEngineMsg.java | 2 +- .../server/common/msg/queue/RuleEngineException.java | 2 +- .../thingsboard/server/common/msg/queue/RuleNodeException.java | 2 +- .../org/thingsboard/server/common/msg/queue/RuleNodeInfo.java | 2 +- .../org/thingsboard/server/common/msg/queue/ServiceType.java | 2 +- .../org/thingsboard/server/common/msg/queue/TbCallback.java | 2 +- .../org/thingsboard/server/common/msg/queue/TbMsgCallback.java | 2 +- .../server/common/msg/queue/TopicPartitionInfo.java | 2 +- .../server/common/msg/rpc/FromDeviceRpcResponse.java | 2 +- .../server/common/msg/rpc/FromDeviceRpcResponseActorMsg.java | 2 +- .../thingsboard/server/common/msg/rpc/RemoveRpcActorMsg.java | 2 +- .../thingsboard/server/common/msg/rpc/ToDeviceRpcRequest.java | 2 +- .../server/common/msg/rpc/ToDeviceRpcRequestActorMsg.java | 2 +- .../server/common/msg/rule/engine/DeviceAttributes.java | 2 +- .../msg/rule/engine/DeviceAttributesEventNotificationMsg.java | 2 +- .../rule/engine/DeviceCredentialsUpdateNotificationMsg.java | 2 +- .../server/common/msg/rule/engine/DeviceDeleteMsg.java | 2 +- .../server/common/msg/rule/engine/DeviceEdgeUpdateMsg.java | 2 +- .../server/common/msg/rule/engine/DeviceMetaData.java | 2 +- .../common/msg/rule/engine/DeviceNameOrTypeUpdateMsg.java | 2 +- .../org/thingsboard/server/common/msg/session/FeatureType.java | 2 +- .../thingsboard/server/common/msg/session/SessionMsgType.java | 2 +- .../common/msg/session/ex/ProcessingTimeoutException.java | 2 +- .../server/common/msg/session/ex/SessionAuthException.java | 2 +- .../server/common/msg/session/ex/SessionException.java | 2 +- .../common/msg/timeout/DeviceActorServerSideRpcTimeoutMsg.java | 2 +- .../org/thingsboard/server/common/msg/timeout/TimeoutMsg.java | 2 +- .../common/msg/tools/MaxPayloadSizeExceededException.java | 2 +- .../thingsboard/server/common/msg/tools/SchedulerUtils.java | 2 +- .../org/thingsboard/server/common/msg/tools/TbRateLimits.java | 2 +- .../server/common/msg/tools/TbRateLimitsException.java | 2 +- common/message/src/main/proto/tbmsg.proto | 2 +- .../org/thingsboard/server/common/msg/EncryptionUtilTest.java | 2 +- .../org/thingsboard/server/common/msg/TbMsgMetaDataTest.java | 2 +- .../server/common/msg/TbMsgProcessingStackItemTest.java | 2 +- .../server/common/msg/queue/TopicPartitionInfoTest.java | 2 +- .../thingsboard/server/common/msg/tools/RateLimitsTest.java | 2 +- common/pom.xml | 2 +- common/proto/pom.xml | 2 +- .../thingsboard/server/common/adaptor/AdaptorException.java | 2 +- .../org/thingsboard/server/common/adaptor/JsonConverter.java | 2 +- .../thingsboard/server/common/adaptor/JsonConverterConfig.java | 2 +- .../org/thingsboard/server/common/adaptor/ProtoConverter.java | 2 +- .../java/org/thingsboard/server/common/util/KvProtoUtil.java | 2 +- .../java/org/thingsboard/server/common/util/ProtoUtils.java | 2 +- common/proto/src/main/proto/jsinvoke.proto | 2 +- common/proto/src/main/proto/queue.proto | 2 +- common/proto/src/main/proto/transport.proto | 2 +- .../thingsboard/server/common/adaptor/JsonConverterTest.java | 2 +- .../org/thingsboard/server/common/util/KvProtoUtilTest.java | 2 +- .../org/thingsboard/server/common/util/ProtoUtilsTest.java | 2 +- common/queue/pom.xml | 2 +- .../server/queue/RuleEngineTbQueueAdminFactory.java | 2 +- .../queue/common/AbstractParallelTbQueueConsumerTemplate.java | 2 +- .../server/queue/common/AbstractTbQueueConsumerTemplate.java | 2 +- .../server/queue/common/AbstractTbQueueTemplate.java | 2 +- .../thingsboard/server/queue/common/AsyncCallbackTemplate.java | 2 +- .../org/thingsboard/server/queue/common/DefaultTbQueueMsg.java | 2 +- .../server/queue/common/DefaultTbQueueMsgHeaders.java | 2 +- .../server/queue/common/DefaultTbQueueRequestTemplate.java | 2 +- .../server/queue/common/DefaultTbQueueResponseTemplate.java | 2 +- .../server/queue/common/MultipleTbQueueCallbackWrapper.java | 2 +- .../queue/common/MultipleTbQueueTbMsgCallbackWrapper.java | 2 +- .../thingsboard/server/queue/common/SimpleTbQueueCallback.java | 2 +- .../org/thingsboard/server/queue/common/TbProtoJsQueueMsg.java | 2 +- .../org/thingsboard/server/queue/common/TbProtoQueueMsg.java | 2 +- .../server/queue/common/TbQueueTbMsgCallbackWrapper.java | 2 +- .../server/queue/common/TbRuleEngineProducerService.java | 2 +- .../server/queue/common/consumer/QueueConsumerManager.java | 2 +- .../server/queue/discovery/ConsistentHashCircle.java | 2 +- .../server/queue/discovery/DefaultTbServiceInfoProvider.java | 2 +- .../thingsboard/server/queue/discovery/DiscoveryService.java | 2 +- .../server/queue/discovery/DummyDiscoveryService.java | 2 +- .../server/queue/discovery/HashPartitionService.java | 2 +- .../thingsboard/server/queue/discovery/PartitionService.java | 2 +- .../java/org/thingsboard/server/queue/discovery/QueueKey.java | 2 +- .../thingsboard/server/queue/discovery/QueueRoutingInfo.java | 2 +- .../server/queue/discovery/QueueRoutingInfoService.java | 2 +- .../server/queue/discovery/TbApplicationEventListener.java | 2 +- .../server/queue/discovery/TbServiceInfoProvider.java | 2 +- .../thingsboard/server/queue/discovery/TenantRoutingInfo.java | 2 +- .../server/queue/discovery/TenantRoutingInfoService.java | 2 +- .../org/thingsboard/server/queue/discovery/TopicService.java | 2 +- .../thingsboard/server/queue/discovery/ZkDiscoveryService.java | 2 +- .../queue/discovery/event/ClusterTopologyChangeEvent.java | 2 +- .../queue/discovery/event/OtherServiceShutdownEvent.java | 2 +- .../server/queue/discovery/event/PartitionChangeEvent.java | 2 +- .../server/queue/discovery/event/ServiceListChangedEvent.java | 2 +- .../server/queue/discovery/event/TbApplicationEvent.java | 2 +- .../server/queue/environment/EnvironmentLogService.java | 2 +- .../server/queue/housekeeper/DefaultHousekeeperClient.java | 2 +- .../server/queue/housekeeper/HousekeeperConfig.java | 2 +- .../org/thingsboard/server/queue/kafka/KafkaTbQueueMsg.java | 2 +- .../server/queue/kafka/KafkaTbQueueMsgMetadata.java | 2 +- .../java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java | 2 +- .../server/queue/kafka/TbKafkaConsumerStatisticConfig.java | 2 +- .../server/queue/kafka/TbKafkaConsumerStatsService.java | 2 +- .../server/queue/kafka/TbKafkaConsumerTemplate.java | 2 +- .../org/thingsboard/server/queue/kafka/TbKafkaDecoder.java | 2 +- .../org/thingsboard/server/queue/kafka/TbKafkaEncoder.java | 2 +- .../server/queue/kafka/TbKafkaProducerTemplate.java | 2 +- .../org/thingsboard/server/queue/kafka/TbKafkaSettings.java | 2 +- .../thingsboard/server/queue/kafka/TbKafkaTopicConfigs.java | 2 +- .../server/queue/memory/DefaultInMemoryStorage.java | 2 +- .../org/thingsboard/server/queue/memory/InMemoryStorage.java | 2 +- .../server/queue/memory/InMemoryTbQueueConsumer.java | 2 +- .../server/queue/memory/InMemoryTbQueueProducer.java | 2 +- .../notification/DefaultNotificationDeduplicationService.java | 2 +- .../queue/notification/NotificationDeduplicationService.java | 2 +- .../queue/notification/RemoteNotificationRuleProcessor.java | 2 +- .../server/queue/provider/HousekeeperClientQueueFactory.java | 2 +- .../server/queue/provider/InMemoryMonolithQueueFactory.java | 2 +- .../server/queue/provider/InMemoryTbTransportQueueFactory.java | 2 +- .../server/queue/provider/KafkaMonolithQueueFactory.java | 2 +- .../server/queue/provider/KafkaTbCoreQueueFactory.java | 2 +- .../server/queue/provider/KafkaTbRuleEngineQueueFactory.java | 2 +- .../server/queue/provider/KafkaTbTransportQueueFactory.java | 2 +- .../queue/provider/KafkaTbVersionControlQueueFactory.java | 2 +- .../thingsboard/server/queue/provider/TbCoreQueueFactory.java | 2 +- .../server/queue/provider/TbCoreQueueProducerProvider.java | 2 +- .../server/queue/provider/TbQueueProducerProvider.java | 2 +- .../server/queue/provider/TbRuleEngineProducerProvider.java | 2 +- .../server/queue/provider/TbRuleEngineQueueFactory.java | 2 +- .../server/queue/provider/TbTransportQueueFactory.java | 2 +- .../queue/provider/TbTransportQueueProducerProvider.java | 2 +- .../server/queue/provider/TbUsageStatsClientQueueFactory.java | 2 +- .../queue/provider/TbVersionControlProducerProvider.java | 2 +- .../server/queue/provider/TbVersionControlQueueFactory.java | 2 +- .../server/queue/scheduler/DefaultSchedulerComponent.java | 2 +- .../thingsboard/server/queue/scheduler/SchedulerComponent.java | 2 +- .../thingsboard/server/queue/settings/TbQueueCoreSettings.java | 2 +- .../thingsboard/server/queue/settings/TbQueueEdgeSettings.java | 2 +- .../server/queue/settings/TbQueueRemoteJsInvokeSettings.java | 2 +- .../server/queue/settings/TbQueueRuleEngineSettings.java | 2 +- .../server/queue/settings/TbQueueTransportApiSettings.java | 2 +- .../queue/settings/TbQueueTransportNotificationSettings.java | 2 +- .../server/queue/settings/TbQueueVersionControlSettings.java | 2 +- .../server/queue/usagestats/DefaultTbApiUsageReportClient.java | 2 +- .../org/thingsboard/server/queue/util/AfterContextReady.java | 2 +- .../java/org/thingsboard/server/queue/util/AfterStartUp.java | 2 +- .../java/org/thingsboard/server/queue/util/PropertyUtils.java | 2 +- .../org/thingsboard/server/queue/util/TbCoreComponent.java | 2 +- .../server/queue/util/TbLwM2mBootstrapTransportComponent.java | 2 +- .../server/queue/util/TbLwM2mTransportComponent.java | 2 +- .../thingsboard/server/queue/util/TbRuleEngineComponent.java | 2 +- .../server/queue/util/TbSnmpTransportComponent.java | 2 +- .../thingsboard/server/queue/util/TbTransportComponent.java | 2 +- .../server/queue/util/TbVersionControlComponent.java | 2 +- .../server/queue/common/DefaultTbQueueRequestTemplateTest.java | 2 +- .../org/thingsboard/server/queue/discovery/QueueKeyTest.java | 2 +- .../server/queue/discovery/ZkDiscoveryServiceTest.java | 2 +- .../org/thingsboard/server/queue/kafka/TbKafkaAdminTest.java | 2 +- .../server/queue/kafka/TbKafkaProducerTemplateTest.java | 2 +- .../thingsboard/server/queue/kafka/TbKafkaSettingsTest.java | 2 +- .../server/queue/memory/DefaultInMemoryStorageTest.java | 2 +- .../org/thingsboard/server/queue/util/PropertyUtilsTest.java | 2 +- common/script/pom.xml | 2 +- common/script/remote-js-client/pom.xml | 2 +- .../thingsboard/server/service/script/JsExecutorService.java | 2 +- .../server/service/script/RemoteJsInvokeService.java | 2 +- .../server/service/script/RemoteJsRequestEncoder.java | 2 +- .../server/service/script/RemoteJsResponseDecoder.java | 2 +- common/script/script-api/pom.xml | 2 +- .../thingsboard/script/api/AbstractScriptInvokeService.java | 2 +- .../java/org/thingsboard/script/api/BlockedScriptInfo.java | 2 +- .../java/org/thingsboard/script/api/RuleNodeScriptFactory.java | 2 +- .../java/org/thingsboard/script/api/ScriptInvokeService.java | 2 +- .../java/org/thingsboard/script/api/ScriptStatCallback.java | 2 +- .../src/main/java/org/thingsboard/script/api/ScriptType.java | 2 +- .../java/org/thingsboard/script/api/TbScriptException.java | 2 +- .../java/org/thingsboard/script/api/TbScriptExecutionTask.java | 2 +- .../org/thingsboard/script/api/js/AbstractJsInvokeService.java | 2 +- .../java/org/thingsboard/script/api/js/JsInvokeService.java | 2 +- .../org/thingsboard/script/api/js/JsScriptExecutionTask.java | 2 +- .../main/java/org/thingsboard/script/api/js/JsScriptInfo.java | 2 +- .../org/thingsboard/script/api/js/NashornJsInvokeService.java | 2 +- .../org/thingsboard/script/api/tbel/DateTimeFormatOptions.java | 2 +- .../thingsboard/script/api/tbel/DefaultTbelInvokeService.java | 2 +- .../src/main/java/org/thingsboard/script/api/tbel/TbDate.java | 2 +- .../src/main/java/org/thingsboard/script/api/tbel/TbJson.java | 2 +- .../src/main/java/org/thingsboard/script/api/tbel/TbUtils.java | 2 +- .../org/thingsboard/script/api/tbel/TbelInvokeService.java | 2 +- .../main/java/org/thingsboard/script/api/tbel/TbelScript.java | 2 +- .../thingsboard/script/api/tbel/TbelScriptExecutionTask.java | 2 +- .../org/thingsboard/script/api/tbel/TbDateConstructorTest.java | 2 +- .../test/java/org/thingsboard/script/api/tbel/TbDateTest.java | 2 +- .../java/org/thingsboard/script/api/tbel/TbDateTestEntity.java | 2 +- .../test/java/org/thingsboard/script/api/tbel/TbUtilsTest.java | 2 +- common/stats/pom.xml | 2 +- .../org/thingsboard/server/common/stats/DefaultCounter.java | 2 +- .../thingsboard/server/common/stats/DefaultMessagesStats.java | 2 +- .../thingsboard/server/common/stats/DefaultStatsFactory.java | 2 +- .../thingsboard/server/common/stats/FstStatsServiceImpl.java | 2 +- .../org/thingsboard/server/common/stats/MessagesStats.java | 2 +- .../java/org/thingsboard/server/common/stats/StatsCounter.java | 2 +- .../java/org/thingsboard/server/common/stats/StatsFactory.java | 2 +- .../java/org/thingsboard/server/common/stats/StatsTimer.java | 2 +- .../java/org/thingsboard/server/common/stats/StatsType.java | 2 +- .../server/common/stats/TbApiUsageReportClient.java | 2 +- .../thingsboard/server/common/stats/TbApiUsageStateClient.java | 2 +- common/transport/coap/pom.xml | 2 +- .../server/transport/coap/AbstractCoapTransportResource.java | 2 +- .../thingsboard/server/transport/coap/CoapSessionMsgType.java | 2 +- .../server/transport/coap/CoapTransportContext.java | 2 +- .../server/transport/coap/CoapTransportResource.java | 2 +- .../server/transport/coap/CoapTransportService.java | 2 +- .../server/transport/coap/OtaPackageTransportResource.java | 2 +- .../server/transport/coap/TbCoapMessageObserver.java | 2 +- .../server/transport/coap/TransportConfigurationContainer.java | 2 +- .../server/transport/coap/adaptors/CoapAdaptorUtils.java | 2 +- .../server/transport/coap/adaptors/CoapTransportAdaptor.java | 2 +- .../server/transport/coap/adaptors/JsonCoapAdaptor.java | 2 +- .../server/transport/coap/adaptors/ProtoCoapAdaptor.java | 2 +- .../transport/coap/callback/AbstractSyncSessionCallback.java | 2 +- .../server/transport/coap/callback/CoapDeviceAuthCallback.java | 2 +- .../server/transport/coap/callback/CoapEfentoCallback.java | 2 +- .../server/transport/coap/callback/CoapNoOpCallback.java | 2 +- .../server/transport/coap/callback/CoapResponseCallback.java | 2 +- .../transport/coap/callback/CoapResponseCodeCallback.java | 2 +- .../coap/callback/GetAttributesSyncSessionCallback.java | 2 +- .../coap/callback/ToServerRpcSyncSessionCallback.java | 2 +- .../server/transport/coap/client/CoapClientContext.java | 2 +- .../server/transport/coap/client/DefaultCoapClientContext.java | 2 +- .../thingsboard/server/transport/coap/client/NoSecClient.java | 2 +- .../server/transport/coap/client/NoSecObserveClient.java | 2 +- .../server/transport/coap/client/SecureClientNoAuth.java | 2 +- .../server/transport/coap/client/SecureClientX509.java | 2 +- .../server/transport/coap/client/TbCoapClientState.java | 2 +- .../server/transport/coap/client/TbCoapContentFormatUtil.java | 2 +- .../server/transport/coap/client/TbCoapObservationState.java | 2 +- .../transport/coap/efento/CoapEfentoTransportResource.java | 2 +- .../transport/coap/efento/adaptor/EfentoCoapAdaptor.java | 2 +- .../server/transport/coap/efento/utils/CoapEfentoUtils.java | 2 +- .../server/transport/coap/efento/utils/PulseCounterType.java | 2 +- common/transport/coap/src/main/proto/efento/proto_config.proto | 2 +- .../coap/src/main/proto/efento/proto_device_info.proto | 2 +- .../coap/src/main/proto/efento/proto_measurement_types.proto | 2 +- .../coap/src/main/proto/efento/proto_measurements.proto | 2 +- common/transport/coap/src/main/proto/efento/proto_rule.proto | 2 +- .../server/transport/coap/CoapTransportResourceTest.java | 2 +- .../transport/coap/efento/CoapEfentoTransportResourceTest.java | 2 +- common/transport/http/pom.xml | 2 +- .../thingsboard/server/transport/http/DeviceApiController.java | 2 +- .../server/transport/http/HttpTransportContext.java | 2 +- .../server/transport/http/config/PayloadSizeFilter.java | 2 +- .../transport/http/config/TransportSecurityConfiguration.java | 2 +- .../server/transport/http/DeviceApiControllerTest.java | 2 +- common/transport/lwm2m/pom.xml | 2 +- .../lwm2m/bootstrap/LwM2MTransportBootstrapService.java | 2 +- .../transport/lwm2m/bootstrap/secure/LwM2MBootstrapConfig.java | 2 +- .../lwm2m/bootstrap/secure/LwM2MBootstrapServers.java | 2 +- .../transport/lwm2m/bootstrap/secure/LwM2MServerBootstrap.java | 2 +- .../bootstrap/secure/LwM2mDefaultBootstrapSessionManager.java | 2 +- .../secure/TbLwM2MDtlsBootstrapCertificateVerifier.java | 2 +- .../lwm2m/bootstrap/store/LwM2MBootstrapClientInstanceIds.java | 2 +- .../bootstrap/store/LwM2MBootstrapConfigStoreTaskProvider.java | 2 +- .../lwm2m/bootstrap/store/LwM2MBootstrapSecurityStore.java | 2 +- .../lwm2m/bootstrap/store/LwM2MBootstrapTaskProvider.java | 2 +- .../lwm2m/bootstrap/store/LwM2MConfigurationChecker.java | 2 +- .../bootstrap/store/LwM2MInMemoryBootstrapConfigStore.java | 2 +- .../server/transport/lwm2m/config/LwM2MSecureServerConfig.java | 2 +- .../transport/lwm2m/config/LwM2MTransportBootstrapConfig.java | 2 +- .../transport/lwm2m/config/LwM2MTransportServerConfig.java | 2 +- .../server/transport/lwm2m/config/TbLwM2mVersion.java | 2 +- .../lwm2m/secure/LwM2mCredentialsSecurityInfoValidator.java | 2 +- .../server/transport/lwm2m/secure/LwM2mRPkCredentials.java | 2 +- .../server/transport/lwm2m/secure/TbLwM2MAuthorizer.java | 2 +- .../transport/lwm2m/secure/TbLwM2MDtlsCertificateVerifier.java | 2 +- .../server/transport/lwm2m/secure/TbLwM2MSecurityInfo.java | 2 +- .../server/transport/lwm2m/secure/TbX509DtlsSessionInfo.java | 2 +- .../lwm2m/secure/credentials/LwM2MClientCredentials.java | 2 +- .../transport/lwm2m/server/AbstractLwM2mTransportResource.java | 2 +- .../transport/lwm2m/server/DefaultLwM2mTransportService.java | 2 +- .../server/transport/lwm2m/server/LwM2MNetworkConfig.java | 2 +- .../server/transport/lwm2m/server/LwM2MOperationType.java | 2 +- .../server/transport/lwm2m/server/LwM2MTransportService.java | 2 +- .../server/transport/lwm2m/server/LwM2mOtaConvert.java | 2 +- .../server/transport/lwm2m/server/LwM2mQueuedRequest.java | 2 +- .../server/transport/lwm2m/server/LwM2mServerListener.java | 2 +- .../server/transport/lwm2m/server/LwM2mSessionMsgListener.java | 2 +- .../transport/lwm2m/server/LwM2mTransportCoapResource.java | 2 +- .../server/transport/lwm2m/server/LwM2mTransportContext.java | 2 +- .../transport/lwm2m/server/LwM2mTransportServerHelper.java | 2 +- .../transport/lwm2m/server/LwM2mVersionedModelProvider.java | 2 +- .../transport/lwm2m/server/adaptors/LwM2MJsonAdaptor.java | 2 +- .../transport/lwm2m/server/adaptors/LwM2MTransportAdaptor.java | 2 +- .../lwm2m/server/attributes/DefaultLwM2MAttributesService.java | 2 +- .../lwm2m/server/attributes/LwM2MAttributesService.java | 2 +- .../transport/lwm2m/server/client/LwM2MAuthException.java | 2 +- .../server/transport/lwm2m/server/client/LwM2MClientState.java | 2 +- .../lwm2m/server/client/LwM2MClientStateException.java | 2 +- .../server/transport/lwm2m/server/client/LwM2mClient.java | 2 +- .../transport/lwm2m/server/client/LwM2mClientContext.java | 2 +- .../transport/lwm2m/server/client/LwM2mClientContextImpl.java | 2 +- .../server/transport/lwm2m/server/client/ModelObject.java | 2 +- .../transport/lwm2m/server/client/ParametersAnalyzeResult.java | 2 +- .../server/transport/lwm2m/server/client/ResourceValue.java | 2 +- .../transport/lwm2m/server/client/ResultsAddKeyValueProto.java | 2 +- .../lwm2m/server/common/LwM2MExecutorAwareService.java | 2 +- .../lwm2m/server/downlink/AbstractTbLwM2MRequestCallback.java | 2 +- .../downlink/AbstractTbLwM2MTargetedDownlinkRequest.java | 2 +- .../lwm2m/server/downlink/DefaultLwM2mDownlinkMsgHandler.java | 2 +- .../lwm2m/server/downlink/DownlinkRequestCallback.java | 2 +- .../transport/lwm2m/server/downlink/HasContentFormat.java | 2 +- .../server/transport/lwm2m/server/downlink/HasVersionedId.java | 2 +- .../transport/lwm2m/server/downlink/HasVersionedIds.java | 2 +- .../lwm2m/server/downlink/LwM2mDownlinkMsgHandler.java | 2 +- .../lwm2m/server/downlink/TbLwM2MCancelAllObserveCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MCancelAllRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MCancelObserveCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MCancelObserveRequest.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MCreateRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MCreateResponseCallback.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MDeleteCallback.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MDeleteRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MDiscoverAllRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MDiscoverCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MDiscoverRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MDownlinkRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MExecuteCallback.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MExecuteRequest.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MLatchCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MObserveAllRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MObserveCallback.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MObserveRequest.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MReadCallback.java | 2 +- .../transport/lwm2m/server/downlink/TbLwM2MReadRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MTargetedCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MUplinkTargetedCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MWriteAttributesCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MWriteAttributesRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MWriteReplaceRequest.java | 2 +- .../lwm2m/server/downlink/TbLwM2MWriteResponseCallback.java | 2 +- .../lwm2m/server/downlink/TbLwM2MWriteUpdateRequest.java | 2 +- .../AbstractTbLwM2MTargetedDownlinkCompositeRequest.java | 2 +- .../composite/TbLwM2MCancelObserveCompositeCallback.java | 2 +- .../composite/TbLwM2MCancelObserveCompositeRequest.java | 2 +- .../downlink/composite/TbLwM2MObserveCompositeCallback.java | 2 +- .../downlink/composite/TbLwM2MObserveCompositeRequest.java | 2 +- .../downlink/composite/TbLwM2MReadCompositeCallback.java | 2 +- .../server/downlink/composite/TbLwM2MReadCompositeRequest.java | 2 +- .../downlink/composite/TbLwM2MWriteCompositeRequest.java | 2 +- .../composite/TbLwM2MWriteResponseCompositeCallback.java | 2 +- .../lwm2m/server/log/DefaultLwM2MTelemetryLogService.java | 2 +- .../transport/lwm2m/server/log/LwM2MTelemetryLogService.java | 2 +- .../server/transport/lwm2m/server/model/LwM2MModelConfig.java | 2 +- .../transport/lwm2m/server/model/LwM2MModelConfigService.java | 2 +- .../lwm2m/server/model/LwM2MModelConfigServiceImpl.java | 2 +- .../lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java | 2 +- .../server/transport/lwm2m/server/ota/LwM2MClientOtaInfo.java | 2 +- .../server/transport/lwm2m/server/ota/LwM2MClientOtaState.java | 2 +- .../transport/lwm2m/server/ota/LwM2MOtaUpdateService.java | 2 +- .../lwm2m/server/ota/firmware/FirmwareDeliveryMethod.java | 2 +- .../lwm2m/server/ota/firmware/FirmwareUpdateResult.java | 2 +- .../lwm2m/server/ota/firmware/FirmwareUpdateState.java | 2 +- .../lwm2m/server/ota/firmware/LwM2MClientFwOtaInfo.java | 2 +- .../lwm2m/server/ota/firmware/LwM2MFirmwareUpdateStrategy.java | 2 +- .../lwm2m/server/ota/software/LwM2MClientSwOtaInfo.java | 2 +- .../lwm2m/server/ota/software/LwM2MSoftwareUpdateStrategy.java | 2 +- .../lwm2m/server/ota/software/SoftwareUpdateResult.java | 2 +- .../lwm2m/server/ota/software/SoftwareUpdateState.java | 2 +- .../lwm2m/server/rpc/DefaultLwM2MRpcRequestHandler.java | 2 +- .../transport/lwm2m/server/rpc/LwM2MRpcRequestHandler.java | 2 +- .../transport/lwm2m/server/rpc/LwM2MRpcRequestHeader.java | 2 +- .../transport/lwm2m/server/rpc/LwM2MRpcResponseBody.java | 2 +- .../lwm2m/server/rpc/RpcCancelAllObserveCallback.java | 2 +- .../transport/lwm2m/server/rpc/RpcCancelObserveCallback.java | 2 +- .../server/transport/lwm2m/server/rpc/RpcCreateRequest.java | 2 +- .../transport/lwm2m/server/rpc/RpcCreateResponseCallback.java | 2 +- .../server/transport/lwm2m/server/rpc/RpcDiscoverCallback.java | 2 +- .../lwm2m/server/rpc/RpcDownlinkRequestCallbackProxy.java | 2 +- .../transport/lwm2m/server/rpc/RpcEmptyResponseCallback.java | 2 +- .../server/transport/lwm2m/server/rpc/RpcLinkSetCallback.java | 2 +- .../transport/lwm2m/server/rpc/RpcLwM2MDownlinkCallback.java | 2 +- .../transport/lwm2m/server/rpc/RpcReadResponseCallback.java | 2 +- .../transport/lwm2m/server/rpc/RpcWriteAttributesRequest.java | 2 +- .../transport/lwm2m/server/rpc/RpcWriteReplaceRequest.java | 2 +- .../transport/lwm2m/server/rpc/RpcWriteUpdateRequest.java | 2 +- .../rpc/composite/RpcCancelObserveCompositeCallback.java | 2 +- .../rpc/composite/RpcObserveResponseCompositeCallback.java | 2 +- .../lwm2m/server/rpc/composite/RpcReadCompositeRequest.java | 2 +- .../server/rpc/composite/RpcReadResponseCompositeCallback.java | 2 +- .../lwm2m/server/rpc/composite/RpcWriteCompositeRequest.java | 2 +- .../lwm2m/server/session/DefaultLwM2MSessionManager.java | 2 +- .../transport/lwm2m/server/session/LwM2MSessionManager.java | 2 +- .../lwm2m/server/store/TbDummyLwM2MClientOtaInfoStore.java | 2 +- .../transport/lwm2m/server/store/TbDummyLwM2MClientStore.java | 2 +- .../lwm2m/server/store/TbDummyLwM2MModelConfigStore.java | 2 +- .../transport/lwm2m/server/store/TbEditableSecurityStore.java | 2 +- .../lwm2m/server/store/TbInMemoryRegistrationStore.java | 2 +- .../transport/lwm2m/server/store/TbInMemorySecurityStore.java | 2 +- .../lwm2m/server/store/TbL2M2MDtlsSessionInMemoryStore.java | 2 +- .../lwm2m/server/store/TbLwM2MClientOtaInfoStore.java | 2 +- .../transport/lwm2m/server/store/TbLwM2MClientStore.java | 2 +- .../lwm2m/server/store/TbLwM2MDtlsSessionRedisStore.java | 2 +- .../transport/lwm2m/server/store/TbLwM2MDtlsSessionStore.java | 2 +- .../transport/lwm2m/server/store/TbLwM2MModelConfigStore.java | 2 +- .../lwm2m/server/store/TbLwM2mRedisClientOtaInfoStore.java | 2 +- .../lwm2m/server/store/TbLwM2mRedisRegistrationStore.java | 2 +- .../lwm2m/server/store/TbLwM2mRedisSecurityStore.java | 2 +- .../transport/lwm2m/server/store/TbLwM2mSecurityStore.java | 2 +- .../transport/lwm2m/server/store/TbLwM2mStoreFactory.java | 2 +- .../transport/lwm2m/server/store/TbMainSecurityStore.java | 2 +- .../transport/lwm2m/server/store/TbRedisLwM2MClientStore.java | 2 +- .../lwm2m/server/store/TbRedisLwM2MModelConfigStore.java | 2 +- .../server/transport/lwm2m/server/store/TbSecurityStore.java | 2 +- .../transport/lwm2m/server/store/util/LwM2MClientSerDes.java | 2 +- .../lwm2m/server/uplink/DefaultLwM2mUplinkMsgHandler.java | 2 +- .../server/transport/lwm2m/server/uplink/LwM2mTypeServer.java | 2 +- .../transport/lwm2m/server/uplink/LwM2mUplinkMsgHandler.java | 2 +- .../server/transport/lwm2m/utils/LwM2MTransportUtil.java | 2 +- .../server/transport/lwm2m/utils/LwM2mValueConverterImpl.java | 2 +- .../server/transport/lwm2m/server/client/LwM2mClientTest.java | 2 +- .../lwm2m/server/model/LwM2MModelConfigServiceImplTest.java | 2 +- .../lwm2m/server/store/util/LwM2MClientSerDesTest.java | 2 +- common/transport/mqtt/pom.xml | 2 +- .../transport/mqtt/DefaultTransportMBeanConfiguration.java | 2 +- .../org/thingsboard/server/transport/mqtt/HashMapObserver.java | 2 +- .../server/transport/mqtt/HashMapObserverMBean.java | 2 +- .../server/transport/mqtt/MqttSslHandlerProvider.java | 2 +- .../server/transport/mqtt/MqttTransportContext.java | 2 +- .../server/transport/mqtt/MqttTransportHandler.java | 2 +- .../server/transport/mqtt/MqttTransportServerInitializer.java | 2 +- .../server/transport/mqtt/MqttTransportService.java | 2 +- .../server/transport/mqtt/TbMqttTransportComponent.java | 2 +- .../java/org/thingsboard/server/transport/mqtt/TopicType.java | 2 +- .../transport/mqtt/adaptors/BackwardCompatibilityAdaptor.java | 2 +- .../server/transport/mqtt/adaptors/JsonMqttAdaptor.java | 2 +- .../server/transport/mqtt/adaptors/MqttTransportAdaptor.java | 2 +- .../server/transport/mqtt/adaptors/ProtoMqttAdaptor.java | 2 +- .../server/transport/mqtt/gateway/GatewayMetricsService.java | 2 +- .../transport/mqtt/gateway/metrics/GatewayMetricsState.java | 2 +- .../server/transport/mqtt/limits/GatewaySessionLimits.java | 2 +- .../org/thingsboard/server/transport/mqtt/limits/IpFilter.java | 2 +- .../server/transport/mqtt/limits/ProxyIpFilter.java | 2 +- .../server/transport/mqtt/limits/SessionLimits.java | 2 +- .../mqtt/session/AbstractGatewayDeviceSessionContext.java | 2 +- .../transport/mqtt/session/AbstractGatewaySessionHandler.java | 2 +- .../server/transport/mqtt/session/DeviceSessionCtx.java | 2 +- .../transport/mqtt/session/GatewayDeviceSessionContext.java | 2 +- .../server/transport/mqtt/session/GatewaySessionHandler.java | 2 +- .../transport/mqtt/session/MqttDeviceAwareSessionContext.java | 2 +- .../server/transport/mqtt/session/MqttTopicMatcher.java | 2 +- .../transport/mqtt/session/SparkplugDeviceSessionContext.java | 2 +- .../transport/mqtt/session/SparkplugNodeSessionHandler.java | 2 +- .../server/transport/mqtt/util/AlwaysTrueTopicFilter.java | 2 +- .../server/transport/mqtt/util/EqualsTopicFilter.java | 2 +- .../server/transport/mqtt/util/MqttTopicFilter.java | 2 +- .../server/transport/mqtt/util/MqttTopicFilterFactory.java | 2 +- .../server/transport/mqtt/util/RegexTopicFilter.java | 2 +- .../server/transport/mqtt/util/ReturnCodeResolver.java | 2 +- .../server/transport/mqtt/util/sparkplug/MetricDataType.java | 2 +- .../mqtt/util/sparkplug/SparkplugConnectionState.java | 2 +- .../transport/mqtt/util/sparkplug/SparkplugMessageType.java | 2 +- .../transport/mqtt/util/sparkplug/SparkplugMetricUtil.java | 2 +- .../mqtt/util/sparkplug/SparkplugRpcRequestHeader.java | 2 +- .../mqtt/util/sparkplug/SparkplugRpcResponseBody.java | 2 +- .../server/transport/mqtt/util/sparkplug/SparkplugTopic.java | 2 +- .../transport/mqtt/util/sparkplug/SparkplugTopicUtil.java | 2 +- common/transport/mqtt/src/main/proto/sparkplug.proto | 2 +- .../server/transport/mqtt/MqttTransportHandlerTest.java | 2 +- .../transport/mqtt/session/GatewaySessionHandlerTest.java | 2 +- .../server/transport/mqtt/util/MqttTopicFilterFactoryTest.java | 2 +- common/transport/pom.xml | 2 +- common/transport/snmp/pom.xml | 2 +- .../server/transport/snmp/SnmpTransportContext.java | 2 +- .../transport/snmp/event/ServiceListChangedEventListener.java | 2 +- .../transport/snmp/event/SnmpTransportListChangedEvent.java | 2 +- .../snmp/event/SnmpTransportListChangedEventListener.java | 2 +- .../thingsboard/server/transport/snmp/service/PduService.java | 2 +- .../transport/snmp/service/ProtoTransportEntityService.java | 2 +- .../server/transport/snmp/service/SnmpAuthService.java | 2 +- .../transport/snmp/service/SnmpTransportBalancingService.java | 2 +- .../server/transport/snmp/service/SnmpTransportService.java | 2 +- .../server/transport/snmp/session/DeviceSessionContext.java | 2 +- .../server/transport/snmp/session/ScheduledTask.java | 2 +- .../server/transport/snmp/SnmpDeviceSimulatorV2.java | 2 +- .../server/transport/snmp/SnmpDeviceSimulatorV3.java | 2 +- .../java/org/thingsboard/server/transport/snmp/SnmpTestV2.java | 2 +- .../java/org/thingsboard/server/transport/snmp/SnmpTestV3.java | 2 +- common/transport/transport-api/pom.xml | 2 +- .../server/common/transport/DeviceDeletedEvent.java | 2 +- .../server/common/transport/DeviceProfileUpdatedEvent.java | 2 +- .../server/common/transport/DeviceUpdatedEvent.java | 2 +- .../server/common/transport/SessionMsgListener.java | 2 +- .../thingsboard/server/common/transport/TransportAdaptor.java | 2 +- .../thingsboard/server/common/transport/TransportContext.java | 2 +- .../server/common/transport/TransportDeviceProfileCache.java | 2 +- .../server/common/transport/TransportResourceCache.java | 2 +- .../thingsboard/server/common/transport/TransportService.java | 2 +- .../server/common/transport/TransportServiceCallback.java | 2 +- .../server/common/transport/TransportTenantProfileCache.java | 2 +- .../common/transport/activity/AbstractActivityManager.java | 2 +- .../server/common/transport/activity/ActivityManager.java | 2 +- .../common/transport/activity/ActivityReportCallback.java | 2 +- .../server/common/transport/activity/ActivityState.java | 2 +- .../common/transport/activity/strategy/ActivityStrategy.java | 2 +- .../transport/activity/strategy/ActivityStrategyType.java | 2 +- .../transport/activity/strategy/AllEventsActivityStrategy.java | 2 +- .../activity/strategy/FirstAndLastEventActivityStrategy.java | 2 +- .../activity/strategy/FirstEventActivityStrategy.java | 2 +- .../transport/activity/strategy/LastEventActivityStrategy.java | 2 +- .../server/common/transport/auth/DeviceAuthResult.java | 2 +- .../server/common/transport/auth/DeviceAuthService.java | 2 +- .../server/common/transport/auth/DeviceProfileAware.java | 2 +- .../transport/auth/GetOrCreateDeviceFromGatewayResponse.java | 2 +- .../server/common/transport/auth/SessionInfoCreator.java | 2 +- .../server/common/transport/auth/TransportDeviceInfo.java | 2 +- .../transport/auth/ValidateDeviceCredentialsResponse.java | 2 +- .../common/transport/config/ssl/AbstractSslCredentials.java | 2 +- .../common/transport/config/ssl/KeystoreSslCredentials.java | 2 +- .../server/common/transport/config/ssl/PemSslCredentials.java | 2 +- .../server/common/transport/config/ssl/SslCredentials.java | 2 +- .../common/transport/config/ssl/SslCredentialsConfig.java | 2 +- .../server/common/transport/config/ssl/SslCredentialsType.java | 2 +- .../config/ssl/SslCredentialsWebServerCustomizer.java | 2 +- .../common/transport/limits/DefaultEntityLimitsCache.java | 2 +- .../transport/limits/DefaultTransportRateLimitService.java | 2 +- .../common/transport/limits/DummyTransportRateLimit.java | 2 +- .../server/common/transport/limits/EntityLimitKey.java | 2 +- .../server/common/transport/limits/EntityLimitsCache.java | 2 +- .../common/transport/limits/EntityTransportRateLimits.java | 2 +- .../common/transport/limits/InetAddressRateLimitStats.java | 2 +- .../common/transport/limits/SimpleTransportRateLimit.java | 2 +- .../server/common/transport/limits/TransportLimitsType.java | 2 +- .../server/common/transport/limits/TransportRateLimit.java | 2 +- .../common/transport/limits/TransportRateLimitService.java | 2 +- .../common/transport/profile/TenantProfileUpdateResult.java | 2 +- .../transport/service/DefaultTransportDeviceProfileCache.java | 2 +- .../transport/service/DefaultTransportResourceCache.java | 2 +- .../common/transport/service/DefaultTransportService.java | 2 +- .../transport/service/DefaultTransportTenantProfileCache.java | 2 +- .../server/common/transport/service/RpcRequestMetadata.java | 2 +- .../server/common/transport/service/SessionMetaData.java | 2 +- .../common/transport/service/ToRuleEngineMsgEncoder.java | 2 +- .../transport/service/ToTransportMsgResponseDecoder.java | 2 +- .../common/transport/service/TransportActivityManager.java | 2 +- .../common/transport/service/TransportApiRequestEncoder.java | 2 +- .../common/transport/service/TransportApiResponseDecoder.java | 2 +- .../transport/service/TransportQueueRoutingInfoService.java | 2 +- .../transport/service/TransportTenantRoutingInfoService.java | 2 +- .../common/transport/session/DeviceAwareSessionContext.java | 2 +- .../server/common/transport/session/SessionContext.java | 2 +- .../thingsboard/server/common/transport/util/JsonUtils.java | 2 +- .../org/thingsboard/server/common/transport/util/SslUtil.java | 2 +- .../transport/activity/strategy/ActivityStrategyTypeTest.java | 2 +- .../activity/strategy/AllEventsActivityStrategyTest.java | 2 +- .../strategy/FirstAndLastEventActivityStrategyTest.java | 2 +- .../activity/strategy/FirstEventActivityStrategyTest.java | 2 +- .../activity/strategy/LastEventActivityStrategyTest.java | 2 +- .../common/transport/service/TransportActivityManagerTest.java | 2 +- common/util/pom.xml | 2 +- .../org/thingsboard/common/util/AbstractListeningExecutor.java | 2 +- .../main/java/org/thingsboard/common/util/AzureIotHubUtil.java | 2 +- .../main/java/org/thingsboard/common/util/DebugModeUtil.java | 2 +- .../java/org/thingsboard/common/util/DeduplicationUtil.java | 2 +- .../main/java/org/thingsboard/common/util/DonAsynchron.java | 2 +- .../main/java/org/thingsboard/common/util/ExceptionUtil.java | 2 +- .../java/org/thingsboard/common/util/ExecutorProvider.java | 2 +- .../src/main/java/org/thingsboard/common/util/JacksonUtil.java | 2 +- .../util/src/main/java/org/thingsboard/common/util/KvUtil.java | 2 +- .../org/thingsboard/common/util/LinkedHashMapRemoveEldest.java | 2 +- .../java/org/thingsboard/common/util/ListeningExecutor.java | 2 +- .../src/main/java/org/thingsboard/common/util/RegexUtils.java | 2 +- .../src/main/java/org/thingsboard/common/util/SslUtil.java | 2 +- .../src/main/java/org/thingsboard/common/util/SystemUtil.java | 2 +- .../src/main/java/org/thingsboard/common/util/TbStopWatch.java | 2 +- .../java/org/thingsboard/common/util/ThingsBoardExecutors.java | 2 +- .../common/util/ThingsBoardForkJoinWorkerThreadFactory.java | 2 +- .../common/util/ThingsBoardScheduledThreadPoolExecutor.java | 2 +- .../org/thingsboard/common/util/ThingsBoardThreadFactory.java | 2 +- .../java/org/thingsboard/common/util/ExceptionUtilTest.java | 2 +- .../test/java/org/thingsboard/common/util/JacksonUtilTest.java | 2 +- .../thingsboard/common/util/LinkedHashMapRemoveEldestTest.java | 2 +- .../util/ThingsBoardScheduledThreadPoolExecutorTest.java | 2 +- common/version-control/pom.xml | 2 +- .../server/service/sync/vc/ClusterVersionControlService.java | 2 +- .../service/sync/vc/DefaultClusterVersionControlService.java | 2 +- .../server/service/sync/vc/DefaultGitRepositoryService.java | 2 +- .../org/thingsboard/server/service/sync/vc/GitRepository.java | 2 +- .../server/service/sync/vc/GitRepositoryService.java | 2 +- .../org/thingsboard/server/service/sync/vc/PendingCommit.java | 2 +- .../server/service/sync/vc/VersionControlRequestCtx.java | 2 +- dao/pom.xml | 2 +- .../server/dao/AbstractVersionedInsertRepository.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/Dao.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/DaoUtil.java | 2 +- .../java/org/thingsboard/server/dao/ExportableEntityDao.java | 2 +- .../org/thingsboard/server/dao/ExportableEntityRepository.java | 2 +- .../java/org/thingsboard/server/dao/ImageContainerDao.java | 2 +- .../main/java/org/thingsboard/server/dao/TenantEntityDao.java | 2 +- .../org/thingsboard/server/dao/TenantEntityWithDataDao.java | 2 +- .../thingsboard/server/dao/ThingsboardPostgreSQLDialect.java | 2 +- .../java/org/thingsboard/server/dao/alarm/AlarmCommentDao.java | 2 +- .../main/java/org/thingsboard/server/dao/alarm/AlarmDao.java | 2 +- .../server/dao/alarm/AlarmTypesCacheEvictEvent.java | 2 +- .../thingsboard/server/dao/alarm/AlarmTypesCaffeineCache.java | 2 +- .../org/thingsboard/server/dao/alarm/AlarmTypesRedisCache.java | 2 +- .../thingsboard/server/dao/alarm/BaseAlarmCommentService.java | 2 +- .../org/thingsboard/server/dao/alarm/BaseAlarmService.java | 2 +- .../java/org/thingsboard/server/dao/aspect/DbCallStats.java | 2 +- .../org/thingsboard/server/dao/aspect/DbCallStatsSnapshot.java | 2 +- .../org/thingsboard/server/dao/aspect/MethodCallStats.java | 2 +- .../thingsboard/server/dao/aspect/MethodCallStatsSnapshot.java | 2 +- .../org/thingsboard/server/dao/aspect/SqlDaoCallsAspect.java | 2 +- .../org/thingsboard/server/dao/asset/AssetCacheEvictEvent.java | 2 +- .../java/org/thingsboard/server/dao/asset/AssetCacheKey.java | 2 +- .../org/thingsboard/server/dao/asset/AssetCaffeineCache.java | 2 +- .../main/java/org/thingsboard/server/dao/asset/AssetDao.java | 2 +- .../org/thingsboard/server/dao/asset/AssetProfileCacheKey.java | 2 +- .../server/dao/asset/AssetProfileCaffeineCache.java | 2 +- .../java/org/thingsboard/server/dao/asset/AssetProfileDao.java | 2 +- .../thingsboard/server/dao/asset/AssetProfileEvictEvent.java | 2 +- .../thingsboard/server/dao/asset/AssetProfileRedisCache.java | 2 +- .../thingsboard/server/dao/asset/AssetProfileServiceImpl.java | 2 +- .../java/org/thingsboard/server/dao/asset/AssetRedisCache.java | 2 +- .../java/org/thingsboard/server/dao/asset/AssetTypeFilter.java | 2 +- .../org/thingsboard/server/dao/asset/BaseAssetService.java | 2 +- .../thingsboard/server/dao/attributes/AttributeCacheKey.java | 2 +- .../server/dao/attributes/AttributeCaffeineCache.java | 2 +- .../thingsboard/server/dao/attributes/AttributeRedisCache.java | 2 +- .../org/thingsboard/server/dao/attributes/AttributeUtils.java | 2 +- .../org/thingsboard/server/dao/attributes/AttributesDao.java | 2 +- .../server/dao/attributes/BaseAttributesService.java | 2 +- .../server/dao/attributes/CachedAttributesService.java | 2 +- .../java/org/thingsboard/server/dao/audit/AuditLogDao.java | 2 +- .../org/thingsboard/server/dao/audit/AuditLogLevelFilter.java | 2 +- .../org/thingsboard/server/dao/audit/AuditLogLevelMask.java | 2 +- .../thingsboard/server/dao/audit/AuditLogLevelProperties.java | 2 +- .../org/thingsboard/server/dao/audit/AuditLogServiceImpl.java | 2 +- .../thingsboard/server/dao/audit/DummyAuditLogServiceImpl.java | 2 +- .../org/thingsboard/server/dao/audit/sink/AuditLogSink.java | 2 +- .../thingsboard/server/dao/audit/sink/DummyAuditLogSink.java | 2 +- .../server/dao/audit/sink/ElasticsearchAuditLogSink.java | 2 +- .../org/thingsboard/server/dao/cache/CacheExecutorService.java | 2 +- .../server/dao/component/BaseComponentDescriptorService.java | 2 +- .../server/dao/component/ComponentDescriptorDao.java | 2 +- .../server/dao/config/DedicatedEventsDataSource.java | 2 +- .../server/dao/config/DedicatedEventsJpaDaoConfig.java | 2 +- .../org/thingsboard/server/dao/config/DefaultDataSource.java | 2 +- .../server/dao/config/DefaultDedicatedJpaDaoConfig.java | 2 +- .../java/org/thingsboard/server/dao/config/JpaDaoConfig.java | 2 +- .../java/org/thingsboard/server/dao/config/SqlTsDaoConfig.java | 2 +- .../thingsboard/server/dao/config/SqlTsLatestDaoConfig.java | 2 +- .../org/thingsboard/server/dao/config/TimescaleDaoConfig.java | 2 +- .../server/dao/config/TimescaleTsLatestDaoConfig.java | 2 +- .../java/org/thingsboard/server/dao/customer/CustomerDao.java | 2 +- .../thingsboard/server/dao/customer/CustomerServiceImpl.java | 2 +- .../org/thingsboard/server/dao/dashboard/DashboardDao.java | 2 +- .../org/thingsboard/server/dao/dashboard/DashboardInfoDao.java | 2 +- .../thingsboard/server/dao/dashboard/DashboardServiceImpl.java | 2 +- .../server/dao/dashboard/DashboardTitleEvictEvent.java | 2 +- .../server/dao/dashboard/DashboardTitlesCaffeineCache.java | 2 +- .../server/dao/dashboard/DashboardTitlesRedisCache.java | 2 +- .../java/org/thingsboard/server/dao/device/ClaimDataInfo.java | 2 +- .../server/dao/device/DeviceConnectivityConfiguration.java | 2 +- .../thingsboard/server/dao/device/DeviceConnectivityInfo.java | 2 +- .../server/dao/device/DeviceConnectivityServiceImpl.java | 2 +- .../server/dao/device/DeviceCredentialsCaffeineCache.java | 2 +- .../thingsboard/server/dao/device/DeviceCredentialsDao.java | 2 +- .../server/dao/device/DeviceCredentialsEvictEvent.java | 2 +- .../server/dao/device/DeviceCredentialsRedisCache.java | 2 +- .../server/dao/device/DeviceCredentialsServiceImpl.java | 2 +- .../main/java/org/thingsboard/server/dao/device/DeviceDao.java | 2 +- .../thingsboard/server/dao/device/DeviceProfileCacheKey.java | 2 +- .../server/dao/device/DeviceProfileCaffeineCache.java | 2 +- .../org/thingsboard/server/dao/device/DeviceProfileDao.java | 2 +- .../thingsboard/server/dao/device/DeviceProfileEvictEvent.java | 2 +- .../thingsboard/server/dao/device/DeviceProfileRedisCache.java | 2 +- .../server/dao/device/DeviceProfileServiceImpl.java | 2 +- .../org/thingsboard/server/dao/device/DeviceServiceImpl.java | 2 +- .../thingsboard/server/dao/dictionary/KeyDictionaryDao.java | 2 +- .../main/java/org/thingsboard/server/dao/domain/DomainDao.java | 2 +- .../org/thingsboard/server/dao/domain/DomainServiceImpl.java | 2 +- .../org/thingsboard/server/dao/edge/BaseEdgeEventService.java | 2 +- .../thingsboard/server/dao/edge/BaseRelatedEdgesService.java | 2 +- .../server/dao/edge/DefaultEdgeSynchronizationManager.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/edge/EdgeDao.java | 2 +- .../java/org/thingsboard/server/dao/edge/EdgeEventDao.java | 2 +- .../java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java | 2 +- .../thingsboard/server/dao/edge/EdgeSessionCaffeineCache.java | 2 +- .../org/thingsboard/server/dao/edge/EdgeSessionRedisCache.java | 2 +- .../thingsboard/server/dao/edge/PostgresEdgeEventService.java | 2 +- .../server/dao/entity/AbstractCachedEntityService.java | 2 +- .../thingsboard/server/dao/entity/AbstractCachedService.java | 2 +- .../thingsboard/server/dao/entity/AbstractEntityService.java | 2 +- .../thingsboard/server/dao/entity/BaseEntityCountService.java | 2 +- .../org/thingsboard/server/dao/entity/BaseEntityService.java | 2 +- .../server/dao/entity/CachedVersionedEntityService.java | 2 +- .../server/dao/entity/DefaultEntityServiceRegistry.java | 2 +- .../server/dao/entity/EntityCountCacheEvictEvent.java | 2 +- .../org/thingsboard/server/dao/entity/EntityCountCacheKey.java | 2 +- .../org/thingsboard/server/dao/entity/EntityDaoRegistry.java | 2 +- .../java/org/thingsboard/server/dao/entity/EntityQueryDao.java | 2 +- .../server/dao/entity/count/EntityCountCaffeineCache.java | 2 +- .../server/dao/entity/count/EntityCountRedisCache.java | 2 +- .../thingsboard/server/dao/entityview/EntityViewCacheKey.java | 2 +- .../server/dao/entityview/EntityViewCacheValue.java | 2 +- .../server/dao/entityview/EntityViewCaffeineCache.java | 2 +- .../org/thingsboard/server/dao/entityview/EntityViewDao.java | 2 +- .../server/dao/entityview/EntityViewEvictEvent.java | 2 +- .../server/dao/entityview/EntityViewRedisCache.java | 2 +- .../server/dao/entityview/EntityViewServiceImpl.java | 2 +- .../org/thingsboard/server/dao/event/BaseEventService.java | 2 +- .../main/java/org/thingsboard/server/dao/event/EventDao.java | 2 +- .../org/thingsboard/server/dao/eventsourcing/ActionCause.java | 2 +- .../server/dao/eventsourcing/ActionEntityEvent.java | 2 +- .../server/dao/eventsourcing/DeleteEntityEvent.java | 2 +- .../server/dao/eventsourcing/RelationActionEvent.java | 2 +- .../thingsboard/server/dao/eventsourcing/SaveEntityEvent.java | 2 +- .../thingsboard/server/dao/exception/BufferLimitException.java | 2 +- .../server/dao/exception/DataValidationException.java | 2 +- .../thingsboard/server/dao/exception/DatabaseException.java | 2 +- .../dao/exception/DeviceCredentialsValidationException.java | 2 +- .../server/dao/exception/EntitiesLimitException.java | 2 +- .../server/dao/exception/IncorrectParameterException.java | 2 +- .../org/thingsboard/server/dao/housekeeper/CleanUpService.java | 2 +- .../org/thingsboard/server/dao/mobile/MobileAppBundleDao.java | 2 +- .../server/dao/mobile/MobileAppBundleServiceImpl.java | 2 +- .../java/org/thingsboard/server/dao/mobile/MobileAppDao.java | 2 +- .../thingsboard/server/dao/mobile/MobileAppServiceImpl.java | 2 +- .../thingsboard/server/dao/mobile/QrCodeSettingService.java | 2 +- .../server/dao/mobile/QrCodeSettingServiceImpl.java | 2 +- .../server/dao/mobile/QrCodeSettingsCaffeineCache.java | 2 +- .../org/thingsboard/server/dao/mobile/QrCodeSettingsDao.java | 2 +- .../server/dao/mobile/QrCodeSettingsEvictEvent.java | 2 +- .../server/dao/mobile/QrCodeSettingsRedisCache.java | 2 +- .../main/java/org/thingsboard/server/dao/model/BaseEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/BaseSqlEntity.java | 2 +- .../org/thingsboard/server/dao/model/BaseVersionedEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/ModelConstants.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/model/ToData.java | 2 +- .../server/dao/model/sql/AbstractAlarmCommentEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AbstractAlarmEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AbstractAssetEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AbstractDeviceEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AbstractEdgeEntity.java | 2 +- .../server/dao/model/sql/AbstractEntityViewEntity.java | 2 +- .../server/dao/model/sql/AbstractMobileAppBundleEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AbstractTenantEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AbstractTsKvEntity.java | 2 +- .../server/dao/model/sql/AbstractWidgetTypeEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AdminSettingsEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AlarmCommentEntity.java | 2 +- .../server/dao/model/sql/AlarmCommentInfoEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/AlarmEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/AlarmInfoEntity.java | 2 +- .../thingsboard/server/dao/model/sql/ApiUsageStateEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/AssetEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/AssetInfoEntity.java | 2 +- .../thingsboard/server/dao/model/sql/AssetProfileEntity.java | 2 +- .../server/dao/model/sql/AttributeKvCompositeKey.java | 2 +- .../thingsboard/server/dao/model/sql/AttributeKvEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/AuditLogEntity.java | 2 +- .../server/dao/model/sql/ComponentDescriptorEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/CustomerEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/DashboardEntity.java | 2 +- .../thingsboard/server/dao/model/sql/DashboardInfoEntity.java | 2 +- .../server/dao/model/sql/DeviceCredentialsEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/DeviceEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/DeviceInfoEntity.java | 2 +- .../thingsboard/server/dao/model/sql/DeviceProfileEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/DomainEntity.java | 2 +- .../server/dao/model/sql/DomainOauth2ClientCompositeKey.java | 2 +- .../server/dao/model/sql/DomainOauth2ClientEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/EdgeEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/EdgeEventEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/EdgeInfoEntity.java | 2 +- .../server/dao/model/sql/EntityAlarmCompositeKey.java | 2 +- .../thingsboard/server/dao/model/sql/EntityAlarmEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/EntityViewEntity.java | 2 +- .../thingsboard/server/dao/model/sql/EntityViewInfoEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/ErrorEventEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/EventEntity.java | 2 +- .../thingsboard/server/dao/model/sql/LifecycleEventEntity.java | 2 +- .../server/dao/model/sql/MobileAppBundleEntity.java | 2 +- .../server/dao/model/sql/MobileAppBundleInfoEntity.java | 2 +- .../dao/model/sql/MobileAppBundleOauth2ClientEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/MobileAppEntity.java | 2 +- .../dao/model/sql/MobileAppOauth2ClientCompositeKey.java | 2 +- .../thingsboard/server/dao/model/sql/NotificationEntity.java | 2 +- .../server/dao/model/sql/NotificationRequestEntity.java | 2 +- .../server/dao/model/sql/NotificationRequestInfoEntity.java | 2 +- .../server/dao/model/sql/NotificationRuleEntity.java | 2 +- .../server/dao/model/sql/NotificationRuleInfoEntity.java | 2 +- .../server/dao/model/sql/NotificationTargetEntity.java | 2 +- .../server/dao/model/sql/NotificationTemplateEntity.java | 2 +- .../thingsboard/server/dao/model/sql/OAuth2ClientEntity.java | 2 +- .../server/dao/model/sql/OAuth2ClientInfoEntity.java | 2 +- .../dao/model/sql/OAuth2ClientRegistrationTemplateEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/OtaPackageEntity.java | 2 +- .../thingsboard/server/dao/model/sql/OtaPackageInfoEntity.java | 2 +- .../thingsboard/server/dao/model/sql/QrCodeSettingsEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/QueueEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/QueueStatsEntity.java | 2 +- .../thingsboard/server/dao/model/sql/RelationCompositeKey.java | 2 +- .../org/thingsboard/server/dao/model/sql/RelationEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/RpcEntity.java | 2 +- .../server/dao/model/sql/RuleChainDebugEventEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/RuleChainEntity.java | 2 +- .../server/dao/model/sql/RuleNodeDebugEventEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/RuleNodeEntity.java | 2 +- .../thingsboard/server/dao/model/sql/RuleNodeStateEntity.java | 2 +- .../server/dao/model/sql/StatisticsEventEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/TbResourceEntity.java | 2 +- .../thingsboard/server/dao/model/sql/TbResourceInfoEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/TenantEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/TenantInfoEntity.java | 2 +- .../thingsboard/server/dao/model/sql/TenantProfileEntity.java | 2 +- .../server/dao/model/sql/UserAuthSettingsEntity.java | 2 +- .../server/dao/model/sql/UserCredentialsEntity.java | 2 +- .../java/org/thingsboard/server/dao/model/sql/UserEntity.java | 2 +- .../thingsboard/server/dao/model/sql/UserSettingsEntity.java | 2 +- .../server/dao/model/sql/WidgetTypeDetailsEntity.java | 2 +- .../org/thingsboard/server/dao/model/sql/WidgetTypeEntity.java | 2 +- .../server/dao/model/sql/WidgetTypeIdFqnEntity.java | 2 +- .../thingsboard/server/dao/model/sql/WidgetTypeInfoEntity.java | 2 +- .../thingsboard/server/dao/model/sql/WidgetsBundleEntity.java | 2 +- .../server/dao/model/sql/WidgetsBundleWidgetCompositeKey.java | 2 +- .../server/dao/model/sql/WidgetsBundleWidgetEntity.java | 2 +- .../dao/model/sqlts/dictionary/KeyDictionaryCompositeKey.java | 2 +- .../server/dao/model/sqlts/dictionary/KeyDictionaryEntry.java | 2 +- .../server/dao/model/sqlts/latest/TsKvLatestCompositeKey.java | 2 +- .../server/dao/model/sqlts/latest/TsKvLatestEntity.java | 2 +- .../model/sqlts/timescale/ts/TimescaleTsKvCompositeKey.java | 2 +- .../dao/model/sqlts/timescale/ts/TimescaleTsKvEntity.java | 2 +- .../server/dao/model/sqlts/ts/TsKvCompositeKey.java | 2 +- .../org/thingsboard/server/dao/model/sqlts/ts/TsKvEntity.java | 2 +- .../server/dao/nosql/CassandraAbstractAsyncDao.java | 2 +- .../org/thingsboard/server/dao/nosql/CassandraAbstractDao.java | 2 +- .../server/dao/nosql/CassandraBufferedRateReadExecutor.java | 2 +- .../server/dao/nosql/CassandraBufferedRateWriteExecutor.java | 2 +- .../dao/notification/DefaultNotificationRequestService.java | 2 +- .../dao/notification/DefaultNotificationRuleService.java | 2 +- .../server/dao/notification/DefaultNotificationService.java | 2 +- .../dao/notification/DefaultNotificationSettingsService.java | 2 +- .../dao/notification/DefaultNotificationTargetService.java | 2 +- .../dao/notification/DefaultNotificationTemplateService.java | 2 +- .../server/dao/notification/DefaultNotifications.java | 2 +- .../thingsboard/server/dao/notification/NotificationDao.java | 2 +- .../server/dao/notification/NotificationRequestDao.java | 2 +- .../server/dao/notification/NotificationRuleDao.java | 2 +- .../server/dao/notification/NotificationTargetDao.java | 2 +- .../server/dao/notification/NotificationTemplateDao.java | 2 +- .../server/dao/oauth2/HybridClientRegistrationRepository.java | 2 +- .../org/thingsboard/server/dao/oauth2/OAuth2ClientDao.java | 2 +- .../server/dao/oauth2/OAuth2ClientRegistrationTemplateDao.java | 2 +- .../thingsboard/server/dao/oauth2/OAuth2ClientServiceImpl.java | 2 +- .../server/dao/oauth2/OAuth2ConfigTemplateServiceImpl.java | 2 +- .../org/thingsboard/server/dao/oauth2/OAuth2Configuration.java | 2 +- .../org/thingsboard/server/dao/oauth2/OAuth2ParamsDao.java | 2 +- .../java/org/thingsboard/server/dao/oauth2/OAuth2Utils.java | 2 +- .../org/thingsboard/server/dao/ota/BaseOtaPackageService.java | 2 +- .../thingsboard/server/dao/ota/OtaPackageCacheEvictEvent.java | 2 +- .../org/thingsboard/server/dao/ota/OtaPackageCacheKey.java | 2 +- .../thingsboard/server/dao/ota/OtaPackageCaffeineCache.java | 2 +- .../java/org/thingsboard/server/dao/ota/OtaPackageDao.java | 2 +- .../java/org/thingsboard/server/dao/ota/OtaPackageInfoDao.java | 2 +- .../org/thingsboard/server/dao/ota/OtaPackageRedisCache.java | 2 +- .../org/thingsboard/server/dao/queue/BaseQueueService.java | 2 +- .../thingsboard/server/dao/queue/BaseQueueStatsService.java | 2 +- .../main/java/org/thingsboard/server/dao/queue/QueueDao.java | 2 +- .../java/org/thingsboard/server/dao/queue/QueueStatsDao.java | 2 +- .../thingsboard/server/dao/relation/BaseRelationService.java | 2 +- .../thingsboard/server/dao/relation/EntityRelationEvent.java | 2 +- .../org/thingsboard/server/dao/relation/RelationCacheKey.java | 2 +- .../thingsboard/server/dao/relation/RelationCacheValue.java | 2 +- .../thingsboard/server/dao/relation/RelationCaffeineCache.java | 2 +- .../java/org/thingsboard/server/dao/relation/RelationDao.java | 2 +- .../thingsboard/server/dao/relation/RelationRedisCache.java | 2 +- .../org/thingsboard/server/dao/resource/BaseImageService.java | 2 +- .../thingsboard/server/dao/resource/BaseResourceService.java | 2 +- .../org/thingsboard/server/dao/resource/ImageCacheKey.java | 2 +- .../org/thingsboard/server/dao/resource/TbResourceDao.java | 2 +- .../org/thingsboard/server/dao/resource/TbResourceInfoDao.java | 2 +- .../java/org/thingsboard/server/dao/rpc/BaseRpcService.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/rpc/RpcDao.java | 2 +- .../org/thingsboard/server/dao/rule/BaseRuleChainService.java | 2 +- .../thingsboard/server/dao/rule/BaseRuleNodeStateService.java | 2 +- .../java/org/thingsboard/server/dao/rule/RuleChainDao.java | 2 +- .../main/java/org/thingsboard/server/dao/rule/RuleNodeDao.java | 2 +- .../java/org/thingsboard/server/dao/rule/RuleNodeStateDao.java | 2 +- .../thingsboard/server/dao/service/ConstraintValidator.java | 2 +- .../java/org/thingsboard/server/dao/service/DataValidator.java | 2 +- .../org/thingsboard/server/dao/service/NoXssValidator.java | 2 +- .../org/thingsboard/server/dao/service/PaginatedRemover.java | 2 +- .../thingsboard/server/dao/service/StringLengthValidator.java | 2 +- .../thingsboard/server/dao/service/TimePaginatedRemover.java | 2 +- .../java/org/thingsboard/server/dao/service/Validator.java | 2 +- .../dao/service/validator/AbstractHasOtaPackageValidator.java | 2 +- .../dao/service/validator/AdminSettingsDataValidator.java | 2 +- .../dao/service/validator/AlarmCommentDataValidator.java | 2 +- .../server/dao/service/validator/AlarmDataValidator.java | 2 +- .../server/dao/service/validator/ApiUsageDataValidator.java | 2 +- .../server/dao/service/validator/AssetDataValidator.java | 2 +- .../dao/service/validator/AssetProfileDataValidator.java | 2 +- .../server/dao/service/validator/AuditLogDataValidator.java | 2 +- .../dao/service/validator/BaseOtaPackageDataValidator.java | 2 +- .../validator/ClientRegistrationTemplateDataValidator.java | 2 +- .../service/validator/ComponentDescriptorDataValidator.java | 2 +- .../server/dao/service/validator/CustomerDataValidator.java | 2 +- .../server/dao/service/validator/DashboardDataValidator.java | 2 +- .../dao/service/validator/DeviceCredentialsDataValidator.java | 2 +- .../server/dao/service/validator/DeviceDataValidator.java | 2 +- .../dao/service/validator/DeviceProfileDataValidator.java | 2 +- .../server/dao/service/validator/DomainDataValidator.java | 2 +- .../server/dao/service/validator/EdgeDataValidator.java | 2 +- .../server/dao/service/validator/EdgeEventDataValidator.java | 2 +- .../server/dao/service/validator/EntityViewDataValidator.java | 2 +- .../server/dao/service/validator/EventDataValidator.java | 2 +- .../dao/service/validator/MobileAppBundleDataValidator.java | 2 +- .../server/dao/service/validator/MobileAppDataValidator.java | 2 +- .../dao/service/validator/Oauth2ClientDataValidator.java | 2 +- .../server/dao/service/validator/OtaPackageDataValidator.java | 2 +- .../dao/service/validator/OtaPackageInfoDataValidator.java | 2 +- .../dao/service/validator/QrCodeSettingsDataValidator.java | 2 +- .../server/dao/service/validator/QueueStatsDataValidator.java | 2 +- .../server/dao/service/validator/QueueValidator.java | 2 +- .../server/dao/service/validator/ResourceDataValidator.java | 2 +- .../server/dao/service/validator/RuleChainDataValidator.java | 2 +- .../server/dao/service/validator/TenantDataValidator.java | 2 +- .../dao/service/validator/TenantProfileDataValidator.java | 2 +- .../dao/service/validator/UserCredentialsDataValidator.java | 2 +- .../server/dao/service/validator/UserDataValidator.java | 2 +- .../server/dao/service/validator/WidgetTypeDataValidator.java | 2 +- .../dao/service/validator/WidgetsBundleDataValidator.java | 2 +- .../org/thingsboard/server/dao/settings/AdminSettingsDao.java | 2 +- .../server/dao/settings/AdminSettingsServiceImpl.java | 2 +- .../server/dao/settings/DefaultSecuritySettingsService.java | 2 +- .../server/dao/settings/SecuritySettingsService.java | 2 +- .../java/org/thingsboard/server/dao/sql/JpaAbstractDao.java | 2 +- .../server/dao/sql/JpaAbstractDaoListeningExecutorService.java | 2 +- .../org/thingsboard/server/dao/sql/JpaExecutorService.java | 2 +- .../thingsboard/server/dao/sql/JpaPartitionedAbstractDao.java | 2 +- .../server/dao/sql/ScheduledLogExecutorComponent.java | 2 +- .../org/thingsboard/server/dao/sql/TbSqlBlockingQueue.java | 2 +- .../thingsboard/server/dao/sql/TbSqlBlockingQueueParams.java | 2 +- .../thingsboard/server/dao/sql/TbSqlBlockingQueueWrapper.java | 2 +- .../main/java/org/thingsboard/server/dao/sql/TbSqlQueue.java | 2 +- .../java/org/thingsboard/server/dao/sql/TbSqlQueueElement.java | 2 +- .../server/dao/sql/alarm/AlarmCommentRepository.java | 2 +- .../org/thingsboard/server/dao/sql/alarm/AlarmRepository.java | 2 +- .../server/dao/sql/alarm/EntityAlarmRepository.java | 2 +- .../thingsboard/server/dao/sql/alarm/JpaAlarmCommentDao.java | 2 +- .../java/org/thingsboard/server/dao/sql/alarm/JpaAlarmDao.java | 2 +- .../server/dao/sql/asset/AssetProfileRepository.java | 2 +- .../org/thingsboard/server/dao/sql/asset/AssetRepository.java | 2 +- .../java/org/thingsboard/server/dao/sql/asset/JpaAssetDao.java | 2 +- .../thingsboard/server/dao/sql/asset/JpaAssetProfileDao.java | 2 +- .../server/dao/sql/attributes/AttributeKvInsertRepository.java | 2 +- .../server/dao/sql/attributes/AttributeKvRepository.java | 2 +- .../thingsboard/server/dao/sql/attributes/JpaAttributeDao.java | 2 +- .../thingsboard/server/dao/sql/audit/AuditLogRepository.java | 2 +- .../server/dao/sql/audit/DedicatedJpaAuditLogDao.java | 2 +- .../org/thingsboard/server/dao/sql/audit/JpaAuditLogDao.java | 2 +- .../component/AbstractComponentDescriptorInsertRepository.java | 2 +- .../dao/sql/component/ComponentDescriptorInsertRepository.java | 2 +- .../dao/sql/component/ComponentDescriptorRepository.java | 2 +- .../dao/sql/component/JpaBaseComponentDescriptorDao.java | 2 +- .../sql/component/SqlComponentDescriptorInsertRepository.java | 2 +- .../server/dao/sql/customer/CustomerRepository.java | 2 +- .../thingsboard/server/dao/sql/customer/JpaCustomerDao.java | 2 +- .../server/dao/sql/dashboard/DashboardInfoRepository.java | 2 +- .../server/dao/sql/dashboard/DashboardRepository.java | 2 +- .../thingsboard/server/dao/sql/dashboard/JpaDashboardDao.java | 2 +- .../server/dao/sql/dashboard/JpaDashboardInfoDao.java | 2 +- .../server/dao/sql/device/DefaultNativeDeviceRepository.java | 2 +- .../server/dao/sql/device/DeviceCredentialsRepository.java | 2 +- .../server/dao/sql/device/DeviceProfileRepository.java | 2 +- .../thingsboard/server/dao/sql/device/DeviceRepository.java | 2 +- .../server/dao/sql/device/JpaDeviceCredentialsDao.java | 2 +- .../org/thingsboard/server/dao/sql/device/JpaDeviceDao.java | 2 +- .../thingsboard/server/dao/sql/device/JpaDeviceProfileDao.java | 2 +- .../server/dao/sql/device/NativeDeviceRepository.java | 2 +- .../server/dao/sql/domain/DomainOauth2ClientRepository.java | 2 +- .../thingsboard/server/dao/sql/domain/DomainRepository.java | 2 +- .../org/thingsboard/server/dao/sql/domain/JpaDomainDao.java | 2 +- .../server/dao/sql/edge/EdgeEventInsertRepository.java | 2 +- .../thingsboard/server/dao/sql/edge/EdgeEventRepository.java | 2 +- .../org/thingsboard/server/dao/sql/edge/EdgeRepository.java | 2 +- .../thingsboard/server/dao/sql/edge/JpaBaseEdgeEventDao.java | 2 +- .../java/org/thingsboard/server/dao/sql/edge/JpaEdgeDao.java | 2 +- .../server/dao/sql/entityview/EntityViewRepository.java | 2 +- .../server/dao/sql/entityview/JpaEntityViewDao.java | 2 +- .../server/dao/sql/event/DedicatedEventInsertRepository.java | 2 +- .../thingsboard/server/dao/sql/event/DedicatedJpaEventDao.java | 2 +- .../thingsboard/server/dao/sql/event/ErrorEventRepository.java | 2 +- .../server/dao/sql/event/EventInsertRepository.java | 2 +- .../server/dao/sql/event/EventPartitionConfiguration.java | 2 +- .../org/thingsboard/server/dao/sql/event/EventRepository.java | 2 +- .../org/thingsboard/server/dao/sql/event/JpaBaseEventDao.java | 2 +- .../server/dao/sql/event/LifecycleEventRepository.java | 2 +- .../server/dao/sql/event/RuleChainDebugEventRepository.java | 2 +- .../server/dao/sql/event/RuleNodeDebugEventRepository.java | 2 +- .../server/dao/sql/event/StatisticsEventRepository.java | 2 +- .../server/dao/sql/mobile/JpaMobileAppBundleDao.java | 2 +- .../org/thingsboard/server/dao/sql/mobile/JpaMobileAppDao.java | 2 +- .../server/dao/sql/mobile/JpaQrCodeSettingsDao.java | 2 +- .../dao/sql/mobile/MobileAppBundleOauth2ClientRepository.java | 2 +- .../server/dao/sql/mobile/MobileAppBundleRepository.java | 2 +- .../thingsboard/server/dao/sql/mobile/MobileAppRepository.java | 2 +- .../server/dao/sql/mobile/QrCodeSettingsRepository.java | 2 +- .../server/dao/sql/notification/JpaNotificationDao.java | 2 +- .../server/dao/sql/notification/JpaNotificationRequestDao.java | 2 +- .../server/dao/sql/notification/JpaNotificationRuleDao.java | 2 +- .../server/dao/sql/notification/JpaNotificationTargetDao.java | 2 +- .../dao/sql/notification/JpaNotificationTemplateDao.java | 2 +- .../server/dao/sql/notification/NotificationRepository.java | 2 +- .../dao/sql/notification/NotificationRequestRepository.java | 2 +- .../dao/sql/notification/NotificationRuleRepository.java | 2 +- .../dao/sql/notification/NotificationTargetRepository.java | 2 +- .../dao/sql/notification/NotificationTemplateRepository.java | 2 +- .../thingsboard/server/dao/sql/oauth2/JpaOAuth2ClientDao.java | 2 +- .../dao/sql/oauth2/JpaOAuth2ClientRegistrationTemplateDao.java | 2 +- .../sql/oauth2/OAuth2ClientRegistrationTemplateRepository.java | 2 +- .../server/dao/sql/oauth2/OAuth2ClientRepository.java | 2 +- .../org/thingsboard/server/dao/sql/ota/JpaOtaPackageDao.java | 2 +- .../thingsboard/server/dao/sql/ota/JpaOtaPackageInfoDao.java | 2 +- .../server/dao/sql/ota/OtaPackageInfoRepository.java | 2 +- .../thingsboard/server/dao/sql/ota/OtaPackageRepository.java | 2 +- .../org/thingsboard/server/dao/sql/query/AlarmDataAdapter.java | 2 +- .../thingsboard/server/dao/sql/query/AlarmQueryRepository.java | 2 +- .../server/dao/sql/query/DefaultAlarmQueryRepository.java | 2 +- .../server/dao/sql/query/DefaultEntityQueryRepository.java | 2 +- .../server/dao/sql/query/DefaultQueryLogComponent.java | 2 +- .../thingsboard/server/dao/sql/query/EntityDataAdapter.java | 2 +- .../org/thingsboard/server/dao/sql/query/EntityKeyMapping.java | 2 +- .../server/dao/sql/query/EntityQueryRepository.java | 2 +- .../thingsboard/server/dao/sql/query/JpaEntityQueryDao.java | 2 +- .../org/thingsboard/server/dao/sql/query/QueryContext.java | 2 +- .../thingsboard/server/dao/sql/query/QueryLogComponent.java | 2 +- .../thingsboard/server/dao/sql/query/QuerySecurityContext.java | 2 +- .../java/org/thingsboard/server/dao/sql/queue/JpaQueueDao.java | 2 +- .../org/thingsboard/server/dao/sql/queue/JpaQueueStatsDao.java | 2 +- .../org/thingsboard/server/dao/sql/queue/QueueRepository.java | 2 +- .../thingsboard/server/dao/sql/queue/QueueStatsRepository.java | 2 +- .../thingsboard/server/dao/sql/relation/JpaRelationDao.java | 2 +- .../dao/sql/relation/JpaRelationQueryExecutorService.java | 2 +- .../server/dao/sql/relation/RelationInsertRepository.java | 2 +- .../server/dao/sql/relation/RelationRepository.java | 2 +- .../server/dao/sql/relation/SqlRelationInsertRepository.java | 2 +- .../thingsboard/server/dao/sql/resource/JpaTbResourceDao.java | 2 +- .../server/dao/sql/resource/JpaTbResourceInfoDao.java | 2 +- .../server/dao/sql/resource/TbResourceInfoRepository.java | 2 +- .../server/dao/sql/resource/TbResourceRepository.java | 2 +- .../java/org/thingsboard/server/dao/sql/rpc/JpaRpcDao.java | 2 +- .../java/org/thingsboard/server/dao/sql/rpc/RpcRepository.java | 2 +- .../org/thingsboard/server/dao/sql/rule/JpaRuleChainDao.java | 2 +- .../org/thingsboard/server/dao/sql/rule/JpaRuleNodeDao.java | 2 +- .../thingsboard/server/dao/sql/rule/JpaRuleNodeStateDao.java | 2 +- .../thingsboard/server/dao/sql/rule/RuleChainRepository.java | 2 +- .../thingsboard/server/dao/sql/rule/RuleNodeRepository.java | 2 +- .../server/dao/sql/rule/RuleNodeStateRepository.java | 2 +- .../server/dao/sql/settings/AdminSettingsRepository.java | 2 +- .../server/dao/sql/settings/JpaAdminSettingsDao.java | 2 +- .../org/thingsboard/server/dao/sql/tenant/JpaTenantDao.java | 2 +- .../thingsboard/server/dao/sql/tenant/JpaTenantProfileDao.java | 2 +- .../server/dao/sql/tenant/TenantProfileRepository.java | 2 +- .../thingsboard/server/dao/sql/tenant/TenantRepository.java | 2 +- .../server/dao/sql/usagerecord/ApiUsageStateRepository.java | 2 +- .../server/dao/sql/usagerecord/JpaApiUsageStateDao.java | 2 +- .../server/dao/sql/user/JpaUserAuthSettingsDao.java | 2 +- .../thingsboard/server/dao/sql/user/JpaUserCredentialsDao.java | 2 +- .../java/org/thingsboard/server/dao/sql/user/JpaUserDao.java | 2 +- .../thingsboard/server/dao/sql/user/JpaUserSettingsDao.java | 2 +- .../server/dao/sql/user/UserAuthSettingsRepository.java | 2 +- .../server/dao/sql/user/UserCredentialsRepository.java | 2 +- .../org/thingsboard/server/dao/sql/user/UserRepository.java | 2 +- .../server/dao/sql/user/UserSettingsRepository.java | 2 +- .../thingsboard/server/dao/sql/widget/JpaWidgetTypeDao.java | 2 +- .../thingsboard/server/dao/sql/widget/JpaWidgetsBundleDao.java | 2 +- .../server/dao/sql/widget/WidgetTypeInfoRepository.java | 2 +- .../server/dao/sql/widget/WidgetTypeRepository.java | 2 +- .../server/dao/sql/widget/WidgetsBundleRepository.java | 2 +- .../server/dao/sql/widget/WidgetsBundleWidgetRepository.java | 2 +- .../dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java | 2 +- .../thingsboard/server/dao/sqlts/AbstractSqlTimeseriesDao.java | 2 +- .../thingsboard/server/dao/sqlts/AggregationTimeseriesDao.java | 2 +- .../server/dao/sqlts/BaseAbstractSqlTimeseriesDao.java | 2 +- .../server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java | 2 +- .../java/org/thingsboard/server/dao/sqlts/EntityContainer.java | 2 +- .../thingsboard/server/dao/sqlts/SqlTimeseriesLatestDao.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/sqlts/TsKey.java | 2 +- .../server/dao/sqlts/dictionary/JpaKeyDictionaryDao.java | 2 +- .../server/dao/sqlts/dictionary/KeyDictionaryRepository.java | 2 +- .../server/dao/sqlts/insert/AbstractInsertRepository.java | 2 +- .../server/dao/sqlts/insert/InsertTsRepository.java | 2 +- .../dao/sqlts/insert/latest/InsertLatestTsRepository.java | 2 +- .../sqlts/insert/latest/sql/SqlLatestInsertTsRepository.java | 2 +- .../insert/sql/DedicatedEventsSqlPartitioningRepository.java | 2 +- .../server/dao/sqlts/insert/sql/SqlInsertTsRepository.java | 2 +- .../server/dao/sqlts/insert/sql/SqlPartitioningRepository.java | 2 +- .../sqlts/insert/timescale/TimescaleInsertTsRepository.java | 2 +- .../server/dao/sqlts/latest/SearchTsKvLatestRepository.java | 2 +- .../server/dao/sqlts/latest/TsKvLatestRepository.java | 2 +- .../thingsboard/server/dao/sqlts/sql/JpaSqlTimeseriesDao.java | 2 +- .../server/dao/sqlts/timescale/AggregationRepository.java | 2 +- .../server/dao/sqlts/timescale/TimescaleTimeseriesDao.java | 2 +- .../server/dao/sqlts/timescale/TsKvTimescaleRepository.java | 2 +- .../org/thingsboard/server/dao/sqlts/ts/TsKvRepository.java | 2 +- .../server/dao/tenant/DefaultTbTenantProfileCache.java | 2 +- .../org/thingsboard/server/dao/tenant/TenantCaffeineCache.java | 2 +- .../main/java/org/thingsboard/server/dao/tenant/TenantDao.java | 2 +- .../org/thingsboard/server/dao/tenant/TenantEvictEvent.java | 2 +- .../server/dao/tenant/TenantExistsCaffeineCache.java | 2 +- .../thingsboard/server/dao/tenant/TenantExistsRedisCache.java | 2 +- .../thingsboard/server/dao/tenant/TenantProfileCacheKey.java | 2 +- .../server/dao/tenant/TenantProfileCaffeineCache.java | 2 +- .../org/thingsboard/server/dao/tenant/TenantProfileDao.java | 2 +- .../thingsboard/server/dao/tenant/TenantProfileEvictEvent.java | 2 +- .../thingsboard/server/dao/tenant/TenantProfileRedisCache.java | 2 +- .../server/dao/tenant/TenantProfileServiceImpl.java | 2 +- .../org/thingsboard/server/dao/tenant/TenantRedisCache.java | 2 +- .../org/thingsboard/server/dao/tenant/TenantServiceImpl.java | 2 +- .../dao/timeseries/AbstractCassandraBaseTimeseriesDao.java | 2 +- .../server/dao/timeseries/AggregatePartitionsFunction.java | 2 +- .../server/dao/timeseries/BaseTimeseriesService.java | 2 +- .../server/dao/timeseries/CassandraBaseTimeseriesDao.java | 2 +- .../dao/timeseries/CassandraBaseTimeseriesLatestDao.java | 2 +- .../server/dao/timeseries/CassandraPartitionCacheKey.java | 2 +- .../server/dao/timeseries/CassandraTsPartitionsCache.java | 2 +- .../server/dao/timeseries/NoSqlTsPartitionDate.java | 2 +- .../org/thingsboard/server/dao/timeseries/QueryCursor.java | 2 +- .../server/dao/timeseries/SimpleListenableFuture.java | 2 +- .../org/thingsboard/server/dao/timeseries/SqlPartition.java | 2 +- .../thingsboard/server/dao/timeseries/SqlTsPartitionDate.java | 2 +- .../org/thingsboard/server/dao/timeseries/TimeseriesDao.java | 2 +- .../thingsboard/server/dao/timeseries/TimeseriesLatestDao.java | 2 +- .../server/dao/timeseries/TsInsertExecutorType.java | 2 +- .../org/thingsboard/server/dao/timeseries/TsKvQueryCursor.java | 2 +- .../thingsboard/server/dao/timeseries/TsLatestCacheKey.java | 2 +- .../thingsboard/server/dao/timeseries/TsLatestRedisCache.java | 2 +- .../thingsboard/server/dao/usage/BasicUsageInfoService.java | 2 +- .../thingsboard/server/dao/usagerecord/ApiUsageStateDao.java | 2 +- .../server/dao/usagerecord/ApiUsageStateServiceImpl.java | 2 +- .../server/dao/usagerecord/DefaultApiLimitService.java | 2 +- .../org/thingsboard/server/dao/user/UserAuthSettingsDao.java | 2 +- .../org/thingsboard/server/dao/user/UserCredentialsDao.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/user/UserDao.java | 2 +- .../java/org/thingsboard/server/dao/user/UserServiceImpl.java | 2 +- .../thingsboard/server/dao/user/UserSettingsCaffeineCache.java | 2 +- .../java/org/thingsboard/server/dao/user/UserSettingsDao.java | 2 +- .../thingsboard/server/dao/user/UserSettingsEvictEvent.java | 2 +- .../thingsboard/server/dao/user/UserSettingsRedisCache.java | 2 +- .../thingsboard/server/dao/user/UserSettingsServiceImpl.java | 2 +- .../server/dao/util/AbstractBufferedRateExecutor.java | 2 +- .../java/org/thingsboard/server/dao/util/AsyncRateLimiter.java | 2 +- .../java/org/thingsboard/server/dao/util/AsyncTaskContext.java | 2 +- .../org/thingsboard/server/dao/util/BufferedRateExecutor.java | 2 +- .../thingsboard/server/dao/util/BufferedRateExecutorStats.java | 2 +- .../thingsboard/server/dao/util/DeviceConnectivityUtil.java | 2 +- .../main/java/org/thingsboard/server/dao/util/ImageUtils.java | 2 +- dao/src/main/java/org/thingsboard/server/dao/util/KvUtils.java | 2 +- .../thingsboard/server/dao/util/TenantRateLimitException.java | 2 +- .../main/java/org/thingsboard/server/dao/util/TimeUtils.java | 2 +- .../org/thingsboard/server/dao/util/mapping/JsonConverter.java | 2 +- .../java/org/thingsboard/server/dao/widget/WidgetTypeDao.java | 2 +- .../thingsboard/server/dao/widget/WidgetTypeServiceImpl.java | 2 +- .../org/thingsboard/server/dao/widget/WidgetsBundleDao.java | 2 +- .../server/dao/widget/WidgetsBundleServiceImpl.java | 2 +- dao/src/main/resources/cassandra/schema-keyspace.cql | 2 +- dao/src/main/resources/cassandra/schema-ts-latest.cql | 2 +- dao/src/main/resources/cassandra/schema-ts.cql | 2 +- dao/src/main/resources/sql/schema-entities-idx-psql-addon.sql | 2 +- dao/src/main/resources/sql/schema-entities-idx.sql | 2 +- dao/src/main/resources/sql/schema-entities.sql | 2 +- dao/src/main/resources/sql/schema-timescale.sql | 2 +- dao/src/main/resources/sql/schema-ts-latest-psql.sql | 2 +- dao/src/main/resources/sql/schema-ts-psql.sql | 2 +- dao/src/main/resources/sql/schema-views-and-functions.sql | 2 +- dao/src/main/resources/xss-policy.xml | 2 +- .../org/thingsboard/server/dao/AbstractDaoServiceTest.java | 2 +- .../java/org/thingsboard/server/dao/AbstractJpaDaoTest.java | 2 +- .../org/thingsboard/server/dao/AbstractNoSqlContainer.java | 2 +- .../thingsboard/server/dao/AbstractRedisClusterContainer.java | 2 +- .../org/thingsboard/server/dao/AbstractRedisContainer.java | 2 +- .../org/thingsboard/server/dao/NoSqlDaoServiceTestSuite.java | 2 +- .../java/org/thingsboard/server/dao/PostgreSqlInitializer.java | 2 +- .../org/thingsboard/server/dao/RedisClusterSqlTestSuite.java | 2 +- .../test/java/org/thingsboard/server/dao/RedisJUnit5Test.java | 2 +- .../java/org/thingsboard/server/dao/RedisSqlTestSuite.java | 2 +- .../thingsboard/server/dao/TimescaleDaoServiceTestSuite.java | 2 +- .../org/thingsboard/server/dao/TimescaleSqlInitializer.java | 2 +- .../thingsboard/server/dao/audit/AuditLogServiceImplTest.java | 2 +- .../server/dao/cache/RedisTbTransactionalCacheTest.java | 2 +- .../server/dao/eventsourcing/DeleteEntityEventTest.java | 2 +- .../server/dao/nosql/CassandraPartitionsCacheTest.java | 2 +- .../thingsboard/server/dao/service/AbstractServiceTest.java | 2 +- .../server/dao/service/AdminSettingsServiceTest.java | 2 +- .../server/dao/service/AlarmCommentServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/AlarmServiceTest.java | 2 +- .../server/dao/service/ApiUsageStateServiceTest.java | 2 +- .../server/dao/service/AssetProfileServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/AssetServiceTest.java | 2 +- .../server/dao/service/ConstraintValidatorTest.java | 2 +- .../thingsboard/server/dao/service/CustomerServiceTest.java | 2 +- .../java/org/thingsboard/server/dao/service/DaoNoSqlTest.java | 2 +- .../java/org/thingsboard/server/dao/service/DaoSqlTest.java | 2 +- .../org/thingsboard/server/dao/service/DaoTimescaleTest.java | 2 +- .../thingsboard/server/dao/service/DashboardServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/DataValidatorTest.java | 2 +- .../server/dao/service/DeviceCredentialsCacheTest.java | 2 +- .../server/dao/service/DeviceCredentialsServiceTest.java | 2 +- .../server/dao/service/DeviceProfileServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/DeviceServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/DomainServiceTest.java | 2 +- .../thingsboard/server/dao/service/EdgeEventServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/EdgeServiceTest.java | 2 +- .../thingsboard/server/dao/service/EntityDaoRegistryTest.java | 2 +- .../server/dao/service/EntityServiceRegistryTest.java | 2 +- .../org/thingsboard/server/dao/service/EntityServiceTest.java | 2 +- .../thingsboard/server/dao/service/MobileAppServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/NoXssValidatorTest.java | 2 +- .../server/dao/service/OAuth2ClientServiceTest.java | 2 +- .../server/dao/service/OAuth2ConfigTemplateServiceTest.java | 2 +- .../thingsboard/server/dao/service/OtaPackageServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/QueueServiceTest.java | 2 +- .../thingsboard/server/dao/service/QueueStatsServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/RelationCacheTest.java | 2 +- .../thingsboard/server/dao/service/RelationServiceTest.java | 2 +- .../thingsboard/server/dao/service/RuleChainServiceTest.java | 2 +- .../server/dao/service/TbCacheSerializationTest.java | 2 +- .../server/dao/service/TenantProfileServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/TenantServiceTest.java | 2 +- .../org/thingsboard/server/dao/service/UserServiceTest.java | 2 +- .../java/org/thingsboard/server/dao/service/ValidatorTest.java | 2 +- .../thingsboard/server/dao/service/WidgetTypeServiceTest.java | 2 +- .../server/dao/service/WidgetsBundleServiceTest.java | 2 +- .../dao/service/attributes/BaseAttributesServiceTest.java | 2 +- .../service/attributes/sql/AttributeCacheServiceSqlTest.java | 2 +- .../dao/service/attributes/sql/AttributesServiceSqlTest.java | 2 +- .../server/dao/service/event/BaseEventServiceTest.java | 2 +- .../server/dao/service/event/sql/EventServiceSqlTest.java | 2 +- .../sql/EventServiceSqlTest_DedicatedEventsDataSource.java | 2 +- .../server/dao/service/install/sql/EntitiesSchemaSqlTest.java | 2 +- .../dao/service/timeseries/BaseTimeseriesServiceTest.java | 2 +- .../nosql/TimeseriesServiceNoSqlSetNullEnabledTest.java | 2 +- .../service/timeseries/nosql/TimeseriesServiceNoSqlTest.java | 2 +- .../timeseries/nosql/TimeseriesServiceTimescaleTest.java | 2 +- .../timeseries/sql/LatestTimeseriesPerformanceTest.java | 2 +- .../dao/service/timeseries/sql/TimeseriesServiceSqlTest.java | 2 +- .../dao/service/validator/AdminSettingsDataValidatorTest.java | 2 +- .../server/dao/service/validator/AlarmDataValidatorTest.java | 2 +- .../server/dao/service/validator/AssetDataValidatorTest.java | 2 +- .../dao/service/validator/AssetProfileDataValidatorTest.java | 2 +- .../dao/service/validator/BaseOtaPackageDataValidatorTest.java | 2 +- .../validator/ComponentDescriptorDataValidatorTest.java | 2 +- .../dao/service/validator/CustomerDataValidatorTest.java | 2 +- .../dao/service/validator/DashboardDataValidatorTest.java | 2 +- .../server/dao/service/validator/DeviceDataValidatorTest.java | 2 +- .../dao/service/validator/DeviceProfileDataValidatorTest.java | 2 +- .../server/dao/service/validator/EdgeDataValidatorTest.java | 2 +- .../dao/service/validator/EntityViewDataValidatorTest.java | 2 +- .../dao/service/validator/ResourceDataValidatorTest.java | 2 +- .../dao/service/validator/RuleChainDataValidatorTest.java | 2 +- .../server/dao/service/validator/TenantDataValidatorTest.java | 2 +- .../dao/service/validator/TenantProfileDataValidatorTest.java | 2 +- .../dao/service/validator/WidgetTypeDataValidatorTest.java | 2 +- .../dao/service/validator/WidgetsBundleDataValidatorTest.java | 2 +- .../server/dao/sql/alarm/JpaAlarmCommentDaoTest.java | 2 +- .../org/thingsboard/server/dao/sql/alarm/JpaAlarmDaoTest.java | 2 +- .../org/thingsboard/server/dao/sql/asset/JpaAssetDaoTest.java | 2 +- .../thingsboard/server/dao/sql/audit/JpaAuditLogDaoTest.java | 2 +- .../dao/sql/component/JpaBaseComponentDescriptorDaoTest.java | 2 +- .../server/dao/sql/customer/JpaCustomerDaoTest.java | 2 +- .../server/dao/sql/dashboard/JpaDashboardInfoDaoTest.java | 2 +- .../server/dao/sql/device/JpaDeviceCredentialsDaoTest.java | 2 +- .../thingsboard/server/dao/sql/device/JpaDeviceDaoTest.java | 2 +- .../thingsboard/server/dao/sql/event/JpaBaseEventDaoTest.java | 2 +- .../server/dao/sql/query/DefaultEntityQueryRepositoryTest.java | 2 +- .../server/dao/sql/query/DefaultQueryLogComponentTest.java | 2 +- .../server/dao/sql/query/EntityDataAdapterTest.java | 2 +- .../thingsboard/server/dao/sql/query/EntityKeyMappingTest.java | 2 +- .../java/org/thingsboard/server/dao/sql/rpc/JpaRpcDaoTest.java | 2 +- .../thingsboard/server/dao/sql/rule/JpaRuleNodeDaoTest.java | 2 +- .../thingsboard/server/dao/sql/tenant/JpaTenantDaoTest.java | 2 +- .../server/dao/sql/user/JpaUserCredentialsDaoTest.java | 2 +- .../org/thingsboard/server/dao/sql/user/JpaUserDaoTest.java | 2 +- .../server/dao/sql/user/JpaUserSettingsDaoTest.java | 2 +- .../server/dao/sql/widget/JpaWidgetTypeDaoTest.java | 2 +- .../server/dao/sql/widget/JpaWidgetsBundleDaoTest.java | 2 +- .../dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java | 2 +- .../server/dao/sqlts/SqlTimeseriesLatestDaoTest.java | 2 +- ...andraBaseTimeseriesDaoPartitioningDaysAlwaysExistsTest.java | 2 +- ...ndraBaseTimeseriesDaoPartitioningHoursAlwaysExistsTest.java | 2 +- ...aseTimeseriesDaoPartitioningIndefiniteAlwaysExistsTest.java | 2 +- ...raBaseTimeseriesDaoPartitioningMinutesAlwaysExistsTest.java | 2 +- ...draBaseTimeseriesDaoPartitioningMonthsAlwaysExistsTest.java | 2 +- ...ndraBaseTimeseriesDaoPartitioningYearsAlwaysExistsTest.java | 2 +- .../server/dao/util/DeviceConnectivityUtilTest.java | 2 +- .../java/org/thingsboard/server/dao/util/TimeUtilsTest.java | 2 +- docker/compose-utils.sh | 2 +- docker/docker-check-log-folders.sh | 2 +- docker/docker-compose.aws-sqs.yml | 2 +- docker/docker-compose.cassandra.volumes.yml | 2 +- docker/docker-compose.confluent.yml | 2 +- docker/docker-compose.hybrid.yml | 2 +- docker/docker-compose.kafka.yml | 2 +- docker/docker-compose.postgres.volumes.yml | 2 +- docker/docker-compose.postgres.yml | 2 +- docker/docker-compose.prometheus-grafana.yml | 2 +- docker/docker-compose.pubsub.yml | 2 +- docker/docker-compose.rabbitmq.yml | 2 +- docker/docker-compose.redis-cluster.volumes.yml | 2 +- docker/docker-compose.redis-cluster.yml | 2 +- docker/docker-compose.redis-sentinel.volumes.yml | 2 +- docker/docker-compose.redis-sentinel.yml | 2 +- docker/docker-compose.redis.volumes.yml | 2 +- docker/docker-compose.redis.yml | 2 +- docker/docker-compose.service-bus.yml | 2 +- docker/docker-compose.volumes.yml | 2 +- docker/docker-compose.yml | 2 +- docker/docker-create-log-folders.sh | 2 +- docker/docker-install-tb.sh | 2 +- docker/docker-remove-services.sh | 2 +- docker/docker-start-services.sh | 2 +- docker/docker-stop-services.sh | 2 +- docker/docker-update-service.sh | 2 +- docker/docker-upgrade-tb.sh | 2 +- .../monitoring/grafana/provisioning/dashboards/dashboard.yml | 2 +- .../monitoring/grafana/provisioning/datasources/datasource.yml | 2 +- docker/monitoring/prometheus/prometheus.yml | 2 +- docker/tb-transports/coap/conf/logback.xml | 2 +- docker/tb-transports/coap/conf/tb-coap-transport.conf | 2 +- docker/tb-transports/http/conf/logback.xml | 2 +- docker/tb-transports/http/conf/tb-http-transport.conf | 2 +- docker/tb-transports/lwm2m/conf/logback.xml | 2 +- docker/tb-transports/lwm2m/conf/tb-lwm2m-transport.conf | 2 +- docker/tb-transports/mqtt/conf/logback.xml | 2 +- docker/tb-transports/mqtt/conf/tb-mqtt-transport.conf | 2 +- docker/tb-transports/snmp/conf/logback.xml | 2 +- docker/tb-transports/snmp/conf/tb-snmp-transport.conf | 2 +- docker/tb-vc-executor/conf/logback.xml | 2 +- docker/tb-vc-executor/conf/tb-vc-executor.conf | 2 +- license-header-template.txt | 2 +- monitoring/pom.xml | 2 +- monitoring/src/main/conf/logback.xml | 2 +- monitoring/src/main/conf/tb-monitoring.conf | 2 +- .../monitoring/ThingsboardMonitoringApplication.java | 2 +- .../java/org/thingsboard/monitoring/client/Lwm2mClient.java | 2 +- .../main/java/org/thingsboard/monitoring/client/TbClient.java | 2 +- .../main/java/org/thingsboard/monitoring/client/WsClient.java | 2 +- .../org/thingsboard/monitoring/client/WsClientFactory.java | 2 +- .../org/thingsboard/monitoring/config/MonitoringConfig.java | 2 +- .../org/thingsboard/monitoring/config/MonitoringTarget.java | 2 +- .../config/transport/CoapTransportMonitoringConfig.java | 2 +- .../thingsboard/monitoring/config/transport/DeviceConfig.java | 2 +- .../config/transport/HttpTransportMonitoringConfig.java | 2 +- .../config/transport/Lwm2mTransportMonitoringConfig.java | 2 +- .../config/transport/MqttTransportMonitoringConfig.java | 2 +- .../thingsboard/monitoring/config/transport/TransportInfo.java | 2 +- .../monitoring/config/transport/TransportMonitoringConfig.java | 2 +- .../monitoring/config/transport/TransportMonitoringTarget.java | 2 +- .../thingsboard/monitoring/config/transport/TransportType.java | 2 +- .../main/java/org/thingsboard/monitoring/data/Latencies.java | 2 +- .../src/main/java/org/thingsboard/monitoring/data/Latency.java | 2 +- .../org/thingsboard/monitoring/data/MonitoredServiceKey.java | 2 +- .../thingsboard/monitoring/data/ServiceFailureException.java | 2 +- .../java/org/thingsboard/monitoring/data/cmd/CmdsWrapper.java | 2 +- .../org/thingsboard/monitoring/data/cmd/EntityDataCmd.java | 2 +- .../org/thingsboard/monitoring/data/cmd/EntityDataUpdate.java | 2 +- .../org/thingsboard/monitoring/data/cmd/LatestValueCmd.java | 2 +- .../monitoring/data/notification/HighLatencyNotification.java | 2 +- .../thingsboard/monitoring/data/notification/Notification.java | 2 +- .../data/notification/ServiceFailureNotification.java | 2 +- .../data/notification/ServiceRecoveryNotification.java | 2 +- .../monitoring/notification/NotificationService.java | 2 +- .../monitoring/notification/channels/NotificationChannel.java | 2 +- .../notification/channels/impl/SlackNotificationChannel.java | 2 +- .../org/thingsboard/monitoring/service/BaseHealthChecker.java | 2 +- .../thingsboard/monitoring/service/BaseMonitoringService.java | 2 +- .../org/thingsboard/monitoring/service/MonitoringReporter.java | 2 +- .../monitoring/service/transport/TransportHealthChecker.java | 2 +- .../service/transport/TransportsMonitoringService.java | 2 +- .../service/transport/impl/CoapTransportHealthChecker.java | 2 +- .../service/transport/impl/HttpTransportHealthChecker.java | 2 +- .../service/transport/impl/Lwm2mTransportHealthChecker.java | 2 +- .../service/transport/impl/MqttTransportHealthChecker.java | 2 +- .../java/org/thingsboard/monitoring/util/ResourceUtils.java | 2 +- .../main/java/org/thingsboard/monitoring/util/TbStopWatch.java | 2 +- monitoring/src/main/resources/logback.xml | 2 +- monitoring/src/main/resources/lwm2m/models/0.xml | 2 +- monitoring/src/main/resources/lwm2m/models/1.xml | 2 +- monitoring/src/main/resources/lwm2m/models/2.xml | 2 +- monitoring/src/main/resources/lwm2m/models/test-model.xml | 2 +- monitoring/src/main/resources/tb-monitoring.yml | 2 +- msa/black-box-tests/pom.xml | 2 +- .../org/thingsboard/server/msa/AbstractCoapClientTest.java | 2 +- .../java/org/thingsboard/server/msa/AbstractContainerTest.java | 2 +- .../java/org/thingsboard/server/msa/ContainerTestSuite.java | 2 +- .../java/org/thingsboard/server/msa/DisableUIListeners.java | 2 +- .../java/org/thingsboard/server/msa/DockerComposeExecutor.java | 2 +- .../thingsboard/server/msa/SeleniumRemoteWebDriverTest.java | 2 +- .../src/test/java/org/thingsboard/server/msa/TestListener.java | 2 +- .../test/java/org/thingsboard/server/msa/TestProperties.java | 2 +- .../test/java/org/thingsboard/server/msa/TestRestClient.java | 2 +- .../org/thingsboard/server/msa/ThingsBoardDbInstaller.java | 2 +- .../src/test/java/org/thingsboard/server/msa/WsClient.java | 2 +- .../thingsboard/server/msa/connectivity/CoapClientTest.java | 2 +- .../thingsboard/server/msa/connectivity/HttpClientTest.java | 2 +- .../thingsboard/server/msa/connectivity/MqttClientTest.java | 2 +- .../server/msa/connectivity/MqttGatewayClientTest.java | 2 +- .../server/msa/connectivity/lwm2m/AbstractLwm2mClientTest.java | 2 +- .../server/msa/connectivity/lwm2m/Lwm2mDevicesForTest.java | 2 +- .../server/msa/connectivity/lwm2m/client/FwLwM2MDevice.java | 2 +- .../server/msa/connectivity/lwm2m/client/LwM2MTestClient.java | 2 +- .../connectivity/lwm2m/client/LwM2mBinaryAppDataContainer.java | 2 +- .../msa/connectivity/lwm2m/client/LwM2mTemperatureSensor.java | 2 +- .../msa/connectivity/lwm2m/client/LwM2mValueConverterImpl.java | 2 +- .../server/msa/connectivity/lwm2m/client/Lwm2mTestHelper.java | 2 +- .../msa/connectivity/lwm2m/client/SimpleLwM2MDevice.java | 2 +- .../msa/connectivity/lwm2m/rpc/Lwm2mObserveCompositeTest.java | 2 +- .../server/msa/connectivity/lwm2m/rpc/Lwm2mObserveTest.java | 2 +- .../msa/connectivity/lwm2m/security/Lwm2mClientNoSecTest.java | 2 +- .../msa/connectivity/lwm2m/security/Lwm2mClientPskTest.java | 2 +- .../org/thingsboard/server/msa/mapper/AttributesResponse.java | 2 +- .../org/thingsboard/server/msa/mapper/WsTelemetryResponse.java | 2 +- .../thingsboard/server/msa/prototypes/DevicePrototypes.java | 2 +- .../org/thingsboard/server/msa/rule/node/MqttNodeTest.java | 2 +- .../org/thingsboard/server/msa/ui/base/AbstractBasePage.java | 2 +- .../thingsboard/server/msa/ui/base/AbstractDriverBaseTest.java | 2 +- .../org/thingsboard/server/msa/ui/listeners/RetryAnalyzer.java | 2 +- .../thingsboard/server/msa/ui/listeners/RetryTestListener.java | 2 +- .../server/msa/ui/pages/AlarmDetailsEntityTabElements.java | 2 +- .../server/msa/ui/pages/AlarmDetailsEntityTabHelper.java | 2 +- .../server/msa/ui/pages/AlarmDetailsViewElements.java | 2 +- .../server/msa/ui/pages/AlarmDetailsViewHelper.java | 2 +- .../thingsboard/server/msa/ui/pages/AlarmWidgetElements.java | 2 +- .../org/thingsboard/server/msa/ui/pages/AssetPageElements.java | 2 +- .../org/thingsboard/server/msa/ui/pages/AssetPageHelper.java | 2 +- .../server/msa/ui/pages/CreateWidgetPopupElements.java | 2 +- .../server/msa/ui/pages/CreateWidgetPopupHelper.java | 2 +- .../thingsboard/server/msa/ui/pages/CustomerPageElements.java | 2 +- .../thingsboard/server/msa/ui/pages/CustomerPageHelper.java | 2 +- .../thingsboard/server/msa/ui/pages/DashboardPageElements.java | 2 +- .../thingsboard/server/msa/ui/pages/DashboardPageHelper.java | 2 +- .../thingsboard/server/msa/ui/pages/DevicePageElements.java | 2 +- .../org/thingsboard/server/msa/ui/pages/DevicePageHelper.java | 2 +- .../server/msa/ui/pages/EntityViewPageElements.java | 2 +- .../thingsboard/server/msa/ui/pages/EntityViewPageHelper.java | 2 +- .../org/thingsboard/server/msa/ui/pages/LoginPageElements.java | 2 +- .../org/thingsboard/server/msa/ui/pages/LoginPageHelper.java | 2 +- .../server/msa/ui/pages/OpenRuleChainPageElements.java | 2 +- .../server/msa/ui/pages/OpenRuleChainPageHelper.java | 2 +- .../org/thingsboard/server/msa/ui/pages/OtherPageElements.java | 2 +- .../server/msa/ui/pages/OtherPageElementsHelper.java | 2 +- .../thingsboard/server/msa/ui/pages/ProfilesPageElements.java | 2 +- .../thingsboard/server/msa/ui/pages/ProfilesPageHelper.java | 2 +- .../server/msa/ui/pages/RuleChainsPageElements.java | 2 +- .../thingsboard/server/msa/ui/pages/RuleChainsPageHelper.java | 2 +- .../server/msa/ui/pages/SideBarMenuViewElements.java | 2 +- .../thingsboard/server/msa/ui/pages/SideBarMenuViewHelper.java | 2 +- .../server/msa/ui/tabs/AssignDeviceTabElements.java | 2 +- .../thingsboard/server/msa/ui/tabs/AssignDeviceTabHelper.java | 2 +- .../server/msa/ui/tabs/CreateDeviceTabElements.java | 2 +- .../thingsboard/server/msa/ui/tabs/CreateDeviceTabHelper.java | 2 +- .../server/msa/ui/tests/alarmassignee/AbstractAssignTest.java | 2 +- .../msa/ui/tests/alarmassignee/AssignDetailsTabAssignTest.java | 2 +- .../alarmassignee/AssignDetailsTabFromCustomerAssignTest.java | 2 +- .../msa/ui/tests/alarmassignee/AssignFromAlarmWidgetTest.java | 2 +- .../ui/tests/assetProfileSmoke/AssetProfileEditMenuTest.java | 2 +- .../tests/assetProfileSmoke/CreateAssetProfileImportTest.java | 2 +- .../msa/ui/tests/assetProfileSmoke/CreateAssetProfileTest.java | 2 +- .../msa/ui/tests/assetProfileSmoke/DeleteAssetProfileTest.java | 2 +- .../assetProfileSmoke/DeleteSeveralAssetProfilesTest.java | 2 +- .../tests/assetProfileSmoke/MakeAssetProfileDefaultTest.java | 2 +- .../msa/ui/tests/assetProfileSmoke/SearchAssetProfileTest.java | 2 +- .../server/msa/ui/tests/assetProfileSmoke/SortByNameTest.java | 2 +- .../server/msa/ui/tests/customerSmoke/CreateCustomerTest.java | 2 +- .../msa/ui/tests/customerSmoke/CustomerEditMenuTest.java | 2 +- .../server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java | 2 +- .../msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java | 2 +- .../msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java | 2 +- .../ui/tests/customerSmoke/ManageCustomersDashboardsTest.java | 2 +- .../msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java | 2 +- .../msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java | 2 +- .../msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java | 2 +- .../server/msa/ui/tests/customerSmoke/SearchCustomerTest.java | 2 +- .../server/msa/ui/tests/customerSmoke/SortByNameTest.java | 2 +- .../deviceProfileSmoke/CreateDeviceProfileImportTest.java | 2 +- .../ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java | 2 +- .../ui/tests/deviceProfileSmoke/DeleteDeviceProfileTest.java | 2 +- .../deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java | 2 +- .../ui/tests/deviceProfileSmoke/DeviceProfileEditMenuTest.java | 2 +- .../tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java | 2 +- .../ui/tests/deviceProfileSmoke/SearchDeviceProfileTest.java | 2 +- .../server/msa/ui/tests/deviceProfileSmoke/SortByNameTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/AbstractDeviceTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/AssignToCustomerTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/CreateDeviceTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/DeleteDeviceTest.java | 2 +- .../msa/ui/tests/devicessmoke/DeleteSeveralDevicesTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/DeviceFilterTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/EditDeviceTest.java | 2 +- .../msa/ui/tests/devicessmoke/MakeDevicePrivateTest.java | 2 +- .../server/msa/ui/tests/devicessmoke/MakeDevicePublicTest.java | 2 +- .../msa/ui/tests/rulechainssmoke/AbstractRuleChainTest.java | 2 +- .../ui/tests/rulechainssmoke/CreateRuleChainImportTest.java | 2 +- .../msa/ui/tests/rulechainssmoke/CreateRuleChainTest.java | 2 +- .../msa/ui/tests/rulechainssmoke/DeleteRuleChainTest.java | 2 +- .../ui/tests/rulechainssmoke/DeleteSeveralRuleChainsTest.java | 2 +- .../msa/ui/tests/rulechainssmoke/MakeRuleChainRootTest.java | 2 +- .../server/msa/ui/tests/rulechainssmoke/OpenRuleChainTest.java | 2 +- .../msa/ui/tests/rulechainssmoke/RuleChainEditMenuTest.java | 2 +- .../msa/ui/tests/rulechainssmoke/SearchRuleChainTest.java | 2 +- .../server/msa/ui/tests/rulechainssmoke/SortByNameTest.java | 2 +- .../server/msa/ui/tests/rulechainssmoke/SortByTimeTest.java | 2 +- .../test/java/org/thingsboard/server/msa/ui/utils/Const.java | 2 +- .../server/msa/ui/utils/DataProviderCredential.java | 2 +- .../org/thingsboard/server/msa/ui/utils/EntityPrototypes.java | 2 +- msa/black-box-tests/src/test/resources/alarmAssignee.xml | 2 +- msa/black-box-tests/src/test/resources/all.xml | 2 +- msa/black-box-tests/src/test/resources/connectivity.xml | 2 +- .../src/test/resources/docker-compose.hybrid-test-extras.yml | 2 +- .../src/test/resources/docker-compose.mosquitto.yml | 2 +- .../src/test/resources/docker-compose.postgres-test-extras.yml | 2 +- .../src/test/resources/docker-compose.rabbitmq-server.yml | 2 +- .../src/test/resources/docker-compose.redis-ssl.volumes.yml | 2 +- .../src/test/resources/docker-compose.redis-ssl.yml | 2 +- msa/black-box-tests/src/test/resources/docker-selenium.yml | 2 +- msa/black-box-tests/src/test/resources/forImport.txt | 2 +- msa/black-box-tests/src/test/resources/logback.xml | 2 +- .../src/test/resources/mosquitto/mosquitto.conf | 2 +- msa/black-box-tests/src/test/resources/smokeDevices.xml | 2 +- msa/black-box-tests/src/test/resources/smokesCustomer.xml | 2 +- msa/black-box-tests/src/test/resources/smokesProfiles.xml | 2 +- msa/black-box-tests/src/test/resources/smokesRuleChain.xml | 2 +- .../src/test/resources/tb-node/conf/logback.xml | 2 +- .../src/test/resources/tb-transports/coap/conf/logback.xml | 2 +- .../src/test/resources/tb-transports/http/conf/logback.xml | 2 +- .../src/test/resources/tb-transports/lwm2m/conf/logback.xml | 2 +- .../src/test/resources/tb-transports/mqtt/conf/logback.xml | 2 +- msa/black-box-tests/src/test/resources/uiTests.xml | 2 +- msa/js-executor/api/httpServer.ts | 2 +- msa/js-executor/api/jsExecutor.models.ts | 2 +- msa/js-executor/api/jsExecutor.ts | 2 +- msa/js-executor/api/jsInvokeMessageProcessor.ts | 2 +- msa/js-executor/api/utils.ts | 2 +- msa/js-executor/config/custom-environment-variables.yml | 2 +- msa/js-executor/config/default.yml | 2 +- msa/js-executor/config/logger.ts | 2 +- msa/js-executor/config/tb-js-executor.conf | 2 +- msa/js-executor/docker/Dockerfile | 2 +- msa/js-executor/docker/start-js-executor.sh | 2 +- msa/js-executor/install.js | 2 +- msa/js-executor/pom.xml | 2 +- msa/js-executor/queue/kafkaTemplate.ts | 2 +- msa/js-executor/queue/queue.models.ts | 2 +- msa/js-executor/server.ts | 2 +- msa/monitoring/docker/Dockerfile | 2 +- msa/monitoring/docker/start-tb-monitoring.sh | 2 +- msa/monitoring/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/docker/Dockerfile | 2 +- msa/tb-node/docker/start-tb-node.sh | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/docker-cassandra/Dockerfile | 2 +- msa/tb/docker-cassandra/start-db.sh | 2 +- msa/tb/docker-cassandra/stop-db.sh | 2 +- msa/tb/docker-postgres/Dockerfile | 2 +- msa/tb/docker-postgres/start-db.sh | 2 +- msa/tb/docker-postgres/stop-db.sh | 2 +- msa/tb/docker/install-tb.sh | 2 +- msa/tb/docker/logback.xml | 2 +- msa/tb/docker/start-tb.sh | 2 +- msa/tb/docker/thingsboard.conf | 2 +- msa/tb/docker/upgrade-tb.sh | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/docker/Dockerfile | 2 +- msa/transport/coap/docker/start-tb-coap-transport.sh | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/docker/Dockerfile | 2 +- msa/transport/http/docker/start-tb-http-transport.sh | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/lwm2m/docker/Dockerfile | 2 +- msa/transport/lwm2m/docker/start-tb-lwm2m-transport.sh | 2 +- msa/transport/lwm2m/pom.xml | 2 +- msa/transport/mqtt/docker/Dockerfile | 2 +- msa/transport/mqtt/docker/start-tb-mqtt-transport.sh | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/transport/snmp/docker/Dockerfile | 2 +- msa/transport/snmp/docker/start-tb-snmp-transport.sh | 2 +- msa/transport/snmp/pom.xml | 2 +- msa/vc-executor-docker/docker/Dockerfile | 2 +- msa/vc-executor-docker/docker/start-tb-vc-executor.sh | 2 +- msa/vc-executor-docker/pom.xml | 2 +- msa/vc-executor/pom.xml | 2 +- msa/vc-executor/src/main/conf/logback.xml | 2 +- msa/vc-executor/src/main/conf/tb-vc-executor.conf | 2 +- .../vc/ThingsboardVersionControlExecutorApplication.java | 2 +- .../vc/service/VersionControlQueueRoutingInfoService.java | 2 +- .../vc/service/VersionControlTenantRoutingInfoService.java | 2 +- msa/vc-executor/src/main/resources/logback.xml | 2 +- msa/vc-executor/src/main/resources/tb-vc-executor.yml | 2 +- msa/web-ui/config/custom-environment-variables.yml | 2 +- msa/web-ui/config/default.yml | 2 +- msa/web-ui/config/logger.ts | 2 +- msa/web-ui/config/tb-web-ui.conf | 2 +- msa/web-ui/docker/Dockerfile | 2 +- msa/web-ui/docker/start-web-ui.sh | 2 +- msa/web-ui/install.js | 2 +- msa/web-ui/pom.xml | 2 +- msa/web-ui/server.ts | 2 +- netty-mqtt/pom.xml | 2 +- .../main/java/org/thingsboard/mqtt/ChannelClosedException.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttChannelHandler.java | 2 +- netty-mqtt/src/main/java/org/thingsboard/mqtt/MqttClient.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttClientCallback.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttClientConfig.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttClientImpl.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttConnectResult.java | 2 +- netty-mqtt/src/main/java/org/thingsboard/mqtt/MqttHandler.java | 2 +- .../java/org/thingsboard/mqtt/MqttIncomingQos2Publish.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttLastWill.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttPendingPublish.java | 2 +- .../java/org/thingsboard/mqtt/MqttPendingSubscription.java | 2 +- .../java/org/thingsboard/mqtt/MqttPendingUnsubscription.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttPingHandler.java | 2 +- .../src/main/java/org/thingsboard/mqtt/MqttSubscription.java | 2 +- .../src/main/java/org/thingsboard/mqtt/PendingOperation.java | 2 +- .../main/java/org/thingsboard/mqtt/RetransmissionHandler.java | 2 +- .../test/java/org/thingsboard/mqtt/MqttPingHandlerTest.java | 2 +- .../org/thingsboard/mqtt/integration/MqttIntegrationTest.java | 2 +- .../org/thingsboard/mqtt/integration/server/MqttServer.java | 2 +- .../mqtt/integration/server/MqttTransportHandler.java | 2 +- packaging/java/assembly/windows.xml | 2 +- packaging/java/build.gradle | 2 +- packaging/java/scripts/install/install.sh | 2 +- packaging/java/scripts/install/install_dev_db.sh | 2 +- packaging/java/scripts/install/logback.xml | 2 +- packaging/java/scripts/install/upgrade.sh | 2 +- packaging/java/scripts/install/upgrade_dev_db.sh | 2 +- packaging/js/assembly/windows.xml | 2 +- packaging/js/build.gradle | 2 +- pom.xml | 2 +- rest-client/pom.xml | 2 +- .../src/main/java/org/thingsboard/rest/client/RestClient.java | 2 +- .../org/thingsboard/rest/client/utils/RestJsonConverter.java | 2 +- rest-client/src/main/resources/logback.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- .../thingsboard/rule/engine/api/AttributesDeleteRequest.java | 2 +- .../org/thingsboard/rule/engine/api/AttributesSaveRequest.java | 2 +- .../thingsboard/rule/engine/api/EmptyNodeConfiguration.java | 2 +- .../main/java/org/thingsboard/rule/engine/api/MailService.java | 2 +- .../org/thingsboard/rule/engine/api/NodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/api/NodeDefinition.java | 2 +- .../org/thingsboard/rule/engine/api/NotificationCenter.java | 2 +- .../thingsboard/rule/engine/api/RuleEngineAlarmService.java | 2 +- .../rule/engine/api/RuleEngineApiUsageStateService.java | 2 +- .../rule/engine/api/RuleEngineAssetProfileCache.java | 2 +- .../rule/engine/api/RuleEngineDeviceProfileCache.java | 2 +- .../rule/engine/api/RuleEngineDeviceRpcRequest.java | 2 +- .../rule/engine/api/RuleEngineDeviceRpcResponse.java | 2 +- .../rule/engine/api/RuleEngineDeviceStateManager.java | 2 +- .../org/thingsboard/rule/engine/api/RuleEngineRpcService.java | 2 +- .../rule/engine/api/RuleEngineTelemetryService.java | 2 +- .../main/java/org/thingsboard/rule/engine/api/RuleNode.java | 2 +- .../java/org/thingsboard/rule/engine/api/ScriptEngine.java | 2 +- .../main/java/org/thingsboard/rule/engine/api/SmsService.java | 2 +- .../main/java/org/thingsboard/rule/engine/api/TbContext.java | 2 +- .../src/main/java/org/thingsboard/rule/engine/api/TbEmail.java | 2 +- .../src/main/java/org/thingsboard/rule/engine/api/TbNode.java | 2 +- .../org/thingsboard/rule/engine/api/TbNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/api/TbNodeException.java | 2 +- .../main/java/org/thingsboard/rule/engine/api/TbNodeState.java | 2 +- .../thingsboard/rule/engine/api/TimeseriesDeleteRequest.java | 2 +- .../org/thingsboard/rule/engine/api/TimeseriesSaveRequest.java | 2 +- .../rule/engine/api/notification/FirebaseService.java | 2 +- .../thingsboard/rule/engine/api/notification/SlackService.java | 2 +- .../java/org/thingsboard/rule/engine/api/sms/SmsSender.java | 2 +- .../org/thingsboard/rule/engine/api/sms/SmsSenderFactory.java | 2 +- .../rule/engine/api/sms/exception/SmsException.java | 2 +- .../rule/engine/api/sms/exception/SmsParseException.java | 2 +- .../rule/engine/api/sms/exception/SmsSendException.java | 2 +- .../java/org/thingsboard/rule/engine/api/util/TbNodeUtils.java | 2 +- .../thingsboard/rule/engine/api/TimeseriesSaveRequestTest.java | 2 +- .../org/thingsboard/rule/engine/api/util/TbNodeUtilsTest.java | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- .../thingsboard/rule/engine/action/TbAbstractAlarmNode.java | 2 +- .../rule/engine/action/TbAbstractAlarmNodeConfiguration.java | 2 +- .../rule/engine/action/TbAbstractCustomerActionNode.java | 2 +- .../action/TbAbstractCustomerActionNodeConfiguration.java | 2 +- .../rule/engine/action/TbAbstractRelationActionNode.java | 2 +- .../action/TbAbstractRelationActionNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/action/TbAlarmResult.java | 2 +- .../thingsboard/rule/engine/action/TbAssignToCustomerNode.java | 2 +- .../engine/action/TbAssignToCustomerNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/action/TbClearAlarmNode.java | 2 +- .../rule/engine/action/TbClearAlarmNodeConfiguration.java | 2 +- .../rule/engine/action/TbCopyAttributesToEntityViewNode.java | 2 +- .../org/thingsboard/rule/engine/action/TbCreateAlarmNode.java | 2 +- .../rule/engine/action/TbCreateAlarmNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/action/TbCreateRelationNode.java | 2 +- .../rule/engine/action/TbCreateRelationNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/action/TbDeleteRelationNode.java | 2 +- .../rule/engine/action/TbDeleteRelationNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/action/TbDeviceStateNode.java | 2 +- .../rule/engine/action/TbDeviceStateNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/action/TbLogNode.java | 2 +- .../thingsboard/rule/engine/action/TbLogNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/action/TbMsgCountNode.java | 2 +- .../rule/engine/action/TbMsgCountNodeConfiguration.java | 2 +- .../rule/engine/action/TbSaveToCustomCassandraTableNode.java | 2 +- .../action/TbSaveToCustomCassandraTableNodeConfiguration.java | 2 +- .../rule/engine/action/TbUnassignFromCustomerNode.java | 2 +- .../engine/action/TbUnassignFromCustomerNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/aws/lambda/TbAwsLambdaNode.java | 2 +- .../rule/engine/aws/lambda/TbAwsLambdaNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/aws/sns/TbSnsNode.java | 2 +- .../rule/engine/aws/sns/TbSnsNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/aws/sqs/TbSqsNode.java | 2 +- .../rule/engine/aws/sqs/TbSqsNodeConfiguration.java | 2 +- .../rule/engine/credentials/AnonymousCredentials.java | 2 +- .../thingsboard/rule/engine/credentials/BasicCredentials.java | 2 +- .../rule/engine/credentials/CertPemCredentials.java | 2 +- .../thingsboard/rule/engine/credentials/ClientCredentials.java | 2 +- .../thingsboard/rule/engine/credentials/CredentialsType.java | 2 +- .../org/thingsboard/rule/engine/data/DeviceRelationsQuery.java | 2 +- .../java/org/thingsboard/rule/engine/data/RelationsQuery.java | 2 +- .../org/thingsboard/rule/engine/debug/TbMsgGeneratorNode.java | 2 +- .../rule/engine/debug/TbMsgGeneratorNodeConfiguration.java | 2 +- .../rule/engine/deduplication/DeduplicationData.java | 2 +- .../thingsboard/rule/engine/deduplication/DeduplicationId.java | 2 +- .../rule/engine/deduplication/DeduplicationStrategy.java | 2 +- .../rule/engine/deduplication/TbMsgDeduplicationNode.java | 2 +- .../deduplication/TbMsgDeduplicationNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/delay/TbMsgDelayNode.java | 2 +- .../rule/engine/delay/TbMsgDelayNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java | 2 +- .../rule/engine/edge/BaseTbMsgPushNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/edge/TbMsgPushToCloudNode.java | 2 +- .../rule/engine/edge/TbMsgPushToCloudNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/edge/TbMsgPushToEdgeNode.java | 2 +- .../rule/engine/edge/TbMsgPushToEdgeNodeConfiguration.java | 2 +- .../rule/engine/external/TbAbstractExternalNode.java | 2 +- .../rule/engine/filter/TbAbstractTypeSwitchNode.java | 2 +- .../thingsboard/rule/engine/filter/TbAssetTypeSwitchNode.java | 2 +- .../thingsboard/rule/engine/filter/TbCheckAlarmStatusNode.java | 2 +- .../rule/engine/filter/TbCheckAlarmStatusNodeConfig.java | 2 +- .../org/thingsboard/rule/engine/filter/TbCheckMessageNode.java | 2 +- .../rule/engine/filter/TbCheckMessageNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/filter/TbCheckRelationNode.java | 2 +- .../rule/engine/filter/TbCheckRelationNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/filter/TbDeviceTypeSwitchNode.java | 2 +- .../org/thingsboard/rule/engine/filter/TbJsFilterNode.java | 2 +- .../rule/engine/filter/TbJsFilterNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/filter/TbJsSwitchNode.java | 2 +- .../rule/engine/filter/TbJsSwitchNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/filter/TbMsgTypeFilterNode.java | 2 +- .../rule/engine/filter/TbMsgTypeFilterNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/filter/TbMsgTypeSwitchNode.java | 2 +- .../rule/engine/filter/TbOriginatorTypeFilterNode.java | 2 +- .../engine/filter/TbOriginatorTypeFilterNodeConfiguration.java | 2 +- .../rule/engine/filter/TbOriginatorTypeSwitchNode.java | 2 +- .../main/java/org/thingsboard/rule/engine/flow/TbAckNode.java | 2 +- .../org/thingsboard/rule/engine/flow/TbCheckpointNode.java | 2 +- .../org/thingsboard/rule/engine/flow/TbRuleChainInputNode.java | 2 +- .../rule/engine/flow/TbRuleChainInputNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/flow/TbRuleChainOutputNode.java | 2 +- .../org/thingsboard/rule/engine/gcp/pubsub/TbPubSubNode.java | 2 +- .../rule/engine/gcp/pubsub/TbPubSubNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/geo/AbstractGeofencingNode.java | 2 +- .../main/java/org/thingsboard/rule/engine/geo/Coordinates.java | 2 +- .../org/thingsboard/rule/engine/geo/EntityGeofencingState.java | 2 +- .../src/main/java/org/thingsboard/rule/engine/geo/GeoUtil.java | 2 +- .../main/java/org/thingsboard/rule/engine/geo/Perimeter.java | 2 +- .../java/org/thingsboard/rule/engine/geo/PerimeterType.java | 2 +- .../main/java/org/thingsboard/rule/engine/geo/RangeUnit.java | 2 +- .../thingsboard/rule/engine/geo/TbGpsGeofencingActionNode.java | 2 +- .../engine/geo/TbGpsGeofencingActionNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/geo/TbGpsGeofencingFilterNode.java | 2 +- .../engine/geo/TbGpsGeofencingFilterNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/kafka/TbKafkaNode.java | 2 +- .../rule/engine/kafka/TbKafkaNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/mail/TbMsgToEmailNode.java | 2 +- .../rule/engine/mail/TbMsgToEmailNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/mail/TbSendEmailNode.java | 2 +- .../rule/engine/mail/TbSendEmailNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/math/TbMathArgument.java | 2 +- .../org/thingsboard/rule/engine/math/TbMathArgumentType.java | 2 +- .../org/thingsboard/rule/engine/math/TbMathArgumentValue.java | 2 +- .../main/java/org/thingsboard/rule/engine/math/TbMathNode.java | 2 +- .../thingsboard/rule/engine/math/TbMathNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/math/TbMathResult.java | 2 +- .../rule/engine/math/TbRuleNodeMathFunctionType.java | 2 +- .../thingsboard/rule/engine/metadata/CalculateDeltaNode.java | 2 +- .../rule/engine/metadata/CalculateDeltaNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/metadata/DataToFetch.java | 2 +- .../java/org/thingsboard/rule/engine/metadata/FetchMode.java | 2 +- .../engine/metadata/TbAbstractFetchToNodeConfiguration.java | 2 +- .../rule/engine/metadata/TbAbstractGetAttributesNode.java | 2 +- .../rule/engine/metadata/TbAbstractGetEntityDataNode.java | 2 +- .../rule/engine/metadata/TbAbstractGetEntityDetailsNode.java | 2 +- .../metadata/TbAbstractGetEntityDetailsNodeConfiguration.java | 2 +- .../rule/engine/metadata/TbAbstractGetMappedDataNode.java | 2 +- .../rule/engine/metadata/TbAbstractNodeWithFetchTo.java | 2 +- .../rule/engine/metadata/TbFetchDeviceCredentialsNode.java | 2 +- .../metadata/TbFetchDeviceCredentialsNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/metadata/TbGetAttributesNode.java | 2 +- .../rule/engine/metadata/TbGetAttributesNodeConfiguration.java | 2 +- .../rule/engine/metadata/TbGetCustomerAttributeNode.java | 2 +- .../rule/engine/metadata/TbGetCustomerDetailsNode.java | 2 +- .../engine/metadata/TbGetCustomerDetailsNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/metadata/TbGetDeviceAttrNode.java | 2 +- .../rule/engine/metadata/TbGetDeviceAttrNodeConfiguration.java | 2 +- .../rule/engine/metadata/TbGetEntityDataNodeConfiguration.java | 2 +- .../rule/engine/metadata/TbGetMappedDataNodeConfiguration.java | 2 +- .../engine/metadata/TbGetOriginatorFieldsConfiguration.java | 2 +- .../rule/engine/metadata/TbGetOriginatorFieldsNode.java | 2 +- .../rule/engine/metadata/TbGetRelatedAttributeNode.java | 2 +- .../engine/metadata/TbGetRelatedDataNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/metadata/TbGetTelemetryNode.java | 2 +- .../rule/engine/metadata/TbGetTelemetryNodeConfiguration.java | 2 +- .../rule/engine/metadata/TbGetTenantAttributeNode.java | 2 +- .../rule/engine/metadata/TbGetTenantDetailsNode.java | 2 +- .../engine/metadata/TbGetTenantDetailsNodeConfiguration.java | 2 +- .../main/java/org/thingsboard/rule/engine/mqtt/TbMqttNode.java | 2 +- .../thingsboard/rule/engine/mqtt/TbMqttNodeConfiguration.java | 2 +- .../rule/engine/mqtt/azure/AzureIotHubSasCredentials.java | 2 +- .../thingsboard/rule/engine/mqtt/azure/TbAzureIotHubNode.java | 2 +- .../rule/engine/mqtt/azure/TbAzureIotHubNodeConfiguration.java | 2 +- .../rule/engine/notification/TbNotificationNode.java | 2 +- .../engine/notification/TbNotificationNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/notification/TbSlackNode.java | 2 +- .../rule/engine/notification/TbSlackNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/profile/AlarmEvalResult.java | 2 +- .../org/thingsboard/rule/engine/profile/AlarmRuleState.java | 2 +- .../java/org/thingsboard/rule/engine/profile/AlarmState.java | 2 +- .../rule/engine/profile/AlarmStateUpdateResult.java | 2 +- .../java/org/thingsboard/rule/engine/profile/DataSnapshot.java | 2 +- .../java/org/thingsboard/rule/engine/profile/DeviceState.java | 2 +- .../rule/engine/profile/DynamicPredicateValueCtx.java | 2 +- .../rule/engine/profile/DynamicPredicateValueCtxImpl.java | 2 +- .../org/thingsboard/rule/engine/profile/EntityKeyValue.java | 2 +- .../thingsboard/rule/engine/profile/NumericParseException.java | 2 +- .../java/org/thingsboard/rule/engine/profile/ProfileState.java | 2 +- .../org/thingsboard/rule/engine/profile/SnapshotUpdate.java | 2 +- .../thingsboard/rule/engine/profile/TbDeviceProfileNode.java | 2 +- .../rule/engine/profile/TbDeviceProfileNodeConfiguration.java | 2 +- .../rule/engine/profile/state/PersistedAlarmRuleState.java | 2 +- .../rule/engine/profile/state/PersistedAlarmState.java | 2 +- .../rule/engine/profile/state/PersistedDeviceState.java | 2 +- .../org/thingsboard/rule/engine/rabbitmq/TbRabbitMqNode.java | 2 +- .../rule/engine/rabbitmq/TbRabbitMqNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/rest/TbHttpClient.java | 2 +- .../org/thingsboard/rule/engine/rest/TbRestApiCallNode.java | 2 +- .../rule/engine/rest/TbRestApiCallNodeConfiguration.java | 2 +- .../rule/engine/rest/TbSendRestApiCallReplyNode.java | 2 +- .../engine/rest/TbSendRestApiCallReplyNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/rpc/TbSendRPCReplyNode.java | 2 +- .../org/thingsboard/rule/engine/rpc/TbSendRPCRequestNode.java | 2 +- .../rule/engine/rpc/TbSendRpcReplyNodeConfiguration.java | 2 +- .../rule/engine/rpc/TbSendRpcRequestNodeConfiguration.java | 2 +- .../java/org/thingsboard/rule/engine/sms/TbSendSmsNode.java | 2 +- .../rule/engine/sms/TbSendSmsNodeConfiguration.java | 2 +- .../rule/engine/telemetry/AttributesDeleteNodeCallback.java | 2 +- .../rule/engine/telemetry/AttributesUpdateNodeCallback.java | 2 +- .../thingsboard/rule/engine/telemetry/TbMsgAttributesNode.java | 2 +- .../engine/telemetry/TbMsgAttributesNodeConfiguration.java | 2 +- .../rule/engine/telemetry/TbMsgDeleteAttributesNode.java | 2 +- .../telemetry/TbMsgDeleteAttributesNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/telemetry/TbMsgTimeseriesNode.java | 2 +- .../engine/telemetry/TbMsgTimeseriesNodeConfiguration.java | 2 +- .../rule/engine/telemetry/TelemetryNodeCallback.java | 2 +- .../telemetry/strategy/DeduplicateProcessingStrategy.java | 2 +- .../telemetry/strategy/OnEveryMessageProcessingStrategy.java | 2 +- .../rule/engine/telemetry/strategy/ProcessingStrategy.java | 2 +- .../rule/engine/telemetry/strategy/SkipProcessingStrategy.java | 2 +- .../rule/engine/transaction/TbSynchronizationBeginNode.java | 2 +- .../rule/engine/transaction/TbSynchronizationEndNode.java | 2 +- .../rule/engine/transform/MultipleTbMsgsCallbackWrapper.java | 2 +- .../thingsboard/rule/engine/transform/OriginatorSource.java | 2 +- .../rule/engine/transform/TbAbstractTransformNode.java | 2 +- .../transform/TbAbstractTransformNodeWithTbMsgSource.java | 2 +- .../rule/engine/transform/TbChangeOriginatorNode.java | 2 +- .../engine/transform/TbChangeOriginatorNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/transform/TbCopyKeysNode.java | 2 +- .../rule/engine/transform/TbCopyKeysNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/transform/TbDeleteKeysNode.java | 2 +- .../rule/engine/transform/TbDeleteKeysNodeConfiguration.java | 2 +- .../org/thingsboard/rule/engine/transform/TbJsonPathNode.java | 2 +- .../rule/engine/transform/TbJsonPathNodeConfiguration.java | 2 +- .../rule/engine/transform/TbMsgCallbackWrapper.java | 2 +- .../thingsboard/rule/engine/transform/TbRenameKeysNode.java | 2 +- .../rule/engine/transform/TbRenameKeysNodeConfiguration.java | 2 +- .../thingsboard/rule/engine/transform/TbSplitArrayMsgNode.java | 2 +- .../thingsboard/rule/engine/transform/TbTransformMsgNode.java | 2 +- .../rule/engine/transform/TbTransformMsgNodeConfiguration.java | 2 +- .../rule/engine/util/ContactBasedEntityDetails.java | 2 +- .../rule/engine/util/EntitiesAlarmOriginatorIdAsyncLoader.java | 2 +- .../rule/engine/util/EntitiesByNameAndTypeLoader.java | 2 +- .../rule/engine/util/EntitiesCustomerIdAsyncLoader.java | 2 +- .../rule/engine/util/EntitiesFieldsAsyncLoader.java | 2 +- .../rule/engine/util/EntitiesRelatedDeviceIdAsyncLoader.java | 2 +- .../rule/engine/util/EntitiesRelatedEntityIdAsyncLoader.java | 2 +- .../org/thingsboard/rule/engine/util/GpsGeofencingEvents.java | 2 +- .../thingsboard/rule/engine/util/SemaphoreWithTbMsgQueue.java | 2 +- .../java/org/thingsboard/rule/engine/util/TbMsgSource.java | 2 +- .../java/org/thingsboard/rule/engine/util/TenantIdLoader.java | 2 +- .../thingsboard/rule/engine/AbstractRuleNodeUpgradeTest.java | 2 +- .../org/thingsboard/rule/engine/TestDbCallbackExecutor.java | 2 +- .../rule/engine/action/TbAssignToCustomerNodeTest.java | 2 +- .../thingsboard/rule/engine/action/TbClearAlarmNodeTest.java | 2 +- .../engine/action/TbCopyAttributesToEntityViewNodeTest.java | 2 +- .../thingsboard/rule/engine/action/TbCreateAlarmNodeTest.java | 2 +- .../rule/engine/action/TbCreateRelationNodeTest.java | 2 +- .../rule/engine/action/TbDeleteRelationNodeTest.java | 2 +- .../thingsboard/rule/engine/action/TbDeviceStateNodeTest.java | 2 +- .../java/org/thingsboard/rule/engine/action/TbLogNodeTest.java | 2 +- .../org/thingsboard/rule/engine/action/TbMsgCountNodeTest.java | 2 +- .../engine/action/TbSaveToCustomCassandraTableNodeTest.java | 2 +- .../rule/engine/action/TbUnassignFromCustomerNodeTest.java | 2 +- .../rule/engine/aws/lambda/TbAwsLambdaNodeTest.java | 2 +- .../org/thingsboard/rule/engine/aws/sns/TbSnsNodeTest.java | 2 +- .../org/thingsboard/rule/engine/aws/sqs/TbSqsNodeTest.java | 2 +- .../rule/engine/credentials/CertPemCredentialsTest.java | 2 +- .../thingsboard/rule/engine/debug/TbMsgGeneratorNodeTest.java | 2 +- .../thingsboard/rule/engine/edge/TbMsgPushToEdgeNodeTest.java | 2 +- .../rule/engine/filter/TbAssetTypeSwitchNodeTest.java | 2 +- .../rule/engine/filter/TbCheckAlarmStatusNodeTest.java | 2 +- .../thingsboard/rule/engine/filter/TbCheckMessageNodeTest.java | 2 +- .../rule/engine/filter/TbCheckRelationNodeTest.java | 2 +- .../rule/engine/filter/TbDeviceTypeSwitchNodeTest.java | 2 +- .../org/thingsboard/rule/engine/filter/TbJsFilterNodeTest.java | 2 +- .../org/thingsboard/rule/engine/filter/TbJsSwitchNodeTest.java | 2 +- .../rule/engine/filter/TbMsgTypeFilterNodeTest.java | 2 +- .../rule/engine/filter/TbMsgTypeSwitchNodeTest.java | 2 +- .../rule/engine/filter/TbOriginatorTypeFilterNodeTest.java | 2 +- .../rule/engine/filter/TbOriginatorTypeSwitchNodeTest.java | 2 +- .../java/org/thingsboard/rule/engine/flow/TbAckNodeTest.java | 2 +- .../org/thingsboard/rule/engine/flow/TbCheckpointNodeTest.java | 2 +- .../thingsboard/rule/engine/flow/TbRuleChainInputNodeTest.java | 2 +- .../rule/engine/flow/TbRuleChainOutputNodeTest.java | 2 +- .../thingsboard/rule/engine/gcp/pubsub/TbPubSubNodeTest.java | 2 +- .../test/java/org/thingsboard/rule/engine/geo/GeoUtilTest.java | 2 +- .../rule/engine/geo/GpsGeofencingActionTestCase.java | 2 +- .../rule/engine/geo/TbGpsGeofencingActionNodeTest.java | 2 +- .../rule/engine/geo/TbGpsGeofencingFilterNodeTest.java | 2 +- .../org/thingsboard/rule/engine/kafka/TbKafkaNodeTest.java | 2 +- .../org/thingsboard/rule/engine/mail/TbMsgToEmailNodeTest.java | 2 +- .../thingsboard/rule/engine/math/TbMathArgumentValueTest.java | 2 +- .../java/org/thingsboard/rule/engine/math/TbMathNodeTest.java | 2 +- .../rule/engine/metadata/CalculateDeltaNodeTest.java | 2 +- .../rule/engine/metadata/TbFetchDeviceCredentialsNodeTest.java | 2 +- .../rule/engine/metadata/TbGetAttributesNodeTest.java | 2 +- .../rule/engine/metadata/TbGetCustomerAttributeNodeTest.java | 2 +- .../rule/engine/metadata/TbGetCustomerDetailsNodeTest.java | 2 +- .../rule/engine/metadata/TbGetDeviceAttrNodeTest.java | 2 +- .../rule/engine/metadata/TbGetOriginatorFieldsNodeTest.java | 2 +- .../rule/engine/metadata/TbGetRelatedAttributeNodeTest.java | 2 +- .../rule/engine/metadata/TbGetTelemetryNodeTest.java | 2 +- .../rule/engine/metadata/TbGetTenantAttributeNodeTest.java | 2 +- .../rule/engine/metadata/TbGetTenantDetailsNodeTest.java | 2 +- .../java/org/thingsboard/rule/engine/mqtt/TbMqttNodeTest.java | 2 +- .../rule/engine/mqtt/azure/TbAzureIotHubNodeTest.java | 2 +- .../thingsboard/rule/engine/profile/AlarmRuleStateTest.java | 2 +- .../org/thingsboard/rule/engine/profile/AlarmStateTest.java | 2 +- .../org/thingsboard/rule/engine/profile/DeviceStateTest.java | 2 +- .../rule/engine/profile/TbDeviceProfileNodeTest.java | 2 +- .../thingsboard/rule/engine/rabbitmq/TbRabbitMqNodeTest.java | 2 +- .../org/thingsboard/rule/engine/rest/TbHttpClientTest.java | 2 +- .../thingsboard/rule/engine/rest/TbRestApiCallNodeTest.java | 2 +- .../rule/engine/rest/TbSendRestApiCallReplyNodeTest.java | 2 +- .../thingsboard/rule/engine/rpc/TbSendRPCReplyNodeTest.java | 2 +- .../thingsboard/rule/engine/rpc/TbSendRPCRequestNodeTest.java | 2 +- .../engine/telemetry/TbMsgAttributesNodeConfigurationTest.java | 2 +- .../rule/engine/telemetry/TbMsgAttributesNodeTest.java | 2 +- .../rule/engine/telemetry/TbMsgDeleteAttributesNodeTest.java | 2 +- .../rule/engine/telemetry/TbMsgTimeseriesNodeTest.java | 2 +- .../telemetry/strategy/DeduplicateProcessingStrategyTest.java | 2 +- .../strategy/OnEveryMessageProcessingStrategyTest.java | 2 +- .../rule/engine/telemetry/strategy/ProcessingStrategyTest.java | 2 +- .../engine/telemetry/strategy/SkipProcessingStrategyTest.java | 2 +- .../rule/engine/transform/TbChangeOriginatorNodeTest.java | 2 +- .../thingsboard/rule/engine/transform/TbCopyKeysNodeTest.java | 2 +- .../rule/engine/transform/TbDeleteKeysNodeTest.java | 2 +- .../thingsboard/rule/engine/transform/TbJsonPathNodeTest.java | 2 +- .../rule/engine/transform/TbMsgDeduplicationNodeTest.java | 2 +- .../rule/engine/transform/TbRenameKeysNodeTest.java | 2 +- .../rule/engine/transform/TbSplitArrayMsgNodeTest.java | 2 +- .../rule/engine/transform/TbTransformMsgNodeTest.java | 2 +- .../rule/engine/util/EntitiesCustomerIdAsyncLoaderTest.java | 2 +- .../rule/engine/util/EntitiesFieldsAsyncLoaderTest.java | 2 +- .../engine/util/EntitiesRelatedDeviceIdAsyncLoaderTest.java | 2 +- .../engine/util/EntitiesRelatedEntityIdAsyncLoaderTest.java | 2 +- .../org/thingsboard/rule/engine/util/TenantIdLoaderTest.java | 2 +- tools/pom.xml | 2 +- .../main/java/org/thingsboard/client/tools/MqttSslClient.java | 2 +- .../thingsboard/client/tools/migrator/DictionaryParser.java | 2 +- .../org/thingsboard/client/tools/migrator/MigratorTool.java | 2 +- .../org/thingsboard/client/tools/migrator/PgCaMigrator.java | 2 +- .../client/tools/migrator/RelatedEntitiesParser.java | 2 +- .../org/thingsboard/client/tools/migrator/WriterBuilder.java | 2 +- tools/src/main/python/check_yml_file.py | 2 +- tools/src/main/python/mqtt-send-telemetry.py | 2 +- tools/src/main/python/one-way-ssl-mqtt-client.py | 2 +- tools/src/main/python/simple-mqtt-client.py | 2 +- tools/src/main/python/two-way-ssl-mqtt-client.py | 2 +- tools/src/main/shell/client.keygen.sh | 2 +- .../src/main/shell/lwm2m/lwM2M_cfssl_chain_clients_for_test.sh | 2 +- tools/src/main/shell/lwm2m/lwm2m_cfssl_chain_all_for_test.sh | 2 +- .../src/main/shell/lwm2m/lwm2m_cfssl_chain_server_for_test.sh | 2 +- tools/src/main/shell/server.keygen.sh | 2 +- transport/coap/pom.xml | 2 +- transport/coap/src/main/conf/logback.xml | 2 +- transport/coap/src/main/conf/tb-coap-transport.conf | 2 +- .../server/coap/ThingsboardCoapTransportApplication.java | 2 +- transport/coap/src/main/resources/logback.xml | 2 +- transport/coap/src/main/resources/tb-coap-transport.yml | 2 +- transport/http/pom.xml | 2 +- transport/http/src/main/conf/logback.xml | 2 +- transport/http/src/main/conf/tb-http-transport.conf | 2 +- .../server/http/ThingsboardHttpTransportApplication.java | 2 +- transport/http/src/main/resources/logback.xml | 2 +- transport/http/src/main/resources/tb-http-transport.yml | 2 +- transport/lwm2m/pom.xml | 2 +- transport/lwm2m/src/main/conf/logback.xml | 2 +- transport/lwm2m/src/main/conf/tb-lwm2m-transport.conf | 2 +- .../server/lwm2m/ThingsboardLwm2mTransportApplication.java | 2 +- transport/lwm2m/src/main/resources/logback.xml | 2 +- transport/lwm2m/src/main/resources/tb-lwm2m-transport.yml | 2 +- transport/mqtt/pom.xml | 2 +- transport/mqtt/src/main/conf/logback.xml | 2 +- transport/mqtt/src/main/conf/tb-mqtt-transport.conf | 2 +- .../server/mqtt/ThingsboardMqttTransportApplication.java | 2 +- transport/mqtt/src/main/resources/logback.xml | 2 +- transport/mqtt/src/main/resources/tb-mqtt-transport.yml | 2 +- transport/pom.xml | 2 +- transport/snmp/pom.xml | 2 +- transport/snmp/src/main/conf/logback.xml | 2 +- transport/snmp/src/main/conf/tb-snmp-transport.conf | 2 +- .../server/snmp/ThingsboardSnmpTransportApplication.java | 2 +- transport/snmp/src/main/resources/logback.xml | 2 +- transport/snmp/src/main/resources/tb-snmp-transport.yml | 2 +- ui-ngx/.editorconfig | 2 +- ui-ngx/esbuild/tb-esbuild-plugins.ts | 2 +- ui-ngx/esbuild/tb-html-fallback-middleware.ts | 2 +- ui-ngx/generate-icon-metadata.js | 3 +-- ui-ngx/generate-types.js | 2 +- ui-ngx/pom.xml | 2 +- ui-ngx/proxy.conf.js | 2 +- ui-ngx/src/app/app-routing.module.ts | 2 +- ui-ngx/src/app/app.component.html | 2 +- ui-ngx/src/app/app.component.scss | 2 +- ui-ngx/src/app/app.component.ts | 2 +- ui-ngx/src/app/app.module.ts | 2 +- ui-ngx/src/app/core/api/alarm-data-subscription.ts | 2 +- ui-ngx/src/app/core/api/alarm-data.service.ts | 2 +- ui-ngx/src/app/core/api/alias-controller.ts | 2 +- ui-ngx/src/app/core/api/data-aggregator.ts | 2 +- ui-ngx/src/app/core/api/entity-data-subscription.ts | 2 +- ui-ngx/src/app/core/api/entity-data.service.ts | 2 +- ui-ngx/src/app/core/api/public-api.ts | 2 +- ui-ngx/src/app/core/api/widget-api.models.ts | 2 +- ui-ngx/src/app/core/api/widget-subscription.ts | 2 +- ui-ngx/src/app/core/auth/auth.actions.ts | 2 +- ui-ngx/src/app/core/auth/auth.effects.ts | 2 +- ui-ngx/src/app/core/auth/auth.models.ts | 2 +- ui-ngx/src/app/core/auth/auth.reducer.ts | 2 +- ui-ngx/src/app/core/auth/auth.selectors.ts | 2 +- ui-ngx/src/app/core/auth/auth.service.spec.ts | 2 +- ui-ngx/src/app/core/auth/auth.service.ts | 2 +- ui-ngx/src/app/core/auth/public-api.ts | 2 +- ui-ngx/src/app/core/core.module.ts | 2 +- ui-ngx/src/app/core/core.state.ts | 2 +- ui-ngx/src/app/core/css/css.js | 2 +- ui-ngx/src/app/core/guards/auth.guard.ts | 2 +- ui-ngx/src/app/core/guards/confirm-on-exit.guard.ts | 2 +- ui-ngx/src/app/core/http/admin.service.ts | 2 +- ui-ngx/src/app/core/http/alarm-comment.service.ts | 2 +- ui-ngx/src/app/core/http/alarm.service.ts | 2 +- ui-ngx/src/app/core/http/asset-profile.service.ts | 2 +- ui-ngx/src/app/core/http/asset.service.ts | 2 +- ui-ngx/src/app/core/http/attribute.service.ts | 2 +- ui-ngx/src/app/core/http/audit-log.service.ts | 2 +- ui-ngx/src/app/core/http/component-descriptor.service.ts | 2 +- ui-ngx/src/app/core/http/customer.service.ts | 2 +- ui-ngx/src/app/core/http/dashboard.service.ts | 2 +- ui-ngx/src/app/core/http/device-profile.service.ts | 2 +- ui-ngx/src/app/core/http/device.service.ts | 2 +- ui-ngx/src/app/core/http/domain.service.ts | 2 +- ui-ngx/src/app/core/http/edge.service.ts | 2 +- ui-ngx/src/app/core/http/entities-version-control.service.ts | 2 +- ui-ngx/src/app/core/http/entity-relation.service.ts | 2 +- ui-ngx/src/app/core/http/entity-view.service.ts | 2 +- ui-ngx/src/app/core/http/entity.service.ts | 2 +- ui-ngx/src/app/core/http/event.service.ts | 2 +- ui-ngx/src/app/core/http/http-utils.ts | 2 +- ui-ngx/src/app/core/http/image.service.ts | 2 +- ui-ngx/src/app/core/http/mobile-app.service.ts | 2 +- ui-ngx/src/app/core/http/mobile-application.service.ts | 2 +- ui-ngx/src/app/core/http/notification.service.ts | 2 +- ui-ngx/src/app/core/http/oauth2.service.ts | 2 +- ui-ngx/src/app/core/http/ota-package.service.ts | 2 +- ui-ngx/src/app/core/http/public-api.ts | 2 +- ui-ngx/src/app/core/http/queue.service.ts | 2 +- ui-ngx/src/app/core/http/resource.service.ts | 2 +- ui-ngx/src/app/core/http/rule-chain.service.ts | 2 +- ui-ngx/src/app/core/http/tenant-profile.service.ts | 2 +- ui-ngx/src/app/core/http/tenant.service.ts | 2 +- ui-ngx/src/app/core/http/two-factor-authentication.service.ts | 2 +- ui-ngx/src/app/core/http/ui-settings.service.ts | 2 +- ui-ngx/src/app/core/http/usage-info.service.ts | 2 +- ui-ngx/src/app/core/http/user-settings.service.ts | 2 +- ui-ngx/src/app/core/http/user.service.ts | 2 +- ui-ngx/src/app/core/http/widget.service.ts | 2 +- .../src/app/core/interceptors/entity-conflict.interceptor.ts | 2 +- ui-ngx/src/app/core/interceptors/global-http-interceptor.ts | 2 +- ui-ngx/src/app/core/interceptors/interceptor-config.ts | 2 +- ui-ngx/src/app/core/interceptors/interceptor-http-params.ts | 2 +- ui-ngx/src/app/core/interceptors/interceptor.util.ts | 2 +- ui-ngx/src/app/core/interceptors/load.actions.ts | 2 +- ui-ngx/src/app/core/interceptors/load.models.ts | 2 +- ui-ngx/src/app/core/interceptors/load.reducer.ts | 2 +- ui-ngx/src/app/core/interceptors/load.selectors.ts | 2 +- ui-ngx/src/app/core/local-storage/local-storage.service.ts | 2 +- ui-ngx/src/app/core/meta-reducers/debug.reducer.ts | 2 +- .../meta-reducers/init-state-from-local-storage.reducer.ts | 2 +- ui-ngx/src/app/core/notification/notification.actions.ts | 2 +- ui-ngx/src/app/core/notification/notification.effects.ts | 2 +- ui-ngx/src/app/core/notification/notification.models.ts | 2 +- ui-ngx/src/app/core/notification/notification.reducer.ts | 2 +- ui-ngx/src/app/core/operator/enterZone.ts | 2 +- ui-ngx/src/app/core/public-api.ts | 2 +- ui-ngx/src/app/core/services/active-component.service.ts | 2 +- ui-ngx/src/app/core/services/broadcast.models.ts | 2 +- ui-ngx/src/app/core/services/broadcast.service.ts | 2 +- ui-ngx/src/app/core/services/dashboard-utils.service.ts | 2 +- ui-ngx/src/app/core/services/dialog.service.ts | 2 +- .../src/app/core/services/dynamic-component-factory.service.ts | 2 +- ui-ngx/src/app/core/services/help.service.ts | 2 +- ui-ngx/src/app/core/services/item-buffer.service.ts | 2 +- ui-ngx/src/app/core/services/menu.models.ts | 2 +- ui-ngx/src/app/core/services/menu.service.ts | 2 +- ui-ngx/src/app/core/services/mobile.service.ts | 2 +- ui-ngx/src/app/core/services/public-api.ts | 2 +- ui-ngx/src/app/core/services/raf.service.ts | 2 +- ui-ngx/src/app/core/services/resources.service.ts | 2 +- .../src/app/core/services/script/node-script-test.service.ts | 2 +- ui-ngx/src/app/core/services/time.service.ts | 2 +- ui-ngx/src/app/core/services/title.service.ts | 2 +- ui-ngx/src/app/core/services/toast-notification.service.ts | 2 +- ui-ngx/src/app/core/services/utils.service.ts | 2 +- ui-ngx/src/app/core/services/window.service.ts | 2 +- ui-ngx/src/app/core/settings/settings.actions.ts | 2 +- ui-ngx/src/app/core/settings/settings.effects.ts | 2 +- ui-ngx/src/app/core/settings/settings.models.ts | 2 +- ui-ngx/src/app/core/settings/settings.reducer.ts | 2 +- ui-ngx/src/app/core/settings/settings.selectors.ts | 2 +- ui-ngx/src/app/core/settings/settings.utils.ts | 2 +- ui-ngx/src/app/core/translate/missing-translate-handler.ts | 2 +- ui-ngx/src/app/core/translate/translate-default-compiler.ts | 2 +- ui-ngx/src/app/core/translate/translate-default-loader.ts | 2 +- ui-ngx/src/app/core/translate/translate-default-parser.ts | 2 +- ui-ngx/src/app/core/utils.ts | 2 +- ui-ngx/src/app/core/ws/notification-websocket.service.ts | 2 +- ui-ngx/src/app/core/ws/public-api.ts | 2 +- ui-ngx/src/app/core/ws/telemetry-websocket.service.ts | 2 +- ui-ngx/src/app/core/ws/websocket.service.ts | 2 +- ui-ngx/src/app/modules/common/modules-map.models.ts | 2 +- ui-ngx/src/app/modules/common/modules-map.ts | 2 +- ui-ngx/src/app/modules/dashboard/dashboard-pages.module.ts | 2 +- .../app/modules/dashboard/dashboard-pages.routing.module.ts | 2 +- ui-ngx/src/app/modules/dashboard/dashboard-routing.module.ts | 2 +- .../home/components/alarm/alarm-assignee-panel.component.html | 2 +- .../home/components/alarm/alarm-assignee-panel.component.scss | 2 +- .../home/components/alarm/alarm-assignee-panel.component.ts | 2 +- .../components/alarm/alarm-assignee-select-panel.component.ts | 2 +- .../home/components/alarm/alarm-assignee-select.component.html | 2 +- .../home/components/alarm/alarm-assignee-select.component.ts | 2 +- .../home/components/alarm/alarm-assignee.component.html | 2 +- .../home/components/alarm/alarm-assignee.component.scss | 2 +- .../modules/home/components/alarm/alarm-assignee.component.ts | 2 +- .../home/components/alarm/alarm-comment-dialog.component.html | 2 +- .../home/components/alarm/alarm-comment-dialog.component.ts | 2 +- .../modules/home/components/alarm/alarm-comment.component.html | 2 +- .../modules/home/components/alarm/alarm-comment.component.scss | 2 +- .../modules/home/components/alarm/alarm-comment.component.ts | 2 +- .../home/components/alarm/alarm-details-dialog.component.html | 2 +- .../home/components/alarm/alarm-details-dialog.component.scss | 2 +- .../home/components/alarm/alarm-details-dialog.component.ts | 2 +- .../home/components/alarm/alarm-filter-config.component.html | 2 +- .../home/components/alarm/alarm-filter-config.component.scss | 2 +- .../home/components/alarm/alarm-filter-config.component.ts | 2 +- .../app/modules/home/components/alarm/alarm-table-config.ts | 2 +- .../home/components/alarm/alarm-table-header.component.html | 2 +- .../home/components/alarm/alarm-table-header.component.scss | 2 +- .../home/components/alarm/alarm-table-header.component.ts | 2 +- .../modules/home/components/alarm/alarm-table.component.html | 2 +- .../modules/home/components/alarm/alarm-table.component.scss | 2 +- .../app/modules/home/components/alarm/alarm-table.component.ts | 2 +- .../alias/aliases-entity-autocomplete.component.html | 2 +- .../components/alias/aliases-entity-autocomplete.component.ts | 2 +- .../alias/aliases-entity-select-panel.component.html | 2 +- .../alias/aliases-entity-select-panel.component.scss | 2 +- .../components/alias/aliases-entity-select-panel.component.ts | 2 +- .../home/components/alias/aliases-entity-select.component.html | 2 +- .../home/components/alias/aliases-entity-select.component.scss | 2 +- .../home/components/alias/aliases-entity-select.component.ts | 2 +- .../home/components/alias/entity-alias-dialog.component.html | 2 +- .../home/components/alias/entity-alias-dialog.component.scss | 2 +- .../home/components/alias/entity-alias-dialog.component.ts | 2 +- .../home/components/alias/entity-alias-select.component.html | 2 +- .../components/alias/entity-alias-select.component.models.ts | 2 +- .../home/components/alias/entity-alias-select.component.scss | 2 +- .../home/components/alias/entity-alias-select.component.ts | 2 +- .../home/components/alias/entity-aliases-dialog.component.html | 2 +- .../home/components/alias/entity-aliases-dialog.component.scss | 2 +- .../home/components/alias/entity-aliases-dialog.component.ts | 2 +- .../components/attribute/add-attribute-dialog.component.html | 2 +- .../components/attribute/add-attribute-dialog.component.ts | 2 +- .../attribute/add-widget-to-dashboard-dialog.component.html | 2 +- .../attribute/add-widget-to-dashboard-dialog.component.scss | 2 +- .../attribute/add-widget-to-dashboard-dialog.component.ts | 2 +- .../home/components/attribute/attribute-table.component.html | 2 +- .../home/components/attribute/attribute-table.component.scss | 2 +- .../home/components/attribute/attribute-table.component.ts | 2 +- .../attribute/delete-timeseries-panel.component.html | 2 +- .../attribute/delete-timeseries-panel.component.scss | 2 +- .../components/attribute/delete-timeseries-panel.component.ts | 2 +- .../attribute/edit-attribute-value-panel.component.html | 2 +- .../attribute/edit-attribute-value-panel.component.scss | 2 +- .../attribute/edit-attribute-value-panel.component.ts | 2 +- .../audit-log/audit-log-details-dialog.component.html | 2 +- .../audit-log/audit-log-details-dialog.component.scss | 2 +- .../components/audit-log/audit-log-details-dialog.component.ts | 2 +- .../home/components/audit-log/audit-log-table-config.ts | 2 +- .../home/components/audit-log/audit-log-table.component.html | 2 +- .../home/components/audit-log/audit-log-table.component.scss | 2 +- .../home/components/audit-log/audit-log-table.component.ts | 2 +- .../components/dashboard-page/add-widget-dialog.component.html | 2 +- .../components/dashboard-page/add-widget-dialog.component.scss | 2 +- .../components/dashboard-page/add-widget-dialog.component.ts | 2 +- .../dashboard-page/dashboard-image-dialog.component.html | 2 +- .../dashboard-page/dashboard-image-dialog.component.scss | 2 +- .../dashboard-page/dashboard-image-dialog.component.ts | 2 +- .../components/dashboard-page/dashboard-page.component.html | 2 +- .../components/dashboard-page/dashboard-page.component.scss | 2 +- .../home/components/dashboard-page/dashboard-page.component.ts | 2 +- .../home/components/dashboard-page/dashboard-page.models.ts | 2 +- .../dashboard-page/dashboard-settings-dialog.component.html | 2 +- .../dashboard-page/dashboard-settings-dialog.component.scss | 2 +- .../dashboard-page/dashboard-settings-dialog.component.ts | 2 +- .../components/dashboard-page/dashboard-state.component.html | 2 +- .../components/dashboard-page/dashboard-state.component.scss | 2 +- .../components/dashboard-page/dashboard-state.component.ts | 2 +- .../components/dashboard-page/dashboard-toolbar.component.html | 2 +- .../components/dashboard-page/dashboard-toolbar.component.scss | 2 +- .../components/dashboard-page/dashboard-toolbar.component.ts | 2 +- .../dashboard-page/dashboard-widget-select.component.html | 2 +- .../dashboard-page/dashboard-widget-select.component.scss | 2 +- .../dashboard-page/dashboard-widget-select.component.ts | 2 +- .../home/components/dashboard-page/edit-widget.component.html | 2 +- .../home/components/dashboard-page/edit-widget.component.scss | 2 +- .../home/components/dashboard-page/edit-widget.component.ts | 2 +- .../layout/add-new-breakpoint-dialog.component.html | 2 +- .../layout/add-new-breakpoint-dialog.component.ts | 2 +- .../dashboard-page/layout/dashboard-layout.component.html | 2 +- .../dashboard-page/layout/dashboard-layout.component.scss | 2 +- .../dashboard-page/layout/dashboard-layout.component.ts | 2 +- .../home/components/dashboard-page/layout/layout.models.ts | 2 +- .../layout/manage-dashboard-layouts-dialog.component.html | 2 +- .../layout/manage-dashboard-layouts-dialog.component.scss | 2 +- .../layout/manage-dashboard-layouts-dialog.component.ts | 2 +- .../dashboard-page/layout/move-widgets-dialog.component.html | 2 +- .../dashboard-page/layout/move-widgets-dialog.component.ts | 2 +- .../layout/select-dashboard-breakpoint.component.html | 2 +- .../layout/select-dashboard-breakpoint.component.scss | 2 +- .../layout/select-dashboard-breakpoint.component.ts | 2 +- .../states/dashboard-state-dialog.component.html | 2 +- .../dashboard-page/states/dashboard-state-dialog.component.ts | 2 +- .../states/default-state-controller.component.html | 2 +- .../states/default-state-controller.component.scss | 2 +- .../states/default-state-controller.component.ts | 2 +- .../states/entity-state-controller.component.html | 2 +- .../states/entity-state-controller.component.scss | 2 +- .../dashboard-page/states/entity-state-controller.component.ts | 2 +- .../states/manage-dashboard-states-dialog.component.html | 2 +- .../states/manage-dashboard-states-dialog.component.models.ts | 2 +- .../states/manage-dashboard-states-dialog.component.scss | 2 +- .../states/manage-dashboard-states-dialog.component.ts | 2 +- .../dashboard-page/states/state-controller.component.ts | 2 +- .../dashboard-page/states/state-controller.models.ts | 2 +- .../dashboard-page/states/states-component.directive.ts | 2 +- .../dashboard-page/states/states-controller.module.ts | 2 +- .../dashboard-page/states/states-controller.service.ts | 2 +- .../dashboard-page/widget-types-panel.component.html | 2 +- .../dashboard-page/widget-types-panel.component.scss | 2 +- .../components/dashboard-page/widget-types-panel.component.ts | 2 +- .../components/dashboard-view/dashboard-view.component.html | 2 +- .../components/dashboard-view/dashboard-view.component.scss | 2 +- .../home/components/dashboard-view/dashboard-view.component.ts | 2 +- .../modules/home/components/dashboard/dashboard.component.html | 2 +- .../modules/home/components/dashboard/dashboard.component.scss | 2 +- .../modules/home/components/dashboard/dashboard.component.ts | 2 +- .../app/modules/home/components/dashboard/layout-button.scss | 2 +- .../dashboard/select-target-layout-dialog.component.html | 2 +- .../dashboard/select-target-layout-dialog.component.ts | 2 +- .../dashboard/select-target-state-dialog.component.html | 2 +- .../dashboard/select-target-state-dialog.component.ts | 2 +- .../app/modules/home/components/details-panel.component.html | 2 +- .../app/modules/home/components/details-panel.component.scss | 2 +- .../src/app/modules/home/components/details-panel.component.ts | 2 +- .../components/device/copy-device-credentials.component.html | 2 +- .../components/device/copy-device-credentials.component.ts | 2 +- .../device/device-credentials-lwm2m-server.component.html | 2 +- .../device/device-credentials-lwm2m-server.component.ts | 2 +- .../components/device/device-credentials-lwm2m.component.html | 2 +- .../components/device/device-credentials-lwm2m.component.scss | 2 +- .../components/device/device-credentials-lwm2m.component.ts | 2 +- .../device/device-credentials-mqtt-basic.component.html | 2 +- .../device/device-credentials-mqtt-basic.component.ts | 2 +- .../home/components/device/device-credentials.component.html | 2 +- .../home/components/device/device-credentials.component.scss | 2 +- .../home/components/device/device-credentials.component.ts | 2 +- .../home/components/device/device-credentials.module.ts | 2 +- .../home/components/device/device-info-filter.component.html | 2 +- .../home/components/device/device-info-filter.component.scss | 2 +- .../home/components/device/device-info-filter.component.ts | 2 +- .../modules/home/components/edge/edge-downlink-table-config.ts | 2 +- .../components/edge/edge-downlink-table-header.component.html | 2 +- .../components/edge/edge-downlink-table-header.component.scss | 2 +- .../components/edge/edge-downlink-table-header.component.ts | 2 +- .../home/components/edge/edge-downlink-table.component.html | 2 +- .../home/components/edge/edge-downlink-table.component.scss | 2 +- .../home/components/edge/edge-downlink-table.component.ts | 2 +- .../home/components/entity/add-entity-dialog.component.html | 2 +- .../home/components/entity/add-entity-dialog.component.scss | 2 +- .../home/components/entity/add-entity-dialog.component.ts | 2 +- .../modules/home/components/entity/contact-based.component.ts | 2 +- .../entity/debug/entity-debug-settings-button.component.html | 2 +- .../entity/debug/entity-debug-settings-button.component.ts | 2 +- .../entity/debug/entity-debug-settings-panel.component.html | 2 +- .../entity/debug/entity-debug-settings-panel.component.ts | 2 +- .../home/components/entity/entities-table.component.html | 2 +- .../home/components/entity/entities-table.component.scss | 2 +- .../modules/home/components/entity/entities-table.component.ts | 2 +- .../modules/home/components/entity/entity-chips.component.html | 3 +-- .../modules/home/components/entity/entity-chips.component.scss | 3 +-- .../modules/home/components/entity/entity-chips.component.ts | 2 +- .../home/components/entity/entity-details-page.component.html | 2 +- .../home/components/entity/entity-details-page.component.scss | 2 +- .../home/components/entity/entity-details-page.component.ts | 2 +- .../home/components/entity/entity-details-panel.component.html | 2 +- .../home/components/entity/entity-details-panel.component.scss | 2 +- .../home/components/entity/entity-details-panel.component.ts | 2 +- .../home/components/entity/entity-filter-view.component.html | 2 +- .../home/components/entity/entity-filter-view.component.scss | 2 +- .../home/components/entity/entity-filter-view.component.ts | 2 +- .../home/components/entity/entity-filter.component.html | 2 +- .../home/components/entity/entity-filter.component.scss | 2 +- .../modules/home/components/entity/entity-filter.component.ts | 2 +- .../home/components/entity/entity-table-header.component.ts | 2 +- .../modules/home/components/entity/entity-tabs.component.ts | 2 +- .../src/app/modules/home/components/entity/entity.component.ts | 2 +- .../home/components/event/event-content-dialog.component.html | 2 +- .../home/components/event/event-content-dialog.component.scss | 2 +- .../home/components/event/event-content-dialog.component.ts | 2 +- .../home/components/event/event-filter-panel.component.html | 2 +- .../home/components/event/event-filter-panel.component.scss | 2 +- .../home/components/event/event-filter-panel.component.ts | 2 +- .../app/modules/home/components/event/event-table-config.ts | 2 +- .../home/components/event/event-table-header.component.html | 2 +- .../home/components/event/event-table-header.component.scss | 2 +- .../home/components/event/event-table-header.component.ts | 2 +- .../modules/home/components/event/event-table.component.html | 2 +- .../modules/home/components/event/event-table.component.scss | 2 +- .../app/modules/home/components/event/event-table.component.ts | 2 +- .../components/filter/boolean-filter-predicate.component.html | 2 +- .../components/filter/boolean-filter-predicate.component.ts | 2 +- .../filter/complex-filter-predicate-dialog.component.html | 2 +- .../filter/complex-filter-predicate-dialog.component.ts | 2 +- .../components/filter/complex-filter-predicate.component.html | 2 +- .../components/filter/complex-filter-predicate.component.ts | 2 +- .../modules/home/components/filter/filter-component.models.ts | 2 +- .../home/components/filter/filter-dialog.component.html | 2 +- .../home/components/filter/filter-dialog.component.scss | 2 +- .../modules/home/components/filter/filter-dialog.component.ts | 2 +- .../components/filter/filter-predicate-list.component.html | 2 +- .../components/filter/filter-predicate-list.component.scss | 2 +- .../home/components/filter/filter-predicate-list.component.ts | 2 +- .../components/filter/filter-predicate-value.component.html | 2 +- .../home/components/filter/filter-predicate-value.component.ts | 2 +- .../home/components/filter/filter-predicate.component.html | 2 +- .../home/components/filter/filter-predicate.component.ts | 2 +- .../app/modules/home/components/filter/filter-predicate.scss | 2 +- .../home/components/filter/filter-select.component.html | 2 +- .../home/components/filter/filter-select.component.models.ts | 2 +- .../modules/home/components/filter/filter-select.component.ts | 2 +- .../modules/home/components/filter/filter-text.component.html | 2 +- .../modules/home/components/filter/filter-text.component.scss | 2 +- .../modules/home/components/filter/filter-text.component.ts | 2 +- .../components/filter/filter-user-info-dialog.component.html | 2 +- .../components/filter/filter-user-info-dialog.component.ts | 2 +- .../home/components/filter/filter-user-info.component.html | 2 +- .../home/components/filter/filter-user-info.component.ts | 2 +- .../home/components/filter/filters-dialog.component.html | 2 +- .../home/components/filter/filters-dialog.component.scss | 2 +- .../modules/home/components/filter/filters-dialog.component.ts | 2 +- .../home/components/filter/filters-edit-panel.component.html | 2 +- .../home/components/filter/filters-edit-panel.component.scss | 2 +- .../home/components/filter/filters-edit-panel.component.ts | 2 +- .../modules/home/components/filter/filters-edit.component.html | 2 +- .../modules/home/components/filter/filters-edit.component.scss | 2 +- .../modules/home/components/filter/filters-edit.component.ts | 2 +- .../home/components/filter/key-filter-dialog.component.html | 2 +- .../home/components/filter/key-filter-dialog.component.scss | 2 +- .../home/components/filter/key-filter-dialog.component.ts | 2 +- .../home/components/filter/key-filter-list.component.html | 2 +- .../home/components/filter/key-filter-list.component.scss | 2 +- .../home/components/filter/key-filter-list.component.ts | 2 +- .../components/filter/numeric-filter-predicate.component.html | 2 +- .../components/filter/numeric-filter-predicate.component.ts | 2 +- .../components/filter/string-filter-predicate.component.html | 2 +- .../components/filter/string-filter-predicate.component.ts | 2 +- .../home/components/filter/user-filter-dialog.component.html | 2 +- .../home/components/filter/user-filter-dialog.component.ts | 2 +- .../src/app/modules/home/components/home-components.module.ts | 2 +- .../components/notification/notification-bell.component.html | 2 +- .../components/notification/notification-bell.component.ts | 2 +- .../notification/send-notification-button.component.html | 2 +- .../notification/send-notification-button.component.ts | 2 +- .../notification/show-notification-popover.component.html | 2 +- .../notification/show-notification-popover.component.scss | 2 +- .../notification/show-notification-popover.component.ts | 2 +- .../profile/add-device-profile-dialog.component.html | 2 +- .../profile/add-device-profile-dialog.component.scss | 2 +- .../components/profile/add-device-profile-dialog.component.ts | 2 +- .../alarm/alarm-duration-predicate-value.component.html | 2 +- .../profile/alarm/alarm-duration-predicate-value.component.ts | 2 +- .../profile/alarm/alarm-dynamic-value.component.html | 2 +- .../components/profile/alarm/alarm-dynamic-value.component.ts | 2 +- .../profile/alarm/alarm-rule-condition-dialog.component.html | 2 +- .../profile/alarm/alarm-rule-condition-dialog.component.scss | 2 +- .../profile/alarm/alarm-rule-condition-dialog.component.ts | 2 +- .../profile/alarm/alarm-rule-condition.component.html | 2 +- .../profile/alarm/alarm-rule-condition.component.scss | 2 +- .../components/profile/alarm/alarm-rule-condition.component.ts | 2 +- .../home/components/profile/alarm/alarm-rule.component.html | 2 +- .../home/components/profile/alarm/alarm-rule.component.scss | 2 +- .../home/components/profile/alarm/alarm-rule.component.ts | 2 +- .../profile/alarm/alarm-schedule-dialog.component.html | 2 +- .../profile/alarm/alarm-schedule-dialog.component.ts | 2 +- .../profile/alarm/alarm-schedule-info.component.html | 2 +- .../profile/alarm/alarm-schedule-info.component.scss | 2 +- .../components/profile/alarm/alarm-schedule-info.component.ts | 2 +- .../components/profile/alarm/alarm-schedule.component.html | 2 +- .../components/profile/alarm/alarm-schedule.component.scss | 2 +- .../home/components/profile/alarm/alarm-schedule.component.ts | 2 +- .../components/profile/alarm/create-alarm-rules.component.html | 2 +- .../components/profile/alarm/create-alarm-rules.component.scss | 2 +- .../components/profile/alarm/create-alarm-rules.component.ts | 2 +- .../profile/alarm/device-profile-alarm.component.html | 2 +- .../profile/alarm/device-profile-alarm.component.scss | 2 +- .../components/profile/alarm/device-profile-alarm.component.ts | 2 +- .../profile/alarm/device-profile-alarms.component.html | 2 +- .../profile/alarm/device-profile-alarms.component.scss | 2 +- .../profile/alarm/device-profile-alarms.component.ts | 2 +- .../profile/alarm/edit-alarm-details-dialog.component.html | 2 +- .../profile/alarm/edit-alarm-details-dialog.component.ts | 2 +- .../profile/asset-profile-autocomplete.component.html | 2 +- .../profile/asset-profile-autocomplete.component.scss | 2 +- .../components/profile/asset-profile-autocomplete.component.ts | 2 +- .../components/profile/asset-profile-dialog.component.html | 2 +- .../home/components/profile/asset-profile-dialog.component.ts | 2 +- .../home/components/profile/asset-profile.component.html | 2 +- .../modules/home/components/profile/asset-profile.component.ts | 2 +- .../profile/device-profile-autocomplete.component.html | 2 +- .../profile/device-profile-autocomplete.component.scss | 2 +- .../profile/device-profile-autocomplete.component.ts | 2 +- .../components/profile/device-profile-dialog.component.html | 2 +- .../home/components/profile/device-profile-dialog.component.ts | 2 +- .../device-profile-provision-configuration.component.html | 2 +- .../device-profile-provision-configuration.component.ts | 2 +- .../home/components/profile/device-profile.component.html | 2 +- .../home/components/profile/device-profile.component.ts | 2 +- .../coap-device-profile-transport-configuration.component.html | 2 +- .../coap-device-profile-transport-configuration.component.scss | 2 +- .../coap-device-profile-transport-configuration.component.ts | 2 +- .../profile/device/common/device-profile-common.module.ts | 2 +- .../profile/device/common/power-mode-setting.component.html | 2 +- .../profile/device/common/power-mode-setting.component.ts | 2 +- .../profile/device/common/time-unit-select.component.html | 2 +- .../profile/device/common/time-unit-select.component.ts | 2 +- .../device/default-device-profile-configuration.component.html | 2 +- .../device/default-device-profile-configuration.component.ts | 2 +- ...fault-device-profile-transport-configuration.component.html | 2 +- ...default-device-profile-transport-configuration.component.ts | 2 +- .../profile/device/device-profile-configuration.component.html | 2 +- .../profile/device/device-profile-configuration.component.ts | 2 +- .../device-profile-transport-configuration.component.html | 2 +- .../device/device-profile-transport-configuration.component.ts | 2 +- .../device/lwm2m/lwm2m-attributes-dialog.component.html | 2 +- .../profile/device/lwm2m/lwm2m-attributes-dialog.component.ts | 2 +- .../device/lwm2m/lwm2m-attributes-key-list.component.html | 2 +- .../device/lwm2m/lwm2m-attributes-key-list.component.scss | 2 +- .../device/lwm2m/lwm2m-attributes-key-list.component.ts | 2 +- .../profile/device/lwm2m/lwm2m-attributes.component.html | 2 +- .../profile/device/lwm2m/lwm2m-attributes.component.ts | 2 +- .../lwm2m-bootstrap-add-config-server-dialog.component.html | 2 +- .../lwm2m-bootstrap-add-config-server-dialog.component.ts | 2 +- .../device/lwm2m/lwm2m-bootstrap-config-servers.component.html | 2 +- .../device/lwm2m/lwm2m-bootstrap-config-servers.component.ts | 2 +- .../device/lwm2m/lwm2m-device-config-server.component.html | 2 +- .../device/lwm2m/lwm2m-device-config-server.component.ts | 2 +- ...lwm2m-device-profile-transport-configuration.component.html | 2 +- ...lwm2m-device-profile-transport-configuration.component.scss | 2 +- .../lwm2m-device-profile-transport-configuration.component.ts | 2 +- .../lwm2m/lwm2m-object-add-instances-dialog.component.html | 2 +- .../lwm2m/lwm2m-object-add-instances-dialog.component.ts | 2 +- .../lwm2m/lwm2m-object-add-instances-list.component.html | 2 +- .../device/lwm2m/lwm2m-object-add-instances-list.component.ts | 2 +- .../profile/device/lwm2m/lwm2m-object-list.component.html | 2 +- .../profile/device/lwm2m/lwm2m-object-list.component.ts | 2 +- .../lwm2m-observe-attr-telemetry-instances.component.html | 2 +- .../lwm2m-observe-attr-telemetry-instances.component.scss | 2 +- .../lwm2m/lwm2m-observe-attr-telemetry-instances.component.ts | 2 +- .../lwm2m-observe-attr-telemetry-resources.component.html | 2 +- .../lwm2m-observe-attr-telemetry-resources.component.scss | 2 +- .../lwm2m/lwm2m-observe-attr-telemetry-resources.component.ts | 2 +- .../device/lwm2m/lwm2m-observe-attr-telemetry.component.html | 2 +- .../device/lwm2m/lwm2m-observe-attr-telemetry.component.scss | 2 +- .../device/lwm2m/lwm2m-observe-attr-telemetry.component.ts | 2 +- .../profile/device/lwm2m/lwm2m-profile-components.module.ts | 2 +- .../profile/device/lwm2m/lwm2m-profile-config.models.ts | 2 +- .../mqtt-device-profile-transport-configuration.component.html | 2 +- .../mqtt-device-profile-transport-configuration.component.scss | 2 +- .../mqtt-device-profile-transport-configuration.component.ts | 2 +- .../snmp-device-profile-communication-config.component.html | 2 +- .../snmp-device-profile-communication-config.component.scss | 2 +- .../snmp/snmp-device-profile-communication-config.component.ts | 2 +- .../device/snmp/snmp-device-profile-mapping.component.html | 2 +- .../device/snmp/snmp-device-profile-mapping.component.scss | 2 +- .../device/snmp/snmp-device-profile-mapping.component.ts | 2 +- .../snmp-device-profile-transport-configuration.component.html | 2 +- .../snmp-device-profile-transport-configuration.component.ts | 2 +- .../device/snmp/snmp-device-profile-transport.module.ts | 2 +- .../profile/queue/tenant-profile-queues.component.html | 2 +- .../profile/queue/tenant-profile-queues.component.scss | 2 +- .../profile/queue/tenant-profile-queues.component.ts | 2 +- .../profile/tenant-profile-autocomplete.component.html | 2 +- .../profile/tenant-profile-autocomplete.component.scss | 2 +- .../profile/tenant-profile-autocomplete.component.ts | 2 +- .../home/components/profile/tenant-profile-data.component.html | 2 +- .../home/components/profile/tenant-profile-data.component.ts | 2 +- .../components/profile/tenant-profile-dialog.component.html | 2 +- .../components/profile/tenant-profile-dialog.component.scss | 2 +- .../home/components/profile/tenant-profile-dialog.component.ts | 2 +- .../home/components/profile/tenant-profile.component.html | 2 +- .../home/components/profile/tenant-profile.component.scss | 2 +- .../home/components/profile/tenant-profile.component.ts | 2 +- .../tenant/default-tenant-profile-configuration.component.html | 2 +- .../tenant/default-tenant-profile-configuration.component.scss | 2 +- .../tenant/default-tenant-profile-configuration.component.ts | 2 +- .../rate-limits/rate-limits-details-dialog.component.html | 2 +- .../tenant/rate-limits/rate-limits-details-dialog.component.ts | 2 +- .../profile/tenant/rate-limits/rate-limits-list.component.html | 2 +- .../profile/tenant/rate-limits/rate-limits-list.component.scss | 2 +- .../profile/tenant/rate-limits/rate-limits-list.component.ts | 2 +- .../profile/tenant/rate-limits/rate-limits-text.component.html | 2 +- .../profile/tenant/rate-limits/rate-limits-text.component.scss | 2 +- .../profile/tenant/rate-limits/rate-limits-text.component.ts | 2 +- .../profile/tenant/rate-limits/rate-limits.component.html | 2 +- .../profile/tenant/rate-limits/rate-limits.component.scss | 2 +- .../profile/tenant/rate-limits/rate-limits.component.ts | 2 +- .../profile/tenant/rate-limits/rate-limits.models.ts | 2 +- .../profile/tenant/tenant-profile-configuration.component.html | 2 +- .../profile/tenant/tenant-profile-configuration.component.ts | 2 +- ui-ngx/src/app/modules/home/components/public-api.ts | 2 +- .../modules/home/components/queue/queue-form.component.html | 2 +- .../modules/home/components/queue/queue-form.component.scss | 2 +- .../app/modules/home/components/queue/queue-form.component.ts | 2 +- .../home/components/relation/relation-dialog.component.html | 2 +- .../home/components/relation/relation-dialog.component.scss | 2 +- .../home/components/relation/relation-dialog.component.ts | 2 +- .../home/components/relation/relation-filters.component.html | 2 +- .../home/components/relation/relation-filters.component.scss | 2 +- .../home/components/relation/relation-filters.component.ts | 2 +- .../home/components/relation/relation-table.component.html | 2 +- .../home/components/relation/relation-table.component.scss | 2 +- .../home/components/relation/relation-table.component.ts | 2 +- .../src/app/modules/home/components/router-tabs.component.html | 2 +- .../src/app/modules/home/components/router-tabs.component.scss | 2 +- .../src/app/modules/home/components/router-tabs.component.ts | 2 +- .../rule-chain/rule-chain-autocomplete.component.html | 2 +- .../components/rule-chain/rule-chain-autocomplete.component.ts | 2 +- .../rule-node/action/action-rule-node-config.module.ts | 2 +- .../action/advanced-persistence-setting-row.component.html | 2 +- .../action/advanced-persistence-setting-row.component.ts | 2 +- .../action/advanced-persistence-setting.component.html | 2 +- .../rule-node/action/advanced-persistence-setting.component.ts | 2 +- .../rule-node/action/assign-customer-config.component.html | 2 +- .../rule-node/action/assign-customer-config.component.ts | 2 +- .../rule-node/action/attributes-config.component.html | 2 +- .../components/rule-node/action/attributes-config.component.ts | 2 +- .../rule-node/action/clear-alarm-config.component.html | 2 +- .../rule-node/action/clear-alarm-config.component.ts | 2 +- .../rule-node/action/create-alarm-config.component.html | 2 +- .../rule-node/action/create-alarm-config.component.ts | 2 +- .../rule-node/action/create-relation-config.component.html | 2 +- .../rule-node/action/create-relation-config.component.ts | 2 +- .../rule-node/action/delete-attributes-config.component.html | 2 +- .../rule-node/action/delete-attributes-config.component.ts | 2 +- .../rule-node/action/delete-relation-config.component.html | 2 +- .../rule-node/action/delete-relation-config.component.ts | 2 +- .../rule-node/action/device-profile-config.component.html | 2 +- .../rule-node/action/device-profile-config.component.ts | 2 +- .../rule-node/action/device-state-config.component.html | 2 +- .../rule-node/action/device-state-config.component.ts | 2 +- .../rule-node/action/generator-config.component.html | 2 +- .../rule-node/action/generator-config.component.scss | 2 +- .../components/rule-node/action/generator-config.component.ts | 2 +- .../rule-node/action/gps-geo-action-config.component.html | 2 +- .../rule-node/action/gps-geo-action-config.component.scss | 2 +- .../rule-node/action/gps-geo-action-config.component.ts | 2 +- .../home/components/rule-node/action/log-config.component.html | 2 +- .../home/components/rule-node/action/log-config.component.ts | 2 +- .../rule-node/action/math-function-config.component.html | 2 +- .../rule-node/action/math-function-config.component.scss | 2 +- .../rule-node/action/math-function-config.component.ts | 2 +- .../rule-node/action/msg-count-config.component.html | 2 +- .../components/rule-node/action/msg-count-config.component.ts | 2 +- .../rule-node/action/msg-delay-config.component.html | 2 +- .../components/rule-node/action/msg-delay-config.component.ts | 2 +- .../rule-node/action/push-to-cloud-config.component.html | 2 +- .../rule-node/action/push-to-cloud-config.component.ts | 2 +- .../rule-node/action/push-to-edge-config.component.html | 2 +- .../rule-node/action/push-to-edge-config.component.ts | 2 +- .../rule-node/action/rpc-reply-config.component.html | 2 +- .../components/rule-node/action/rpc-reply-config.component.ts | 2 +- .../rule-node/action/rpc-request-config.component.html | 2 +- .../rule-node/action/rpc-request-config.component.ts | 2 +- .../action/save-to-custom-table-config.component.html | 2 +- .../rule-node/action/save-to-custom-table-config.component.ts | 2 +- .../action/send-rest-api-call-reply-config.component.html | 2 +- .../action/send-rest-api-call-reply-config.component.ts | 2 +- .../rule-node/action/timeseries-config.component.html | 2 +- .../components/rule-node/action/timeseries-config.component.ts | 2 +- .../components/rule-node/action/timeseries-config.models.ts | 2 +- .../rule-node/action/unassign-customer-config.component.html | 2 +- .../rule-node/action/unassign-customer-config.component.ts | 2 +- .../rule-node/common/alarm-status-select.component.html | 2 +- .../rule-node/common/alarm-status-select.component.scss | 2 +- .../rule-node/common/alarm-status-select.component.ts | 2 +- .../rule-node/common/arguments-map-config.component.html | 2 +- .../rule-node/common/arguments-map-config.component.scss | 2 +- .../rule-node/common/arguments-map-config.component.ts | 2 +- .../rule-node/common/common-rule-node-config.module.ts | 2 +- .../rule-node/common/credentials-config.component.html | 2 +- .../rule-node/common/credentials-config.component.ts | 2 +- .../common/device-relations-query-config.component.html | 2 +- .../common/device-relations-query-config.component.scss | 2 +- .../common/device-relations-query-config.component.ts | 2 +- .../components/rule-node/common/example-hint.component.html | 2 +- .../home/components/rule-node/common/example-hint.component.ts | 2 +- .../rule-node/common/kv-map-config-old.component.html | 2 +- .../rule-node/common/kv-map-config-old.component.scss | 2 +- .../components/rule-node/common/kv-map-config-old.component.ts | 2 +- .../components/rule-node/common/kv-map-config.component.html | 2 +- .../components/rule-node/common/kv-map-config.component.scss | 2 +- .../components/rule-node/common/kv-map-config.component.ts | 2 +- .../rule-node/common/math-function-autocomplete.component.html | 2 +- .../rule-node/common/math-function-autocomplete.component.ts | 2 +- .../rule-node/common/message-types-config.component.html | 2 +- .../rule-node/common/message-types-config.component.ts | 2 +- .../rule-node/common/msg-metadata-chip.component.html | 2 +- .../components/rule-node/common/msg-metadata-chip.component.ts | 2 +- .../common/output-message-type-autocomplete.component.html | 2 +- .../common/output-message-type-autocomplete.component.ts | 2 +- .../rule-node/common/relations-query-config-old.component.html | 2 +- .../rule-node/common/relations-query-config-old.component.ts | 2 +- .../rule-node/common/relations-query-config.component.html | 2 +- .../rule-node/common/relations-query-config.component.ts | 2 +- .../rule-node/common/select-attributes.component.html | 2 +- .../components/rule-node/common/select-attributes.component.ts | 2 +- .../components/rule-node/common/sv-map-config.component.html | 2 +- .../components/rule-node/common/sv-map-config.component.scss | 2 +- .../components/rule-node/common/sv-map-config.component.ts | 2 +- .../components/rule-node/common/time-unit-input.component.html | 2 +- .../components/rule-node/common/time-unit-input.component.ts | 2 +- .../home/components/rule-node/empty-config.component.ts | 2 +- .../rule-node/enrichment/calculate-delta-config.component.html | 2 +- .../rule-node/enrichment/calculate-delta-config.component.ts | 2 +- .../enrichment/customer-attributes-config.component.html | 2 +- .../enrichment/customer-attributes-config.component.scss | 2 +- .../enrichment/customer-attributes-config.component.ts | 2 +- .../enrichment/device-attributes-config.component.html | 2 +- .../rule-node/enrichment/device-attributes-config.component.ts | 2 +- .../rule-node/enrichment/enrichment-rule-node-core.module.ts | 2 +- .../rule-node/enrichment/entity-details-config.component.html | 2 +- .../rule-node/enrichment/entity-details-config.component.ts | 2 +- .../enrichment/fetch-device-credentials-config.component.html | 2 +- .../enrichment/fetch-device-credentials-config.component.ts | 2 +- .../get-telemetry-from-database-config.component.html | 2 +- .../get-telemetry-from-database-config.component.scss | 2 +- .../enrichment/get-telemetry-from-database-config.component.ts | 2 +- .../enrichment/originator-attributes-config.component.html | 2 +- .../enrichment/originator-attributes-config.component.ts | 2 +- .../enrichment/originator-fields-config.component.html | 2 +- .../rule-node/enrichment/originator-fields-config.component.ts | 2 +- .../enrichment/related-attributes-config.component.html | 2 +- .../enrichment/related-attributes-config.component.ts | 2 +- .../enrichment/tenant-attributes-config.component.html | 2 +- .../enrichment/tenant-attributes-config.component.scss | 2 +- .../rule-node/enrichment/tenant-attributes-config.component.ts | 2 +- .../rule-node/external/azure-iot-hub-config.component.html | 2 +- .../rule-node/external/azure-iot-hub-config.component.ts | 2 +- .../rule-node/external/external-rule-node-config.module.ts | 2 +- .../components/rule-node/external/kafka-config.component.html | 2 +- .../components/rule-node/external/kafka-config.component.ts | 2 +- .../components/rule-node/external/lambda-config.component.html | 2 +- .../components/rule-node/external/lambda-config.component.ts | 2 +- .../components/rule-node/external/mqtt-config.component.html | 2 +- .../components/rule-node/external/mqtt-config.component.scss | 2 +- .../components/rule-node/external/mqtt-config.component.ts | 2 +- .../rule-node/external/notification-config.component.html | 2 +- .../rule-node/external/notification-config.component.ts | 2 +- .../components/rule-node/external/pubsub-config.component.html | 2 +- .../components/rule-node/external/pubsub-config.component.ts | 2 +- .../rule-node/external/rabbit-mq-config.component.html | 2 +- .../rule-node/external/rabbit-mq-config.component.ts | 2 +- .../rule-node/external/rest-api-call-config.component.html | 2 +- .../rule-node/external/rest-api-call-config.component.ts | 2 +- .../rule-node/external/send-email-config.component.html | 2 +- .../rule-node/external/send-email-config.component.ts | 2 +- .../rule-node/external/send-sms-config.component.html | 2 +- .../components/rule-node/external/send-sms-config.component.ts | 2 +- .../components/rule-node/external/slack-config.component.html | 2 +- .../components/rule-node/external/slack-config.component.scss | 2 +- .../components/rule-node/external/slack-config.component.ts | 2 +- .../components/rule-node/external/sns-config.component.html | 2 +- .../home/components/rule-node/external/sns-config.component.ts | 2 +- .../components/rule-node/external/sqs-config.component.html | 2 +- .../home/components/rule-node/external/sqs-config.component.ts | 2 +- .../rule-node/filter/check-alarm-status.component.html | 2 +- .../rule-node/filter/check-alarm-status.component.ts | 2 +- .../rule-node/filter/check-message-config.component.html | 2 +- .../rule-node/filter/check-message-config.component.ts | 2 +- .../rule-node/filter/check-relation-config.component.html | 2 +- .../rule-node/filter/check-relation-config.component.scss | 2 +- .../rule-node/filter/check-relation-config.component.ts | 2 +- .../rule-node/filter/filter-rule-node-config.module.ts | 2 +- .../rule-node/filter/gps-geo-filter-config.component.html | 2 +- .../rule-node/filter/gps-geo-filter-config.component.scss | 2 +- .../rule-node/filter/gps-geo-filter-config.component.ts | 2 +- .../rule-node/filter/message-type-config.component.html | 2 +- .../rule-node/filter/message-type-config.component.ts | 2 +- .../rule-node/filter/originator-type-config.component.html | 2 +- .../rule-node/filter/originator-type-config.component.ts | 2 +- .../components/rule-node/filter/script-config.component.html | 2 +- .../components/rule-node/filter/script-config.component.ts | 2 +- .../components/rule-node/filter/switch-config.component.html | 2 +- .../components/rule-node/filter/switch-config.component.ts | 2 +- .../components/rule-node/flow/flow-rule-node-config.module.ts | 2 +- .../components/rule-node/flow/rule-chain-input.component.html | 2 +- .../components/rule-node/flow/rule-chain-input.component.ts | 2 +- .../components/rule-node/flow/rule-chain-output.component.html | 2 +- .../components/rule-node/flow/rule-chain-output.component.ts | 2 +- .../home/components/rule-node/rule-node-config.models.ts | 2 +- .../home/components/rule-node/rule-node-config.module.ts | 2 +- .../transformation/change-originator-config.component.html | 2 +- .../transformation/change-originator-config.component.ts | 2 +- .../rule-node/transformation/copy-keys-config.component.html | 2 +- .../rule-node/transformation/copy-keys-config.component.ts | 2 +- .../transformation/deduplication-config.component.html | 2 +- .../rule-node/transformation/deduplication-config.component.ts | 2 +- .../rule-node/transformation/delete-keys-config.component.html | 2 +- .../rule-node/transformation/delete-keys-config.component.ts | 2 +- .../transformation/node-json-path-config.component.html | 2 +- .../transformation/node-json-path-config.component.ts | 2 +- .../rule-node/transformation/rename-keys-config.component.html | 2 +- .../rule-node/transformation/rename-keys-config.component.scss | 2 +- .../rule-node/transformation/rename-keys-config.component.ts | 2 +- .../rule-node/transformation/script-config.component.html | 2 +- .../rule-node/transformation/script-config.component.ts | 2 +- .../rule-node/transformation/to-email-config.component.html | 2 +- .../rule-node/transformation/to-email-config.component.scss | 2 +- .../rule-node/transformation/to-email-config.component.ts | 2 +- .../transformation/transformation-rule-node-config.module.ts | 2 +- .../modules/home/components/shared-home-components.module.ts | 2 +- .../sms/aws-sns-provider-configuration.component.html | 2 +- .../components/sms/aws-sns-provider-configuration.component.ts | 2 +- .../sms/smpp-sms-provider-configuration.component.html | 2 +- .../sms/smpp-sms-provider-configuration.component.ts | 2 +- .../components/sms/sms-provider-configuration.component.html | 2 +- .../components/sms/sms-provider-configuration.component.ts | 2 +- .../sms/twilio-sms-provider-configuration.component.html | 2 +- .../sms/twilio-sms-provider-configuration.component.ts | 2 +- ui-ngx/src/app/modules/home/components/tokens.ts | 2 +- .../home/components/vc/auto-commit-settings.component.html | 2 +- .../home/components/vc/auto-commit-settings.component.scss | 2 +- .../home/components/vc/auto-commit-settings.component.ts | 2 +- .../home/components/vc/complex-version-create.component.html | 2 +- .../home/components/vc/complex-version-create.component.ts | 2 +- .../home/components/vc/complex-version-load.component.html | 2 +- .../home/components/vc/complex-version-load.component.ts | 2 +- .../components/vc/entity-types-version-create.component.html | 2 +- .../components/vc/entity-types-version-create.component.ts | 2 +- .../components/vc/entity-types-version-load.component.html | 2 +- .../home/components/vc/entity-types-version-load.component.ts | 2 +- .../home/components/vc/entity-types-version.component.scss | 2 +- .../home/components/vc/entity-version-create.component.html | 2 +- .../home/components/vc/entity-version-create.component.ts | 2 +- .../home/components/vc/entity-version-diff.component.html | 2 +- .../home/components/vc/entity-version-diff.component.scss | 2 +- .../home/components/vc/entity-version-diff.component.ts | 2 +- .../home/components/vc/entity-version-restore.component.html | 2 +- .../home/components/vc/entity-version-restore.component.ts | 2 +- .../home/components/vc/entity-versions-table.component.html | 2 +- .../home/components/vc/entity-versions-table.component.scss | 2 +- .../home/components/vc/entity-versions-table.component.ts | 2 +- .../components/vc/remove-other-entities-confirm.component.html | 2 +- .../components/vc/remove-other-entities-confirm.component.ts | 2 +- .../home/components/vc/repository-settings.component.html | 2 +- .../home/components/vc/repository-settings.component.scss | 2 +- .../home/components/vc/repository-settings.component.ts | 2 +- .../modules/home/components/vc/version-control.component.html | 2 +- .../modules/home/components/vc/version-control.component.scss | 2 +- .../modules/home/components/vc/version-control.component.ts | 2 +- ui-ngx/src/app/modules/home/components/vc/version-control.scss | 2 +- .../widget/action/manage-widget-actions-dialog.component.html | 2 +- .../widget/action/manage-widget-actions-dialog.component.ts | 2 +- .../widget/action/manage-widget-actions.component.html | 2 +- .../widget/action/manage-widget-actions.component.models.ts | 2 +- .../widget/action/manage-widget-actions.component.scss | 2 +- .../widget/action/manage-widget-actions.component.ts | 2 +- .../widget/action/widget-action-dialog.component.html | 2 +- .../components/widget/action/widget-action-dialog.component.ts | 2 +- .../config/basic/alarm/alarm-count-basic-config.component.html | 2 +- .../config/basic/alarm/alarm-count-basic-config.component.ts | 2 +- .../basic/alarm/alarms-table-basic-config.component.html | 2 +- .../config/basic/alarm/alarms-table-basic-config.component.ts | 2 +- .../home/components/widget/config/basic/basic-config.scss | 2 +- .../widget/config/basic/basic-widget-config.module.ts | 2 +- .../basic/button/action-button-basic-config.component.html | 2 +- .../basic/button/action-button-basic-config.component.ts | 2 +- .../basic/button/command-button-basic-config.component.html | 2 +- .../basic/button/command-button-basic-config.component.ts | 2 +- .../basic/button/power-button-basic-config.component.html | 2 +- .../config/basic/button/power-button-basic-config.component.ts | 2 +- .../basic/button/segmented-button-basic-config.component.html | 2 +- .../basic/button/segmented-button-basic-config.component.ts | 2 +- .../basic/button/toggle-button-basic-config.component.html | 2 +- .../basic/button/toggle-button-basic-config.component.ts | 2 +- .../config/basic/cards/aggregated-data-key-row.component.html | 2 +- .../config/basic/cards/aggregated-data-key-row.component.scss | 2 +- .../config/basic/cards/aggregated-data-key-row.component.ts | 2 +- .../basic/cards/aggregated-data-keys-panel.component.html | 2 +- .../basic/cards/aggregated-data-keys-panel.component.scss | 2 +- .../config/basic/cards/aggregated-data-keys-panel.component.ts | 2 +- .../cards/aggregated-value-card-basic-config.component.html | 2 +- .../cards/aggregated-value-card-basic-config.component.ts | 2 +- .../config/basic/cards/label-card-basic-config.component.html | 2 +- .../config/basic/cards/label-card-basic-config.component.ts | 2 +- .../basic/cards/label-value-card-basic-config.component.html | 2 +- .../basic/cards/label-value-card-basic-config.component.ts | 2 +- .../basic/cards/mobile-app-qr-code-basic-config.component.html | 2 +- .../basic/cards/mobile-app-qr-code-basic-config.component.ts | 2 +- .../basic/cards/progress-bar-basic-config.component.html | 2 +- .../config/basic/cards/progress-bar-basic-config.component.ts | 2 +- .../config/basic/cards/simple-card-basic-config.component.html | 2 +- .../config/basic/cards/simple-card-basic-config.component.ts | 2 +- .../basic/cards/timeseries-table-basic-config.component.html | 2 +- .../basic/cards/timeseries-table-basic-config.component.ts | 2 +- .../cards/unread-notification-basic-config.component.html | 2 +- .../basic/cards/unread-notification-basic-config.component.ts | 2 +- .../config/basic/cards/value-card-basic-config.component.html | 2 +- .../config/basic/cards/value-card-basic-config.component.ts | 2 +- .../basic/cards/value-chart-card-basic-config.component.html | 2 +- .../basic/cards/value-chart-card-basic-config.component.ts | 2 +- .../config/basic/chart/bar-chart-basic-config.component.ts | 2 +- .../chart/bar-chart-with-labels-basic-config.component.html | 2 +- .../chart/bar-chart-with-labels-basic-config.component.ts | 2 +- .../config/basic/chart/comparison-key-row.component.html | 2 +- .../config/basic/chart/comparison-key-row.component.scss | 2 +- .../widget/config/basic/chart/comparison-key-row.component.ts | 2 +- .../config/basic/chart/comparison-keys-table.component.html | 2 +- .../config/basic/chart/comparison-keys-table.component.scss | 2 +- .../config/basic/chart/comparison-keys-table.component.ts | 2 +- .../config/basic/chart/doughnut-basic-config.component.ts | 2 +- .../widget/config/basic/chart/flot-basic-config.component.html | 2 +- .../widget/config/basic/chart/flot-basic-config.component.ts | 2 +- .../basic/chart/latest-chart-basic-config.component.html | 2 +- .../config/basic/chart/latest-chart-basic-config.component.ts | 2 +- .../config/basic/chart/pie-chart-basic-config.component.ts | 2 +- .../basic/chart/polar-area-chart-basic-config.component.ts | 2 +- .../config/basic/chart/radar-chart-basic-config.component.ts | 2 +- .../config/basic/chart/range-chart-basic-config.component.html | 2 +- .../config/basic/chart/range-chart-basic-config.component.ts | 2 +- .../basic/chart/time-series-chart-basic-config.component.html | 2 +- .../basic/chart/time-series-chart-basic-config.component.ts | 2 +- .../widget/config/basic/common/data-key-row.component.html | 2 +- .../widget/config/basic/common/data-key-row.component.scss | 2 +- .../widget/config/basic/common/data-key-row.component.ts | 2 +- .../widget/config/basic/common/data-keys-panel.component.html | 2 +- .../widget/config/basic/common/data-keys-panel.component.scss | 2 +- .../widget/config/basic/common/data-keys-panel.component.ts | 2 +- .../config/basic/common/widget-actions-panel.component.html | 2 +- .../config/basic/common/widget-actions-panel.component.ts | 2 +- .../basic/entity/entities-table-basic-config.component.html | 2 +- .../basic/entity/entities-table-basic-config.component.ts | 2 +- .../basic/entity/entity-count-basic-config.component.html | 2 +- .../config/basic/entity/entity-count-basic-config.component.ts | 2 +- .../basic/gauge/analog-gauge-basic-config.component.html | 2 +- .../config/basic/gauge/analog-gauge-basic-config.component.ts | 2 +- .../basic/gauge/compass-gauge-basic-config.component.html | 2 +- .../config/basic/gauge/compass-gauge-basic-config.component.ts | 2 +- .../gauge/digital-simple-gauge-basic-config.component.html | 2 +- .../basic/gauge/digital-simple-gauge-basic-config.component.ts | 2 +- .../config/basic/gauge/radial-gauge-basic-config.component.ts | 2 +- .../gauge/thermometer-scale-gauge-basic-config.component.ts | 2 +- .../basic/indicator/battery-level-basic-config.component.html | 2 +- .../basic/indicator/battery-level-basic-config.component.ts | 2 +- .../indicator/liquid-level-card-basic-config.component.html | 2 +- .../indicator/liquid-level-card-basic-config.component.ts | 2 +- .../indicator/signal-strength-basic-config.component.html | 2 +- .../basic/indicator/signal-strength-basic-config.component.ts | 2 +- .../basic/indicator/status-widget-basic-config.component.html | 2 +- .../basic/indicator/status-widget-basic-config.component.ts | 2 +- .../config/basic/rpc/single-switch-basic-config.component.html | 2 +- .../config/basic/rpc/single-switch-basic-config.component.ts | 2 +- .../widget/config/basic/rpc/slider-basic-config.component.html | 2 +- .../widget/config/basic/rpc/slider-basic-config.component.ts | 2 +- .../config/basic/rpc/value-stepper-basic-config.component.html | 2 +- .../config/basic/rpc/value-stepper-basic-config.component.ts | 2 +- .../basic/scada/scada-symbol-basic-config.component.html | 2 +- .../config/basic/scada/scada-symbol-basic-config.component.ts | 2 +- .../weather/wind-speed-direction-basic-config.component.html | 2 +- .../weather/wind-speed-direction-basic-config.component.ts | 2 +- .../widget/config/data-key-config-dialog.component.html | 2 +- .../widget/config/data-key-config-dialog.component.scss | 2 +- .../widget/config/data-key-config-dialog.component.ts | 2 +- .../components/widget/config/data-key-config.component.html | 2 +- .../home/components/widget/config/data-key-config.component.ts | 2 +- .../home/components/widget/config/data-keys.component.html | 2 +- .../components/widget/config/data-keys.component.models.ts | 2 +- .../home/components/widget/config/data-keys.component.scss | 2 +- .../home/components/widget/config/data-keys.component.ts | 2 +- .../home/components/widget/config/datasource.component.html | 2 +- .../components/widget/config/datasource.component.models.ts | 2 +- .../home/components/widget/config/datasource.component.scss | 2 +- .../home/components/widget/config/datasource.component.ts | 2 +- .../home/components/widget/config/datasources.component.html | 2 +- .../home/components/widget/config/datasources.component.scss | 2 +- .../home/components/widget/config/datasources.component.ts | 2 +- .../home/components/widget/config/target-device.component.html | 2 +- .../home/components/widget/config/target-device.component.ts | 2 +- .../widget/config/timewindow-config-panel.component.html | 2 +- .../widget/config/timewindow-config-panel.component.ts | 2 +- .../widget/config/timewindow-style-panel.component.html | 2 +- .../widget/config/timewindow-style-panel.component.scss | 2 +- .../widget/config/timewindow-style-panel.component.ts | 2 +- .../components/widget/config/timewindow-style.component.html | 2 +- .../components/widget/config/timewindow-style.component.ts | 2 +- .../widget/config/widget-config-components.module.ts | 2 +- .../components/widget/config/widget-config.component.models.ts | 2 +- .../components/widget/config/widget-settings.component.html | 2 +- .../components/widget/config/widget-settings.component.scss | 2 +- .../home/components/widget/config/widget-settings.component.ts | 2 +- .../widget/dialog/custom-dialog-container.component.ts | 2 +- .../home/components/widget/dialog/custom-dialog.component.ts | 2 +- .../home/components/widget/dialog/custom-dialog.service.ts | 2 +- .../components/widget/dialog/embed-dashboard-dialog-token.ts | 2 +- .../widget/dialog/embed-dashboard-dialog.component.html | 2 +- .../widget/dialog/embed-dashboard-dialog.component.scss | 2 +- .../widget/dialog/embed-dashboard-dialog.component.ts | 2 +- .../modules/home/components/widget/dynamic-widget.component.ts | 2 +- .../home/components/widget/lib/action/action-widget.models.ts | 2 +- .../home/components/widget/lib/action/action-widget.scss | 2 +- .../widget/lib/alarm/alarms-table-widget.component.html | 2 +- .../widget/lib/alarm/alarms-table-widget.component.scss | 2 +- .../widget/lib/alarm/alarms-table-widget.component.ts | 2 +- .../home/components/widget/lib/analogue-compass.models.ts | 2 +- .../app/modules/home/components/widget/lib/analogue-compass.ts | 2 +- .../home/components/widget/lib/analogue-gauge.models.ts | 2 +- .../home/components/widget/lib/analogue-linear-gauge.models.ts | 2 +- .../home/components/widget/lib/analogue-linear-gauge.ts | 2 +- .../home/components/widget/lib/analogue-radial-gauge.models.ts | 2 +- .../home/components/widget/lib/analogue-radial-gauge.ts | 2 +- .../widget/lib/button/action-button-widget.component.html | 2 +- .../widget/lib/button/action-button-widget.component.scss | 2 +- .../widget/lib/button/action-button-widget.component.ts | 2 +- .../widget/lib/button/action-button-widget.models.ts | 2 +- .../widget/lib/button/command-button-widget.component.html | 2 +- .../widget/lib/button/command-button-widget.component.scss | 2 +- .../widget/lib/button/command-button-widget.component.ts | 2 +- .../widget/lib/button/command-button-widget.models.ts | 2 +- .../widget/lib/button/segmented-button-widget.models.ts | 2 +- .../widget/lib/button/toggle-button-widget.component.html | 2 +- .../widget/lib/button/toggle-button-widget.component.scss | 2 +- .../widget/lib/button/toggle-button-widget.component.ts | 2 +- .../widget/lib/button/toggle-button-widget.models.ts | 2 +- .../widget/lib/button/two-segment-button-widget.component.html | 2 +- .../widget/lib/button/two-segment-button-widget.component.scss | 2 +- .../widget/lib/button/two-segment-button-widget.component.ts | 2 +- .../modules/home/components/widget/lib/canvas-digital-gauge.ts | 2 +- .../lib/cards/aggregated-value-card-widget.component.html | 2 +- .../lib/cards/aggregated-value-card-widget.component.scss | 2 +- .../widget/lib/cards/aggregated-value-card-widget.component.ts | 2 +- .../widget/lib/cards/aggregated-value-card.models.ts | 2 +- .../widget/lib/cards/label-card-widget.component.html | 2 +- .../widget/lib/cards/label-card-widget.component.scss | 3 +-- .../components/widget/lib/cards/label-card-widget.component.ts | 2 +- .../components/widget/lib/cards/label-card-widget.models.ts | 2 +- .../widget/lib/cards/label-value-card-widget.component.html | 2 +- .../widget/lib/cards/label-value-card-widget.component.scss | 3 +-- .../widget/lib/cards/label-value-card-widget.component.ts | 2 +- .../widget/lib/cards/label-value-card-widget.models.ts | 2 +- .../widget/lib/cards/mobile-app-qr-code-widget.models.ts | 2 +- .../lib/cards/notification-type-filter-panel.component.html | 2 +- .../lib/cards/notification-type-filter-panel.component.scss | 3 +-- .../lib/cards/notification-type-filter-panel.component.ts | 2 +- .../widget/lib/cards/progress-bar-widget.component.html | 2 +- .../widget/lib/cards/progress-bar-widget.component.scss | 2 +- .../widget/lib/cards/progress-bar-widget.component.ts | 2 +- .../components/widget/lib/cards/progress-bar-widget.models.ts | 2 +- .../widget/lib/cards/unread-notification-widget.component.html | 2 +- .../widget/lib/cards/unread-notification-widget.component.scss | 3 +-- .../widget/lib/cards/unread-notification-widget.component.ts | 2 +- .../widget/lib/cards/unread-notification-widget.models.ts | 2 +- .../widget/lib/cards/value-card-widget.component.html | 2 +- .../widget/lib/cards/value-card-widget.component.scss | 2 +- .../components/widget/lib/cards/value-card-widget.component.ts | 2 +- .../components/widget/lib/cards/value-card-widget.models.ts | 2 +- .../widget/lib/cards/value-chart-card-widget.component.html | 2 +- .../widget/lib/cards/value-chart-card-widget.component.scss | 2 +- .../widget/lib/cards/value-chart-card-widget.component.ts | 2 +- .../widget/lib/cards/value-chart-card-widget.models.ts | 2 +- .../components/widget/lib/chart/bar-chart-widget.component.ts | 2 +- .../components/widget/lib/chart/bar-chart-widget.models.ts | 2 +- .../lib/chart/bar-chart-with-labels-widget.component.html | 2 +- .../lib/chart/bar-chart-with-labels-widget.component.scss | 2 +- .../widget/lib/chart/bar-chart-with-labels-widget.component.ts | 2 +- .../widget/lib/chart/bar-chart-with-labels-widget.models.ts | 2 +- .../home/components/widget/lib/chart/bars-chart.models.ts | 2 +- .../app/modules/home/components/widget/lib/chart/bars-chart.ts | 2 +- .../modules/home/components/widget/lib/chart/chart.models.ts | 2 +- .../components/widget/lib/chart/doughnut-widget.component.ts | 2 +- .../home/components/widget/lib/chart/doughnut-widget.models.ts | 2 +- .../home/components/widget/lib/chart/echarts-widget.models.ts | 2 +- .../widget/lib/chart/latest-chart-widget.component.html | 2 +- .../components/widget/lib/chart/latest-chart.component.html | 2 +- .../components/widget/lib/chart/latest-chart.component.scss | 2 +- .../home/components/widget/lib/chart/latest-chart.component.ts | 2 +- .../home/components/widget/lib/chart/latest-chart.models.ts | 2 +- .../modules/home/components/widget/lib/chart/latest-chart.ts | 2 +- .../components/widget/lib/chart/pie-chart-widget.component.ts | 2 +- .../components/widget/lib/chart/pie-chart-widget.models.ts | 2 +- .../home/components/widget/lib/chart/pie-chart.models.ts | 2 +- .../app/modules/home/components/widget/lib/chart/pie-chart.ts | 2 +- .../components/widget/lib/chart/polar-area-widget.component.ts | 2 +- .../components/widget/lib/chart/polar-area-widget.models.ts | 2 +- .../widget/lib/chart/radar-chart-widget.component.ts | 2 +- .../components/widget/lib/chart/radar-chart-widget.models.ts | 2 +- .../home/components/widget/lib/chart/radar-chart.models.ts | 2 +- .../modules/home/components/widget/lib/chart/radar-chart.ts | 2 +- .../widget/lib/chart/range-chart-widget.component.html | 2 +- .../widget/lib/chart/range-chart-widget.component.scss | 2 +- .../widget/lib/chart/range-chart-widget.component.ts | 2 +- .../components/widget/lib/chart/range-chart-widget.models.ts | 2 +- .../widget/lib/chart/time-series-chart-bar.models.ts | 2 +- .../widget/lib/chart/time-series-chart-state.models.ts | 2 +- .../widget/lib/chart/time-series-chart-tooltip.models.ts | 2 +- .../widget/lib/chart/time-series-chart-widget.component.html | 2 +- .../widget/lib/chart/time-series-chart-widget.component.scss | 3 +-- .../widget/lib/chart/time-series-chart-widget.component.ts | 2 +- .../widget/lib/chart/time-series-chart-widget.models.ts | 2 +- .../components/widget/lib/chart/time-series-chart.models.ts | 2 +- .../home/components/widget/lib/chart/time-series-chart.ts | 2 +- .../components/widget/lib/count/count-widget.component.html | 2 +- .../components/widget/lib/count/count-widget.component.scss | 2 +- .../home/components/widget/lib/count/count-widget.component.ts | 2 +- .../home/components/widget/lib/count/count-widget.models.ts | 2 +- .../date-range-navigator-panel.component.html | 2 +- .../date-range-navigator-panel.component.scss | 2 +- .../date-range-navigator/date-range-navigator.component.html | 2 +- .../date-range-navigator/date-range-navigator.component.scss | 2 +- .../lib/date-range-navigator/date-range-navigator.component.ts | 2 +- .../lib/date-range-navigator/date-range-navigator.models.ts | 2 +- .../modules/home/components/widget/lib/digital-gauge.models.ts | 2 +- .../app/modules/home/components/widget/lib/digital-gauge.ts | 2 +- .../components/widget/lib/display-columns-panel.component.html | 2 +- .../components/widget/lib/display-columns-panel.component.scss | 2 +- .../components/widget/lib/display-columns-panel.component.ts | 2 +- .../components/widget/lib/edges-overview-widget.component.html | 2 +- .../components/widget/lib/edges-overview-widget.component.scss | 2 +- .../components/widget/lib/edges-overview-widget.component.ts | 2 +- .../home/components/widget/lib/edges-overview-widget.models.ts | 2 +- .../widget/lib/entity/entities-hierarchy-widget.component.html | 2 +- .../widget/lib/entity/entities-hierarchy-widget.component.scss | 2 +- .../widget/lib/entity/entities-hierarchy-widget.component.ts | 2 +- .../widget/lib/entity/entities-hierarchy-widget.models.ts | 2 +- .../widget/lib/entity/entities-table-widget.component.html | 2 +- .../widget/lib/entity/entities-table-widget.component.scss | 2 +- .../widget/lib/entity/entities-table-widget.component.ts | 2 +- .../home/components/widget/lib/flot-widget.component.html | 2 +- .../home/components/widget/lib/flot-widget.component.ts | 2 +- .../modules/home/components/widget/lib/flot-widget.models.ts | 2 +- .../src/app/modules/home/components/widget/lib/flot-widget.ts | 2 +- .../widget/lib/home-page/add-doc-link-dialog.component.html | 2 +- .../widget/lib/home-page/add-doc-link-dialog.component.scss | 2 +- .../widget/lib/home-page/add-doc-link-dialog.component.ts | 2 +- .../widget/lib/home-page/add-quick-link-dialog.component.html | 2 +- .../widget/lib/home-page/add-quick-link-dialog.component.scss | 2 +- .../widget/lib/home-page/add-quick-link-dialog.component.ts | 2 +- .../widget/lib/home-page/cluster-info-table.component.html | 2 +- .../widget/lib/home-page/cluster-info-table.component.scss | 2 +- .../widget/lib/home-page/cluster-info-table.component.ts | 2 +- .../widget/lib/home-page/configured-features.component.html | 2 +- .../widget/lib/home-page/configured-features.component.scss | 2 +- .../widget/lib/home-page/configured-features.component.ts | 2 +- .../components/widget/lib/home-page/doc-link.component.html | 2 +- .../home/components/widget/lib/home-page/doc-link.component.ts | 2 +- .../widget/lib/home-page/doc-links-widget.component.html | 2 +- .../widget/lib/home-page/doc-links-widget.component.ts | 2 +- .../widget/lib/home-page/edit-links-dialog.component.html | 2 +- .../widget/lib/home-page/edit-links-dialog.component.scss | 2 +- .../widget/lib/home-page/edit-links-dialog.component.ts | 2 +- .../home-page/getting-started-completed-dialog.component.html | 2 +- .../home-page/getting-started-completed-dialog.component.scss | 2 +- .../home-page/getting-started-completed-dialog.component.ts | 2 +- .../widget/lib/home-page/getting-started-widget.component.html | 2 +- .../widget/lib/home-page/getting-started-widget.component.scss | 2 +- .../widget/lib/home-page/getting-started-widget.component.ts | 2 +- .../home/components/widget/lib/home-page/home-page-widget.scss | 2 +- .../widget/lib/home-page/home-page-widgets.module.ts | 2 +- .../home/components/widget/lib/home-page/home-page.scss | 2 +- .../home/components/widget/lib/home-page/link.component.scss | 2 +- .../widget/lib/home-page/links-widget.component.scss | 2 +- .../components/widget/lib/home-page/quick-link.component.html | 2 +- .../components/widget/lib/home-page/quick-link.component.ts | 2 +- .../widget/lib/home-page/quick-links-widget.component.html | 2 +- .../widget/lib/home-page/quick-links-widget.component.ts | 2 +- .../lib/home-page/recent-dashboards-widget.component.html | 2 +- .../lib/home-page/recent-dashboards-widget.component.scss | 2 +- .../widget/lib/home-page/recent-dashboards-widget.component.ts | 2 +- .../widget/lib/home-page/usage-info-widget.component.html | 2 +- .../widget/lib/home-page/usage-info-widget.component.scss | 2 +- .../widget/lib/home-page/usage-info-widget.component.ts | 2 +- .../widget/lib/home-page/version-info.component.html | 2 +- .../widget/lib/home-page/version-info.component.scss | 2 +- .../components/widget/lib/home-page/version-info.component.ts | 2 +- .../widget/lib/indicator/battery-level-widget.component.html | 2 +- .../widget/lib/indicator/battery-level-widget.component.scss | 2 +- .../widget/lib/indicator/battery-level-widget.component.ts | 2 +- .../widget/lib/indicator/battery-level-widget.models.ts | 2 +- .../widget/lib/indicator/liquid-level-widget.component.html | 2 +- .../widget/lib/indicator/liquid-level-widget.component.scss | 2 +- .../widget/lib/indicator/liquid-level-widget.component.ts | 2 +- .../widget/lib/indicator/liquid-level-widget.models.ts | 2 +- .../widget/lib/indicator/signal-strength-widget.component.html | 2 +- .../widget/lib/indicator/signal-strength-widget.component.scss | 2 +- .../widget/lib/indicator/signal-strength-widget.component.ts | 2 +- .../widget/lib/indicator/signal-strength-widget.models.ts | 2 +- .../widget/lib/indicator/status-widget.component.html | 2 +- .../widget/lib/indicator/status-widget.component.scss | 2 +- .../components/widget/lib/indicator/status-widget.component.ts | 2 +- .../components/widget/lib/indicator/status-widget.models.ts | 2 +- .../components/widget/lib/json-input-widget.component.html | 2 +- .../components/widget/lib/json-input-widget.component.scss | 2 +- .../home/components/widget/lib/json-input-widget.component.ts | 2 +- .../modules/home/components/widget/lib/legend.component.html | 2 +- .../modules/home/components/widget/lib/legend.component.scss | 2 +- .../app/modules/home/components/widget/lib/legend.component.ts | 2 +- .../src/app/modules/home/components/widget/lib/maps/circle.ts | 2 +- .../home/components/widget/lib/maps/common-maps-utils.ts | 2 +- .../lib/maps/dialogs/select-entity-dialog.component.html | 2 +- .../lib/maps/dialogs/select-entity-dialog.component.scss | 2 +- .../widget/lib/maps/dialogs/select-entity-dialog.component.ts | 2 +- .../app/modules/home/components/widget/lib/maps/leaflet-map.ts | 2 +- .../app/modules/home/components/widget/lib/maps/map-models.ts | 2 +- .../home/components/widget/lib/maps/map-widget.interface.ts | 2 +- .../app/modules/home/components/widget/lib/maps/map-widget2.ts | 2 +- .../app/modules/home/components/widget/lib/maps/maps-utils.ts | 2 +- .../app/modules/home/components/widget/lib/maps/markers.scss | 2 +- .../src/app/modules/home/components/widget/lib/maps/markers.ts | 2 +- .../src/app/modules/home/components/widget/lib/maps/polygon.ts | 2 +- .../app/modules/home/components/widget/lib/maps/polyline.ts | 2 +- .../home/components/widget/lib/maps/providers/google-map.ts | 2 +- .../home/components/widget/lib/maps/providers/here-map.ts | 2 +- .../home/components/widget/lib/maps/providers/image-map.ts | 2 +- .../components/widget/lib/maps/providers/openstreet-map.ts | 2 +- .../home/components/widget/lib/maps/providers/public-api.ts | 2 +- .../home/components/widget/lib/maps/providers/tencent-map.ts | 2 +- .../home/components/widget/lib/markdown-widget.component.html | 2 +- .../home/components/widget/lib/markdown-widget.component.ts | 2 +- .../widget/lib/mobile-app-qrcode-widget.component.html | 2 +- .../widget/lib/mobile-app-qrcode-widget.component.scss | 3 +-- .../widget/lib/mobile-app-qrcode-widget.component.ts | 2 +- .../components/widget/lib/multiple-input-widget.component.html | 2 +- .../components/widget/lib/multiple-input-widget.component.scss | 2 +- .../components/widget/lib/multiple-input-widget.component.ts | 2 +- .../widget/lib/navigation-card-widget.component.html | 2 +- .../widget/lib/navigation-card-widget.component.scss | 2 +- .../components/widget/lib/navigation-card-widget.component.ts | 2 +- .../widget/lib/navigation-cards-widget.component.html | 2 +- .../widget/lib/navigation-cards-widget.component.scss | 2 +- .../components/widget/lib/navigation-cards-widget.component.ts | 2 +- .../components/widget/lib/photo-camera-input.component.html | 2 +- .../components/widget/lib/photo-camera-input.component.scss | 2 +- .../home/components/widget/lib/photo-camera-input.component.ts | 2 +- .../home/components/widget/lib/qrcode-widget.component.html | 2 +- .../home/components/widget/lib/qrcode-widget.component.ts | 2 +- .../modules/home/components/widget/lib/rpc/knob.component.html | 2 +- .../modules/home/components/widget/lib/rpc/knob.component.scss | 2 +- .../modules/home/components/widget/lib/rpc/knob.component.ts | 2 +- .../components/widget/lib/rpc/led-indicator.component.html | 2 +- .../components/widget/lib/rpc/led-indicator.component.scss | 2 +- .../home/components/widget/lib/rpc/led-indicator.component.ts | 2 +- .../widget/lib/rpc/persistent-add-dialog.component.html | 2 +- .../widget/lib/rpc/persistent-add-dialog.component.scss | 2 +- .../widget/lib/rpc/persistent-add-dialog.component.ts | 2 +- .../widget/lib/rpc/persistent-details-dialog.component.html | 2 +- .../widget/lib/rpc/persistent-details-dialog.component.scss | 2 +- .../widget/lib/rpc/persistent-details-dialog.component.ts | 2 +- .../widget/lib/rpc/persistent-filter-panel.component.html | 2 +- .../widget/lib/rpc/persistent-filter-panel.component.scss | 2 +- .../widget/lib/rpc/persistent-filter-panel.component.ts | 2 +- .../components/widget/lib/rpc/persistent-table.component.html | 2 +- .../components/widget/lib/rpc/persistent-table.component.scss | 2 +- .../components/widget/lib/rpc/persistent-table.component.ts | 2 +- .../widget/lib/rpc/power-button-widget.component.html | 2 +- .../widget/lib/rpc/power-button-widget.component.scss | 2 +- .../components/widget/lib/rpc/power-button-widget.component.ts | 2 +- .../components/widget/lib/rpc/power-button-widget.models.ts | 2 +- .../home/components/widget/lib/rpc/round-switch.component.html | 2 +- .../home/components/widget/lib/rpc/round-switch.component.scss | 2 +- .../home/components/widget/lib/rpc/round-switch.component.ts | 2 +- .../home/components/widget/lib/rpc/rpc-widgets.module.ts | 2 +- .../widget/lib/rpc/single-switch-widget.component.html | 2 +- .../widget/lib/rpc/single-switch-widget.component.scss | 2 +- .../widget/lib/rpc/single-switch-widget.component.ts | 2 +- .../components/widget/lib/rpc/single-switch-widget.models.ts | 2 +- .../components/widget/lib/rpc/slider-widget.component.html | 2 +- .../components/widget/lib/rpc/slider-widget.component.scss | 2 +- .../home/components/widget/lib/rpc/slider-widget.component.ts | 2 +- .../home/components/widget/lib/rpc/slider-widget.models.ts | 2 +- .../home/components/widget/lib/rpc/switch.component.html | 2 +- .../home/components/widget/lib/rpc/switch.component.scss | 2 +- .../modules/home/components/widget/lib/rpc/switch.component.ts | 2 +- .../widget/lib/rpc/value-stepper-widget.component.html | 2 +- .../widget/lib/rpc/value-stepper-widget.component.scss | 3 +-- .../widget/lib/rpc/value-stepper-widget.component.ts | 2 +- .../components/widget/lib/rpc/value-stepper-widget.models.ts | 2 +- .../widget/lib/scada/scada-symbol-widget.component.html | 2 +- .../widget/lib/scada/scada-symbol-widget.component.scss | 3 +-- .../widget/lib/scada/scada-symbol-widget.component.ts | 2 +- .../components/widget/lib/scada/scada-symbol-widget.models.ts | 2 +- .../home/components/widget/lib/scada/scada-symbol.models.ts | 2 +- .../app/modules/home/components/widget/lib/settings.models.ts | 2 +- .../settings/alarm/alarm-count-widget-settings.component.html | 2 +- .../settings/alarm/alarm-count-widget-settings.component.ts | 2 +- .../settings/alarm/alarms-table-key-settings.component.html | 2 +- .../lib/settings/alarm/alarms-table-key-settings.component.ts | 2 +- .../settings/alarm/alarms-table-widget-settings.component.html | 2 +- .../settings/alarm/alarms-table-widget-settings.component.ts | 2 +- .../button/action-button-widget-settings.component.html | 2 +- .../settings/button/action-button-widget-settings.component.ts | 2 +- .../button/command-button-widget-settings.component.html | 2 +- .../button/command-button-widget-settings.component.ts | 2 +- .../button/power-button-widget-settings.component.html | 2 +- .../settings/button/power-button-widget-settings.component.ts | 2 +- .../button/segmented-button-widget-settings.component.html | 2 +- .../button/segmented-button-widget-settings.component.ts | 2 +- .../button/toggle-button-widget-settings.component.html | 2 +- .../settings/button/toggle-button-widget-settings.component.ts | 2 +- .../cards/aggregated-value-card-key-settings.component.html | 2 +- .../cards/aggregated-value-card-key-settings.component.ts | 2 +- .../cards/aggregated-value-card-widget-settings.component.html | 2 +- .../cards/aggregated-value-card-widget-settings.component.ts | 2 +- .../cards/dashboard-state-widget-settings.component.html | 2 +- .../cards/dashboard-state-widget-settings.component.ts | 2 +- .../cards/edge-quick-overview-widget-settings.component.html | 2 +- .../cards/edge-quick-overview-widget-settings.component.ts | 2 +- .../settings/cards/html-card-widget-settings.component.html | 2 +- .../lib/settings/cards/html-card-widget-settings.component.ts | 2 +- .../settings/cards/label-card-widget-settings.component.html | 2 +- .../lib/settings/cards/label-card-widget-settings.component.ts | 2 +- .../cards/label-value-card-widget-settings.component.html | 2 +- .../cards/label-value-card-widget-settings.component.ts | 2 +- .../lib/settings/cards/label-widget-label.component.html | 2 +- .../lib/settings/cards/label-widget-label.component.scss | 2 +- .../widget/lib/settings/cards/label-widget-label.component.ts | 2 +- .../lib/settings/cards/label-widget-settings.component.html | 2 +- .../lib/settings/cards/label-widget-settings.component.ts | 2 +- .../lib/settings/cards/markdown-widget-settings.component.html | 2 +- .../lib/settings/cards/markdown-widget-settings.component.ts | 2 +- .../cards/mobile-app-qr-code-widget-settings.component.html | 2 +- .../cards/mobile-app-qr-code-widget-settings.component.ts | 2 +- .../settings/cards/progress-bar-widget-settings.component.html | 2 +- .../settings/cards/progress-bar-widget-settings.component.ts | 2 +- .../lib/settings/cards/qrcode-widget-settings.component.html | 2 +- .../lib/settings/cards/qrcode-widget-settings.component.ts | 2 +- .../settings/cards/simple-card-widget-settings.component.html | 2 +- .../settings/cards/simple-card-widget-settings.component.ts | 2 +- .../cards/timeseries-table-key-settings.component.html | 2 +- .../settings/cards/timeseries-table-key-settings.component.ts | 2 +- .../cards/timeseries-table-latest-key-settings.component.html | 2 +- .../cards/timeseries-table-latest-key-settings.component.ts | 2 +- .../cards/timeseries-table-widget-settings.component.html | 2 +- .../cards/timeseries-table-widget-settings.component.ts | 2 +- .../cards/unread-notification-widget-settings.component.html | 2 +- .../cards/unread-notification-widget-settings.component.ts | 2 +- .../settings/cards/value-card-widget-settings.component.html | 2 +- .../lib/settings/cards/value-card-widget-settings.component.ts | 2 +- .../cards/value-chart-card-widget-settings.component.html | 2 +- .../cards/value-chart-card-widget-settings.component.ts | 2 +- .../lib/settings/chart/bar-chart-widget-settings.component.ts | 2 +- .../chart/bar-chart-with-labels-widget-settings.component.html | 2 +- .../chart/bar-chart-with-labels-widget-settings.component.ts | 2 +- .../lib/settings/chart/chart-widget-settings.component.html | 2 +- .../lib/settings/chart/chart-widget-settings.component.ts | 2 +- .../chart/doughnut-chart-widget-settings.component.html | 2 +- .../settings/chart/doughnut-chart-widget-settings.component.ts | 2 +- .../lib/settings/chart/doughnut-widget-settings.component.ts | 2 +- .../lib/settings/chart/flot-bar-key-settings.component.html | 2 +- .../lib/settings/chart/flot-bar-key-settings.component.ts | 2 +- .../lib/settings/chart/flot-bar-widget-settings.component.html | 2 +- .../lib/settings/chart/flot-bar-widget-settings.component.ts | 2 +- .../widget/lib/settings/chart/flot-key-settings.component.html | 2 +- .../widget/lib/settings/chart/flot-key-settings.component.ts | 2 +- .../lib/settings/chart/flot-latest-key-settings.component.html | 2 +- .../lib/settings/chart/flot-latest-key-settings.component.ts | 2 +- .../lib/settings/chart/flot-line-key-settings.component.html | 2 +- .../lib/settings/chart/flot-line-key-settings.component.ts | 2 +- .../settings/chart/flot-line-widget-settings.component.html | 2 +- .../lib/settings/chart/flot-line-widget-settings.component.ts | 2 +- .../lib/settings/chart/flot-pie-key-settings.component.html | 2 +- .../lib/settings/chart/flot-pie-key-settings.component.ts | 2 +- .../lib/settings/chart/flot-pie-widget-settings.component.html | 2 +- .../lib/settings/chart/flot-pie-widget-settings.component.ts | 2 +- .../widget/lib/settings/chart/flot-threshold.component.html | 2 +- .../widget/lib/settings/chart/flot-threshold.component.ts | 2 +- .../lib/settings/chart/flot-widget-settings.component.html | 2 +- .../lib/settings/chart/flot-widget-settings.component.ts | 2 +- .../widget/lib/settings/chart/label-data-key.component.html | 2 +- .../widget/lib/settings/chart/label-data-key.component.scss | 2 +- .../widget/lib/settings/chart/label-data-key.component.ts | 2 +- .../settings/chart/latest-chart-widget-settings.component.html | 2 +- .../settings/chart/latest-chart-widget-settings.component.ts | 2 +- .../lib/settings/chart/pie-chart-widget-settings.component.ts | 2 +- .../chart/polar-area-chart-widget-settings.component.ts | 2 +- .../settings/chart/radar-chart-widget-settings.component.ts | 2 +- .../settings/chart/range-chart-widget-settings.component.html | 2 +- .../settings/chart/range-chart-widget-settings.component.ts | 2 +- .../chart/time-series-chart-key-settings.component.html | 2 +- .../settings/chart/time-series-chart-key-settings.component.ts | 2 +- .../chart/time-series-chart-line-settings.component.html | 2 +- .../chart/time-series-chart-line-settings.component.ts | 2 +- .../chart/time-series-chart-widget-settings.component.html | 2 +- .../chart/time-series-chart-widget-settings.component.ts | 2 +- .../common/action/action-settings-button.component.html | 2 +- .../lib/settings/common/action/action-settings-button.scss | 2 +- .../common/action/action-settings-panel.component.scss | 2 +- .../common/action/custom-action-pretty-editor.component.html | 2 +- .../common/action/custom-action-pretty-editor.component.scss | 2 +- .../common/action/custom-action-pretty-editor.component.ts | 2 +- .../action/custom-action-pretty-resources-tabs.component.html | 2 +- .../action/custom-action-pretty-resources-tabs.component.scss | 2 +- .../action/custom-action-pretty-resources-tabs.component.ts | 2 +- .../widget/lib/settings/common/action/custom-action.models.ts | 2 +- .../action/get-value-action-settings-panel.component.html | 2 +- .../common/action/get-value-action-settings-panel.component.ts | 2 +- .../common/action/get-value-action-settings.component.ts | 2 +- .../settings/common/action/mobile-action-editor.component.html | 2 +- .../settings/common/action/mobile-action-editor.component.ts | 2 +- .../lib/settings/common/action/mobile-action-editor.models.ts | 2 +- .../action/set-value-action-settings-panel.component.html | 2 +- .../common/action/set-value-action-settings-panel.component.ts | 2 +- .../common/action/set-value-action-settings.component.ts | 2 +- .../common/action/widget-action-settings-panel.component.html | 2 +- .../common/action/widget-action-settings-panel.component.ts | 2 +- .../settings/common/action/widget-action-settings.component.ts | 2 +- .../lib/settings/common/action/widget-action.component.html | 2 +- .../lib/settings/common/action/widget-action.component.ts | 2 +- .../widget/lib/settings/common/advanced-range.component.html | 2 +- .../widget/lib/settings/common/advanced-range.component.scss | 2 +- .../widget/lib/settings/common/advanced-range.component.ts | 2 +- .../common/auto-date-format-settings-panel.component.html | 2 +- .../common/auto-date-format-settings-panel.component.scss | 2 +- .../common/auto-date-format-settings-panel.component.ts | 2 +- .../settings/common/auto-date-format-settings.component.html | 2 +- .../lib/settings/common/auto-date-format-settings.component.ts | 2 +- .../settings/common/background-settings-panel.component.html | 2 +- .../settings/common/background-settings-panel.component.scss | 2 +- .../lib/settings/common/background-settings-panel.component.ts | 2 +- .../lib/settings/common/background-settings.component.html | 2 +- .../lib/settings/common/background-settings.component.scss | 2 +- .../lib/settings/common/background-settings.component.ts | 2 +- .../common/button/widget-button-appearance.component.html | 2 +- .../common/button/widget-button-appearance.component.ts | 2 +- .../button/widget-button-custom-style-panel.component.html | 2 +- .../button/widget-button-custom-style-panel.component.scss | 2 +- .../button/widget-button-custom-style-panel.component.ts | 2 +- .../common/button/widget-button-custom-style.component.html | 2 +- .../common/button/widget-button-custom-style.component.scss | 2 +- .../common/button/widget-button-custom-style.component.ts | 2 +- .../widget-button-toggle-custom-style-panel.component.html | 2 +- .../widget-button-toggle-custom-style-panel.component.scss | 2 +- .../widget-button-toggle-custom-style-panel.component.ts | 2 +- .../button/widget-button-toggle-custom-style.component.html | 2 +- .../button/widget-button-toggle-custom-style.component.scss | 2 +- .../button/widget-button-toggle-custom-style.component.ts | 2 +- .../common/chart/chart-animation-settings.component.html | 2 +- .../common/chart/chart-animation-settings.component.ts | 2 +- .../settings/common/chart/chart-bar-settings.component.html | 2 +- .../lib/settings/common/chart/chart-bar-settings.component.ts | 2 +- .../settings/common/chart/chart-fill-settings.component.html | 2 +- .../lib/settings/common/chart/chart-fill-settings.component.ts | 2 +- .../time-series-chart-axis-settings-button.component.html | 2 +- .../chart/time-series-chart-axis-settings-button.component.ts | 2 +- .../chart/time-series-chart-axis-settings-panel.component.html | 2 +- .../chart/time-series-chart-axis-settings-panel.component.scss | 2 +- .../chart/time-series-chart-axis-settings-panel.component.ts | 2 +- .../chart/time-series-chart-axis-settings.component.html | 2 +- .../common/chart/time-series-chart-axis-settings.component.ts | 2 +- .../chart/time-series-chart-grid-settings.component.html | 2 +- .../common/chart/time-series-chart-grid-settings.component.ts | 2 +- .../common/chart/time-series-chart-state-row.component.html | 2 +- .../common/chart/time-series-chart-state-row.component.scss | 3 +-- .../common/chart/time-series-chart-state-row.component.ts | 2 +- .../common/chart/time-series-chart-states-panel.component.html | 2 +- .../common/chart/time-series-chart-states-panel.component.scss | 3 +-- .../common/chart/time-series-chart-states-panel.component.ts | 2 +- .../chart/time-series-chart-threshold-row.component.html | 2 +- .../chart/time-series-chart-threshold-row.component.scss | 3 +-- .../common/chart/time-series-chart-threshold-row.component.ts | 2 +- .../time-series-chart-threshold-settings-panel.component.html | 2 +- .../time-series-chart-threshold-settings-panel.component.scss | 2 +- .../time-series-chart-threshold-settings-panel.component.ts | 2 +- .../chart/time-series-chart-threshold-settings.component.html | 2 +- .../chart/time-series-chart-threshold-settings.component.ts | 2 +- .../chart/time-series-chart-thresholds-panel.component.html | 2 +- .../chart/time-series-chart-thresholds-panel.component.scss | 3 +-- .../chart/time-series-chart-thresholds-panel.component.ts | 2 +- .../common/chart/time-series-chart-y-axes-panel.component.html | 2 +- .../common/chart/time-series-chart-y-axes-panel.component.scss | 2 +- .../common/chart/time-series-chart-y-axes-panel.component.ts | 2 +- .../common/chart/time-series-chart-y-axis-row.component.html | 2 +- .../common/chart/time-series-chart-y-axis-row.component.scss | 2 +- .../common/chart/time-series-chart-y-axis-row.component.ts | 2 +- ...ime-series-no-aggregation-bar-width-settings.component.html | 2 +- .../time-series-no-aggregation-bar-width-settings.component.ts | 2 +- .../widget/lib/settings/common/color-range-list.component.html | 2 +- .../widget/lib/settings/common/color-range-list.component.scss | 2 +- .../widget/lib/settings/common/color-range-list.component.ts | 2 +- .../lib/settings/common/color-range-panel.component.html | 2 +- .../widget/lib/settings/common/color-range-panel.component.ts | 2 +- .../lib/settings/common/color-range-settings.component.html | 2 +- .../lib/settings/common/color-range-settings.component.ts | 2 +- .../lib/settings/common/color-settings-panel.component.html | 2 +- .../lib/settings/common/color-settings-panel.component.scss | 2 +- .../lib/settings/common/color-settings-panel.component.ts | 2 +- .../widget/lib/settings/common/color-settings.component.html | 2 +- .../widget/lib/settings/common/color-settings.component.ts | 2 +- .../lib/settings/common/count-widget-settings.component.html | 2 +- .../lib/settings/common/count-widget-settings.component.ts | 2 +- .../widget/lib/settings/common/css-size-input.component.html | 2 +- .../widget/lib/settings/common/css-size-input.component.ts | 2 +- .../widget/lib/settings/common/css-unit-select.component.html | 2 +- .../widget/lib/settings/common/css-unit-select.component.ts | 2 +- .../widget/lib/settings/common/data-key-input.component.html | 2 +- .../widget/lib/settings/common/data-key-input.component.scss | 2 +- .../widget/lib/settings/common/data-key-input.component.ts | 2 +- .../lib/settings/common/date-format-select.component.html | 2 +- .../widget/lib/settings/common/date-format-select.component.ts | 2 +- .../settings/common/date-format-settings-panel.component.html | 2 +- .../settings/common/date-format-settings-panel.component.scss | 2 +- .../settings/common/date-format-settings-panel.component.ts | 2 +- .../common/dynamic-form/dynamic-form-array.component.html | 2 +- .../common/dynamic-form/dynamic-form-array.component.scss | 2 +- .../common/dynamic-form/dynamic-form-array.component.ts | 2 +- .../common/dynamic-form/dynamic-form-properties.component.html | 2 +- .../common/dynamic-form/dynamic-form-properties.component.scss | 2 +- .../common/dynamic-form/dynamic-form-properties.component.ts | 2 +- .../dynamic-form/dynamic-form-property-panel.component.html | 2 +- .../dynamic-form/dynamic-form-property-panel.component.scss | 2 +- .../dynamic-form/dynamic-form-property-panel.component.ts | 2 +- .../dynamic-form/dynamic-form-property-row.component.html | 2 +- .../dynamic-form/dynamic-form-property-row.component.scss | 2 +- .../common/dynamic-form/dynamic-form-property-row.component.ts | 2 +- .../dynamic-form/dynamic-form-select-item-row.component.html | 2 +- .../dynamic-form/dynamic-form-select-item-row.component.scss | 2 +- .../dynamic-form/dynamic-form-select-item-row.component.ts | 2 +- .../dynamic-form/dynamic-form-select-items.component.html | 2 +- .../dynamic-form/dynamic-form-select-items.component.scss | 2 +- .../common/dynamic-form/dynamic-form-select-items.component.ts | 2 +- .../settings/common/dynamic-form/dynamic-form.component.html | 2 +- .../settings/common/dynamic-form/dynamic-form.component.scss | 3 +-- .../lib/settings/common/dynamic-form/dynamic-form.component.ts | 2 +- .../lib/settings/common/entity-alias-input.component.html | 2 +- .../lib/settings/common/entity-alias-input.component.scss | 2 +- .../widget/lib/settings/common/entity-alias-input.component.ts | 2 +- .../lib/settings/common/font-settings-panel.component.html | 2 +- .../lib/settings/common/font-settings-panel.component.scss | 2 +- .../lib/settings/common/font-settings-panel.component.ts | 2 +- .../widget/lib/settings/common/font-settings.component.html | 2 +- .../widget/lib/settings/common/font-settings.component.ts | 2 +- .../widget/lib/settings/common/gradient.component.html | 2 +- .../widget/lib/settings/common/gradient.component.scss | 3 +-- .../widget/lib/settings/common/gradient.component.ts | 2 +- .../lib/settings/common/image-cards-select.component.html | 2 +- .../lib/settings/common/image-cards-select.component.scss | 2 +- .../widget/lib/settings/common/image-cards-select.component.ts | 2 +- .../indicator/status-widget-state-settings.component.html | 2 +- .../common/indicator/status-widget-state-settings.component.ts | 2 +- .../widget/lib/settings/common/legend-config.component.html | 2 +- .../widget/lib/settings/common/legend-config.component.ts | 2 +- .../common/scada/scada-symbol-object-settings.component.html | 2 +- .../common/scada/scada-symbol-object-settings.component.scss | 2 +- .../common/scada/scada-symbol-object-settings.component.ts | 2 +- .../common/scada/scada-symbol-object-settings.models.ts | 2 +- .../lib/settings/common/value-source-data-key.component.html | 2 +- .../lib/settings/common/value-source-data-key.component.scss | 3 +-- .../lib/settings/common/value-source-data-key.component.ts | 2 +- .../widget/lib/settings/common/value-source.component.html | 3 +-- .../widget/lib/settings/common/value-source.component.ts | 2 +- .../widget/lib/settings/common/widget-font.component.html | 2 +- .../widget/lib/settings/common/widget-font.component.ts | 2 +- .../lib/settings/common/widget-settings-common.module.ts | 2 +- .../settings/control/device-key-autocomplete.component.html | 2 +- .../lib/settings/control/device-key-autocomplete.component.ts | 2 +- .../control/knob-control-widget-settings.component.html | 2 +- .../settings/control/knob-control-widget-settings.component.ts | 2 +- .../control/led-indicator-widget-settings.component.html | 2 +- .../control/led-indicator-widget-settings.component.ts | 2 +- .../control/persistent-table-widget-settings.component.html | 2 +- .../control/persistent-table-widget-settings.component.ts | 2 +- .../control/round-switch-widget-settings.component.html | 2 +- .../settings/control/round-switch-widget-settings.component.ts | 2 +- .../lib/settings/control/rpc-button-style.component.html | 2 +- .../widget/lib/settings/control/rpc-button-style.component.ts | 2 +- .../settings/control/rpc-shell-widget-settings.component.html | 2 +- .../settings/control/rpc-shell-widget-settings.component.ts | 2 +- .../control/rpc-terminal-widget-settings.component.html | 2 +- .../settings/control/rpc-terminal-widget-settings.component.ts | 2 +- .../settings/control/send-rpc-widget-settings.component.html | 2 +- .../lib/settings/control/send-rpc-widget-settings.component.ts | 2 +- .../control/single-switch-widget-settings.component.html | 2 +- .../control/single-switch-widget-settings.component.ts | 2 +- .../control/slide-toggle-widget-settings.component.html | 2 +- .../settings/control/slide-toggle-widget-settings.component.ts | 2 +- .../lib/settings/control/slider-widget-settings.component.html | 2 +- .../lib/settings/control/slider-widget-settings.component.ts | 2 +- .../control/switch-control-widget-settings.component.html | 2 +- .../control/switch-control-widget-settings.component.ts | 2 +- .../lib/settings/control/switch-rpc-settings.component.html | 2 +- .../lib/settings/control/switch-rpc-settings.component.ts | 2 +- .../update-device-attribute-widget-settings.component.html | 2 +- .../update-device-attribute-widget-settings.component.ts | 2 +- .../control/value-stepper-widget-settings.component.html | 2 +- .../control/value-stepper-widget-settings.component.ts | 2 +- .../date/date-range-navigator-widget-settings.component.html | 2 +- .../date/date-range-navigator-widget-settings.component.ts | 2 +- .../entity/entities-hierarchy-widget-settings.component.html | 2 +- .../entity/entities-hierarchy-widget-settings.component.ts | 2 +- .../settings/entity/entities-table-key-settings.component.html | 2 +- .../settings/entity/entities-table-key-settings.component.ts | 2 +- .../entity/entities-table-widget-settings.component.html | 2 +- .../entity/entities-table-widget-settings.component.ts | 2 +- .../entity/entity-count-widget-settings.component.html | 2 +- .../settings/entity/entity-count-widget-settings.component.ts | 2 +- ...gateway-config-single-device-widget-settings.component.html | 2 +- .../gateway-config-single-device-widget-settings.component.ts | 2 +- .../gateway/gateway-config-widget-settings.component.html | 2 +- .../gateway/gateway-config-widget-settings.component.ts | 2 +- .../gateway/gateway-events-widget-settings.component.html | 2 +- .../gateway/gateway-events-widget-settings.component.ts | 2 +- .../lib/settings/gateway/gateway-logs-settings.component.html | 2 +- .../lib/settings/gateway/gateway-logs-settings.component.ts | 2 +- .../gateway/gateway-service-rpc-settings.component.html | 2 +- .../settings/gateway/gateway-service-rpc-settings.component.ts | 2 +- .../gauge/analogue-compass-widget-settings.component.html | 2 +- .../gauge/analogue-compass-widget-settings.component.ts | 2 +- .../gauge/analogue-gauge-widget-settings.component.html | 2 +- .../settings/gauge/analogue-gauge-widget-settings.component.ts | 2 +- .../gauge/analogue-linear-gauge-widget-settings.component.ts | 2 +- .../gauge/analogue-radial-gauge-widget-settings.component.ts | 2 +- .../gauge/digital-gauge-widget-settings.component.html | 2 +- .../settings/gauge/digital-gauge-widget-settings.component.ts | 2 +- .../widget/lib/settings/gauge/tick-value.component.html | 3 +-- .../widget/lib/settings/gauge/tick-value.component.ts | 2 +- .../settings/gpio/gpio-control-widget-settings.component.html | 2 +- .../settings/gpio/gpio-control-widget-settings.component.ts | 2 +- .../widget/lib/settings/gpio/gpio-item.component.html | 2 +- .../widget/lib/settings/gpio/gpio-item.component.scss | 2 +- .../components/widget/lib/settings/gpio/gpio-item.component.ts | 2 +- .../settings/gpio/gpio-panel-widget-settings.component.html | 2 +- .../lib/settings/gpio/gpio-panel-widget-settings.component.ts | 2 +- .../home-page/doc-links-widget-settings.component.html | 2 +- .../settings/home-page/doc-links-widget-settings.component.ts | 2 +- .../home-page/quick-links-widget-settings.component.html | 2 +- .../home-page/quick-links-widget-settings.component.ts | 2 +- .../indicator/battery-level-widget-settings.component.html | 2 +- .../indicator/battery-level-widget-settings.component.ts | 2 +- .../indicator/liquid-level-card-widget-settings.component.html | 2 +- .../indicator/liquid-level-card-widget-settings.component.ts | 2 +- .../indicator/signal-strength-widget-settings.component.html | 2 +- .../indicator/signal-strength-widget-settings.component.ts | 2 +- .../settings/indicator/status-widget-settings.component.html | 2 +- .../lib/settings/indicator/status-widget-settings.component.ts | 2 +- .../lib/settings/input/datakey-select-option.component.html | 2 +- .../lib/settings/input/datakey-select-option.component.scss | 2 +- .../lib/settings/input/datakey-select-option.component.ts | 2 +- .../input/device-claiming-widget-settings.component.html | 2 +- .../input/device-claiming-widget-settings.component.ts | 2 +- .../input/photo-camera-input-widget-settings.component.html | 2 +- .../input/photo-camera-input-widget-settings.component.ts | 2 +- .../input/update-attribute-general-settings.component.html | 2 +- .../input/update-attribute-general-settings.component.ts | 2 +- .../update-boolean-attribute-widget-settings.component.html | 2 +- .../update-boolean-attribute-widget-settings.component.ts | 2 +- .../input/update-date-attribute-widget-settings.component.html | 2 +- .../input/update-date-attribute-widget-settings.component.ts | 2 +- .../update-double-attribute-widget-settings.component.html | 2 +- .../input/update-double-attribute-widget-settings.component.ts | 2 +- .../update-image-attribute-widget-settings.component.html | 2 +- .../input/update-image-attribute-widget-settings.component.ts | 2 +- .../update-integer-attribute-widget-settings.component.html | 2 +- .../update-integer-attribute-widget-settings.component.ts | 2 +- .../input/update-json-attribute-widget-settings.component.html | 2 +- .../input/update-json-attribute-widget-settings.component.ts | 2 +- .../update-location-attribute-widget-settings.component.html | 2 +- .../update-location-attribute-widget-settings.component.ts | 2 +- .../update-multiple-attributes-key-settings.component.html | 2 +- .../input/update-multiple-attributes-key-settings.component.ts | 2 +- .../update-multiple-attributes-widget-settings.component.html | 2 +- .../update-multiple-attributes-widget-settings.component.ts | 2 +- .../update-string-attribute-widget-settings.component.html | 2 +- .../input/update-string-attribute-widget-settings.component.ts | 2 +- .../widget/lib/settings/map/circle-settings.component.html | 2 +- .../widget/lib/settings/map/circle-settings.component.ts | 2 +- .../widget/lib/settings/map/common-map-settings.component.html | 2 +- .../widget/lib/settings/map/common-map-settings.component.ts | 2 +- .../settings/map/datasources-key-autocomplete.component.html | 2 +- .../lib/settings/map/datasources-key-autocomplete.component.ts | 2 +- .../settings/map/google-map-provider-settings.component.html | 2 +- .../lib/settings/map/google-map-provider-settings.component.ts | 2 +- .../lib/settings/map/here-map-provider-settings.component.html | 2 +- .../lib/settings/map/here-map-provider-settings.component.ts | 2 +- .../settings/map/image-map-provider-settings.component.html | 2 +- .../lib/settings/map/image-map-provider-settings.component.ts | 2 +- .../widget/lib/settings/map/map-editor-settings.component.html | 2 +- .../widget/lib/settings/map/map-editor-settings.component.ts | 2 +- .../lib/settings/map/map-provider-settings.component.html | 2 +- .../widget/lib/settings/map/map-provider-settings.component.ts | 2 +- .../widget/lib/settings/map/map-settings.component.html | 2 +- .../widget/lib/settings/map/map-settings.component.ts | 2 +- .../widget/lib/settings/map/map-widget-settings.component.html | 2 +- .../widget/lib/settings/map/map-widget-settings.component.ts | 2 +- .../lib/settings/map/marker-clustering-settings.component.html | 2 +- .../lib/settings/map/marker-clustering-settings.component.ts | 2 +- .../widget/lib/settings/map/markers-settings.component.html | 2 +- .../widget/lib/settings/map/markers-settings.component.ts | 2 +- .../map/openstreet-map-provider-settings.component.html | 2 +- .../settings/map/openstreet-map-provider-settings.component.ts | 2 +- .../widget/lib/settings/map/polygon-settings.component.html | 2 +- .../widget/lib/settings/map/polygon-settings.component.ts | 2 +- .../widget/lib/settings/map/route-map-settings.component.html | 2 +- .../widget/lib/settings/map/route-map-settings.component.ts | 2 +- .../lib/settings/map/route-map-widget-settings.component.html | 2 +- .../lib/settings/map/route-map-widget-settings.component.ts | 2 +- .../settings/map/tencent-map-provider-settings.component.html | 2 +- .../settings/map/tencent-map-provider-settings.component.ts | 2 +- .../settings/map/trip-animation-common-settings.component.html | 2 +- .../settings/map/trip-animation-common-settings.component.ts | 2 +- .../settings/map/trip-animation-marker-settings.component.html | 2 +- .../settings/map/trip-animation-marker-settings.component.ts | 2 +- .../settings/map/trip-animation-path-settings.component.html | 2 +- .../lib/settings/map/trip-animation-path-settings.component.ts | 2 +- .../settings/map/trip-animation-point-settings.component.html | 2 +- .../settings/map/trip-animation-point-settings.component.ts | 2 +- .../settings/map/trip-animation-widget-settings.component.html | 2 +- .../settings/map/trip-animation-widget-settings.component.ts | 2 +- .../navigation/navigation-card-widget-settings.component.html | 2 +- .../navigation/navigation-card-widget-settings.component.ts | 2 +- .../navigation/navigation-cards-widget-settings.component.html | 2 +- .../navigation/navigation-cards-widget-settings.component.ts | 2 +- .../settings/scada/scada-symbol-widget-settings.component.html | 2 +- .../settings/scada/scada-symbol-widget-settings.component.ts | 2 +- .../wind-speed-direction-widget-settings.component.html | 2 +- .../weather/wind-speed-direction-widget-settings.component.ts | 2 +- .../components/widget/lib/settings/widget-settings.module.ts | 2 +- .../home/components/widget/lib/settings/widget-settings.scss | 2 +- .../modules/home/components/widget/lib/table-widget.models.ts | 2 +- .../app/modules/home/components/widget/lib/table-widget.scss | 2 +- .../widget/lib/timeseries-table-widget.component.html | 2 +- .../widget/lib/timeseries-table-widget.component.scss | 2 +- .../components/widget/lib/timeseries-table-widget.component.ts | 2 +- .../widget/lib/trip-animation/trip-animation.component.html | 2 +- .../widget/lib/trip-animation/trip-animation.component.scss | 2 +- .../widget/lib/trip-animation/trip-animation.component.ts | 2 +- .../lib/weather/wind-speed-direction-widget.component.html | 2 +- .../lib/weather/wind-speed-direction-widget.component.scss | 2 +- .../lib/weather/wind-speed-direction-widget.component.ts | 2 +- .../widget/lib/weather/wind-speed-direction-widget.models.ts | 2 +- .../modules/home/components/widget/widget-component.service.ts | 2 +- .../modules/home/components/widget/widget-components.module.ts | 2 +- .../home/components/widget/widget-config.component.html | 2 +- .../home/components/widget/widget-config.component.scss | 2 +- .../modules/home/components/widget/widget-config.component.ts | 2 +- .../home/components/widget/widget-container.component.html | 2 +- .../home/components/widget/widget-container.component.scss | 2 +- .../home/components/widget/widget-container.component.ts | 2 +- .../home/components/widget/widget-preview.component.html | 2 +- .../home/components/widget/widget-preview.component.scss | 2 +- .../modules/home/components/widget/widget-preview.component.ts | 2 +- .../app/modules/home/components/widget/widget.component.html | 2 +- .../app/modules/home/components/widget/widget.component.scss | 2 +- .../src/app/modules/home/components/widget/widget.component.ts | 2 +- .../home/components/wizard/device-wizard-dialog.component.html | 2 +- .../home/components/wizard/device-wizard-dialog.component.scss | 2 +- .../home/components/wizard/device-wizard-dialog.component.ts | 2 +- .../dialogs/add-entities-to-customer-dialog.component.html | 2 +- .../home/dialogs/add-entities-to-customer-dialog.component.ts | 2 +- .../home/dialogs/add-entities-to-edge-dialog.component.html | 2 +- .../home/dialogs/add-entities-to-edge-dialog.component.ts | 2 +- .../home/dialogs/assign-to-customer-dialog.component.html | 2 +- .../home/dialogs/assign-to-customer-dialog.component.ts | 2 +- ui-ngx/src/app/modules/home/dialogs/home-dialogs.module.ts | 2 +- ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts | 2 +- ui-ngx/src/app/modules/home/home-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/home.component.html | 2 +- ui-ngx/src/app/modules/home/home.component.scss | 2 +- ui-ngx/src/app/modules/home/home.component.ts | 2 +- ui-ngx/src/app/modules/home/home.module.ts | 2 +- ui-ngx/src/app/modules/home/menu/menu-link.component.html | 2 +- ui-ngx/src/app/modules/home/menu/menu-link.component.scss | 2 +- ui-ngx/src/app/modules/home/menu/menu-link.component.ts | 2 +- ui-ngx/src/app/modules/home/menu/menu-toggle.component.html | 2 +- ui-ngx/src/app/modules/home/menu/menu-toggle.component.scss | 2 +- ui-ngx/src/app/modules/home/menu/menu-toggle.component.ts | 2 +- ui-ngx/src/app/modules/home/menu/side-menu.component.html | 2 +- ui-ngx/src/app/modules/home/menu/side-menu.component.scss | 2 +- ui-ngx/src/app/modules/home/menu/side-menu.component.ts | 2 +- .../src/app/modules/home/models/dashboard-component.models.ts | 2 +- .../app/modules/home/models/datasource/attribute-datasource.ts | 2 +- .../app/modules/home/models/datasource/entity-datasource.ts | 2 +- .../app/modules/home/models/datasource/relation-datasource.ts | 2 +- .../modules/home/models/entity/entities-table-config.models.ts | 2 +- .../app/modules/home/models/entity/entity-component.models.ts | 2 +- .../home/models/entity/entity-details-page-component.models.ts | 2 +- .../home/models/entity/entity-table-component.models.ts | 2 +- .../src/app/modules/home/models/searchable-component.models.ts | 2 +- ui-ngx/src/app/modules/home/models/services.map.ts | 2 +- ui-ngx/src/app/modules/home/models/widget-component.models.ts | 2 +- .../app/modules/home/pages/account/account-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/account/account.module.ts | 2 +- .../src/app/modules/home/pages/admin/admin-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/admin/admin.module.ts | 2 +- .../home/pages/admin/auto-commit-admin-settings.component.html | 2 +- .../home/pages/admin/auto-commit-admin-settings.component.ts | 2 +- .../modules/home/pages/admin/general-settings.component.html | 2 +- .../modules/home/pages/admin/general-settings.component.scss | 2 +- .../app/modules/home/pages/admin/general-settings.component.ts | 2 +- .../app/modules/home/pages/admin/home-settings.component.html | 2 +- .../app/modules/home/pages/admin/home-settings.component.scss | 2 +- .../app/modules/home/pages/admin/home-settings.component.ts | 2 +- .../app/modules/home/pages/admin/mail-server.component.html | 2 +- .../app/modules/home/pages/admin/mail-server.component.scss | 2 +- .../src/app/modules/home/pages/admin/mail-server.component.ts | 2 +- .../pages/admin/oauth2/clients/client-dialog.component.html | 2 +- .../home/pages/admin/oauth2/clients/client-dialog.component.ts | 2 +- .../admin/oauth2/clients/client-table-header.component.html | 2 +- .../admin/oauth2/clients/client-table-header.component.ts | 2 +- .../home/pages/admin/oauth2/clients/client.component.html | 2 +- .../home/pages/admin/oauth2/clients/client.component.scss | 3 +-- .../home/pages/admin/oauth2/clients/client.component.ts | 2 +- .../admin/oauth2/clients/clients-table-config.resolver.ts | 2 +- .../pages/admin/oauth2/domains/domain-table-config.resolver.ts | 2 +- .../admin/oauth2/domains/domain-table-header.component.html | 2 +- .../admin/oauth2/domains/domain-table-header.component.ts | 2 +- .../home/pages/admin/oauth2/domains/domain.component.html | 2 +- .../home/pages/admin/oauth2/domains/domain.component.ts | 2 +- .../modules/home/pages/admin/oauth2/oauth2-routing.module.ts | 2 +- .../src/app/modules/home/pages/admin/oauth2/oauth2.module.ts | 2 +- .../app/modules/home/pages/admin/queue/queue.component.html | 2 +- .../src/app/modules/home/pages/admin/queue/queue.component.ts | 2 +- .../home/pages/admin/queue/queues-table-config.resolver.ts | 2 +- .../home/pages/admin/repository-admin-settings.component.html | 2 +- .../home/pages/admin/repository-admin-settings.component.ts | 2 +- .../pages/admin/resource/js-library-table-config.resolver.ts | 2 +- .../admin/resource/js-library-table-header.component.html | 2 +- .../pages/admin/resource/js-library-table-header.component.ts | 2 +- .../home/pages/admin/resource/js-resource.component.html | 2 +- .../modules/home/pages/admin/resource/js-resource.component.ts | 2 +- .../home/pages/admin/resource/resource-tabs.component.html | 2 +- .../home/pages/admin/resource/resource-tabs.component.ts | 2 +- .../admin/resource/resources-library-table-config.resolve.ts | 2 +- .../home/pages/admin/resource/resources-library.component.html | 2 +- .../home/pages/admin/resource/resources-library.component.ts | 2 +- .../pages/admin/resource/resources-table-header.component.html | 2 +- .../pages/admin/resource/resources-table-header.component.ts | 2 +- .../modules/home/pages/admin/security-settings.component.html | 2 +- .../modules/home/pages/admin/security-settings.component.scss | 2 +- .../modules/home/pages/admin/security-settings.component.ts | 2 +- .../home/pages/admin/send-test-sms-dialog.component.html | 2 +- .../modules/home/pages/admin/send-test-sms-dialog.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/admin/settings-card.scss | 2 +- .../app/modules/home/pages/admin/sms-provider.component.html | 2 +- .../app/modules/home/pages/admin/sms-provider.component.scss | 2 +- .../src/app/modules/home/pages/admin/sms-provider.component.ts | 2 +- .../home/pages/admin/two-factor-auth-settings.component.html | 2 +- .../home/pages/admin/two-factor-auth-settings.component.scss | 2 +- .../home/pages/admin/two-factor-auth-settings.component.ts | 2 +- .../src/app/modules/home/pages/alarm/alarm-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/alarm/alarm.module.ts | 2 +- .../modules/home/pages/api-usage/api-usage-routing.module.ts | 2 +- .../src/app/modules/home/pages/api-usage/api-usage.module.ts | 2 +- .../home/pages/asset-profile/asset-profile-routing.module.ts | 2 +- .../home/pages/asset-profile/asset-profile-tabs.component.html | 2 +- .../home/pages/asset-profile/asset-profile-tabs.component.ts | 2 +- .../modules/home/pages/asset-profile/asset-profile.module.ts | 2 +- .../asset-profile/asset-profiles-table-config.resolver.ts | 2 +- .../src/app/modules/home/pages/asset/asset-routing.module.ts | 2 +- .../modules/home/pages/asset/asset-table-header.component.html | 2 +- .../modules/home/pages/asset/asset-table-header.component.ts | 2 +- .../src/app/modules/home/pages/asset/asset-tabs.component.html | 2 +- .../src/app/modules/home/pages/asset/asset-tabs.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/asset/asset.component.html | 2 +- ui-ngx/src/app/modules/home/pages/asset/asset.component.scss | 2 +- ui-ngx/src/app/modules/home/pages/asset/asset.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/asset/asset.module.ts | 2 +- .../modules/home/pages/asset/assets-table-config.resolver.ts | 2 +- .../modules/home/pages/audit-log/audit-log-routing.module.ts | 2 +- .../src/app/modules/home/pages/audit-log/audit-log.module.ts | 2 +- .../app/modules/home/pages/customer/customer-routing.module.ts | 2 +- .../modules/home/pages/customer/customer-tabs.component.html | 2 +- .../app/modules/home/pages/customer/customer-tabs.component.ts | 2 +- .../app/modules/home/pages/customer/customer.component.html | 2 +- .../app/modules/home/pages/customer/customer.component.scss | 2 +- .../src/app/modules/home/pages/customer/customer.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/customer/customer.module.ts | 2 +- .../home/pages/customer/customers-table-config.resolver.ts | 2 +- .../modules/home/pages/dashboard/dashboard-form.component.html | 2 +- .../modules/home/pages/dashboard/dashboard-form.component.scss | 2 +- .../modules/home/pages/dashboard/dashboard-form.component.ts | 2 +- .../modules/home/pages/dashboard/dashboard-routing.module.ts | 2 +- .../modules/home/pages/dashboard/dashboard-tabs.component.html | 2 +- .../modules/home/pages/dashboard/dashboard-tabs.component.ts | 2 +- .../src/app/modules/home/pages/dashboard/dashboard.module.ts | 2 +- .../home/pages/dashboard/dashboards-table-config.resolver.ts | 2 +- .../dashboard/make-dashboard-public-dialog.component.html | 2 +- .../pages/dashboard/make-dashboard-public-dialog.component.ts | 2 +- .../dashboard/manage-dashboard-customers-dialog.component.html | 2 +- .../dashboard/manage-dashboard-customers-dialog.component.ts | 2 +- .../home/pages/device-profile/device-profile-routing.module.ts | 2 +- .../pages/device-profile/device-profile-tabs.component.html | 2 +- .../home/pages/device-profile/device-profile-tabs.component.ts | 2 +- .../modules/home/pages/device-profile/device-profile.module.ts | 2 +- .../device-profile/device-profiles-table-config.resolver.ts | 2 +- .../data/coap-device-transport-configuration.component.html | 2 +- .../data/coap-device-transport-configuration.component.ts | 2 +- .../device/data/default-device-configuration.component.html | 2 +- .../device/data/default-device-configuration.component.ts | 2 +- .../data/default-device-transport-configuration.component.html | 2 +- .../data/default-device-transport-configuration.component.ts | 2 +- .../home/pages/device/data/device-configuration.component.html | 2 +- .../home/pages/device/data/device-configuration.component.ts | 2 +- .../modules/home/pages/device/data/device-data.component.html | 2 +- .../modules/home/pages/device/data/device-data.component.ts | 2 +- .../device/data/device-transport-configuration.component.html | 2 +- .../device/data/device-transport-configuration.component.ts | 2 +- .../data/lwm2m-device-transport-configuration.component.html | 2 +- .../data/lwm2m-device-transport-configuration.component.ts | 2 +- .../data/mqtt-device-transport-configuration.component.html | 2 +- .../data/mqtt-device-transport-configuration.component.ts | 2 +- .../data/snmp-device-transport-configuration.component.html | 2 +- .../data/snmp-device-transport-configuration.component.ts | 2 +- .../device/device-check-connectivity-dialog.component.html | 2 +- .../device/device-check-connectivity-dialog.component.scss | 2 +- .../pages/device/device-check-connectivity-dialog.component.ts | 2 +- .../home/pages/device/device-credentials-dialog.component.html | 2 +- .../home/pages/device/device-credentials-dialog.component.scss | 2 +- .../home/pages/device/device-credentials-dialog.component.ts | 2 +- .../src/app/modules/home/pages/device/device-routing.module.ts | 2 +- .../home/pages/device/device-table-header.component.html | 2 +- .../modules/home/pages/device/device-table-header.component.ts | 2 +- .../app/modules/home/pages/device/device-tabs.component.html | 2 +- .../src/app/modules/home/pages/device/device-tabs.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/device/device.component.html | 2 +- ui-ngx/src/app/modules/home/pages/device/device.component.scss | 2 +- ui-ngx/src/app/modules/home/pages/device/device.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/device/device.module.ts | 2 +- .../modules/home/pages/device/devices-table-config.resolver.ts | 2 +- .../home/pages/edge/edge-instructions-dialog.component.html | 2 +- .../home/pages/edge/edge-instructions-dialog.component.scss | 2 +- .../home/pages/edge/edge-instructions-dialog.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts | 2 +- .../modules/home/pages/edge/edge-table-header.component.html | 2 +- .../app/modules/home/pages/edge/edge-table-header.component.ts | 2 +- .../src/app/modules/home/pages/edge/edge-tabs.component.html | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge.component.html | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge.component.scss | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/edge/edge.module.ts | 2 +- .../app/modules/home/pages/edge/edges-table-config.resolver.ts | 2 +- .../app/modules/home/pages/entities/entities-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/entities/entities.module.ts | 2 +- .../home/pages/entity-view/entity-view-routing.module.ts | 2 +- .../pages/entity-view/entity-view-table-header.component.html | 2 +- .../pages/entity-view/entity-view-table-header.component.ts | 2 +- .../home/pages/entity-view/entity-view-tabs.component.html | 2 +- .../home/pages/entity-view/entity-view-tabs.component.ts | 2 +- .../modules/home/pages/entity-view/entity-view.component.html | 2 +- .../modules/home/pages/entity-view/entity-view.component.scss | 2 +- .../modules/home/pages/entity-view/entity-view.component.ts | 2 +- .../app/modules/home/pages/entity-view/entity-view.module.ts | 2 +- .../pages/entity-view/entity-views-table-config.resolver.ts | 2 +- .../app/modules/home/pages/features/features-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/features/features.module.ts | 2 +- .../app/modules/home/pages/gateways/gateways-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/gateways/gateways.module.ts | 2 +- .../modules/home/pages/home-links/home-links-routing.module.ts | 2 +- .../modules/home/pages/home-links/home-links.component.html | 2 +- .../modules/home/pages/home-links/home-links.component.scss | 2 +- .../app/modules/home/pages/home-links/home-links.component.ts | 2 +- .../src/app/modules/home/pages/home-links/home-links.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/home-pages.models.ts | 2 +- ui-ngx/src/app/modules/home/pages/home-pages.module.ts | 2 +- .../pages/mobile/applications/applications-routing.module.ts | 2 +- .../home/pages/mobile/applications/applications.module.ts | 2 +- .../pages/mobile/applications/mobile-app-dialog.component.html | 2 +- .../pages/mobile/applications/mobile-app-dialog.component.ts | 2 +- .../mobile/applications/mobile-app-table-config.resolver.ts | 2 +- .../mobile/applications/mobile-app-table-header.component.html | 2 +- .../mobile/applications/mobile-app-table-header.component.scss | 2 +- .../mobile/applications/mobile-app-table-header.component.ts | 2 +- .../home/pages/mobile/applications/mobile-app.component.html | 2 +- .../home/pages/mobile/applications/mobile-app.component.scss | 2 +- .../home/pages/mobile/applications/mobile-app.component.ts | 2 +- .../pages/mobile/applications/remove-app-dialog.component.html | 2 +- .../pages/mobile/applications/remove-app-dialog.component.scss | 2 +- .../pages/mobile/applications/remove-app-dialog.component.ts | 2 +- .../modules/home/pages/mobile/bundes/bundles-routing.module.ts | 2 +- .../src/app/modules/home/pages/mobile/bundes/bundles.module.ts | 2 +- .../mobile/bundes/layout/add-mobile-page-dialog.component.html | 2 +- .../mobile/bundes/layout/add-mobile-page-dialog.component.scss | 2 +- .../mobile/bundes/layout/add-mobile-page-dialog.component.ts | 2 +- .../bundes/layout/custom-mobile-page-panel.component.html | 2 +- .../bundes/layout/custom-mobile-page-panel.component.scss | 2 +- .../mobile/bundes/layout/custom-mobile-page-panel.component.ts | 2 +- .../mobile/bundes/layout/custom-mobile-page.component.html | 2 +- .../mobile/bundes/layout/custom-mobile-page.component.scss | 2 +- .../pages/mobile/bundes/layout/custom-mobile-page.component.ts | 2 +- .../bundes/layout/default-mobile-page-panel.component.html | 2 +- .../bundes/layout/default-mobile-page-panel.component.scss | 2 +- .../bundes/layout/default-mobile-page-panel.component.ts | 2 +- .../pages/mobile/bundes/layout/mobile-layout.component.html | 2 +- .../pages/mobile/bundes/layout/mobile-layout.component.scss | 2 +- .../home/pages/mobile/bundes/layout/mobile-layout.component.ts | 2 +- .../mobile/bundes/layout/mobile-page-item-row.component.html | 2 +- .../mobile/bundes/layout/mobile-page-item-row.component.scss | 2 +- .../mobile/bundes/layout/mobile-page-item-row.component.ts | 2 +- .../bundes/mobile-app-configuration-dialog.component.html | 2 +- .../bundes/mobile-app-configuration-dialog.component.scss | 2 +- .../mobile/bundes/mobile-app-configuration-dialog.component.ts | 2 +- .../pages/mobile/bundes/mobile-bundle-dialog.component.html | 2 +- .../pages/mobile/bundes/mobile-bundle-dialog.component.scss | 2 +- .../home/pages/mobile/bundes/mobile-bundle-dialog.component.ts | 2 +- .../pages/mobile/bundes/mobile-bundle-table-config.resolve.ts | 2 +- .../mobile/bundes/mobile-bundle-table-header.component.html | 2 +- .../mobile/bundes/mobile-bundle-table-header.component.scss | 2 +- .../mobile/bundes/mobile-bundle-table-header.component.ts | 2 +- .../modules/home/pages/mobile/common/common-mobile.module.ts | 2 +- .../home/pages/mobile/common/editor-panel.component.html | 2 +- .../home/pages/mobile/common/editor-panel.component.scss | 2 +- .../modules/home/pages/mobile/common/editor-panel.component.ts | 2 +- .../src/app/modules/home/pages/mobile/mobile-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/mobile/mobile.module.ts | 2 +- .../mobile-qr-code-widget-settings-routing.module.ts | 2 +- .../mobile-qr-code-widget-settings.component.html | 2 +- .../mobile-qr-code-widget-settings.component.scss | 3 +-- .../qr-code-widget/mobile-qr-code-widget-settings.component.ts | 2 +- .../qr-code-widget/mobile-qr-code-widget-settings.module.ts | 2 +- .../inbox/inbox-notification-dialog.component.html | 2 +- .../inbox/inbox-notification-dialog.component.scss | 2 +- .../notification/inbox/inbox-notification-dialog.component.ts | 2 +- .../pages/notification/inbox/inbox-table-config.resolver.ts | 2 +- .../pages/notification/inbox/inbox-table-header.component.html | 2 +- .../pages/notification/inbox/inbox-table-header.component.ts | 2 +- .../home/pages/notification/notification-routing.module.ts | 2 +- .../app/modules/home/pages/notification/notification.module.ts | 2 +- .../recipient/recipient-notification-dialog.component.html | 2 +- .../recipient/recipient-notification-dialog.component.scss | 2 +- .../recipient/recipient-notification-dialog.component.ts | 2 +- .../notification/recipient/recipient-table-config.resolver.ts | 2 +- .../pages/notification/rule/escalation-form.component.html | 2 +- .../pages/notification/rule/escalation-form.component.scss | 2 +- .../home/pages/notification/rule/escalation-form.component.ts | 2 +- .../home/pages/notification/rule/escalations.component.html | 2 +- .../home/pages/notification/rule/escalations.component.ts | 2 +- .../notification/rule/rule-notification-dialog.component.html | 2 +- .../notification/rule/rule-notification-dialog.component.scss | 2 +- .../notification/rule/rule-notification-dialog.component.ts | 2 +- .../home/pages/notification/rule/rule-table-config.resolver.ts | 2 +- .../pages/notification/sent/sent-error-dialog.component.html | 2 +- .../pages/notification/sent/sent-error-dialog.component.scss | 2 +- .../pages/notification/sent/sent-error-dialog.component.ts | 2 +- .../notification/sent/sent-notification-dialog.component.html | 2 +- .../notification/sent/sent-notification-dialog.component.scss | 2 +- .../notification/sent/sent-notification-dialog.componet.ts | 2 +- .../home/pages/notification/sent/sent-table-config.resolver.ts | 2 +- .../settings/notification-setting-form.component.html | 2 +- .../settings/notification-setting-form.component.scss | 2 +- .../settings/notification-setting-form.component.ts | 2 +- .../settings/notification-settings-routing.modules.ts | 2 +- .../notification/settings/notification-settings.component.html | 2 +- .../notification/settings/notification-settings.component.scss | 2 +- .../notification/settings/notification-settings.component.ts | 2 +- .../notification-action-button-configuration.component.html | 2 +- .../notification-action-button-configuration.component.ts | 2 +- .../notification-template-configuration.component.html | 2 +- .../notification-template-configuration.component.scss | 2 +- .../notification-template-configuration.component.ts | 2 +- .../home/pages/notification/template/template-configuration.ts | 2 +- .../template/template-notification-dialog.component.html | 2 +- .../template/template-notification-dialog.component.scss | 2 +- .../template/template-notification-dialog.component.ts | 2 +- .../notification/template/template-table-config.resolver.ts | 2 +- .../modules/home/pages/ota-update/ota-update-routing.module.ts | 2 +- .../home/pages/ota-update/ota-update-table-config.resolve.ts | 2 +- .../modules/home/pages/ota-update/ota-update.component.html | 2 +- .../app/modules/home/pages/ota-update/ota-update.component.ts | 2 +- .../src/app/modules/home/pages/ota-update/ota-update.module.ts | 2 +- .../app/modules/home/pages/profile/profile-routing.module.ts | 2 +- .../src/app/modules/home/pages/profile/profile.component.html | 2 +- .../src/app/modules/home/pages/profile/profile.component.scss | 2 +- ui-ngx/src/app/modules/home/pages/profile/profile.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/profile/profile.module.ts | 2 +- .../app/modules/home/pages/profiles/profiles-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/profiles/profiles.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/public-api.ts | 2 +- .../home/pages/rulechain/add-rule-node-dialog.component.html | 2 +- .../home/pages/rulechain/add-rule-node-dialog.component.scss | 2 +- .../pages/rulechain/add-rule-node-link-dialog.component.html | 2 +- .../pages/rulechain/add-rule-node-link-dialog.component.scss | 2 +- .../rulechain/create-nested-rulechain-dialog.component.html | 2 +- .../modules/home/pages/rulechain/link-labels.component.html | 2 +- .../app/modules/home/pages/rulechain/link-labels.component.ts | 2 +- .../src/app/modules/home/pages/rulechain/rule-node-colors.scss | 2 +- .../home/pages/rulechain/rule-node-config.component.html | 2 +- .../home/pages/rulechain/rule-node-config.component.scss | 2 +- .../modules/home/pages/rulechain/rule-node-config.component.ts | 2 +- .../home/pages/rulechain/rule-node-details.component.html | 2 +- .../home/pages/rulechain/rule-node-details.component.scss | 2 +- .../home/pages/rulechain/rule-node-details.component.ts | 2 +- .../modules/home/pages/rulechain/rule-node-link.component.html | 2 +- .../modules/home/pages/rulechain/rule-node-link.component.ts | 2 +- .../modules/home/pages/rulechain/rulechain-page.component.html | 2 +- .../modules/home/pages/rulechain/rulechain-page.component.scss | 2 +- .../modules/home/pages/rulechain/rulechain-page.component.ts | 2 +- .../app/modules/home/pages/rulechain/rulechain-page.models.ts | 2 +- .../app/modules/home/pages/rulechain/rulechain-page.module.ts | 2 +- .../modules/home/pages/rulechain/rulechain-routing.module.ts | 2 +- .../modules/home/pages/rulechain/rulechain-tabs.component.html | 2 +- .../modules/home/pages/rulechain/rulechain-tabs.component.ts | 2 +- .../app/modules/home/pages/rulechain/rulechain.component.html | 2 +- .../app/modules/home/pages/rulechain/rulechain.component.scss | 2 +- .../app/modules/home/pages/rulechain/rulechain.component.ts | 2 +- .../src/app/modules/home/pages/rulechain/rulechain.module.ts | 2 +- .../home/pages/rulechain/rulechains-table-config.resolver.ts | 2 +- .../app/modules/home/pages/rulechain/rulenode.component.html | 2 +- .../app/modules/home/pages/rulechain/rulenode.component.scss | 2 +- .../src/app/modules/home/pages/rulechain/rulenode.component.ts | 2 +- .../scada-symbol-behavior-panel.component.html | 2 +- .../scada-symbol-behavior-panel.component.scss | 2 +- .../scada-symbol-behavior-panel.component.ts | 2 +- .../scada-symbol-behavior-row.component.html | 2 +- .../scada-symbol-behavior-row.component.scss | 2 +- .../metadata-components/scada-symbol-behavior-row.component.ts | 2 +- .../metadata-components/scada-symbol-behaviors.component.html | 2 +- .../metadata-components/scada-symbol-behaviors.component.scss | 2 +- .../metadata-components/scada-symbol-behaviors.component.ts | 2 +- .../scada-symbol-metadata-components.module.ts | 2 +- .../scada-symbol-metadata-tag-function-panel.component.html | 2 +- .../scada-symbol-metadata-tag-function-panel.component.scss | 2 +- .../scada-symbol-metadata-tag-function-panel.component.ts | 2 +- .../scada-symbol-metadata-tag.component.html | 2 +- .../scada-symbol-metadata-tag.component.scss | 2 +- .../metadata-components/scada-symbol-metadata-tag.component.ts | 2 +- .../scada-symbol-metadata-tags.component.html | 2 +- .../scada-symbol-metadata-tags.component.scss | 2 +- .../scada-symbol-metadata-tags.component.ts | 2 +- .../metadata-components/scada-symbol-metadata.component.html | 2 +- .../metadata-components/scada-symbol-metadata.component.scss | 2 +- .../metadata-components/scada-symbol-metadata.component.ts | 2 +- .../home/pages/scada-symbol/scada-symbol-editor.component.html | 2 +- .../home/pages/scada-symbol/scada-symbol-editor.component.scss | 2 +- .../home/pages/scada-symbol/scada-symbol-editor.component.ts | 2 +- .../home/pages/scada-symbol/scada-symbol-editor.models.ts | 2 +- .../pages/scada-symbol/scada-symbol-tooltip.component.scss | 2 +- .../home/pages/scada-symbol/scada-symbol-tooltip.components.ts | 2 +- .../home/pages/scada-symbol/scada-symbol.component.html | 2 +- .../home/pages/scada-symbol/scada-symbol.component.scss | 3 +-- .../modules/home/pages/scada-symbol/scada-symbol.component.ts | 2 +- .../app/modules/home/pages/scada-symbol/scada-symbol.module.ts | 2 +- .../authentication-dialog/authentication-dialog.component.scss | 2 +- .../authentication-dialog/authentication-dialog.map.ts | 2 +- .../backup-code-auth-dialog.component.html | 2 +- .../authentication-dialog/backup-code-auth-dialog.component.ts | 2 +- .../authentication-dialog/email-auth-dialog.component.html | 2 +- .../authentication-dialog/email-auth-dialog.component.ts | 2 +- .../authentication-dialog/sms-auth-dialog.component.html | 2 +- .../authentication-dialog/sms-auth-dialog.component.ts | 2 +- .../authentication-dialog/totp-auth-dialog.component.html | 2 +- .../authentication-dialog/totp-auth-dialog.component.ts | 2 +- .../app/modules/home/pages/security/security-routing.module.ts | 2 +- .../app/modules/home/pages/security/security.component.html | 2 +- .../app/modules/home/pages/security/security.component.scss | 2 +- .../src/app/modules/home/pages/security/security.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/security/security.module.ts | 2 +- .../home/pages/tenant-profile/tenant-profile-routing.module.ts | 2 +- .../pages/tenant-profile/tenant-profile-tabs.component.html | 2 +- .../home/pages/tenant-profile/tenant-profile-tabs.component.ts | 2 +- .../modules/home/pages/tenant-profile/tenant-profile.module.ts | 2 +- .../tenant-profile/tenant-profiles-table-config.resolver.ts | 2 +- .../src/app/modules/home/pages/tenant/tenant-routing.module.ts | 2 +- .../app/modules/home/pages/tenant/tenant-tabs.component.html | 2 +- .../src/app/modules/home/pages/tenant/tenant-tabs.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/tenant/tenant.component.html | 2 +- ui-ngx/src/app/modules/home/pages/tenant/tenant.component.scss | 2 +- ui-ngx/src/app/modules/home/pages/tenant/tenant.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/tenant/tenant.module.ts | 2 +- .../modules/home/pages/tenant/tenants-table-config.resolver.ts | 2 +- .../home/pages/user/activation-link-dialog.component.html | 2 +- .../home/pages/user/activation-link-dialog.component.ts | 2 +- .../app/modules/home/pages/user/add-user-dialog.component.html | 2 +- .../app/modules/home/pages/user/add-user-dialog.component.scss | 2 +- .../app/modules/home/pages/user/add-user-dialog.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/user/user-routing.module.ts | 2 +- .../src/app/modules/home/pages/user/user-tabs.component.html | 2 +- ui-ngx/src/app/modules/home/pages/user/user-tabs.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/user/user.component.html | 2 +- ui-ngx/src/app/modules/home/pages/user/user.component.scss | 2 +- ui-ngx/src/app/modules/home/pages/user/user.component.ts | 2 +- ui-ngx/src/app/modules/home/pages/user/user.module.ts | 2 +- .../app/modules/home/pages/user/users-table-config.resolver.ts | 2 +- ui-ngx/src/app/modules/home/pages/vc/vc-routing.module.ts | 2 +- ui-ngx/src/app/modules/home/pages/vc/vc.module.ts | 2 +- .../pages/widget/save-widget-type-as-dialog.component.html | 2 +- .../home/pages/widget/save-widget-type-as-dialog.component.ts | 2 +- .../home/pages/widget/select-widget-type-dialog.component.html | 2 +- .../home/pages/widget/select-widget-type-dialog.component.scss | 2 +- .../home/pages/widget/select-widget-type-dialog.component.ts | 2 +- .../app/modules/home/pages/widget/widget-editor.component.html | 2 +- .../app/modules/home/pages/widget/widget-editor.component.scss | 2 +- .../app/modules/home/pages/widget/widget-editor.component.ts | 2 +- .../src/app/modules/home/pages/widget/widget-editor.models.ts | 2 +- .../modules/home/pages/widget/widget-library-routing.module.ts | 2 +- .../src/app/modules/home/pages/widget/widget-library.module.ts | 2 +- .../home/pages/widget/widget-type-autocomplete.component.html | 2 +- .../home/pages/widget/widget-type-autocomplete.component.scss | 2 +- .../home/pages/widget/widget-type-autocomplete.component.ts | 2 +- .../modules/home/pages/widget/widget-type-tabs.component.html | 2 +- .../modules/home/pages/widget/widget-type-tabs.component.ts | 2 +- .../app/modules/home/pages/widget/widget-type.component.html | 2 +- .../src/app/modules/home/pages/widget/widget-type.component.ts | 2 +- .../home/pages/widget/widget-types-table-config.resolver.ts | 2 +- .../home/pages/widget/widgets-bundle-dialog.component.html | 2 +- .../home/pages/widget/widgets-bundle-dialog.component.scss | 2 +- .../home/pages/widget/widgets-bundle-dialog.component.ts | 2 +- .../home/pages/widget/widgets-bundle-tabs.component.html | 2 +- .../modules/home/pages/widget/widgets-bundle-tabs.component.ts | 2 +- .../home/pages/widget/widgets-bundle-widgets.component.html | 2 +- .../home/pages/widget/widgets-bundle-widgets.component.scss | 2 +- .../home/pages/widget/widgets-bundle-widgets.component.ts | 2 +- .../modules/home/pages/widget/widgets-bundle.component.html | 2 +- .../modules/home/pages/widget/widgets-bundle.component.scss | 2 +- .../app/modules/home/pages/widget/widgets-bundle.component.ts | 2 +- .../home/pages/widget/widgets-bundles-table-config.resolver.ts | 2 +- ui-ngx/src/app/modules/home/public-api.ts | 2 +- ui-ngx/src/app/modules/login/login-routing.module.ts | 2 +- ui-ngx/src/app/modules/login/login.module.ts | 2 +- .../modules/login/pages/login/create-password.component.html | 2 +- .../modules/login/pages/login/create-password.component.scss | 2 +- .../app/modules/login/pages/login/create-password.component.ts | 2 +- .../app/modules/login/pages/login/link-expired.component.html | 2 +- .../app/modules/login/pages/login/link-expired.component.scss | 2 +- .../app/modules/login/pages/login/link-expired.component.ts | 2 +- ui-ngx/src/app/modules/login/pages/login/login.component.html | 2 +- ui-ngx/src/app/modules/login/pages/login/login.component.scss | 2 +- ui-ngx/src/app/modules/login/pages/login/login.component.ts | 2 +- .../login/pages/login/reset-password-request.component.html | 2 +- .../login/pages/login/reset-password-request.component.scss | 2 +- .../login/pages/login/reset-password-request.component.ts | 2 +- .../modules/login/pages/login/reset-password.component.html | 2 +- .../modules/login/pages/login/reset-password.component.scss | 2 +- .../app/modules/login/pages/login/reset-password.component.ts | 2 +- .../login/pages/login/two-factor-auth-login.component.html | 2 +- .../login/pages/login/two-factor-auth-login.component.scss | 2 +- .../login/pages/login/two-factor-auth-login.component.ts | 2 +- ui-ngx/src/app/shared/adapter/custom-datatime-adapter.ts | 2 +- ui-ngx/src/app/shared/animations/speed-dial-fab.animations.ts | 2 +- ui-ngx/src/app/shared/components/breadcrumb.component.html | 2 +- ui-ngx/src/app/shared/components/breadcrumb.component.scss | 2 +- ui-ngx/src/app/shared/components/breadcrumb.component.ts | 2 +- ui-ngx/src/app/shared/components/breadcrumb.ts | 2 +- .../app/shared/components/button/copy-button.component.html | 2 +- .../app/shared/components/button/copy-button.component.scss | 2 +- .../src/app/shared/components/button/copy-button.component.ts | 2 +- .../shared/components/button/toggle-password.component.html | 2 +- .../app/shared/components/button/toggle-password.component.ts | 2 +- .../components/button/widget-button-toggle.component.html | 2 +- .../components/button/widget-button-toggle.component.scss | 3 +-- .../shared/components/button/widget-button-toggle.component.ts | 2 +- .../app/shared/components/button/widget-button.component.html | 2 +- .../app/shared/components/button/widget-button.component.scss | 2 +- .../app/shared/components/button/widget-button.component.ts | 2 +- .../src/app/shared/components/button/widget-button.models.ts | 2 +- ui-ngx/src/app/shared/components/cheatsheet.component.ts | 2 +- .../src/app/shared/components/circular-progress.directive.ts | 2 +- ui-ngx/src/app/shared/components/color-input.component.html | 2 +- ui-ngx/src/app/shared/components/color-input.component.scss | 2 +- ui-ngx/src/app/shared/components/color-input.component.ts | 2 +- .../components/color-picker/color-picker-panel.component.html | 2 +- .../components/color-picker/color-picker-panel.component.scss | 2 +- .../components/color-picker/color-picker-panel.component.ts | 2 +- .../shared/components/color-picker/color-picker.component.html | 2 +- .../shared/components/color-picker/color-picker.component.scss | 2 +- .../shared/components/color-picker/color-picker.component.ts | 2 +- .../shared/components/color-picker/hex-input.component.html | 2 +- .../shared/components/color-picker/hex-input.component.scss | 3 +-- .../app/shared/components/color-picker/hex-input.component.ts | 2 +- ui-ngx/src/app/shared/components/contact.component.html | 2 +- ui-ngx/src/app/shared/components/contact.component.ts | 2 +- .../app/shared/components/country-autocomplete.component.html | 2 +- .../app/shared/components/country-autocomplete.component.ts | 2 +- ui-ngx/src/app/shared/components/css.component.html | 2 +- ui-ngx/src/app/shared/components/css.component.scss | 2 +- ui-ngx/src/app/shared/components/css.component.ts | 2 +- .../shared/components/dashboard-autocomplete.component.html | 2 +- .../app/shared/components/dashboard-autocomplete.component.ts | 2 +- .../shared/components/dashboard-select-panel.component.html | 2 +- .../shared/components/dashboard-select-panel.component.scss | 2 +- .../app/shared/components/dashboard-select-panel.component.ts | 2 +- .../src/app/shared/components/dashboard-select.component.html | 2 +- .../src/app/shared/components/dashboard-select.component.scss | 2 +- ui-ngx/src/app/shared/components/dashboard-select.component.ts | 2 +- .../components/dashboard-state-autocomplete.component.html | 2 +- .../components/dashboard-state-autocomplete.component.ts | 2 +- ui-ngx/src/app/shared/components/dialog.component.ts | 2 +- .../app/shared/components/dialog/alert-dialog.component.html | 2 +- .../app/shared/components/dialog/alert-dialog.component.scss | 2 +- .../src/app/shared/components/dialog/alert-dialog.component.ts | 2 +- .../components/dialog/color-picker-dialog.component.html | 2 +- .../components/dialog/color-picker-dialog.component.scss | 2 +- .../shared/components/dialog/color-picker-dialog.component.ts | 2 +- .../app/shared/components/dialog/confirm-dialog.component.html | 2 +- .../app/shared/components/dialog/confirm-dialog.component.scss | 2 +- .../app/shared/components/dialog/confirm-dialog.component.ts | 2 +- .../entity-conflict-dialog.component.html | 2 +- .../entity-conflict-dialog.component.scss | 2 +- .../entity-conflict-dialog/entity-conflict-dialog.component.ts | 2 +- .../shared/components/dialog/error-alert-dialog.component.html | 2 +- .../shared/components/dialog/error-alert-dialog.component.scss | 2 +- .../shared/components/dialog/error-alert-dialog.component.ts | 2 +- .../components/dialog/json-object-edit-dialog.component.html | 2 +- .../components/dialog/json-object-edit-dialog.component.ts | 2 +- .../components/dialog/material-icons-dialog.component.html | 2 +- .../components/dialog/material-icons-dialog.component.scss | 2 +- .../components/dialog/material-icons-dialog.component.ts | 2 +- .../components/dialog/node-script-test-dialog.component.html | 2 +- .../components/dialog/node-script-test-dialog.component.scss | 2 +- .../components/dialog/node-script-test-dialog.component.ts | 2 +- .../app/shared/components/dialog/todo-dialog.component.html | 2 +- .../app/shared/components/dialog/todo-dialog.component.scss | 2 +- .../src/app/shared/components/dialog/todo-dialog.component.ts | 2 +- .../shared/components/directives/component-outlet.directive.ts | 2 +- .../components/directives/sring-template-outlet.directive.ts | 2 +- .../components/directives/tb-json-to-string.directive.ts | 2 +- .../components/entity/entity-autocomplete.component.html | 2 +- .../shared/components/entity/entity-autocomplete.component.ts | 2 +- .../components/entity/entity-gateway-select.component.html | 2 +- .../components/entity/entity-gateway-select.component.ts | 2 +- .../shared/components/entity/entity-keys-list.component.html | 2 +- .../app/shared/components/entity/entity-keys-list.component.ts | 2 +- .../shared/components/entity/entity-list-select.component.html | 2 +- .../shared/components/entity/entity-list-select.component.scss | 2 +- .../shared/components/entity/entity-list-select.component.ts | 2 +- .../app/shared/components/entity/entity-list.component.html | 2 +- .../src/app/shared/components/entity/entity-list.component.ts | 2 +- .../app/shared/components/entity/entity-select.component.html | 2 +- .../app/shared/components/entity/entity-select.component.scss | 2 +- .../app/shared/components/entity/entity-select.component.ts | 2 +- .../entity/entity-subtype-autocomplete.component.html | 2 +- .../components/entity/entity-subtype-autocomplete.component.ts | 2 +- .../components/entity/entity-subtype-list.component.html | 2 +- .../shared/components/entity/entity-subtype-list.component.ts | 2 +- .../components/entity/entity-subtype-select.component.html | 2 +- .../components/entity/entity-subtype-select.component.scss | 2 +- .../components/entity/entity-subtype-select.component.ts | 2 +- .../shared/components/entity/entity-type-list.component.html | 2 +- .../app/shared/components/entity/entity-type-list.component.ts | 2 +- .../shared/components/entity/entity-type-select.component.html | 2 +- .../shared/components/entity/entity-type-select.component.scss | 2 +- .../shared/components/entity/entity-type-select.component.ts | 2 +- ui-ngx/src/app/shared/components/fab-toolbar.component.html | 2 +- ui-ngx/src/app/shared/components/fab-toolbar.component.scss | 2 +- ui-ngx/src/app/shared/components/fab-toolbar.component.ts | 2 +- ui-ngx/src/app/shared/components/file-input.component.html | 2 +- ui-ngx/src/app/shared/components/file-input.component.scss | 2 +- ui-ngx/src/app/shared/components/file-input.component.ts | 2 +- .../app/shared/components/footer-fab-buttons.component.html | 2 +- .../app/shared/components/footer-fab-buttons.component.scss | 2 +- .../src/app/shared/components/footer-fab-buttons.component.ts | 2 +- ui-ngx/src/app/shared/components/footer.component.html | 2 +- ui-ngx/src/app/shared/components/footer.component.scss | 2 +- ui-ngx/src/app/shared/components/footer.component.ts | 2 +- ui-ngx/src/app/shared/components/fullscreen.directive.ts | 2 +- .../src/app/shared/components/grid/scroll-grid-datasource.ts | 2 +- .../src/app/shared/components/grid/scroll-grid.component.html | 2 +- .../src/app/shared/components/grid/scroll-grid.component.scss | 2 +- ui-ngx/src/app/shared/components/grid/scroll-grid.component.ts | 2 +- ui-ngx/src/app/shared/components/help-markdown.component.html | 2 +- ui-ngx/src/app/shared/components/help-markdown.component.scss | 2 +- ui-ngx/src/app/shared/components/help-markdown.component.ts | 2 +- ui-ngx/src/app/shared/components/help-popup.component.html | 2 +- ui-ngx/src/app/shared/components/help-popup.component.scss | 2 +- ui-ngx/src/app/shared/components/help-popup.component.ts | 2 +- ui-ngx/src/app/shared/components/help.component.html | 2 +- ui-ngx/src/app/shared/components/help.component.ts | 2 +- .../src/app/shared/components/hint-tooltip-icon.component.html | 2 +- .../src/app/shared/components/hint-tooltip-icon.component.scss | 2 +- .../src/app/shared/components/hint-tooltip-icon.component.ts | 2 +- ui-ngx/src/app/shared/components/hotkeys.directive.ts | 2 +- ui-ngx/src/app/shared/components/html.component.html | 2 +- ui-ngx/src/app/shared/components/html.component.scss | 2 +- ui-ngx/src/app/shared/components/html.component.ts | 2 +- ui-ngx/src/app/shared/components/icon.component.ts | 2 +- ui-ngx/src/app/shared/components/image-input.component.html | 2 +- ui-ngx/src/app/shared/components/image-input.component.scss | 2 +- ui-ngx/src/app/shared/components/image-input.component.ts | 2 +- .../shared/components/image/embed-image-dialog.component.html | 2 +- .../shared/components/image/embed-image-dialog.component.scss | 2 +- .../shared/components/image/embed-image-dialog.component.ts | 2 +- .../shared/components/image/gallery-image-input.component.html | 2 +- .../shared/components/image/gallery-image-input.component.scss | 2 +- .../shared/components/image/gallery-image-input.component.ts | 2 +- .../app/shared/components/image/image-dialog.component.html | 2 +- .../app/shared/components/image/image-dialog.component.scss | 2 +- .../src/app/shared/components/image/image-dialog.component.ts | 2 +- .../components/image/image-gallery-dialog.component.html | 2 +- .../components/image/image-gallery-dialog.component.scss | 2 +- .../shared/components/image/image-gallery-dialog.component.ts | 2 +- .../app/shared/components/image/image-gallery.component.html | 2 +- .../app/shared/components/image/image-gallery.component.scss | 2 +- .../src/app/shared/components/image/image-gallery.component.ts | 2 +- .../shared/components/image/image-references.component.html | 2 +- .../shared/components/image/image-references.component.scss | 2 +- .../app/shared/components/image/image-references.component.ts | 2 +- ui-ngx/src/app/shared/components/image/images-datasource.ts | 2 +- .../components/image/images-in-use-dialog.component.html | 2 +- .../components/image/images-in-use-dialog.component.scss | 2 +- .../shared/components/image/images-in-use-dialog.component.ts | 2 +- .../image/multiple-gallery-image-input.component.html | 2 +- .../image/multiple-gallery-image-input.component.scss | 2 +- .../components/image/multiple-gallery-image-input.component.ts | 2 +- .../shared/components/image/scada-symbol-input.component.html | 2 +- .../shared/components/image/scada-symbol-input.component.scss | 2 +- .../shared/components/image/scada-symbol-input.component.ts | 2 +- .../shared/components/image/upload-image-dialog.component.html | 2 +- .../shared/components/image/upload-image-dialog.component.ts | 2 +- .../app/shared/components/js-func-module-row.component.html | 2 +- .../app/shared/components/js-func-module-row.component.scss | 2 +- .../src/app/shared/components/js-func-module-row.component.ts | 2 +- .../src/app/shared/components/js-func-modules.component.html | 2 +- .../src/app/shared/components/js-func-modules.component.scss | 2 +- ui-ngx/src/app/shared/components/js-func-modules.component.ts | 2 +- ui-ngx/src/app/shared/components/js-func.component.html | 2 +- ui-ngx/src/app/shared/components/js-func.component.scss | 2 +- ui-ngx/src/app/shared/components/js-func.component.ts | 2 +- ui-ngx/src/app/shared/components/json-content.component.html | 2 +- ui-ngx/src/app/shared/components/json-content.component.scss | 2 +- ui-ngx/src/app/shared/components/json-content.component.ts | 2 +- .../src/app/shared/components/json-object-edit.component.html | 2 +- .../src/app/shared/components/json-object-edit.component.scss | 2 +- ui-ngx/src/app/shared/components/json-object-edit.component.ts | 2 +- .../src/app/shared/components/json-object-view.component.html | 2 +- .../src/app/shared/components/json-object-view.component.scss | 2 +- ui-ngx/src/app/shared/components/json-object-view.component.ts | 2 +- ui-ngx/src/app/shared/components/kv-map.component.html | 2 +- ui-ngx/src/app/shared/components/kv-map.component.scss | 2 +- ui-ngx/src/app/shared/components/kv-map.component.ts | 2 +- ui-ngx/src/app/shared/components/led-light.component.html | 2 +- ui-ngx/src/app/shared/components/led-light.component.ts | 2 +- ui-ngx/src/app/shared/components/logo.component.html | 2 +- ui-ngx/src/app/shared/components/logo.component.scss | 2 +- ui-ngx/src/app/shared/components/logo.component.ts | 2 +- .../src/app/shared/components/markdown-editor.component.html | 2 +- .../src/app/shared/components/markdown-editor.component.scss | 2 +- ui-ngx/src/app/shared/components/markdown-editor.component.ts | 2 +- ui-ngx/src/app/shared/components/markdown.component.html | 2 +- ui-ngx/src/app/shared/components/markdown.component.scss | 2 +- ui-ngx/src/app/shared/components/markdown.component.ts | 2 +- ui-ngx/src/app/shared/components/marked-options.service.ts | 2 +- .../app/shared/components/material-icon-select.component.html | 2 +- .../app/shared/components/material-icon-select.component.scss | 2 +- .../app/shared/components/material-icon-select.component.ts | 2 +- ui-ngx/src/app/shared/components/material-icons.component.html | 2 +- ui-ngx/src/app/shared/components/material-icons.component.scss | 2 +- ui-ngx/src/app/shared/components/material-icons.component.ts | 2 +- .../shared/components/message-type-autocomplete.component.html | 2 +- .../shared/components/message-type-autocomplete.component.ts | 2 +- .../app/shared/components/multiple-image-input.component.html | 2 +- .../app/shared/components/multiple-image-input.component.scss | 2 +- .../app/shared/components/multiple-image-input.component.ts | 2 +- ui-ngx/src/app/shared/components/nav-tree.component.html | 2 +- ui-ngx/src/app/shared/components/nav-tree.component.scss | 2 +- ui-ngx/src/app/shared/components/nav-tree.component.ts | 2 +- .../shared/components/notification/notification.component.html | 2 +- .../shared/components/notification/notification.component.scss | 2 +- .../shared/components/notification/notification.component.ts | 2 +- .../notification/template-autocomplete.component.html | 2 +- .../notification/template-autocomplete.component.scss | 2 +- .../components/notification/template-autocomplete.component.ts | 2 +- .../ota-package/ota-package-autocomplete.component.html | 2 +- .../ota-package/ota-package-autocomplete.component.scss | 2 +- .../ota-package/ota-package-autocomplete.component.ts | 2 +- ui-ngx/src/app/shared/components/page.component.ts | 2 +- ui-ngx/src/app/shared/components/phone-input.component.html | 2 +- ui-ngx/src/app/shared/components/phone-input.component.scss | 2 +- ui-ngx/src/app/shared/components/phone-input.component.ts | 2 +- ui-ngx/src/app/shared/components/popover.component.scss | 2 +- ui-ngx/src/app/shared/components/popover.component.ts | 2 +- ui-ngx/src/app/shared/components/popover.models.ts | 2 +- ui-ngx/src/app/shared/components/popover.service.ts | 2 +- .../src/app/shared/components/protobuf-content.component.html | 2 +- .../src/app/shared/components/protobuf-content.component.scss | 2 +- ui-ngx/src/app/shared/components/protobuf-content.component.ts | 2 +- ui-ngx/src/app/shared/components/public-api.ts | 2 +- .../shared/components/queue/queue-autocomplete.component.html | 2 +- .../shared/components/queue/queue-autocomplete.component.scss | 2 +- .../shared/components/queue/queue-autocomplete.component.ts | 2 +- .../relation/relation-type-autocomplete.component.html | 2 +- .../relation/relation-type-autocomplete.component.ts | 2 +- .../components/resource/resource-autocomplete.component.html | 2 +- .../components/resource/resource-autocomplete.component.ts | 2 +- .../rule-chain/rule-chain-select-panel.component.html | 2 +- .../rule-chain/rule-chain-select-panel.component.scss | 2 +- .../components/rule-chain/rule-chain-select-panel.component.ts | 2 +- .../components/rule-chain/rule-chain-select.component.html | 2 +- .../components/rule-chain/rule-chain-select.component.scss | 2 +- .../components/rule-chain/rule-chain-select.component.ts | 2 +- ui-ngx/src/app/shared/components/script-lang.component.html | 2 +- ui-ngx/src/app/shared/components/script-lang.component.scss | 2 +- ui-ngx/src/app/shared/components/script-lang.component.ts | 2 +- .../components/slack-conversation-autocomplete.component.html | 2 +- .../components/slack-conversation-autocomplete.component.scss | 2 +- .../components/slack-conversation-autocomplete.component.ts | 2 +- ui-ngx/src/app/shared/components/snack-bar-component.html | 2 +- ui-ngx/src/app/shared/components/snack-bar-component.scss | 2 +- .../src/app/shared/components/socialshare-panel.component.html | 2 +- .../src/app/shared/components/socialshare-panel.component.scss | 2 +- .../src/app/shared/components/socialshare-panel.component.ts | 2 +- .../app/shared/components/string-autocomplete.component.html | 2 +- .../app/shared/components/string-autocomplete.component.scss | 2 +- .../src/app/shared/components/string-autocomplete.component.ts | 2 +- .../src/app/shared/components/string-items-list.component.html | 2 +- .../src/app/shared/components/string-items-list.component.ts | 2 +- ui-ngx/src/app/shared/components/svg-xml.component.html | 2 +- ui-ngx/src/app/shared/components/svg-xml.component.scss | 2 +- ui-ngx/src/app/shared/components/svg-xml.component.ts | 2 +- .../app/shared/components/table/table-datasource.abstract.ts | 2 +- ui-ngx/src/app/shared/components/tb-anchor.component.ts | 2 +- ui-ngx/src/app/shared/components/tb-checkbox.component.html | 2 +- ui-ngx/src/app/shared/components/tb-checkbox.component.ts | 2 +- ui-ngx/src/app/shared/components/tb-error.component.ts | 2 +- .../aggregation-options-config-panel.component.html | 2 +- .../aggregation-options-config-panel.component.scss | 2 +- .../aggregation/aggregation-options-config-panel.component.ts | 2 +- .../time/aggregation/aggregation-type-select.component.html | 2 +- .../time/aggregation/aggregation-type-select.component.scss | 2 +- .../time/aggregation/aggregation-type-select.component.ts | 2 +- .../time/aggregation/grouping-interval-options.component.html | 2 +- .../time/aggregation/grouping-interval-options.component.scss | 2 +- .../time/aggregation/grouping-interval-options.component.ts | 2 +- .../app/shared/components/time/datapoints-limit.component.html | 2 +- .../app/shared/components/time/datapoints-limit.component.scss | 2 +- .../app/shared/components/time/datapoints-limit.component.ts | 2 +- .../app/shared/components/time/datetime-period.component.html | 2 +- .../app/shared/components/time/datetime-period.component.scss | 3 +-- .../app/shared/components/time/datetime-period.component.ts | 2 +- ui-ngx/src/app/shared/components/time/datetime.component.html | 2 +- ui-ngx/src/app/shared/components/time/datetime.component.scss | 2 +- ui-ngx/src/app/shared/components/time/datetime.component.ts | 2 +- .../time/history-selector/history-selector.component.html | 2 +- .../time/history-selector/history-selector.component.scss | 2 +- .../time/history-selector/history-selector.component.ts | 2 +- .../time/interval-options-config-panel.component.html | 2 +- .../time/interval-options-config-panel.component.scss | 2 +- .../components/time/interval-options-config-panel.component.ts | 2 +- .../shared/components/time/quick-time-interval.component.html | 2 +- .../shared/components/time/quick-time-interval.component.scss | 2 +- .../shared/components/time/quick-time-interval.component.ts | 2 +- .../src/app/shared/components/time/timeinterval.component.html | 2 +- .../src/app/shared/components/time/timeinterval.component.scss | 2 +- .../src/app/shared/components/time/timeinterval.component.ts | 2 +- .../components/time/timewindow-config-dialog.component.html | 2 +- .../components/time/timewindow-config-dialog.component.scss | 3 +-- .../components/time/timewindow-config-dialog.component.ts | 2 +- ui-ngx/src/app/shared/components/time/timewindow-form.scss | 3 +-- .../app/shared/components/time/timewindow-panel.component.html | 2 +- .../app/shared/components/time/timewindow-panel.component.scss | 3 +-- .../app/shared/components/time/timewindow-panel.component.ts | 2 +- .../src/app/shared/components/time/timewindow.component.html | 2 +- .../src/app/shared/components/time/timewindow.component.scss | 2 +- ui-ngx/src/app/shared/components/time/timewindow.component.ts | 2 +- .../app/shared/components/time/timezone-panel.component.html | 2 +- .../app/shared/components/time/timezone-panel.component.scss | 3 +-- .../src/app/shared/components/time/timezone-panel.component.ts | 2 +- .../app/shared/components/time/timezone-select.component.html | 2 +- .../app/shared/components/time/timezone-select.component.ts | 2 +- ui-ngx/src/app/shared/components/time/timezone.component.html | 2 +- ui-ngx/src/app/shared/components/time/timezone.component.scss | 2 +- ui-ngx/src/app/shared/components/time/timezone.component.ts | 2 +- ui-ngx/src/app/shared/components/toast.directive.ts | 2 +- ui-ngx/src/app/shared/components/toggle-header.component.html | 2 +- ui-ngx/src/app/shared/components/toggle-header.component.scss | 2 +- ui-ngx/src/app/shared/components/toggle-header.component.ts | 2 +- ui-ngx/src/app/shared/components/toggle-select.component.html | 2 +- ui-ngx/src/app/shared/components/toggle-select.component.scss | 2 +- ui-ngx/src/app/shared/components/toggle-select.component.ts | 2 +- ui-ngx/src/app/shared/components/tokens.ts | 2 +- ui-ngx/src/app/shared/components/unit-input.component.html | 2 +- ui-ngx/src/app/shared/components/unit-input.component.scss | 2 +- ui-ngx/src/app/shared/components/unit-input.component.ts | 2 +- ui-ngx/src/app/shared/components/user-menu.component.html | 2 +- ui-ngx/src/app/shared/components/user-menu.component.scss | 2 +- ui-ngx/src/app/shared/components/user-menu.component.ts | 2 +- ui-ngx/src/app/shared/components/value-input.component.html | 2 +- ui-ngx/src/app/shared/components/value-input.component.scss | 3 +-- ui-ngx/src/app/shared/components/value-input.component.ts | 2 +- .../shared/components/vc/branch-autocomplete.component.html | 2 +- .../shared/components/vc/branch-autocomplete.component.scss | 2 +- .../app/shared/components/vc/branch-autocomplete.component.ts | 2 +- .../app/shared/components/widgets-bundle-search.component.html | 2 +- .../app/shared/components/widgets-bundle-search.component.scss | 2 +- .../app/shared/components/widgets-bundle-search.component.ts | 2 +- .../app/shared/components/widgets-bundle-select.component.html | 2 +- .../app/shared/components/widgets-bundle-select.component.scss | 2 +- .../app/shared/components/widgets-bundle-select.component.ts | 2 +- ui-ngx/src/app/shared/decorators/coercion.ts | 2 +- ui-ngx/src/app/shared/decorators/enumerable.ts | 2 +- ui-ngx/src/app/shared/decorators/public-api.ts | 2 +- ui-ngx/src/app/shared/directives/context-menu.directive.ts | 2 +- .../src/app/shared/directives/ellipsis-chip-list.directive.ts | 2 +- ui-ngx/src/app/shared/directives/public-api.ts | 2 +- .../app/shared/directives/truncate-with-tooltip.directive.ts | 2 +- .../shared/import-export/export-resource-dialog.component.html | 2 +- .../shared/import-export/export-resource-dialog.component.ts | 2 +- .../app/shared/import-export/import-dialog-csv.component.html | 2 +- .../app/shared/import-export/import-dialog-csv.component.scss | 2 +- .../app/shared/import-export/import-dialog-csv.component.ts | 2 +- .../src/app/shared/import-export/import-dialog.component.html | 2 +- ui-ngx/src/app/shared/import-export/import-dialog.component.ts | 2 +- ui-ngx/src/app/shared/import-export/import-export.models.ts | 2 +- ui-ngx/src/app/shared/import-export/import-export.service.ts | 2 +- .../import-export/table-columns-assignment.component.html | 2 +- .../import-export/table-columns-assignment.component.scss | 2 +- .../shared/import-export/table-columns-assignment.component.ts | 2 +- ui-ngx/src/app/shared/legacy/flex-layout.models.ts | 2 +- ui-ngx/src/app/shared/legacy/json-form-utils.ts | 2 +- ui-ngx/src/app/shared/legacy/json-form.models.ts | 2 +- ui-ngx/src/app/shared/models/ace/ace.models.ts | 2 +- ui-ngx/src/app/shared/models/ace/completion.models.ts | 2 +- ui-ngx/src/app/shared/models/ace/service-completion.models.ts | 2 +- ui-ngx/src/app/shared/models/ace/tbel/mode-tbel.js | 2 +- ui-ngx/src/app/shared/models/ace/tbel/worker-tbel.js | 2 +- ui-ngx/src/app/shared/models/ace/widget-completion.models.ts | 2 +- ui-ngx/src/app/shared/models/action-widget-settings.models.ts | 2 +- ui-ngx/src/app/shared/models/alarm.models.ts | 2 +- ui-ngx/src/app/shared/models/alias.models.ts | 2 +- ui-ngx/src/app/shared/models/api-usage.models.ts | 2 +- ui-ngx/src/app/shared/models/asset.models.ts | 2 +- ui-ngx/src/app/shared/models/audit-log.models.ts | 2 +- ui-ngx/src/app/shared/models/authority.enum.ts | 2 +- ui-ngx/src/app/shared/models/base-data.ts | 2 +- ui-ngx/src/app/shared/models/beautify.models.ts | 2 +- ui-ngx/src/app/shared/models/color.models.ts | 2 +- ui-ngx/src/app/shared/models/common.ts | 2 +- ui-ngx/src/app/shared/models/component-descriptor.models.ts | 2 +- ui-ngx/src/app/shared/models/constants.ts | 2 +- ui-ngx/src/app/shared/models/contact-based.model.ts | 2 +- ui-ngx/src/app/shared/models/country.models.ts | 2 +- ui-ngx/src/app/shared/models/customer.model.ts | 2 +- ui-ngx/src/app/shared/models/dashboard.models.ts | 2 +- ui-ngx/src/app/shared/models/device.models.ts | 2 +- ui-ngx/src/app/shared/models/dynamic-form.models.ts | 2 +- ui-ngx/src/app/shared/models/edge.models.ts | 2 +- ui-ngx/src/app/shared/models/entity-type.models.ts | 2 +- ui-ngx/src/app/shared/models/entity-view.models.ts | 2 +- ui-ngx/src/app/shared/models/entity.models.ts | 2 +- ui-ngx/src/app/shared/models/error.models.ts | 2 +- ui-ngx/src/app/shared/models/event.models.ts | 2 +- ui-ngx/src/app/shared/models/icon.models.ts | 2 +- ui-ngx/src/app/shared/models/id/alarm-comment-id.ts | 2 +- ui-ngx/src/app/shared/models/id/alarm-id.ts | 2 +- ui-ngx/src/app/shared/models/id/asset-id.ts | 2 +- ui-ngx/src/app/shared/models/id/asset-profile-id.ts | 2 +- ui-ngx/src/app/shared/models/id/audit-log-id.ts | 2 +- ui-ngx/src/app/shared/models/id/customer-id.ts | 2 +- ui-ngx/src/app/shared/models/id/dashboard-id.ts | 2 +- ui-ngx/src/app/shared/models/id/device-credentials-id.ts | 2 +- ui-ngx/src/app/shared/models/id/device-id.ts | 2 +- ui-ngx/src/app/shared/models/id/device-profile-id.ts | 2 +- ui-ngx/src/app/shared/models/id/domain-id.ts | 2 +- ui-ngx/src/app/shared/models/id/edge-id.ts | 2 +- ui-ngx/src/app/shared/models/id/entity-id.ts | 2 +- ui-ngx/src/app/shared/models/id/entity-view-id.ts | 2 +- ui-ngx/src/app/shared/models/id/event-id.ts | 2 +- ui-ngx/src/app/shared/models/id/has-uuid.ts | 2 +- ui-ngx/src/app/shared/models/id/mobile-app-bundle-id.ts | 2 +- ui-ngx/src/app/shared/models/id/mobile-app-id.ts | 2 +- ui-ngx/src/app/shared/models/id/notification-id.ts | 2 +- ui-ngx/src/app/shared/models/id/notification-request-id.ts | 2 +- ui-ngx/src/app/shared/models/id/notification-rule-id.ts | 2 +- ui-ngx/src/app/shared/models/id/notification-target-id.ts | 2 +- ui-ngx/src/app/shared/models/id/notification-template-id.ts | 2 +- ui-ngx/src/app/shared/models/id/oauth2-client-id.ts | 2 +- ui-ngx/src/app/shared/models/id/ota-package-id.ts | 2 +- ui-ngx/src/app/shared/models/id/public-api.ts | 2 +- ui-ngx/src/app/shared/models/id/queue-id.ts | 2 +- ui-ngx/src/app/shared/models/id/rpc-id.ts | 2 +- ui-ngx/src/app/shared/models/id/rule-chain-id.ts | 2 +- ui-ngx/src/app/shared/models/id/rule-node-id.ts | 2 +- ui-ngx/src/app/shared/models/id/tb-resource-id.ts | 2 +- ui-ngx/src/app/shared/models/id/tenant-id.ts | 2 +- ui-ngx/src/app/shared/models/id/tenant-profile-id.ts | 2 +- ui-ngx/src/app/shared/models/id/user-id.ts | 2 +- ui-ngx/src/app/shared/models/id/widget-type-id.ts | 2 +- ui-ngx/src/app/shared/models/id/widgets-bundle-id.ts | 2 +- ui-ngx/src/app/shared/models/jquery-event.models.ts | 2 +- ui-ngx/src/app/shared/models/js-function.models.ts | 2 +- ui-ngx/src/app/shared/models/limited-api.models.ts | 2 +- ui-ngx/src/app/shared/models/login.models.ts | 2 +- ui-ngx/src/app/shared/models/lwm2m-security-config.models.ts | 2 +- ui-ngx/src/app/shared/models/material.models.ts | 2 +- ui-ngx/src/app/shared/models/mobile-app.models.ts | 2 +- ui-ngx/src/app/shared/models/notification.models.ts | 2 +- ui-ngx/src/app/shared/models/oauth2.models.ts | 2 +- ui-ngx/src/app/shared/models/ota-package.models.ts | 2 +- ui-ngx/src/app/shared/models/overlay.models.ts | 2 +- ui-ngx/src/app/shared/models/page/page-data.ts | 2 +- ui-ngx/src/app/shared/models/page/page-link.ts | 2 +- ui-ngx/src/app/shared/models/page/public-api.ts | 2 +- ui-ngx/src/app/shared/models/page/sort-order.ts | 2 +- ui-ngx/src/app/shared/models/public-api.ts | 2 +- ui-ngx/src/app/shared/models/query/query.models.ts | 2 +- ui-ngx/src/app/shared/models/queue.models.ts | 2 +- ui-ngx/src/app/shared/models/relation.models.ts | 2 +- ui-ngx/src/app/shared/models/resource.models.ts | 2 +- ui-ngx/src/app/shared/models/rpc.models.ts | 2 +- ui-ngx/src/app/shared/models/rule-chain.models.ts | 2 +- ui-ngx/src/app/shared/models/rule-node.models.ts | 2 +- ui-ngx/src/app/shared/models/settings.models.ts | 2 +- ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts | 2 +- ui-ngx/src/app/shared/models/tenant.model.ts | 2 +- ui-ngx/src/app/shared/models/time/time.models.ts | 2 +- ui-ngx/src/app/shared/models/two-factor-auth.models.ts | 2 +- ui-ngx/src/app/shared/models/unit.models.ts | 2 +- ui-ngx/src/app/shared/models/usage.models.ts | 2 +- ui-ngx/src/app/shared/models/user-settings.models.ts | 2 +- ui-ngx/src/app/shared/models/user.model.ts | 2 +- ui-ngx/src/app/shared/models/vc.models.ts | 2 +- ui-ngx/src/app/shared/models/websocket/websocket.models.ts | 2 +- ui-ngx/src/app/shared/models/widget-settings.models.ts | 2 +- ui-ngx/src/app/shared/models/widget.models.ts | 2 +- ui-ngx/src/app/shared/models/widgets-bundle.model.ts | 2 +- ui-ngx/src/app/shared/models/window-message.model.ts | 2 +- ui-ngx/src/app/shared/pipe/custom-translate.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/date-ago.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/duration-left.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/enum-to-array.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/file-size.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/highlight.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/image.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/key-value-not-empty.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/keyboard-shortcut.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/milliseconds-to-time-string.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/nospace.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/public-api.ts | 2 +- ui-ngx/src/app/shared/pipe/safe.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/selectable-columns.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/short-number.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/tbJson.pipe.ts | 2 +- ui-ngx/src/app/shared/pipe/truncate.pipe.ts | 2 +- ui-ngx/src/app/shared/public-api.ts | 2 +- ui-ngx/src/app/shared/services/custom-paginator-intl.ts | 2 +- ui-ngx/src/app/shared/shared.module.ts | 2 +- ui-ngx/src/assets/fonts/material-icons.css | 2 +- ui-ngx/src/environments/environment.prod.ts | 2 +- ui-ngx/src/environments/environment.ts | 2 +- ui-ngx/src/form.scss | 2 +- ui-ngx/src/index.html | 2 +- ui-ngx/src/main.ts | 2 +- ui-ngx/src/polyfills.ts | 2 +- ui-ngx/src/scss/animations.scss | 2 +- ui-ngx/src/scss/constants.scss | 2 +- ui-ngx/src/scss/fonts.scss | 2 +- ui-ngx/src/scss/mixins.scss | 2 +- ui-ngx/src/styles.scss | 2 +- ui-ngx/src/theme-overwrites.scss | 2 +- ui-ngx/src/theme.scss | 2 +- ui-ngx/src/theme/datepicker-theme.scss | 2 +- ui-ngx/src/typings/jquery.flot.typings.d.ts | 2 +- ui-ngx/src/typings/jquery.jstree.typings.d.ts | 2 +- ui-ngx/src/typings/jquery.typings.d.ts | 2 +- ui-ngx/src/typings/leaflet-extend-tb.d.ts | 2 +- ui-ngx/src/typings/leaflet-geoman-extend.d.ts | 2 +- ui-ngx/src/typings/rawloader.typings.d.ts | 2 +- ui-ngx/src/typings/split.js.typings.d.ts | 2 +- ui-ngx/src/typings/utils.d.ts | 2 +- ui-ngx/src/zone-flags.ts | 2 +- ui-ngx/tailwind.config.js | 2 +- 6781 files changed, 6781 insertions(+), 6812 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 5e0ddc4300..53b2e3ae65 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,5 +1,5 @@ # -# Copyright © 2016-2024 The Thingsboard Authors +# Copyright © 2016-2025 The Thingsboard Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/check-configuration-files.yml b/.github/workflows/check-configuration-files.yml index 94bfc85ce3..f280e326c2 100644 --- a/.github/workflows/check-configuration-files.yml +++ b/.github/workflows/check-configuration-files.yml @@ -1,5 +1,5 @@ # -# Copyright © 2016-2024 The Thingsboard Authors +# Copyright © 2016-2025 The Thingsboard Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/license-header-format.yml b/.github/workflows/license-header-format.yml index 20b5e7f063..20a1c1350a 100644 --- a/.github/workflows/license-header-format.yml +++ b/.github/workflows/license-header-format.yml @@ -1,5 +1,5 @@ # -# Copyright © 2016-2024 The Thingsboard Authors +# Copyright © 2016-2025 The Thingsboard Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/application/pom.xml b/application/pom.xml index d97f6d92e3..a9356cc14a 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -1,6 +1,6 @@ - {{ subEntity.name | customTranslate }} diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.scss b/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.scss index 72098fff51..a689dd371e 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.scss +++ b/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.scss @@ -1,5 +1,5 @@ /** - * Copyright © 2016-2024 The Thingsboard Authors + * Copyright © 2016-2025 The Thingsboard Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - :host { display: flex; flex-wrap: wrap; diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts index ebece2186b..f45c2d01b5 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entity-chips.component.ts @@ -1,5 +1,5 @@ /// -/// Copyright © 2016-2024 The Thingsboard Authors +/// Copyright © 2016-2025 The Thingsboard Authors /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.html b/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.html index 49a868a7e7..1f9de30cb8 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.html @@ -1,6 +1,6 @@ -
        diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/value-source.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/value-source.component.ts index 28bcb1dd4b..9b688ac455 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/value-source.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/value-source.component.ts @@ -1,5 +1,5 @@ /// -/// Copyright © 2016-2024 The Thingsboard Authors +/// Copyright © 2016-2025 The Thingsboard Authors /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-font.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-font.component.html index f192352d83..fa38ac6d4d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-font.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-font.component.html @@ -1,6 +1,6 @@ -
        Date: Tue, 25 Feb 2025 12:02:25 +0200 Subject: [PATCH 097/100] Updated license --- .../org/thingsboard/server/service/apiusage/ApiUsageTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java b/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java index 84a6fb9931..961185d3cd 100644 --- a/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java +++ b/application/src/test/java/org/thingsboard/server/service/apiusage/ApiUsageTest.java @@ -1,5 +1,5 @@ /** - * Copyright © 2016-2024 The Thingsboard Authors + * Copyright © 2016-2025 The Thingsboard Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 347e18ec4bf72c84b279f50a2a232710be3820be Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Tue, 25 Feb 2025 15:14:16 +0100 Subject: [PATCH 098/100] used correct queueName for TPI in input node --- .../actors/ruleChain/DefaultTbContext.java | 5 +- .../actors/rule/DefaultTbContextTest.java | 58 +++++++++++++++++-- 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java index 8bd3bcc81d..66afd2671c 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java @@ -124,6 +124,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; import java.util.function.Consumer; +import static org.thingsboard.server.common.data.DataConstants.MAIN_QUEUE_NAME; import static org.thingsboard.server.common.data.msg.TbMsgType.ATTRIBUTES_DELETED; import static org.thingsboard.server.common.data.msg.TbMsgType.ATTRIBUTES_UPDATED; import static org.thingsboard.server.common.data.msg.TbMsgType.ENTITY_CREATED; @@ -178,7 +179,7 @@ public class DefaultTbContext implements TbContext { .resetRuleNodeId() .build(); tbMsg.pushToStack(nodeCtx.getSelf().getRuleChainId(), nodeCtx.getSelf().getId()); - TopicPartitionInfo tpi = mainCtx.resolve(ServiceType.TB_RULE_ENGINE, getQueueName(), getTenantId(), tbMsg.getOriginator()); + TopicPartitionInfo tpi = resolvePartition(msg); doEnqueue(tpi, tbMsg, new SimpleTbQueueCallback(md -> ack(msg), t -> tellFailure(msg, t))); } @@ -195,7 +196,7 @@ public class DefaultTbContext implements TbContext { @Override public void enqueue(TbMsg tbMsg, Runnable onSuccess, Consumer onFailure) { - TopicPartitionInfo tpi = mainCtx.resolve(ServiceType.TB_RULE_ENGINE, getQueueName(), getTenantId(), tbMsg.getOriginator()); + TopicPartitionInfo tpi = resolvePartition(tbMsg, MAIN_QUEUE_NAME); enqueue(tpi, tbMsg, onFailure, onSuccess); } diff --git a/application/src/test/java/org/thingsboard/server/actors/rule/DefaultTbContextTest.java b/application/src/test/java/org/thingsboard/server/actors/rule/DefaultTbContextTest.java index af2f9ce8ec..ea900afd4e 100644 --- a/application/src/test/java/org/thingsboard/server/actors/rule/DefaultTbContextTest.java +++ b/application/src/test/java/org/thingsboard/server/actors/rule/DefaultTbContextTest.java @@ -98,6 +98,56 @@ class DefaultTbContextTest { defaultTbContext = new DefaultTbContext(mainCtxMock, "Test rule chain name", nodeCtxMock); } + @MethodSource + @ParameterizedTest + public void givenMsgWithQueueName_whenInput_thenVerifyEnqueueWithCorrectTpi(String queueName) { + // GIVEN + var tpi = resolve(queueName); + + given(mainCtxMock.resolve(eq(ServiceType.TB_RULE_ENGINE), eq(queueName), eq(TENANT_ID), eq(TENANT_ID))).willReturn(tpi); + var clusterService = mock(TbClusterService.class); + given(mainCtxMock.getClusterService()).willReturn(clusterService); + var callbackMock = mock(TbMsgCallback.class); + given(callbackMock.isMsgValid()).willReturn(true); + var ruleNode = new RuleNode(RULE_NODE_ID); + + var msg = TbMsg.newMsg() + .type(TbMsgType.POST_TELEMETRY_REQUEST) + .originator(TENANT_ID) + .queueName(queueName) + .copyMetaData(TbMsgMetaData.EMPTY) + .data(TbMsg.EMPTY_STRING) + .callback(callbackMock) + .build(); + + var ruleChainId = new RuleChainId(UUID.randomUUID()); + + ruleNode.setRuleChainId(RULE_CHAIN_ID); + ruleNode.setDebugSettings(DebugSettings.failures()); + given(nodeCtxMock.getTenantId()).willReturn(TENANT_ID); + given(nodeCtxMock.getSelf()).willReturn(ruleNode); + + // WHEN + defaultTbContext.input(msg, ruleChainId); + + // THEN + + then(clusterService).should().pushMsgToRuleEngine(eq(tpi), eq(msg.getId()), any(), any()); + } + + private static Stream givenMsgWithQueueName_whenInput_thenVerifyEnqueueWithCorrectTpi() { + return Stream.of("Main", "Test", null); + } + + private TopicPartitionInfo resolve(String queueName) { + var tpiBuilder = TopicPartitionInfo.builder() + .topic(queueName == null ? "MainQueueTopic" : queueName + "QueueTopic") + .partition(1) + .myPartition(true); + + return tpiBuilder.build(); + } + @Test public void givenDebugFailuresEvents_whenTellSuccess_thenVerifyDebugOutputNotPersisted() { // GIVEN @@ -810,10 +860,10 @@ class DefaultTbContextTest { @MethodSource @ParameterizedTest void givenDebugFailuresAndDebugAllAndConnectionAndPersistedResultOptions_whenTellNext_thenVerifyDebugOutputPersistence(boolean debugFailures, - long debugAllUntil, - String connection, - boolean shouldPersist, - boolean shouldPersistAfterDurationTime) { + long debugAllUntil, + String connection, + boolean shouldPersist, + boolean shouldPersistAfterDurationTime) { // GIVEN var callbackMock = mock(TbMsgCallback.class); var msg = getTbMsgWithCallback(callbackMock); From 002ecc63424e8485271711df6c908cf425f2ae69 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 26 Feb 2025 11:16:05 +0200 Subject: [PATCH 099/100] used correct queueName for TPI in input node --- .../server/actors/ruleChain/DefaultTbContext.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java index 0070eba4a1..091b97ac9d 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java @@ -124,6 +124,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; import java.util.function.Consumer; +import static org.thingsboard.server.common.data.DataConstants.MAIN_QUEUE_NAME; import static org.thingsboard.server.common.data.msg.TbMsgType.ATTRIBUTES_DELETED; import static org.thingsboard.server.common.data.msg.TbMsgType.ATTRIBUTES_UPDATED; import static org.thingsboard.server.common.data.msg.TbMsgType.ENTITY_CREATED; @@ -175,7 +176,7 @@ public class DefaultTbContext implements TbContext { } TbMsg tbMsg = msg.copyWithRuleChainId(ruleChainId); tbMsg.pushToStack(nodeCtx.getSelf().getRuleChainId(), nodeCtx.getSelf().getId()); - TopicPartitionInfo tpi = mainCtx.resolve(ServiceType.TB_RULE_ENGINE, getQueueName(), getTenantId(), tbMsg.getOriginator()); + TopicPartitionInfo tpi = resolvePartition(msg); doEnqueue(tpi, tbMsg, new SimpleTbQueueCallback(md -> ack(msg), t -> tellFailure(msg, t))); } @@ -192,7 +193,7 @@ public class DefaultTbContext implements TbContext { @Override public void enqueue(TbMsg tbMsg, Runnable onSuccess, Consumer onFailure) { - TopicPartitionInfo tpi = mainCtx.resolve(ServiceType.TB_RULE_ENGINE, getQueueName(), getTenantId(), tbMsg.getOriginator()); + TopicPartitionInfo tpi = resolvePartition(tbMsg, MAIN_QUEUE_NAME); enqueue(tpi, tbMsg, onFailure, onSuccess); } From 01e99efc4ed6e59c21c551ab0e5da11083d27fea Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 26 Feb 2025 12:28:01 +0200 Subject: [PATCH 100/100] Minor refactoring for TbContext --- .../server/actors/ruleChain/DefaultTbContext.java | 5 ++--- .../thingsboard/rule/engine/api/TbContext.java | 15 ++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java index 091b97ac9d..24edd8f8bf 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import io.netty.channel.EventLoopGroup; import lombok.extern.slf4j.Slf4j; import org.bouncycastle.util.Arrays; +import org.thingsboard.common.util.DebugModeUtil; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.common.util.ListeningExecutor; import org.thingsboard.rule.engine.api.MailService; @@ -64,7 +65,6 @@ import org.thingsboard.server.common.data.msg.TbNodeConnectionType; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.rule.RuleNode; -import org.thingsboard.common.util.DebugModeUtil; import org.thingsboard.server.common.data.rule.RuleNodeState; import org.thingsboard.server.common.data.script.ScriptLanguage; import org.thingsboard.server.common.msg.TbActorMsg; @@ -193,8 +193,7 @@ public class DefaultTbContext implements TbContext { @Override public void enqueue(TbMsg tbMsg, Runnable onSuccess, Consumer onFailure) { - TopicPartitionInfo tpi = resolvePartition(tbMsg, MAIN_QUEUE_NAME); - enqueue(tpi, tbMsg, onFailure, onSuccess); + enqueue(tbMsg, MAIN_QUEUE_NAME, onSuccess, onFailure); } @Override diff --git a/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/TbContext.java b/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/TbContext.java index b517bb0051..b3fc646b94 100644 --- a/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/TbContext.java +++ b/rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/TbContext.java @@ -144,11 +144,19 @@ public interface TbContext { /** * Puts new message to queue for processing by the Root Rule Chain + * WARNING: message is put to the Main queue. To specify other queue name - use {@link #enqueue(TbMsg, String, Runnable, Consumer)} * * @param msg - message */ void enqueue(TbMsg msg, Runnable onSuccess, Consumer onFailure); + /** + * Puts new message to custom queue for processing + * + * @param msg - message + */ + void enqueue(TbMsg msg, String queueName, Runnable onSuccess, Consumer onFailure); + /** * Sends message to the nested rule chain. * Fails processing of the message if the nested rule chain is not found. @@ -167,13 +175,6 @@ public interface TbContext { */ void output(TbMsg msg, String relationType); - /** - * Puts new message to custom queue for processing - * - * @param msg - message - */ - void enqueue(TbMsg msg, String queueName, Runnable onSuccess, Consumer onFailure); - void enqueueForTellFailure(TbMsg msg, String failureMessage); void enqueueForTellFailure(TbMsg tbMsg, Throwable t);