Showing
1 changed file
with
6 additions
and
0 deletions
... | ... | @@ -24,6 +24,7 @@ import com.google.common.util.concurrent.ListenableFuture; |
24 | 24 | import lombok.Data; |
25 | 25 | import lombok.NoArgsConstructor; |
26 | 26 | import lombok.extern.slf4j.Slf4j; |
27 | +import org.apache.commons.lang3.StringUtils; | |
27 | 28 | import org.apache.commons.lang3.math.NumberUtils; |
28 | 29 | import org.thingsboard.rule.engine.api.RuleNode; |
29 | 30 | import org.thingsboard.rule.engine.api.TbContext; |
... | ... | @@ -66,6 +67,8 @@ import static org.thingsboard.server.common.data.kv.Aggregation.NONE; |
66 | 67 | configDirective = "tbEnrichmentNodeGetTelemetryFromDatabase") |
67 | 68 | public class TbGetTelemetryNode implements TbNode { |
68 | 69 | |
70 | + private static final String DESC_ORDER = "DESC"; | |
71 | + | |
69 | 72 | private TbGetTelemetryNodeConfiguration config; |
70 | 73 | private List<String> tsKeyNames; |
71 | 74 | private int limit; |
... | ... | @@ -80,6 +83,9 @@ public class TbGetTelemetryNode implements TbNode { |
80 | 83 | limit = config.getFetchMode().equals(FETCH_MODE_ALL) ? MAX_FETCH_SIZE : 1; |
81 | 84 | fetchMode = config.getFetchMode(); |
82 | 85 | orderBy = config.getOrderBy(); |
86 | + if (StringUtils.isEmpty(orderBy)) { | |
87 | + orderBy = DESC_ORDER; | |
88 | + } | |
83 | 89 | mapper = new ObjectMapper(); |
84 | 90 | mapper.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, false); |
85 | 91 | mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); | ... | ... |