Hi Andre,
Please find the full code in attached text format. In form init() method we are calling that class using below code.
MinMaxUpdateOrgTree internalOrgTreeDS;
internalOrgTreeDS = MinMaxUpdateOrgTree::construct(tree, element.getOMHierarchyType());
internalOrgTreeDS.buildTree();
In Standard F&O we have class named (RetailInternalOrgTreeDatasource) to display the organization hierarchy as tree structure on forms.
RetailInternalOrgTreeDatasource class was built in such a way that it will display all "Legal Entity's" & all LE Stores as well. i.e. STANDRAD WAS NOT A LEGAL ENTITY SPECIFIC
But our requirement was specific to current LE and also if any nodes doesn't consists child's as retail channels then that entire node must be ignored.
To achieve this requirement :-
1. Duplicated the Standard F&O class (RetailInternalOrgTreeDatasource).
2. Added conditions to display the organization hierarchy on the form w.r.t LE specific i.e. 'contoso retail usa' LE related nodes only.
3. In "getOrgTreeData" Method you can see those conditions in b/w Inline comment tags (// Custom code - START ----- // Custom code - END).
4. Condition with comments "// Condition added to ignore the Tree Nodes which doesn't consists Children as retail channel/store" is added to ignore the tree nodes which doesn't consists child as retail channel.
5. Now added condition (4th point) not working as expected.
6. our expectation was to hide the entire tree node if that node & it's children's are not a retail channels.
Example:-
1. Refer below images with org hierarchy. Now my condition was hiding only "IT Department" & "WEST".
2. Instead we want to hide the "EAST" node as well along with "IT Department" & "WEST" because in this org hierarchy setup
2.1 'EAST' & it's child's doesn't have any retail channel associated.
2.2 'WEST' is not a retail channel.


[View:/cfs-file/__key/communityserver-discussions-components-files/797/5706.MinMaxUpdateOrgTree.xml]
I hope now you understand.
Thanks & Regards,
krishna Srikanth M.