Search in sources :

Example 1 with ComponentDescriptorEntity

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

the class CassandraBaseComponentDescriptorDao method findByClazz.

@Override
public ComponentDescriptor findByClazz(String clazz) {
    log.debug("Search component entity by clazz [{}]", clazz);
    Select.Where query = select().from(getColumnFamilyName()).where(eq(ModelConstants.COMPONENT_DESCRIPTOR_CLASS_PROPERTY, clazz));
    log.trace("Execute query [{}]", query);
    ComponentDescriptorEntity entity = findOneByStatement(query);
    if (log.isTraceEnabled()) {
        log.trace("Search result: [{}] for component entity [{}]", entity != null, entity);
    } else {
        log.debug(SEARCH_RESULT, entity != null);
    }
    return DaoUtil.getData(entity);
}
Also used : Select(com.datastax.driver.core.querybuilder.Select) ComponentDescriptorEntity(org.thingsboard.server.dao.model.nosql.ComponentDescriptorEntity)

Example 2 with ComponentDescriptorEntity

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

the class CassandraBaseComponentDescriptorDao method saveIfNotExist.

@Override
public Optional<ComponentDescriptor> saveIfNotExist(ComponentDescriptor component) {
    ComponentDescriptorEntity entity = new ComponentDescriptorEntity(component);
    log.debug("Save component entity [{}]", entity);
    Optional<ComponentDescriptor> result = saveIfNotExist(entity);
    if (log.isTraceEnabled()) {
        log.trace("Saved result: [{}] for component entity [{}]", result.isPresent(), result.orElse(null));
    } else {
        log.debug("Saved result: [{}]", result.isPresent());
    }
    return result;
}
Also used : ComponentDescriptor(org.thingsboard.server.common.data.plugin.ComponentDescriptor) ComponentDescriptorEntity(org.thingsboard.server.dao.model.nosql.ComponentDescriptorEntity)

Aggregations

ComponentDescriptorEntity (org.thingsboard.server.dao.model.nosql.ComponentDescriptorEntity)2 Select (com.datastax.driver.core.querybuilder.Select)1 ComponentDescriptor (org.thingsboard.server.common.data.plugin.ComponentDescriptor)1