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);
}
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;
}
Aggregations