Browse Source

Merge master in develop/3.3

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

2
application/pom.xml

@ -1,6 +1,6 @@
<!--
Copyright © 2016-2020 The Thingsboard Authors
Copyright © 2016-2021 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.

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright © 2016-2020 The Thingsboard Authors
Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
#
# Copyright © 2016-2020 The Thingsboard Authors
# Copyright © 2016-2021 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.

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

File diff suppressed because one or more lines are too long

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
--
-- Copyright © 2016-2020 The Thingsboard Authors
-- Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.
@ -244,8 +244,18 @@ class DefaultTbContext implements TbContext {
if (nodeCtx.getSelf().isDebugMode()) {
mainCtx.persistDebugOutput(nodeCtx.getTenantId(), nodeCtx.getSelf().getId(), msg, TbRelationTypes.FAILURE, th);
}
String failureMessage;
if (th != null) {
if (!StringUtils.isEmpty(th.getMessage())) {
failureMessage = th.getMessage();
} else {
failureMessage = th.getClass().getSimpleName();
}
} else {
failureMessage = null;
}
nodeCtx.getChainActor().tell(new RuleNodeToRuleChainTellNextMsg(nodeCtx.getSelf().getId(), Collections.singleton(TbRelationTypes.FAILURE),
msg, th != null ? th.getMessage() : null));
msg, failureMessage));
}
public void updateSelf(RuleNode self) {

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.
@ -56,6 +56,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
@ -288,10 +289,10 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
private void putToQueue(TopicPartitionInfo tpi, TbMsg msg, TbQueueCallback callbackWrapper, EntityId target) {
switch (target.getEntityType()) {
case RULE_NODE:
putToQueue(tpi, msg.copyWithRuleNodeId(entityId, new RuleNodeId(target.getId())), callbackWrapper);
putToQueue(tpi, msg.copyWithRuleNodeId(entityId, new RuleNodeId(target.getId()), UUID.randomUUID()), callbackWrapper);
break;
case RULE_CHAIN:
putToQueue(tpi, msg.copyWithRuleChainId(new RuleChainId(target.getId())), callbackWrapper);
putToQueue(tpi, msg.copyWithRuleChainId(new RuleChainId(target.getId()), UUID.randomUUID()), callbackWrapper);
break;
}
}

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.
@ -53,6 +53,8 @@ import org.thingsboard.server.common.data.id.WidgetTypeId;
import org.thingsboard.server.common.data.id.WidgetsBundleId;
import org.thingsboard.server.common.data.kv.AttributeKvEntry;
import org.thingsboard.server.common.data.kv.DataType;
import org.thingsboard.server.common.data.kv.KvEntry;
import org.thingsboard.server.common.data.kv.TsKvEntry;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.page.SortOrder;
import org.thingsboard.server.common.data.page.TimePageLink;
@ -107,9 +109,11 @@ import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService;
import javax.mail.MessagingException;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import static org.thingsboard.server.dao.service.Validator.validateId;
@ -713,6 +717,12 @@ public abstract class BaseController {
case PROVISION_FAILURE:
msgType = DataConstants.PROVISION_FAILURE;
break;
case TIMESERIES_UPDATED:
msgType = DataConstants.TIMESERIES_UPDATED;
break;
case TIMESERIES_DELETED:
msgType = DataConstants.TIMESERIES_DELETED;
break;
}
if (!StringUtils.isEmpty(msgType)) {
try {
@ -757,17 +767,7 @@ public abstract class BaseController {
metaData.putValue("scope", scope);
if (attributes != null) {
for (AttributeKvEntry attr : attributes) {
if (attr.getDataType() == DataType.BOOLEAN) {
entityNode.put(attr.getKey(), attr.getBooleanValue().get());
} else if (attr.getDataType() == DataType.DOUBLE) {
entityNode.put(attr.getKey(), attr.getDoubleValue().get());
} else if (attr.getDataType() == DataType.LONG) {
entityNode.put(attr.getKey(), attr.getLongValue().get());
} else if (attr.getDataType() == DataType.JSON) {
entityNode.set(attr.getKey(), json.readTree(attr.getJsonValue().get()));
} else {
entityNode.put(attr.getKey(), attr.getValueAsString());
}
addKvEntry(entityNode, attr);
}
}
} else if (actionType == ActionType.ATTRIBUTES_DELETED) {
@ -778,6 +778,17 @@ public abstract class BaseController {
if (keys != null) {
keys.forEach(attrsArrayNode::add);
}
} else if (actionType == ActionType.TIMESERIES_UPDATED) {
List<TsKvEntry> timeseries = extractParameter(List.class, 0, additionalInfo);
addTimeseries(entityNode, timeseries);
} else if (actionType == ActionType.TIMESERIES_DELETED) {
List<String> keys = extractParameter(List.class, 0, additionalInfo);
if (keys != null) {
ArrayNode timeseriesArrayNode = entityNode.putArray("timeseries");
keys.forEach(timeseriesArrayNode::add);
}
entityNode.put("startTs", extractParameter(Long.class, 1, additionalInfo));
entityNode.put("endTs", extractParameter(Long.class, 2, additionalInfo));
}
}
TbMsg tbMsg = TbMsg.newMsg(msgType, entityId, metaData, TbMsgDataType.JSON, json.writeValueAsString(entityNode));
@ -794,6 +805,22 @@ public abstract class BaseController {
}
}
private void addKvEntry(ObjectNode entityNode, KvEntry kvEntry) throws Exception {
if (kvEntry.getDataType() == DataType.BOOLEAN) {
kvEntry.getBooleanValue().ifPresent(value -> entityNode.put(kvEntry.getKey(), value));
} else if (kvEntry.getDataType() == DataType.DOUBLE) {
kvEntry.getDoubleValue().ifPresent(value -> entityNode.put(kvEntry.getKey(), value));
} else if (kvEntry.getDataType() == DataType.LONG) {
kvEntry.getLongValue().ifPresent(value -> entityNode.put(kvEntry.getKey(), value));
} else if (kvEntry.getDataType() == DataType.JSON) {
if (kvEntry.getJsonValue().isPresent()) {
entityNode.set(kvEntry.getKey(), json.readTree(kvEntry.getJsonValue().get()));
}
} else {
entityNode.put(kvEntry.getKey(), kvEntry.getValueAsString());
}
}
private <T> T extractParameter(Class<T> clazz, int index, Object... additionalInfo) {
T result = null;
if (additionalInfo != null && additionalInfo.length > index) {
@ -814,4 +841,20 @@ public abstract class BaseController {
return null;
}
private void addTimeseries(ObjectNode entityNode, List<TsKvEntry> timeseries) throws Exception {
if (timeseries != null && !timeseries.isEmpty()) {
ArrayNode result = entityNode.putArray("timeseries");
Map<Long, List<TsKvEntry>> groupedTelemetry = timeseries.stream()
.collect(Collectors.groupingBy(TsKvEntry::getTs));
for (Map.Entry<Long, List<TsKvEntry>> entry : groupedTelemetry.entrySet()) {
ObjectNode element = json.createObjectNode();
element.put("ts", entry.getKey());
ObjectNode values = element.putObject("values");
for (TsKvEntry tsKvEntry : entry.getValue()) {
addKvEntry(values, tsKvEntry);
}
result.add(element);
}
}
}
}

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.
@ -212,7 +212,7 @@ public class DashboardController extends BaseController {
@RequestMapping(value = "/dashboard/{dashboardId}/customers", method = RequestMethod.POST)
@ResponseBody
public Dashboard updateDashboardCustomers(@PathVariable(DASHBOARD_ID) String strDashboardId,
@RequestBody String[] strCustomerIds) throws ThingsboardException {
@RequestBody(required = false) String[] strCustomerIds) throws ThingsboardException {
checkParameter(DASHBOARD_ID, strDashboardId);
try {
DashboardId dashboardId = new DashboardId(toUUID(strDashboardId));

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

71
application/src/main/java/org/thingsboard/server/controller/DeviceProfileController.java

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.
@ -16,6 +16,8 @@
package org.thingsboard.server.controller;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
@ -35,21 +37,30 @@ import org.thingsboard.server.common.data.id.DeviceProfileId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent;
import org.thingsboard.server.dao.timeseries.TimeseriesService;
import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.security.permission.Operation;
import org.thingsboard.server.service.security.permission.Resource;
import java.util.List;
import java.util.UUID;
@RestController
@TbCoreComponent
@RequestMapping("/api")
@Slf4j
public class DeviceProfileController extends BaseController {
private static final String DEVICE_PROFILE_ID = "deviceProfileId";
@Autowired
private TimeseriesService timeseriesService;
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/deviceProfile/{deviceProfileId}", method = RequestMethod.GET)
@ResponseBody
public DeviceProfile getDeviceProfileById(@PathVariable("deviceProfileId") String strDeviceProfileId) throws ThingsboardException {
checkParameter("deviceProfileId", strDeviceProfileId);
public DeviceProfile getDeviceProfileById(@PathVariable(DEVICE_PROFILE_ID) String strDeviceProfileId) throws ThingsboardException {
checkParameter(DEVICE_PROFILE_ID, strDeviceProfileId);
try {
DeviceProfileId deviceProfileId = new DeviceProfileId(toUUID(strDeviceProfileId));
return checkDeviceProfileId(deviceProfileId, Operation.READ);
@ -61,8 +72,8 @@ public class DeviceProfileController extends BaseController {
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/deviceProfileInfo/{deviceProfileId}", method = RequestMethod.GET)
@ResponseBody
public DeviceProfileInfo getDeviceProfileInfoById(@PathVariable("deviceProfileId") String strDeviceProfileId) throws ThingsboardException {
checkParameter("deviceProfileId", strDeviceProfileId);
public DeviceProfileInfo getDeviceProfileInfoById(@PathVariable(DEVICE_PROFILE_ID) String strDeviceProfileId) throws ThingsboardException {
checkParameter(DEVICE_PROFILE_ID, strDeviceProfileId);
try {
DeviceProfileId deviceProfileId = new DeviceProfileId(toUUID(strDeviceProfileId));
return checkNotNull(deviceProfileService.findDeviceProfileInfoById(getTenantId(), deviceProfileId));
@ -82,6 +93,46 @@ public class DeviceProfileController extends BaseController {
}
}
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/deviceProfile/devices/keys/timeseries", method = RequestMethod.GET)
@ResponseBody
public List<String> getTimeseriesKeys(
@RequestParam(name = DEVICE_PROFILE_ID, required = false) String deviceProfileIdStr) throws ThingsboardException {
DeviceProfileId deviceProfileId;
if (StringUtils.isNotEmpty(deviceProfileIdStr)) {
deviceProfileId = new DeviceProfileId(UUID.fromString(deviceProfileIdStr));
checkDeviceProfileId(deviceProfileId, Operation.READ);
} else {
deviceProfileId = null;
}
try {
return timeseriesService.findAllKeysByDeviceProfileId(getTenantId(), deviceProfileId);
} catch (Exception e) {
throw handleException(e);
}
}
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/deviceProfile/devices/keys/attributes", method = RequestMethod.GET)
@ResponseBody
public List<String> getAttributesKeys(
@RequestParam(name = DEVICE_PROFILE_ID, required = false) String deviceProfileIdStr) throws ThingsboardException {
DeviceProfileId deviceProfileId;
if (StringUtils.isNotEmpty(deviceProfileIdStr)) {
deviceProfileId = new DeviceProfileId(UUID.fromString(deviceProfileIdStr));
checkDeviceProfileId(deviceProfileId, Operation.READ);
} else {
deviceProfileId = null;
}
try {
return attributesService.findAllKeysByDeviceProfileId(getTenantId(), deviceProfileId);
} catch (Exception e) {
throw handleException(e);
}
}
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/deviceProfile", method = RequestMethod.POST)
@ResponseBody
@ -100,7 +151,7 @@ public class DeviceProfileController extends BaseController {
logEntityAction(savedDeviceProfile.getId(), savedDeviceProfile,
null,
savedDeviceProfile.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
created ? ActionType.ADDED : ActionType.UPDATED, null);
return savedDeviceProfile;
} catch (Exception e) {
@ -113,8 +164,8 @@ public class DeviceProfileController extends BaseController {
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/deviceProfile/{deviceProfileId}", method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.OK)
public void deleteDeviceProfile(@PathVariable("deviceProfileId") String strDeviceProfileId) throws ThingsboardException {
checkParameter("deviceProfileId", strDeviceProfileId);
public void deleteDeviceProfile(@PathVariable(DEVICE_PROFILE_ID) String strDeviceProfileId) throws ThingsboardException {
checkParameter(DEVICE_PROFILE_ID, strDeviceProfileId);
try {
DeviceProfileId deviceProfileId = new DeviceProfileId(toUUID(strDeviceProfileId));
DeviceProfile deviceProfile = checkDeviceProfileId(deviceProfileId, Operation.DELETE);
@ -139,8 +190,8 @@ public class DeviceProfileController extends BaseController {
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/deviceProfile/{deviceProfileId}/default", method = RequestMethod.POST)
@ResponseBody
public DeviceProfile setDefaultDeviceProfile(@PathVariable("deviceProfileId") String strDeviceProfileId) throws ThingsboardException {
checkParameter("deviceProfileId", strDeviceProfileId);
public DeviceProfile setDefaultDeviceProfile(@PathVariable(DEVICE_PROFILE_ID) String strDeviceProfileId) throws ThingsboardException {
checkParameter(DEVICE_PROFILE_ID, strDeviceProfileId);
try {
DeviceProfileId deviceProfileId = new DeviceProfileId(toUUID(strDeviceProfileId));
DeviceProfile deviceProfile = checkDeviceProfileId(deviceProfileId, Operation.WRITE);

28
application/src/main/java/org/thingsboard/server/controller/EntityQueryController.java

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.
@ -16,18 +16,23 @@
package org.thingsboard.server.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.async.DeferredResult;
import org.thingsboard.server.common.data.exception.ThingsboardException;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.query.AlarmData;
import org.thingsboard.server.common.data.query.AlarmDataQuery;
import org.thingsboard.server.common.data.query.EntityCountQuery;
import org.thingsboard.server.common.data.query.EntityData;
import org.thingsboard.server.common.data.query.EntityDataPageLink;
import org.thingsboard.server.common.data.query.EntityDataQuery;
import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.query.EntityQueryService;
@ -40,6 +45,7 @@ public class EntityQueryController extends BaseController {
@Autowired
private EntityQueryService entityQueryService;
private static final int MAX_PAGE_SIZE = 100;
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/entitiesQuery/count", method = RequestMethod.POST)
@ -76,4 +82,24 @@ public class EntityQueryController extends BaseController {
throw handleException(e);
}
}
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/entitiesQuery/find/keys", method = RequestMethod.POST)
@ResponseBody
public DeferredResult<ResponseEntity> findEntityTimeseriesAndAttributesKeysByQuery(@RequestBody EntityDataQuery query,
@RequestParam("timeseries") boolean isTimeseries,
@RequestParam("attributes") boolean isAttributes) throws ThingsboardException {
TenantId tenantId = getTenantId();
checkNotNull(query);
try {
EntityDataPageLink pageLink = query.getPageLink();
if (pageLink.getPageSize() > MAX_PAGE_SIZE) {
pageLink.setPageSize(MAX_PAGE_SIZE);
}
return entityQueryService.getKeysByQuery(getCurrentUser(), tenantId, query, isTimeseries, isAttributes);
} catch (Exception e) {
throw handleException(e);
}
}
}

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

@ -1,5 +1,5 @@
/**
* Copyright © 2016-2020 The Thingsboard Authors
* Copyright © 2016-2021 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.

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

Loading…
Cancel
Save