cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get actual Iteration version of WTPartMaster

SOLVED
VINO
Visitor

How to get actual Iteration version of WTPartMaster

I'm passing WTPart roleA(parent) object in a query of UsageLink object i'm getting roleB(child) objects.Here the roleB objects which I'm getting are the WTPartMaster..

How can I get the actual Iteration of child object which has been attached to parent part??

Thanks

vignesh

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to get actual Iteration version of WTPartMaster

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

View solution in original post

2 REPLIES 2

Re: How to get actual Iteration version of WTPartMaster

Hello

As you said, the usage link is to the child master

So you need to use a filter criteria to identify the Version : for example LATEST (ie latest version iteration)

regards

Re: How to get actual Iteration version of WTPartMaster

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

View solution in original post

Announcements