Skip to content

Commit

Permalink
adding nodeId in treeNode for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ck-c8y committed Oct 10, 2024
1 parent 43525ee commit c8ddcb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class MappingTreeNode {

private Mapping mapping;

private String nodeId;

private boolean mappingNode;

private long depthIndex;
Expand Down Expand Up @@ -93,6 +95,7 @@ public static MappingTreeNode createMappingNode(MappingTreeNode parent, String l

public MappingTreeNode() {
this.childNodes = new HashMap<String, List<MappingTreeNode>>();
this.nodeId = uuidCustom();
}

public List<MappingTreeNode> resolveTopicPath(List<String> remainingLevels) throws ResolveException {
Expand Down Expand Up @@ -338,4 +341,11 @@ private String createPathMonitoring(List<String> levels, int currentLevel) {
copyLevels.set(currentLevel, "__" + cl + "__");
return copyLevels.toString();
}

public static String uuidCustom() {
Random random = new Random();
int randomInt = random.nextInt(Integer.MAX_VALUE);
String id = Integer.toString(randomInt, 36).substring(0, 6);
return id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void serialize(
jgen.writeStartObject();
jgen.writeNumberField("depthIndex", value.getDepthIndex());
jgen.writeStringField("level", value.getLevel());
jgen.writeStringField("nodeId", value.getNodeId());
jgen.writeBooleanField("isMappingNode", value.isMappingNode());
jgen.writeStringField("parentNode",
(value.getParentNode() != null ? value.getParentNode().getAbsolutePath() : "null"));
Expand Down

0 comments on commit c8ddcb2

Please sign in to comment.