Recursively store values in data structure and getting BOM Structure level
Hi All. I have a requirement to store parts while traversing through a multi level BOM structure. So far I have been able to recursively print all the child parts but having a problem add all parts to a list or map ( only adds values of 1st level BOM but not other levels).
Here is the code I am using;
public static List<WTPart> getChildParts(WTPart parentPart) throws WTException {
ArrayList<WTPart> info = new ArrayList<WTPart>();
Map<String, List<String>> map = new HashMap<String,List<String>>();
QueryResult queryResult= WTPartHelper.service.getUsesWTParts(parentPart, new LatestConfigSpec());
// int structure = 1;
WTPart part=null;
if (queryResult != null){
while(queryResult.hasMoreElements()){
Persistable[] persistable=(Persistable[])queryResult.nextElement();
part=(WTPart)persistable[1];
printMessageToConsole(part.getNumber());
info.add(part);
//WTPartUsageLink partLink=(WTPartUsageLink)persistable[0];
getChildParts(part);
}
}
return info;
}
I am also trying to get the BOM Structure level. Is there anyway to get this using this piece of code?

