use of org.thingsboard.server.common.data.kv.JsonDataEntry in project thingsboard by thingsboard.
the class AbstractCassandraBaseTimeseriesDao method toKvEntry.
public static KvEntry toKvEntry(Row row, String key) {
KvEntry kvEntry = null;
String strV = row.get(ModelConstants.STRING_VALUE_COLUMN, String.class);
if (strV != null) {
kvEntry = new StringDataEntry(key, strV);
} else {
Long longV = row.get(ModelConstants.LONG_VALUE_COLUMN, Long.class);
if (longV != null) {
kvEntry = new LongDataEntry(key, longV);
} else {
Double doubleV = row.get(ModelConstants.DOUBLE_VALUE_COLUMN, Double.class);
if (doubleV != null) {
kvEntry = new DoubleDataEntry(key, doubleV);
} else {
Boolean boolV = row.get(ModelConstants.BOOLEAN_VALUE_COLUMN, Boolean.class);
if (boolV != null) {
kvEntry = new BooleanDataEntry(key, boolV);
} else {
String jsonV = row.get(ModelConstants.JSON_VALUE_COLUMN, String.class);
if (StringUtils.isNoneEmpty(jsonV)) {
kvEntry = new JsonDataEntry(key, jsonV);
} else {
log.warn("All values in key-value row are nullable ");
}
}
}
}
}
return kvEntry;
}
Aggregations