Search in sources :

Example 1 with AssetEntity

use of org.thingsboard.server.dao.model.nosql.AssetEntity in project thingsboard by thingsboard.

the class CassandraAssetDao method findAssetsByTenantIdAndName.

@Override
public Optional<Asset> findAssetsByTenantIdAndName(UUID tenantId, String assetName) {
    Select select = select().from(ASSET_BY_TENANT_AND_NAME_VIEW_NAME);
    Select.Where query = select.where();
    query.and(eq(ASSET_TENANT_ID_PROPERTY, tenantId));
    query.and(eq(ASSET_NAME_PROPERTY, assetName));
    AssetEntity assetEntity = (AssetEntity) findOneByStatement(query);
    return Optional.ofNullable(DaoUtil.getData(assetEntity));
}
Also used : Select(com.datastax.driver.core.querybuilder.Select) AssetEntity(org.thingsboard.server.dao.model.nosql.AssetEntity)

Aggregations

Select (com.datastax.driver.core.querybuilder.Select)1 AssetEntity (org.thingsboard.server.dao.model.nosql.AssetEntity)1