Browse Source

base entity service improvement: init commit

pull/7775/head
ShvaykaD 4 years ago
parent
commit
661480ff39
  1. 4
      common/dao-api/pom.xml
  2. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/alarm/AlarmService.java
  3. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetProfileService.java
  4. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetService.java
  5. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/audit/AuditLogService.java
  6. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/customer/CustomerService.java
  7. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/dashboard/DashboardService.java
  8. 4
      common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceProfileService.java
  9. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceService.java
  10. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/edge/EdgeService.java
  11. 4
      common/dao-api/src/main/java/org/thingsboard/server/dao/entity/EntityService.java
  12. 43
      common/dao-api/src/main/java/org/thingsboard/server/dao/entity/EntityServiceBeanFactory.java
  13. 39
      common/dao-api/src/main/java/org/thingsboard/server/dao/entity/SimpleEntityService.java
  14. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/entityview/EntityViewService.java
  15. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/event/EventService.java
  16. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/ota/OtaPackageService.java
  17. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/queue/QueueService.java
  18. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java
  19. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/rpc/RpcService.java
  20. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/rule/RuleChainService.java
  21. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileService.java
  22. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/tenant/TenantService.java
  23. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateService.java
  24. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/user/UserService.java
  25. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeService.java
  26. 3
      common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetsBundleService.java
  27. 4
      dao/pom.xml
  28. 30
      dao/src/main/java/org/thingsboard/server/dao/alarm/BaseAlarmService.java
  29. 11
      dao/src/main/java/org/thingsboard/server/dao/asset/AssetProfileServiceImpl.java
  30. 16
      dao/src/main/java/org/thingsboard/server/dao/asset/BaseAssetService.java
  31. 10
      dao/src/main/java/org/thingsboard/server/dao/audit/AuditLogServiceImpl.java
  32. 15
      dao/src/main/java/org/thingsboard/server/dao/customer/CustomerServiceImpl.java
  33. 9
      dao/src/main/java/org/thingsboard/server/dao/dashboard/DashboardServiceImpl.java
  34. 11
      dao/src/main/java/org/thingsboard/server/dao/device/DeviceProfileServiceImpl.java
  35. 15
      dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java
  36. 15
      dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java
  37. 139
      dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java
  38. 15
      dao/src/main/java/org/thingsboard/server/dao/entityview/EntityViewServiceImpl.java
  39. 2
      dao/src/main/java/org/thingsboard/server/dao/event/BaseEventService.java
  40. 9
      dao/src/main/java/org/thingsboard/server/dao/ota/BaseOtaPackageService.java
  41. 11
      dao/src/main/java/org/thingsboard/server/dao/queue/BaseQueueService.java
  42. 9
      dao/src/main/java/org/thingsboard/server/dao/relation/BaseRelationService.java
  43. 9
      dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java
  44. 2
      dao/src/main/java/org/thingsboard/server/dao/rpc/BaseRpcService.java
  45. 12
      dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java
  46. 11
      dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java
  47. 9
      dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java
  48. 2
      dao/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateServiceImpl.java
  49. 16
      dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java
  50. 4
      dao/src/main/java/org/thingsboard/server/dao/util/AbstractBufferedRateExecutor.java
  51. 2
      dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeServiceImpl.java
  52. 11
      dao/src/main/java/org/thingsboard/server/dao/widget/WidgetsBundleServiceImpl.java
  53. 46
      dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceBeanFactoryTest.java
  54. 24
      dao/src/test/java/org/thingsboard/server/dao/service/sql/EntityServiceBeanFactorySqlTest.java
  55. 6
      pom.xml

4
common/dao-api/pom.xml

@ -115,6 +115,10 @@
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
</dependencies>
<build>

3
common/dao-api/src/main/java/org/thingsboard/server/dao/alarm/AlarmService.java

@ -30,13 +30,14 @@ 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.dao.entity.SimpleEntityService;
import java.util.Collection;
/**
* Created by ashvayka on 11.05.17.
*/
public interface AlarmService {
public interface AlarmService extends SimpleEntityService {
AlarmOperationResult createOrUpdateAlarm(Alarm alarm);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetProfileService.java

@ -21,8 +21,9 @@ import org.thingsboard.server.common.data.id.AssetProfileId;
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.dao.entity.SimpleEntityService;
public interface AssetProfileService {
public interface AssetProfileService extends SimpleEntityService {
AssetProfile findAssetProfileById(TenantId tenantId, AssetProfileId assetProfileId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetService.java

@ -27,10 +27,11 @@ import org.thingsboard.server.common.data.id.EdgeId;
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.dao.entity.SimpleEntityService;
import java.util.List;
public interface AssetService {
public interface AssetService extends SimpleEntityService {
AssetInfo findAssetInfoById(TenantId tenantId, AssetId assetId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/audit/AuditLogService.java

@ -25,10 +25,11 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.UserId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.TimePageLink;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
public interface AuditLogService {
public interface AuditLogService extends SimpleEntityService {
PageData<AuditLog> findAuditLogsByTenantIdAndCustomerId(TenantId tenantId, CustomerId customerId, List<ActionType> actionTypes, TimePageLink pageLink);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/customer/CustomerService.java

@ -21,10 +21,11 @@ import org.thingsboard.server.common.data.id.CustomerId;
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.dao.entity.SimpleEntityService;
import java.util.Optional;
public interface CustomerService {
public interface CustomerService extends SimpleEntityService {
Customer findCustomerById(TenantId tenantId, CustomerId customerId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/dashboard/DashboardService.java

@ -24,10 +24,11 @@ import org.thingsboard.server.common.data.id.EdgeId;
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.dao.entity.SimpleEntityService;
import java.util.List;
public interface DashboardService {
public interface DashboardService extends SimpleEntityService {
Dashboard findDashboardById(TenantId tenantId, DashboardId dashboardId);

4
common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceProfileService.java

@ -17,13 +17,13 @@ package org.thingsboard.server.dao.device;
import org.thingsboard.server.common.data.DeviceProfile;
import org.thingsboard.server.common.data.DeviceProfileInfo;
import org.thingsboard.server.common.data.EntityInfo;
import org.thingsboard.server.common.data.id.DeviceProfileId;
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.dao.entity.SimpleEntityService;
public interface DeviceProfileService {
public interface DeviceProfileService extends SimpleEntityService {
DeviceProfile findDeviceProfileById(TenantId tenantId, DeviceProfileId deviceProfileId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceService.java

@ -33,11 +33,12 @@ import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.security.DeviceCredentials;
import org.thingsboard.server.dao.device.provision.ProvisionRequest;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
import java.util.UUID;
public interface DeviceService {
public interface DeviceService extends SimpleEntityService {
DeviceInfo findDeviceInfoById(TenantId tenantId, DeviceId deviceId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/edge/EdgeService.java

@ -26,11 +26,12 @@ import org.thingsboard.server.common.data.id.EntityId;
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.dao.entity.SimpleEntityService;
import java.util.List;
import java.util.Optional;
public interface EdgeService {
public interface EdgeService extends SimpleEntityService {
Edge findEdgeById(TenantId tenantId, EdgeId edgeId);

4
common/dao-api/src/main/java/org/thingsboard/server/dao/entity/EntityService.java

@ -24,9 +24,11 @@ import org.thingsboard.server.common.data.query.EntityCountQuery;
import org.thingsboard.server.common.data.query.EntityData;
import org.thingsboard.server.common.data.query.EntityDataQuery;
import java.util.Optional;
public interface EntityService {
ListenableFuture<String> fetchEntityNameAsync(TenantId tenantId, EntityId entityId);
ListenableFuture<Optional<String>> fetchEntityNameAsync(TenantId tenantId, EntityId entityId);
CustomerId fetchEntityCustomerId(TenantId tenantId, EntityId entityId);

43
common/dao-api/src/main/java/org/thingsboard/server/dao/entity/EntityServiceBeanFactory.java

@ -0,0 +1,43 @@
/**
* Copyright © 2016-2022 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.entity;
import org.apache.commons.text.CaseUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.EntityType;
@Service
public class EntityServiceBeanFactory {
private static final String SERVICE_SUFFIX = "DaoService";
private final BeanFactory beanFactory;
public EntityServiceBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
public SimpleEntityService getServiceByEntityType(EntityType entityType) {
String beanName = EntityType.RULE_NODE.equals(entityType) ? getBeanName(EntityType.RULE_CHAIN) : getBeanName(entityType);
return beanFactory.getBean(beanName, SimpleEntityService.class);
}
private String getBeanName(EntityType entityType) {
return CaseUtils.toCamelCase(entityType.name(), true, '_') + SERVICE_SUFFIX;
}
}

39
common/dao-api/src/main/java/org/thingsboard/server/dao/entity/SimpleEntityService.java

@ -0,0 +1,39 @@
/**
* Copyright © 2016-2022 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.entity;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import static org.thingsboard.server.common.data.id.EntityId.NULL_UUID;
public interface SimpleEntityService {
CustomerId NULL_CUSTOMER_ID = new CustomerId(NULL_UUID);
default ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return Futures.immediateFuture(null);
}
default CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
return NULL_CUSTOMER_ID;
}
}

3
common/dao-api/src/main/java/org/thingsboard/server/dao/entityview/EntityViewService.java

@ -27,13 +27,14 @@ import org.thingsboard.server.common.data.id.EntityViewId;
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.dao.entity.SimpleEntityService;
import java.util.List;
/**
* Created by Victor Basanets on 8/27/2017.
*/
public interface EntityViewService {
public interface EntityViewService extends SimpleEntityService {
EntityView saveEntityView(EntityView entityView);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/event/EventService.java

@ -24,10 +24,11 @@ import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.TimePageLink;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
public interface EventService {
public interface EventService extends SimpleEntityService {
ListenableFuture<Void> saveAsync(Event event);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/ota/OtaPackageService.java

@ -25,10 +25,11 @@ import org.thingsboard.server.common.data.ota.ChecksumAlgorithm;
import org.thingsboard.server.common.data.ota.OtaPackageType;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.nio.ByteBuffer;
public interface OtaPackageService {
public interface OtaPackageService extends SimpleEntityService {
OtaPackageInfo saveOtaPackageInfo(OtaPackageInfo otaPackageInfo, boolean isUrl);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/queue/QueueService.java

@ -20,10 +20,11 @@ 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.common.data.queue.Queue;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
public interface QueueService {
public interface QueueService extends SimpleEntityService {
Queue saveQueue(Queue queue);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java

@ -23,10 +23,11 @@ import org.thingsboard.server.common.data.id.TbResourceId;
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.dao.entity.SimpleEntityService;
import java.util.List;
public interface ResourceService {
public interface ResourceService extends SimpleEntityService {
TbResource saveResource(TbResource resource);
TbResource getResource(TenantId tenantId, ResourceType resourceType, String resourceId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/rpc/RpcService.java

@ -23,8 +23,9 @@ import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.rpc.Rpc;
import org.thingsboard.server.common.data.rpc.RpcStatus;
import org.thingsboard.server.dao.entity.SimpleEntityService;
public interface RpcService {
public interface RpcService extends SimpleEntityService {
Rpc save(Rpc rpc);
void deleteRpc(TenantId tenantId, RpcId id);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/rule/RuleChainService.java

@ -31,6 +31,7 @@ import org.thingsboard.server.common.data.rule.RuleChainMetaData;
import org.thingsboard.server.common.data.rule.RuleChainType;
import org.thingsboard.server.common.data.rule.RuleChainUpdateResult;
import org.thingsboard.server.common.data.rule.RuleNode;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.Collection;
import java.util.List;
@ -38,7 +39,7 @@ import java.util.List;
/**
* Created by igor on 3/12/18.
*/
public interface RuleChainService {
public interface RuleChainService extends SimpleEntityService {
RuleChain saveRuleChain(RuleChain ruleChain);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileService.java

@ -21,8 +21,9 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.TenantProfileId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.dao.entity.SimpleEntityService;
public interface TenantProfileService {
public interface TenantProfileService extends SimpleEntityService {
TenantProfile findTenantProfileById(TenantId tenantId, TenantProfileId tenantProfileId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/tenant/TenantService.java

@ -22,10 +22,11 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.TenantProfileId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
public interface TenantService {
public interface TenantService extends SimpleEntityService {
Tenant findTenantById(TenantId tenantId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateService.java

@ -19,8 +19,9 @@ import org.thingsboard.server.common.data.ApiUsageState;
import org.thingsboard.server.common.data.id.ApiUsageStateId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.dao.entity.SimpleEntityService;
public interface ApiUsageStateService {
public interface ApiUsageStateService extends SimpleEntityService {
ApiUsageState createDefaultApiUsageState(TenantId id, EntityId entityId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/user/UserService.java

@ -24,8 +24,9 @@ import org.thingsboard.server.common.data.id.UserId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.security.UserCredentials;
import org.thingsboard.server.dao.entity.SimpleEntityService;
public interface UserService {
public interface UserService extends SimpleEntityService {
User findUserById(TenantId tenantId, UserId userId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeService.java

@ -20,10 +20,11 @@ import org.thingsboard.server.common.data.id.WidgetTypeId;
import org.thingsboard.server.common.data.widget.WidgetType;
import org.thingsboard.server.common.data.widget.WidgetTypeDetails;
import org.thingsboard.server.common.data.widget.WidgetTypeInfo;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
public interface WidgetTypeService {
public interface WidgetTypeService extends SimpleEntityService {
WidgetType findWidgetTypeById(TenantId tenantId, WidgetTypeId widgetTypeId);

3
common/dao-api/src/main/java/org/thingsboard/server/dao/widget/WidgetsBundleService.java

@ -20,10 +20,11 @@ import org.thingsboard.server.common.data.id.WidgetsBundleId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import java.util.List;
public interface WidgetsBundleService {
public interface WidgetsBundleService extends SimpleEntityService {
WidgetsBundle findWidgetsBundleById(TenantId tenantId, WidgetsBundleId widgetsBundleId);

4
dao/pom.xml

@ -108,6 +108,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>

30
dao/src/main/java/org/thingsboard/server/dao/alarm/BaseAlarmService.java

@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.thingsboard.common.util.ThingsBoardThreadFactory;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.alarm.Alarm;
import org.thingsboard.server.common.data.alarm.AlarmInfo;
import org.thingsboard.server.common.data.alarm.AlarmQuery;
@ -48,6 +49,7 @@ import org.thingsboard.server.common.data.relation.EntitySearchDirection;
import org.thingsboard.server.common.data.relation.RelationsSearchParameters;
import org.thingsboard.server.dao.entity.AbstractEntityService;
import org.thingsboard.server.dao.entity.EntityService;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import org.thingsboard.server.dao.service.DataValidator;
import javax.annotation.Nullable;
@ -67,7 +69,7 @@ import java.util.stream.Stream;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("AlarmDaoService")
@Slf4j
public class BaseAlarmService extends AbstractEntityService implements AlarmService {
@ -283,8 +285,8 @@ public class BaseAlarmService extends AbstractEntityService implements AlarmServ
a -> {
AlarmInfo alarmInfo = new AlarmInfo(a);
return Futures.transform(
entityService.fetchEntityNameAsync(tenantId, alarmInfo.getOriginator()), originatorName -> {
alarmInfo.setOriginatorName(originatorName);
entityService.fetchEntityNameAsync(tenantId, alarmInfo.getOriginator()), originatorNameOpt -> {
alarmInfo.setOriginatorName(originatorNameOpt.isEmpty() ? "N/A" : originatorNameOpt.get());
return alarmInfo;
}, MoreExecutors.directExecutor());
}, MoreExecutors.directExecutor());
@ -312,11 +314,8 @@ public class BaseAlarmService extends AbstractEntityService implements AlarmServ
List<ListenableFuture<AlarmInfo>> alarmFutures = new ArrayList<>(alarms.getData().size());
for (AlarmInfo alarmInfo : alarms.getData()) {
alarmFutures.add(Futures.transform(
entityService.fetchEntityNameAsync(tenantId, alarmInfo.getOriginator()), originatorName -> {
if (originatorName == null) {
originatorName = "Deleted";
}
alarmInfo.setOriginatorName(originatorName);
entityService.fetchEntityNameAsync(tenantId, alarmInfo.getOriginator()), originatorNameOpt -> {
alarmInfo.setOriginatorName(originatorNameOpt.isEmpty() ? "Deleted" : originatorNameOpt.get());
return alarmInfo;
}, MoreExecutors.directExecutor()
));
@ -409,4 +408,19 @@ public class BaseAlarmService extends AbstractEntityService implements AlarmServ
Alarm entity = alarmDao.findAlarmById(tenantId, alarmId.getId());
return function.apply(entity);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findAlarmByIdAsync(tenantId, new AlarmId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
try {
Alarm alarm = findAlarmByIdAsync(tenantId, new AlarmId(entityId.getId())).get();
return alarm != null ? alarm.getCustomerId() : SimpleEntityService.NULL_CUSTOMER_ID;
} catch (Exception e) {
return SimpleEntityService.NULL_CUSTOMER_ID;
}
}
}

11
dao/src/main/java/org/thingsboard/server/dao/asset/AssetProfileServiceImpl.java

@ -15,17 +15,21 @@
*/
package org.thingsboard.server.dao.asset;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.event.TransactionalEventListener;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.asset.Asset;
import org.thingsboard.server.common.data.asset.AssetProfile;
import org.thingsboard.server.common.data.asset.AssetProfileInfo;
import org.thingsboard.server.common.data.id.AssetProfileId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
@ -41,7 +45,7 @@ import java.util.Map;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("AssetProfileDaoService")
@Slf4j
public class AssetProfileServiceImpl extends AbstractCachedEntityService<AssetProfileCacheKey, AssetProfile, AssetProfileEvictEvent> implements AssetProfileService {
@ -264,6 +268,11 @@ public class AssetProfileServiceImpl extends AbstractCachedEntityService<AssetPr
tenantAssetProfilesRemover.removeEntities(tenantId, tenantId);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return Futures.immediateFuture(findAssetProfileById(tenantId, new AssetProfileId(entityId.getId())));
}
private PaginatedRemover<TenantId, AssetProfile> tenantAssetProfilesRemover =
new PaginatedRemover<>() {

16
dao/src/main/java/org/thingsboard/server/dao/asset/BaseAssetService.java

@ -27,6 +27,7 @@ import org.springframework.transaction.event.TransactionalEventListener;
import org.thingsboard.server.common.data.EntitySubtype;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.EntityView;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.asset.Asset;
import org.thingsboard.server.common.data.asset.AssetInfo;
@ -45,6 +46,7 @@ import org.thingsboard.server.common.data.relation.EntityRelation;
import org.thingsboard.server.common.data.relation.EntitySearchDirection;
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
import org.thingsboard.server.dao.entity.AbstractCachedEntityService;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.service.DataValidator;
import org.thingsboard.server.dao.service.PaginatedRemover;
@ -61,7 +63,7 @@ import static org.thingsboard.server.dao.service.Validator.validateIds;
import static org.thingsboard.server.dao.service.Validator.validatePageLink;
import static org.thingsboard.server.dao.service.Validator.validateString;
@Service
@Service("AssetDaoService")
@Slf4j
public class BaseAssetService extends AbstractCachedEntityService<AssetCacheKey, Asset, AssetCacheEvictEvent> implements AssetService {
@ -429,4 +431,16 @@ public class BaseAssetService extends AbstractCachedEntityService<AssetCacheKey,
unassignAssetFromCustomer(tenantId, new AssetId(entity.getId().getId()));
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findAssetByIdAsync(tenantId, new AssetId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
Asset asset = findAssetById(tenantId, new AssetId(entityId.getId()));
return asset != null ? asset.getCustomerId() : SimpleEntityService.NULL_CUSTOMER_ID;
}
}

10
dao/src/main/java/org/thingsboard/server/dao/audit/AuditLogServiceImpl.java

@ -53,6 +53,7 @@ import org.thingsboard.server.dao.service.DataValidator;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
@ -60,7 +61,7 @@ import static org.thingsboard.server.dao.service.Validator.validateEntityId;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Slf4j
@Service
@Service("AuditLogDaoService")
@ConditionalOnProperty(prefix = "audit-log", value = "enabled", havingValue = "true")
public class AuditLogServiceImpl implements AuditLogService {
@ -121,13 +122,14 @@ public class AuditLogServiceImpl implements AuditLogService {
JsonNode actionData = constructActionData(entityId, entity, actionType, additionalInfo);
ActionStatus actionStatus = ActionStatus.SUCCESS;
String failureDetails = "";
String entityName = "";
String entityName = "N/A";
if (entity != null) {
entityName = entity.getName();
} else {
try {
entityName = entityService.fetchEntityNameAsync(tenantId, entityId).get();
} catch (Exception ex) {
Optional<String> entityNameOpt = entityService.fetchEntityNameAsync(tenantId, entityId).get();
entityName = entityNameOpt.orElse(entityName);
} catch (Exception ignored) {
}
}
if (e != null) {

15
dao/src/main/java/org/thingsboard/server/dao/customer/CustomerServiceImpl.java

@ -24,7 +24,9 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
@ -44,7 +46,7 @@ import java.util.Optional;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("CustomerDaoService")
@Slf4j
public class CustomerServiceImpl extends AbstractEntityService implements CustomerService {
@ -178,4 +180,15 @@ public class CustomerServiceImpl extends AbstractEntityService implements Custom
deleteCustomer(tenantId, new CustomerId(entity.getUuidId()));
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findCustomerByIdAsync(tenantId, new CustomerId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
// todo ask Andrew why we are not checking for parent customer.
return new CustomerId(entityId.getId());
}
}

9
dao/src/main/java/org/thingsboard/server/dao/dashboard/DashboardServiceImpl.java

@ -24,10 +24,12 @@ import org.springframework.transaction.annotation.Transactional;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Dashboard;
import org.thingsboard.server.common.data.DashboardInfo;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.edge.Edge;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.DashboardId;
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.PageData;
import org.thingsboard.server.common.data.page.PageLink;
@ -45,7 +47,7 @@ import java.util.List;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("DashboardDaoService")
@Slf4j
public class DashboardServiceImpl extends AbstractEntityService implements DashboardService {
@ -307,6 +309,11 @@ public class DashboardServiceImpl extends AbstractEntityService implements Dashb
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findDashboardByIdAsync(tenantId, new DashboardId(entityId.getId()));
}
private class CustomerDashboardsUnassigner extends PaginatedRemover<Customer, DashboardInfo> {
private Customer customer;

11
dao/src/main/java/org/thingsboard/server/dao/device/DeviceProfileServiceImpl.java

@ -15,6 +15,8 @@
*/
package org.thingsboard.server.dao.device;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,12 +30,14 @@ import org.thingsboard.server.common.data.DeviceProfileInfo;
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.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.device.profile.DefaultDeviceProfileConfiguration;
import org.thingsboard.server.common.data.device.profile.DefaultDeviceProfileTransportConfiguration;
import org.thingsboard.server.common.data.device.profile.DeviceProfileData;
import org.thingsboard.server.common.data.device.profile.DisabledDeviceProfileProvisionConfiguration;
import org.thingsboard.server.common.data.id.DeviceProfileId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
@ -50,7 +54,7 @@ import java.util.Map;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("DeviceProfileDaoService")
@Slf4j
public class DeviceProfileServiceImpl extends AbstractCachedEntityService<DeviceProfileCacheKey, DeviceProfile, DeviceProfileEvictEvent> implements DeviceProfileService {
@ -286,6 +290,11 @@ public class DeviceProfileServiceImpl extends AbstractCachedEntityService<Device
tenantDeviceProfilesRemover.removeEntities(tenantId, tenantId);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return Futures.immediateFuture(findDeviceProfileById(tenantId, new DeviceProfileId(entityId.getId())));
}
private PaginatedRemover<TenantId, DeviceProfile> tenantDeviceProfilesRemover =
new PaginatedRemover<>() {

15
dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java

@ -37,6 +37,7 @@ import org.thingsboard.server.common.data.DeviceTransportType;
import org.thingsboard.server.common.data.EntitySubtype;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.EntityView;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.device.DeviceSearchQuery;
import org.thingsboard.server.common.data.device.credentials.BasicMqttCredentials;
@ -66,6 +67,7 @@ import org.thingsboard.server.dao.device.provision.ProvisionFailedException;
import org.thingsboard.server.dao.device.provision.ProvisionRequest;
import org.thingsboard.server.dao.device.provision.ProvisionResponseStatus;
import org.thingsboard.server.dao.entity.AbstractCachedEntityService;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import org.thingsboard.server.dao.event.EventService;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.service.DataValidator;
@ -85,7 +87,7 @@ import static org.thingsboard.server.dao.service.Validator.validateIds;
import static org.thingsboard.server.dao.service.Validator.validatePageLink;
import static org.thingsboard.server.dao.service.Validator.validateString;
@Service
@Service("DeviceDaoService")
@Slf4j
public class DeviceServiceImpl extends AbstractCachedEntityService<DeviceCacheKey, Device, DeviceCacheEvictEvent> implements DeviceService {
@ -705,4 +707,15 @@ public class DeviceServiceImpl extends AbstractCachedEntityService<DeviceCacheKe
unassignDeviceFromCustomer(tenantId, new DeviceId(entity.getUuidId()));
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findDeviceByIdAsync(tenantId, new DeviceId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
Device device = findDeviceById(tenantId, new DeviceId(entityId.getId()));
return device != null ? device.getCustomerId() : SimpleEntityService.NULL_CUSTOMER_ID;
}
}

15
dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java

@ -32,6 +32,7 @@ import org.springframework.transaction.event.TransactionalEventListener;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.EntitySubtype;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.User;
import org.thingsboard.server.common.data.edge.Edge;
@ -52,6 +53,7 @@ import org.thingsboard.server.common.data.relation.EntitySearchDirection;
import org.thingsboard.server.common.data.rule.RuleChain;
import org.thingsboard.server.common.data.rule.RuleNode;
import org.thingsboard.server.dao.entity.AbstractCachedEntityService;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.relation.RelationService;
import org.thingsboard.server.dao.rule.RuleChainService;
@ -75,7 +77,7 @@ import static org.thingsboard.server.dao.service.Validator.validateIds;
import static org.thingsboard.server.dao.service.Validator.validatePageLink;
import static org.thingsboard.server.dao.service.Validator.validateString;
@Service
@Service("EdgeDaoService")
@Slf4j
public class EdgeServiceImpl extends AbstractCachedEntityService<EdgeCacheKey, Edge, EdgeCacheEvictEvent> implements EdgeService {
@ -519,4 +521,15 @@ public class EdgeServiceImpl extends AbstractCachedEntityService<EdgeCacheKey, E
} while (pageData != null && pageData.hasNext());
return result;
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findEdgeByIdAsync(tenantId, new EdgeId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
Edge edge = findEdgeById(tenantId, new EdgeId(entityId.getId()));
return edge != null ? edge.getCustomerId() : SimpleEntityService.NULL_CUSTOMER_ID;
}
}

139
dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java

@ -23,21 +23,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.thingsboard.server.common.data.HasCustomerId;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.id.AlarmId;
import org.thingsboard.server.common.data.id.AssetId;
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.EdgeId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.EntityViewId;
import org.thingsboard.server.common.data.id.OtaPackageId;
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.page.PageData;
import org.thingsboard.server.common.data.query.EntityCountQuery;
import org.thingsboard.server.common.data.query.EntityData;
@ -58,7 +47,8 @@ import org.thingsboard.server.dao.rule.RuleChainService;
import org.thingsboard.server.dao.tenant.TenantService;
import org.thingsboard.server.dao.user.UserService;
import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID;
import java.util.Optional;
import static org.thingsboard.server.dao.service.Validator.validateId;
/**
@ -71,41 +61,11 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe
public static final String INCORRECT_TENANT_ID = "Incorrect tenantId ";
public static final String INCORRECT_CUSTOMER_ID = "Incorrect customerId ";
@Autowired
private AssetService assetService;
@Autowired
private DeviceService deviceService;
@Autowired
private EntityViewService entityViewService;
@Autowired
private TenantService tenantService;
@Autowired
private CustomerService customerService;
@Autowired
private UserService userService;
@Autowired
private DashboardService dashboardService;
@Autowired
private AlarmService alarmService;
@Autowired
private RuleChainService ruleChainService;
@Autowired
private EntityQueryDao entityQueryDao;
@Autowired
private ResourceService resourceService;
@Autowired
private OtaPackageService otaPackageService;
EntityServiceBeanFactory entityServiceBeanFactory;
@Override
public long countEntitiesByQuery(TenantId tenantId, CustomerId customerId, EntityCountQuery query) {
@ -125,100 +85,19 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe
return this.entityQueryDao.findEntityDataByQuery(tenantId, customerId, query);
}
//TODO: 3.1 Remove this from project.
@Override
public ListenableFuture<String> fetchEntityNameAsync(TenantId tenantId, EntityId entityId) {
public ListenableFuture<Optional<String>> fetchEntityNameAsync(TenantId tenantId, EntityId entityId) {
log.trace("Executing fetchEntityNameAsync [{}]", entityId);
ListenableFuture<String> entityName;
ListenableFuture<? extends HasName> hasName;
switch (entityId.getEntityType()) {
case ASSET:
hasName = assetService.findAssetByIdAsync(tenantId, new AssetId(entityId.getId()));
break;
case DEVICE:
hasName = deviceService.findDeviceByIdAsync(tenantId, new DeviceId(entityId.getId()));
break;
case ENTITY_VIEW:
hasName = entityViewService.findEntityViewByIdAsync(tenantId, new EntityViewId(entityId.getId()));
break;
case TENANT:
hasName = tenantService.findTenantByIdAsync(tenantId, TenantId.fromUUID(entityId.getId()));
break;
case CUSTOMER:
hasName = customerService.findCustomerByIdAsync(tenantId, new CustomerId(entityId.getId()));
break;
case USER:
hasName = userService.findUserByIdAsync(tenantId, new UserId(entityId.getId()));
break;
case DASHBOARD:
hasName = dashboardService.findDashboardInfoByIdAsync(tenantId, new DashboardId(entityId.getId()));
break;
case ALARM:
hasName = alarmService.findAlarmByIdAsync(tenantId, new AlarmId(entityId.getId()));
break;
case RULE_CHAIN:
hasName = ruleChainService.findRuleChainByIdAsync(tenantId, new RuleChainId(entityId.getId()));
break;
case EDGE:
hasName = edgeService.findEdgeByIdAsync(tenantId, new EdgeId(entityId.getId()));
break;
case TB_RESOURCE:
hasName = resourceService.findResourceInfoByIdAsync(tenantId, new TbResourceId(entityId.getId()));
break;
case OTA_PACKAGE:
hasName = otaPackageService.findOtaPackageInfoByIdAsync(tenantId, new OtaPackageId(entityId.getId()));
break;
default:
throw new IllegalStateException("Not Implemented!");
}
entityName = Futures.transform(hasName, (Function<HasName, String>) hasName1 -> hasName1 != null ? hasName1.getName() : null, MoreExecutors.directExecutor());
return entityName;
SimpleEntityService fetchEntityService = entityServiceBeanFactory.getServiceByEntityType(entityId.getEntityType());
return Futures.transform(fetchEntityService.fetchHasNameEntityAsync(tenantId, entityId),
hasName -> hasName != null ? Optional.of(hasName.getName()) : Optional.empty(), MoreExecutors.directExecutor());
}
@Override
public CustomerId fetchEntityCustomerId(TenantId tenantId, EntityId entityId) {
log.trace("Executing fetchEntityCustomerId [{}]", entityId);
HasCustomerId hasCustomerId = null;
switch (entityId.getEntityType()) {
case TENANT:
case RULE_CHAIN:
case RULE_NODE:
case DASHBOARD:
case WIDGETS_BUNDLE:
case WIDGET_TYPE:
case TENANT_PROFILE:
case DEVICE_PROFILE:
case ASSET_PROFILE:
case API_USAGE_STATE:
case TB_RESOURCE:
case OTA_PACKAGE:
break;
case CUSTOMER:
hasCustomerId = () -> new CustomerId(entityId.getId());
break;
case USER:
hasCustomerId = userService.findUserById(tenantId, new UserId(entityId.getId()));
break;
case ASSET:
hasCustomerId = assetService.findAssetById(tenantId, new AssetId(entityId.getId()));
break;
case DEVICE:
hasCustomerId = deviceService.findDeviceById(tenantId, new DeviceId(entityId.getId()));
break;
case ALARM:
try {
hasCustomerId = alarmService.findAlarmByIdAsync(tenantId, new AlarmId(entityId.getId())).get();
} catch (Exception e) {
}
break;
case ENTITY_VIEW:
hasCustomerId = entityViewService.findEntityViewById(tenantId, new EntityViewId(entityId.getId()));
break;
case EDGE:
hasCustomerId = edgeService.findEdgeById(tenantId, new EdgeId(entityId.getId()));
break;
}
return hasCustomerId != null ? hasCustomerId.getCustomerId() : new CustomerId(NULL_UUID);
SimpleEntityService fetchEntityService = entityServiceBeanFactory.getServiceByEntityType(entityId.getEntityType());
return fetchEntityService.getCustomerId(tenantId, entityId);
}
private static void validateEntityCountQuery(EntityCountQuery query) {

15
dao/src/main/java/org/thingsboard/server/dao/entityview/EntityViewServiceImpl.java

@ -28,6 +28,7 @@ import org.thingsboard.server.common.data.EntitySubtype;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.EntityView;
import org.thingsboard.server.common.data.EntityViewInfo;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.edge.Edge;
import org.thingsboard.server.common.data.entityview.EntityViewSearchQuery;
@ -42,6 +43,7 @@ import org.thingsboard.server.common.data.relation.EntityRelation;
import org.thingsboard.server.common.data.relation.EntitySearchDirection;
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
import org.thingsboard.server.dao.entity.AbstractCachedEntityService;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.service.DataValidator;
import org.thingsboard.server.dao.service.PaginatedRemover;
@ -61,7 +63,7 @@ import static org.thingsboard.server.dao.service.Validator.validateString;
/**
* Created by Victor Basanets on 8/28/2017.
*/
@Service
@Service("EntityViewDaoService")
@Slf4j
public class EntityViewServiceImpl extends AbstractCachedEntityService<EntityViewCacheKey, EntityViewCacheValue, EntityViewEvictEvent> implements EntityViewService {
@ -408,4 +410,15 @@ public class EntityViewServiceImpl extends AbstractCachedEntityService<EntityVie
unassignEntityViewFromCustomer(tenantId, new EntityViewId(entity.getUuidId()));
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findEntityViewByIdAsync(tenantId, new EntityViewId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
EntityView entityView = findEntityViewById(tenantId, new EntityViewId(entityId.getId()));
return entityView != null ? entityView.getCustomerId() : SimpleEntityService.NULL_CUSTOMER_ID;
}
}

2
dao/src/main/java/org/thingsboard/server/dao/event/BaseEventService.java

@ -41,7 +41,7 @@ import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
@Service("EventDaoService")
@Slf4j
public class BaseEventService implements EventService {

9
dao/src/main/java/org/thingsboard/server/dao/ota/BaseOtaPackageService.java

@ -24,10 +24,12 @@ import org.hibernate.exception.ConstraintViolationException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.event.TransactionalEventListener;
import org.thingsboard.server.cache.ota.OtaPackageDataCache;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.OtaPackage;
import org.thingsboard.server.common.data.OtaPackageInfo;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.id.DeviceProfileId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.OtaPackageId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.ota.ChecksumAlgorithm;
@ -45,7 +47,7 @@ import java.util.Optional;
import static org.thingsboard.server.dao.service.Validator.validateId;
import static org.thingsboard.server.dao.service.Validator.validatePageLink;
@Service
@Service("OtaPackageDaoService")
@Slf4j
@RequiredArgsConstructor
public class BaseOtaPackageService extends AbstractCachedEntityService<OtaPackageCacheKey, OtaPackageInfo, OtaPackageCacheEvictEvent> implements OtaPackageService {
@ -234,4 +236,9 @@ public class BaseOtaPackageService extends AbstractCachedEntityService<OtaPackag
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findOtaPackageInfoByIdAsync(tenantId, new OtaPackageId(entityId.getId()));
}
}

11
dao/src/main/java/org/thingsboard/server/dao/queue/BaseQueueService.java

@ -15,13 +15,17 @@
*/
package org.thingsboard.server.dao.queue;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.TenantProfile;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.QueueId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
@ -36,7 +40,7 @@ import org.thingsboard.server.dao.tenant.TbTenantProfileCache;
import java.util.List;
@Service
@Service("QueueDaoService")
@Slf4j
@RequiredArgsConstructor
public class BaseQueueService extends AbstractEntityService implements QueueService {
@ -119,6 +123,11 @@ public class BaseQueueService extends AbstractEntityService implements QueueServ
tenantQueuesRemover.removeEntities(tenantId, tenantId);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return Futures.immediateFuture(findQueueById(tenantId, new QueueId(entityId.getId())));
}
private PaginatedRemover<TenantId, Queue> tenantQueuesRemover =
new PaginatedRemover<>() {

9
dao/src/main/java/org/thingsboard/server/dao/relation/BaseRelationService.java

@ -57,6 +57,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@ -71,7 +72,7 @@ import static org.thingsboard.server.dao.service.Validator.validateId;
/**
* Created by ashvayka on 28.04.17.
*/
@Service
@Service("RelationDaoService")
@Slf4j
public class BaseRelationService implements RelationService {
@ -374,10 +375,10 @@ public class BaseRelationService implements RelationService {
private ListenableFuture<EntityRelationInfo> fetchRelationInfoAsync(TenantId tenantId, EntityRelation relation,
Function<EntityRelation, EntityId> entityIdGetter,
BiConsumer<EntityRelationInfo, String> entityNameSetter) {
ListenableFuture<String> entityName = entityService.fetchEntityNameAsync(tenantId, entityIdGetter.apply(relation));
return Futures.transform(entityName, entityName1 -> {
ListenableFuture<Optional<String>> entityNameFuture = entityService.fetchEntityNameAsync(tenantId, entityIdGetter.apply(relation));
return Futures.transform(entityNameFuture, nameOpt -> {
EntityRelationInfo entityRelationInfo1 = new EntityRelationInfo(relation);
entityNameSetter.accept(entityRelationInfo1, entityName1);
entityNameSetter.accept(entityRelationInfo1, nameOpt.orElse("N/A"));
return entityRelationInfo1;
}, MoreExecutors.directExecutor());
}

9
dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java

@ -20,9 +20,11 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.ResourceType;
import org.thingsboard.server.common.data.TbResource;
import org.thingsboard.server.common.data.TbResourceInfo;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TbResourceId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
@ -38,7 +40,7 @@ import java.util.Optional;
import static org.thingsboard.server.dao.device.DeviceServiceImpl.INCORRECT_TENANT_ID;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("TbResourceDaoService")
@Slf4j
@AllArgsConstructor
public class BaseResourceService implements ResourceService {
@ -134,6 +136,11 @@ public class BaseResourceService implements ResourceService {
tenantResourcesRemover.removeEntities(tenantId, tenantId);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findResourceInfoByIdAsync(tenantId, new TbResourceId(entityId.getId()));
}
@Override
public long sumDataSizeByTenantId(TenantId tenantId) {
return resourceDao.sumDataSizeByTenantId(tenantId);

2
dao/src/main/java/org/thingsboard/server/dao/rpc/BaseRpcService.java

@ -31,7 +31,7 @@ import org.thingsboard.server.dao.service.PaginatedRemover;
import static org.thingsboard.server.dao.service.Validator.validateId;
import static org.thingsboard.server.dao.service.Validator.validatePageLink;
@Service
@Service("RpcDaoService")
@Slf4j
@RequiredArgsConstructor
public class BaseRpcService implements RpcService {

12
dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java

@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.BaseData;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.edge.Edge;
import org.thingsboard.server.common.data.id.EdgeId;
import org.thingsboard.server.common.data.id.EntityId;
@ -77,7 +78,7 @@ import static org.thingsboard.server.dao.service.Validator.validateString;
/**
* Created by igor on 3/12/18.
*/
@Service
@Service("RuleChainDaoService")
@Slf4j
public class BaseRuleChainService extends AbstractEntityService implements RuleChainService {
@ -758,6 +759,15 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
deleteEntityRelations(tenantId, ruleChainId);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
if (EntityType.RULE_NODE.equals(entityId.getEntityType())) {
return findRuleNodeByIdAsync(tenantId, new RuleNodeId(entityId.getId()));
}
return findRuleChainByIdAsync(tenantId, new RuleChainId(entityId.getId()));
}
private List<EntityRelation> getRuleChainToNodeRelations(TenantId tenantId, RuleChainId ruleChainId) {
return relationService.findByFrom(tenantId, ruleChainId, RelationTypeGroup.RULE_CHAIN);
}

11
dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java

@ -15,13 +15,17 @@
*/
package org.thingsboard.server.dao.tenant;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.event.TransactionalEventListener;
import org.thingsboard.server.common.data.EntityInfo;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.TenantProfile;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.TenantProfileId;
import org.thingsboard.server.common.data.page.PageData;
@ -39,7 +43,7 @@ import java.util.List;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("TenantProfileDaoService")
@Slf4j
public class TenantProfileServiceImpl extends AbstractCachedEntityService<TenantProfileCacheKey, TenantProfile, TenantProfileEvictEvent> implements TenantProfileService {
@ -204,6 +208,11 @@ public class TenantProfileServiceImpl extends AbstractCachedEntityService<Tenant
tenantProfilesRemover.removeEntities(tenantId, null);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return Futures.immediateFuture(findTenantProfileById(tenantId, new TenantProfileId(entityId.getId())));
}
private final PaginatedRemover<String, TenantProfile> tenantProfilesRemover =
new PaginatedRemover<>() {

9
dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java

@ -23,9 +23,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.event.TransactionalEventListener;
import org.thingsboard.server.cache.TbTransactionalCache;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.TenantInfo;
import org.thingsboard.server.common.data.TenantProfile;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.TenantProfileId;
import org.thingsboard.server.common.data.page.PageData;
@ -54,7 +56,7 @@ import java.util.List;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("TenantDaoService")
@Slf4j
public class TenantServiceImpl extends AbstractCachedEntityService<TenantId, Tenant, TenantEvictEvent> implements TenantService {
@ -256,4 +258,9 @@ public class TenantServiceImpl extends AbstractCachedEntityService<TenantId, Ten
deleteTenant(TenantId.fromUUID(entity.getUuidId()));
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findTenantByIdAsync(tenantId, new TenantId(entityId.getId()));
}
}

2
dao/src/main/java/org/thingsboard/server/dao/usagerecord/ApiUsageStateServiceImpl.java

@ -45,7 +45,7 @@ import java.util.Objects;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Service("ApiUsageStateDaoService")
@Slf4j
public class ApiUsageStateServiceImpl extends AbstractEntityService implements ApiUsageStateService {
public static final String INCORRECT_TENANT_ID = "Incorrect tenantId ";

16
dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java

@ -28,9 +28,11 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.User;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.UserCredentialsId;
import org.thingsboard.server.common.data.id.UserId;
@ -39,6 +41,7 @@ import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.security.UserCredentials;
import org.thingsboard.server.common.data.security.event.UserCredentialsInvalidationEvent;
import org.thingsboard.server.dao.entity.AbstractEntityService;
import org.thingsboard.server.dao.entity.SimpleEntityService;
import org.thingsboard.server.dao.exception.IncorrectParameterException;
import org.thingsboard.server.dao.service.DataValidator;
import org.thingsboard.server.dao.service.PaginatedRemover;
@ -50,7 +53,7 @@ import static org.thingsboard.server.dao.service.Validator.validateId;
import static org.thingsboard.server.dao.service.Validator.validatePageLink;
import static org.thingsboard.server.dao.service.Validator.validateString;
@Service
@Service("UserDaoService")
@Slf4j
@RequiredArgsConstructor
public class UserServiceImpl extends AbstractEntityService implements UserService {
@ -397,4 +400,15 @@ public class UserServiceImpl extends AbstractEntityService implements UserServic
}
};
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return findUserByIdAsync(tenantId, new UserId(entityId.getId()));
}
@Override
public CustomerId getCustomerId(TenantId tenantId, EntityId entityId) {
User user = findUserById(tenantId, new UserId(entityId.getId()));
return user != null ? user.getCustomerId() : SimpleEntityService.NULL_CUSTOMER_ID;
}
}

4
dao/src/main/java/org/thingsboard/server/dao/util/AbstractBufferedRateExecutor.java

@ -44,6 +44,7 @@ import org.thingsboard.server.dao.tenant.TbTenantProfileCache;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
@ -327,7 +328,8 @@ public abstract class AbstractBufferedRateExecutor<T extends AsyncTask, F extend
if (printTenantNames) {
String name = tenantNamesCache.computeIfAbsent(tenantId, tId -> {
try {
return entityService.fetchEntityNameAsync(TenantId.SYS_TENANT_ID, tenantId).get();
ListenableFuture<Optional<String>> nameOpt = entityService.fetchEntityNameAsync(TenantId.SYS_TENANT_ID, tenantId);
return nameOpt.get().orElse("N/A");
} catch (Exception e) {
log.error("[{}] Failed to get tenant name", tenantId, e);
return "N/A";

2
dao/src/main/java/org/thingsboard/server/dao/widget/WidgetTypeServiceImpl.java

@ -28,7 +28,7 @@ import org.thingsboard.server.dao.service.Validator;
import java.util.List;
@Service
@Service("WidgetTypeDaoService")
@Slf4j
public class WidgetTypeServiceImpl implements WidgetTypeService {

11
dao/src/main/java/org/thingsboard/server/dao/widget/WidgetsBundleServiceImpl.java

@ -15,9 +15,13 @@
*/
package org.thingsboard.server.dao.widget;
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.Service;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.WidgetsBundleId;
import org.thingsboard.server.common.data.page.PageData;
@ -32,7 +36,7 @@ import org.thingsboard.server.dao.service.Validator;
import java.util.ArrayList;
import java.util.List;
@Service
@Service("WidgetsBundleDaoService")
@Slf4j
public class WidgetsBundleServiceImpl implements WidgetsBundleService {
@ -151,6 +155,11 @@ public class WidgetsBundleServiceImpl implements WidgetsBundleService {
tenantWidgetsBundleRemover.removeEntities(tenantId, tenantId);
}
@Override
public ListenableFuture<? extends HasName> fetchHasNameEntityAsync(TenantId tenantId, EntityId entityId) {
return Futures.immediateFuture(findWidgetsBundleById(tenantId, new WidgetsBundleId(entityId.getId())));
}
private PaginatedRemover<TenantId, WidgetsBundle> tenantWidgetsBundleRemover =
new PaginatedRemover<TenantId, WidgetsBundle>() {

46
dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceBeanFactoryTest.java

@ -0,0 +1,46 @@
/**
* Copyright © 2016-2022 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.service;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.dao.entity.EntityServiceBeanFactory;
import org.thingsboard.server.dao.rule.BaseRuleChainService;
@Slf4j
public abstract class BaseEntityServiceBeanFactoryTest extends AbstractServiceTest {
@Autowired
private EntityServiceBeanFactory entityServiceBeanFactory;
@Test
public void givenAllEntityTypes_whenGetServiceByEntityTypeCalled_thenNoExceptionsThrows() {
for (EntityType entityType : EntityType.values()) {
Assertions.assertThatCode(() -> entityServiceBeanFactory.getServiceByEntityType(entityType))
.doesNotThrowAnyException();
}
}
@Test
public void givenRuleNodeEntityType_whenGetServiceByEntityTypeCalled_thenReturnedRuleChainDaoService() {
Assert.assertTrue(entityServiceBeanFactory.getServiceByEntityType(EntityType.RULE_NODE) instanceof BaseRuleChainService);
}
}

24
dao/src/test/java/org/thingsboard/server/dao/service/sql/EntityServiceBeanFactorySqlTest.java

@ -0,0 +1,24 @@
/**
* Copyright © 2016-2022 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.service.sql;
import org.thingsboard.server.dao.service.BaseEntityServiceBeanFactoryTest;
import org.thingsboard.server.dao.service.DaoSqlTest;
@DaoSqlTest
public class EntityServiceBeanFactorySqlTest extends BaseEntityServiceBeanFactoryTest {
}

6
pom.xml

@ -61,6 +61,7 @@
<commons-io.version>2.11.0</commons-io.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-csv.version>1.4</commons-csv.version>
<commons-text.version>1.9</commons-text.version>
<apache-httpclient.version>4.5.13</apache-httpclient.version>
<apache-httpcore.version>4.4.14</apache-httpcore.version>
<joda-time.version>2.8.1</joda-time.version>
@ -1363,6 +1364,11 @@
<artifactId>commons-csv</artifactId>
<version>${commons-csv.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>

Loading…
Cancel
Save