Problem Statement : Given top bom line, you need to expand and store all of it's child line in HashMap.
Answer is ...Checkout the below code
Load property by default when object loaded.Get the item_id against which we store the bom lineSessionService sessionService = SessionService.getService( connection );
//Set Property Policy to get the required property as default
ObjectPropertyPolicy objectpropertypolicy = new ObjectPropertyPolicy();
PolicyType policytype = new PolicyType( "BOMLine", new String [] { "bl_item_item_id" } );
objectpropertypolicy.addType(policytype );
sessionService.setObjectPropertyPolicy(objectpropertypolicy);
Expand the topline and get all child lines
StructureManagementService structureManagementService = StructureManagementService.getService(connection);
com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsInfo info = new com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsInfo();
info.parentBomLines = new BOMLine[]{ (BOMLine) topline };
info.excludeFilter = "None2";
com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsPref pref = new com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsPref();
ExpandPSAllLevelsResponse2 expandPSAllLevelsResponse = structureManagementService.expandPSAllLevels(info, pref);
for (int i = 0; i < expandPSAllLevelsResponse.output.length; i++)
{
try
{
BOMLine childline = expandPSAllLevelsResponse.output[i].parent.bomLine;
hmstructureLine.put( childline.get_bl_item_item_id(), childline );
}
catch (NotLoadedException e)
{
StringBuilder sErrorMessage = new StringBuilder();
sErrorMessage.append( "Exception occurred while fetching the item id for loaded structure. " );
throw new Exception( sErrorMessage.toString() );
}
}
Important thing above is info.excludeFilter = "None2";
if you see help document it has mention about using 'None' but it won't work (Error : Invalid enum value)
If you check service reference guide it has mentioned 'None2' value for BOMLineFilter2