Getting taxonomy tree structure using MDM Java API
I want to display the Texonomy tree structure as displayed in the Data Manager for a taxonomy table.I am using the following code to get the parent node and children :
WebTreeNode wtn = catalog.GetHierarchy("<taxonomy table name>",<node ID>); (node ID:0 for root)
WebTreeNodeArray wtna = wtn.GetChildren();
Then I want to loop through the array to get each child node and subsequently for other sub nodes till i reach the leaf nodes.
However the problem is that the tree structure does not follow a fixed pattern , meaning to say that each node may have 0 to n child nodes.I can't figure out a logic to put all the nodes under one parent inside a List and then probably put them into a Map with name of the parent as Key.If anybody can help to device the (recursion)logic , i'll be thankful.