improvements asset validation for RE statistics
This commit is contained in:
parent
80b1ffa736
commit
e19bd433ad
@ -78,6 +78,8 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ
|
|||||||
public static final String INCORRECT_PAGE_LINK = "Incorrect page link ";
|
public static final String INCORRECT_PAGE_LINK = "Incorrect page link ";
|
||||||
public static final String INCORRECT_CUSTOMER_ID = "Incorrect customerId ";
|
public static final String INCORRECT_CUSTOMER_ID = "Incorrect customerId ";
|
||||||
public static final String INCORRECT_ASSET_ID = "Incorrect assetId ";
|
public static final String INCORRECT_ASSET_ID = "Incorrect assetId ";
|
||||||
|
public static final String TB_SERVICE_QUEUE = "TbServiceQueue";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssetDao assetDao;
|
private AssetDao assetDao;
|
||||||
|
|
||||||
@ -329,9 +331,11 @@ public class BaseAssetService extends AbstractEntityService implements AssetServ
|
|||||||
protected void validateCreate(TenantId tenantId, Asset asset) {
|
protected void validateCreate(TenantId tenantId, Asset asset) {
|
||||||
DefaultTenantProfileConfiguration profileConfiguration =
|
DefaultTenantProfileConfiguration profileConfiguration =
|
||||||
(DefaultTenantProfileConfiguration)tenantProfileCache.get(tenantId).getProfileData().getConfiguration();
|
(DefaultTenantProfileConfiguration)tenantProfileCache.get(tenantId).getProfileData().getConfiguration();
|
||||||
|
if (!TB_SERVICE_QUEUE.equals(asset.getType())) {
|
||||||
long maxAssets = profileConfiguration.getMaxAssets();
|
long maxAssets = profileConfiguration.getMaxAssets();
|
||||||
validateNumberOfEntitiesPerTenant(tenantId, assetDao, maxAssets, EntityType.ASSET);
|
validateNumberOfEntitiesPerTenant(tenantId, assetDao, maxAssets, EntityType.ASSET);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateUpdate(TenantId tenantId, Asset asset) {
|
protected void validateUpdate(TenantId tenantId, Asset asset) {
|
||||||
|
|||||||
@ -39,12 +39,13 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static org.thingsboard.server.dao.asset.BaseAssetService.TB_SERVICE_QUEUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Valerii Sosliuk on 5/19/2017.
|
* Created by Valerii Sosliuk on 5/19/2017.
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao {
|
public class JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao {
|
||||||
public static final String TB_SERVICE_QUEUE = "TbServiceQueue";
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssetRepository assetRepository;
|
private AssetRepository assetRepository;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user