Hi ,
Using the following method you can get child WTPart instead of WTPartMaster.
public static void getChildParts(WTPart parentPart) throws WTException
{
@SuppressWarnings("deprecation")
QueryResult queryResult= WTPartHelper.service.getUsesWTParts(parentPart, new LatestConfigSpec());
while(queryResult.hasMoreElements())
{
WTPart part=null;
Persistable[] persistable=(Persistable[])queryResult.nextElement();
part=(WTPart)persistable[1];
System.out.println(part.getName() + " Child part");
WTPartUsageLink partLink=(WTPartUsageLink)persistable[0];
}
}
and if you don't want to use deprecated method then there is another method.
public static void getChildParts(WTPart[] parentParts) throws WTException //use this method if you have to find for WTPart Array
{
WTArrayList paramWTList = new WTArrayList();
for(WTPart part : parentParts)
paramWTList.add(part);
Persistable[][][] queryResult= WTPartHelper.service.getUsesWTParts(paramWTList, new LatestConfigSpec());
for(int i=0 ; i < queryResult.length; i++)
{
System.out.println("Parent part :-" + parentParts[i].getName());
for(int j=0;j<queryResult[i].length;j++)
{
WTPart part = (WTPart)queryResult[i][j][1];
//if you need WTPartUsageLink object then change 1 to 0
System.out.println("Child Part :- " + part.getName());
}
}
}
After getting the WTPart object you can easily find the iteration and version value.
String str1 = part.getVersionInfo().getIdentifier().getValue();//for revision
String str2 = part.getIterationIdentifier().getValue();//for iteration
VersionControlHelper.getIterationDisplayIdentifier(part);
I guess from WTPartMaster there is no direct way to get the latest version and iteration without querying the database.
Thanks and Regards,
Kaushik
Message was edited by: kaushik das