package geo.limited.windchill;
import wt.fc.QueryResult;
import wt.part.WTPart;
import wt.part.WTPartUsageLink;
import wt.vc.VersionControlHelper;
import wt.vc.config.LatestConfigSpec;
import wt.vc.struct.StructHelper;
public class RetrivingChildParts {
public void getPartStructure(WTPart parentPart) throws Exception {
System.out.println("In getPartStructure!!"+parentPart.getNumber());
LatestConfigSpec lcs = new LatestConfigSpec();
QueryResult usesLinks = StructHelper.service.navigateUses(parentPart, false);
System.out.println("usesLinks :"+usesLinks);
while(usesLinks.hasMoreElements()){
//FileWriter writer = new FileWriter(path, true);
WTPartUsageLink usageLink = (WTPartUsageLink) usesLinks.nextElement();
System.out.println(usageLink);
WTPart childPart = (WTPart) lcs.process(VersionControlHelper.service.allVersionsOf(usageLink.getUses())).nextElement();
getPartStructure(childPart);
}
}
}