Search in sources :

Example 1 with CustomerEntity

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

the class CassandraCustomerDao method findCustomersByTenantIdAndTitle.

@Override
public Optional<Customer> findCustomersByTenantIdAndTitle(UUID tenantId, String title) {
    Select select = select().from(CUSTOMER_BY_TENANT_AND_TITLE_VIEW_NAME);
    Select.Where query = select.where();
    query.and(eq(CUSTOMER_TENANT_ID_PROPERTY, tenantId));
    query.and(eq(CUSTOMER_TITLE_PROPERTY, title));
    CustomerEntity customerEntity = findOneByStatement(query);
    Customer customer = DaoUtil.getData(customerEntity);
    return Optional.ofNullable(customer);
}
Also used : Customer(org.thingsboard.server.common.data.Customer) CustomerEntity(org.thingsboard.server.dao.model.nosql.CustomerEntity) Select(com.datastax.driver.core.querybuilder.Select)

Aggregations

Select (com.datastax.driver.core.querybuilder.Select)1 Customer (org.thingsboard.server.common.data.Customer)1 CustomerEntity (org.thingsboard.server.dao.model.nosql.CustomerEntity)1