public class HierarchyHelper extends Object
| Constructor and Description |
|---|
HierarchyHelper() |
| Modifier and Type | Method and Description |
|---|---|
static List<List<String>> |
getNewHierarchySequence(String nodeHierarchy,
String parentHierarchy,
int sequence,
List<String> hierachyCodesTaken) |
static IHierarchialReference |
getParent(Long parentId,
List hierarchy)
Do a DFS on the List-Tree and find the matching parent.
TODO: consider replace with method in DAO that will fetch this data directly? For Small trees this is fine, but for large data sets Tree traversal maybe more expensive than a database call. |
public static List<List<String>> getNewHierarchySequence(String nodeHierarchy, String parentHierarchy, int sequence, List<String> hierachyCodesTaken)
nodeHierarchy - as the Code of node causing all this shifting. If it is part of set being shifted then one has to give it extra considerationparentHierarchy - sequence - as int, What is the desired location under parentHierarchy for the current parentHierarchy elementhierachyCodesTaken, - What are the hierarchy codes already taken under parentHierarchy. This may include nodeHierarchy if it is already under same parent. (common use case)public static IHierarchialReference getParent(Long parentId, List hierarchy)
parentId - hierarchy - Copyright © 2018. All rights reserved.