Commit e19bd433ade3d00679d7a73035d73ca714370fca
Committed by
Andrew Shvayka
1 parent
80b1ffa7
improvements asset validation for RE statistics
Showing
2 changed files
with
8 additions
and
3 deletions
@@ -78,6 +78,8 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ | @@ -78,6 +78,8 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ | ||
78 | public static final String INCORRECT_PAGE_LINK = "Incorrect page link "; | 78 | public static final String INCORRECT_PAGE_LINK = "Incorrect page link "; |
79 | public static final String INCORRECT_CUSTOMER_ID = "Incorrect customerId "; | 79 | public static final String INCORRECT_CUSTOMER_ID = "Incorrect customerId "; |
80 | public static final String INCORRECT_ASSET_ID = "Incorrect assetId "; | 80 | public static final String INCORRECT_ASSET_ID = "Incorrect assetId "; |
81 | + public static final String TB_SERVICE_QUEUE = "TbServiceQueue"; | ||
82 | + | ||
81 | @Autowired | 83 | @Autowired |
82 | private AssetDao assetDao; | 84 | private AssetDao assetDao; |
83 | 85 | ||
@@ -329,8 +331,10 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ | @@ -329,8 +331,10 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ | ||
329 | protected void validateCreate(TenantId tenantId, Asset asset) { | 331 | protected void validateCreate(TenantId tenantId, Asset asset) { |
330 | DefaultTenantProfileConfiguration profileConfiguration = | 332 | DefaultTenantProfileConfiguration profileConfiguration = |
331 | (DefaultTenantProfileConfiguration)tenantProfileCache.get(tenantId).getProfileData().getConfiguration(); | 333 | (DefaultTenantProfileConfiguration)tenantProfileCache.get(tenantId).getProfileData().getConfiguration(); |
332 | - long maxAssets = profileConfiguration.getMaxAssets(); | ||
333 | - validateNumberOfEntitiesPerTenant(tenantId, assetDao, maxAssets, EntityType.ASSET); | 334 | + if (!TB_SERVICE_QUEUE.equals(asset.getType())) { |
335 | + long maxAssets = profileConfiguration.getMaxAssets(); | ||
336 | + validateNumberOfEntitiesPerTenant(tenantId, assetDao, maxAssets, EntityType.ASSET); | ||
337 | + } | ||
334 | } | 338 | } |
335 | 339 | ||
336 | @Override | 340 | @Override |
@@ -39,12 +39,13 @@ import java.util.Objects; | @@ -39,12 +39,13 @@ import java.util.Objects; | ||
39 | import java.util.Optional; | 39 | import java.util.Optional; |
40 | import java.util.UUID; | 40 | import java.util.UUID; |
41 | 41 | ||
42 | +import static org.thingsboard.server.dao.asset.BaseAssetService.TB_SERVICE_QUEUE; | ||
43 | + | ||
42 | /** | 44 | /** |
43 | * Created by Valerii Sosliuk on 5/19/2017. | 45 | * Created by Valerii Sosliuk on 5/19/2017. |
44 | */ | 46 | */ |
45 | @Component | 47 | @Component |
46 | public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { | 48 | public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { |
47 | - public static final String TB_SERVICE_QUEUE = "TbServiceQueue"; | ||
48 | 49 | ||
49 | @Autowired | 50 | @Autowired |
50 | private AssetRepository assetRepository; | 51 | private AssetRepository assetRepository; |