Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
"Feofilov Ivan" wrote:
Hello, if yor interesting I coud post java code for get last version and iteration of any Windchill object. Why that can't do you programmer?
Hi Ivan,
Please share your java code for getting last version and iteration of any Windchill object.
Thanks in advance.
Hello Ivan,
Can you post the code please?
Ravin Kayasth
Hi Ravin,
You can use this code
/**
* Get latest Object.
*
* @param master
* Provide Master of the part.
* @return returns the latest object of related Part.
* @exception wt.util.WTException
* throws {@link wt.util.WTException}
*/
public static wt.enterprise.RevisionControlled getLatestObject(
wt.enterprise.Master master) throws wt.util.WTException {
if (master == null) {
throw new wt.util.WTException("Master can't be null");
}
QueryResult queryResult = null;
wt.enterprise.RevisionControlled latestObject = null;
try {
/* This method will return all the latest iteration of all the revision. */
queryResult = wt.vc.VersionControlHelper.service
.allVersionsOf(master);
if (queryResult.hasMoreElements()) {
latestObject = (wt.enterprise.RevisionControlled) queryResult
.nextElement();
}
} catch (wt.pom.PersistenceException e) {
e.printStackTrace();
}
return latestObject;
}
Have a look in this thread http://communities.ptc.com/thread/53151?tstart=0
Thanks,
Kaushik