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 | 78 | public static final String INCORRECT_PAGE_LINK = "Incorrect page link "; |
79 | 79 | public static final String INCORRECT_CUSTOMER_ID = "Incorrect customerId "; |
80 | 80 | public static final String INCORRECT_ASSET_ID = "Incorrect assetId "; |
81 | + public static final String TB_SERVICE_QUEUE = "TbServiceQueue"; | |
82 | + | |
81 | 83 | @Autowired |
82 | 84 | private AssetDao assetDao; |
83 | 85 | |
... | ... | @@ -329,8 +331,10 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ |
329 | 331 | protected void validateCreate(TenantId tenantId, Asset asset) { |
330 | 332 | DefaultTenantProfileConfiguration profileConfiguration = |
331 | 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 | 340 | @Override | ... | ... |
... | ... | @@ -39,12 +39,13 @@ import java.util.Objects; |
39 | 39 | import java.util.Optional; |
40 | 40 | import java.util.UUID; |
41 | 41 | |
42 | +import static org.thingsboard.server.dao.asset.BaseAssetService.TB_SERVICE_QUEUE; | |
43 | + | |
42 | 44 | /** |
43 | 45 | * Created by Valerii Sosliuk on 5/19/2017. |
44 | 46 | */ |
45 | 47 | @Component |
46 | 48 | public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { |
47 | - public static final String TB_SERVICE_QUEUE = "TbServiceQueue"; | |
48 | 49 | |
49 | 50 | @Autowired |
50 | 51 | private AssetRepository assetRepository; | ... | ... |