Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Is there any way to get WTPart type Object from WTPartMaster like casting or any other method?
Solved! Go to Solution.
QueryResult linksQueryResult = VersionControlHelper.service.allVersionsOf(wtPartMaster);
WTPart wtPart = null;
boolean latestIteration = false;
while ((linksQueryResult.hasMoreElements()) && (!latestIteration))
{
WTPart tempPart = (WTPart)linksQueryResult.nextElement();
latestIteration = tempPart.isLatestIteration();
if (latestIteration)
{
wtPart = tempPart;
}
}
QueryResult linksQueryResult = VersionControlHelper.service.allVersionsOf(wtPartMaster);
WTPart wtPart = null;
boolean latestIteration = false;
while ((linksQueryResult.hasMoreElements()) && (!latestIteration))
{
WTPart tempPart = (WTPart)linksQueryResult.nextElement();
latestIteration = tempPart.isLatestIteration();
if (latestIteration)
{
wtPart = tempPart;
}
}
You cannot cast a WTPartMater into a WTPart because they are entirely different classes that are not related in a java class parent-child relationship. However, there are a lot of helper APIs to use in
wt.vc.VersionControlHelper
and
wt.vc.VersionControlService
You access the service methods using wt.vc.VersionControlHelper.service.xxxxx()
For example, one method among the many to look at is this one.
wt.vc.VersionControlHelper.service.allVersionsFrom(Versioned version), defined from the API, below.
QueryResult allVersionsFrom(Versioned version) throws WTException, PersistenceException
version
- WTException
PersistenceException