Browse Source

refactor code

pull/7016/head
Yuriy Lytvynchuk 4 years ago
parent
commit
d4b3eebb50
  1. 16
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/transform/TbRenameMsgKeysNode.java

16
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/transform/TbRenameMsgKeysNode.java

@ -37,8 +37,8 @@ import java.util.concurrent.ExecutionException;
type = ComponentType.TRANSFORMATION,
name = "rename keys",
configClazz = TbRenameMsgKeysNodeConfiguration.class,
nodeDescription = "Renames the keys in the msg data to the specified key names selected in the key mapping.",
nodeDetails = "Will fetch fields values specified in mapping. If specified field is not part of msg fields it will be ignored." +
nodeDescription = "Renames msg data keys to the new key names selected in the key mapping.",
nodeDetails = "If the key that is selected in the key mapping is missed in the msg data, it will be ignored." +
"If the msg is not a JSON object returns the incoming message as outbound message with <code>Failure</code> chain," +
" otherwise returns transformed messages via <code>Success</code> chain",
uiResources = {"static/rulenode/rulenode-core-config.js"},
@ -56,14 +56,6 @@ public class TbRenameMsgKeysNode implements TbNode {
@Override
public void onMsg(TbContext ctx, TbMsg msg) throws ExecutionException, InterruptedException, TbNodeException {
processRename(ctx, msg);
}
@Override
public void destroy() {
}
private void processRename(TbContext ctx, TbMsg msg) {
Map<String, String> renameKeysMapping = config.getRenameKeysMapping();
if (CollectionUtils.isEmpty(renameKeysMapping)) {
ctx.tellSuccess(msg);
@ -83,5 +75,9 @@ public class TbRenameMsgKeysNode implements TbNode {
}
}
}
@Override
public void destroy() {
}
}

Loading…
Cancel
Save