Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I am trying to retrieve the WTPart(s) related to an EPMDocument and WTDocument. I have the code given the WTPart to find the related EPM and WTDocs, however cannot go in the other direction. Anyone have a sample to get me started?
Thanks,
James Little
James,
Use following to get WTParts related to EPMDocument (works in 9.1 M40).
//get WTParts with active and passive links
//assuming epmDoc is a EPMDocument object
QueryResult wtpart1QR = PersistenceHelper.manager.navigate(epmDoc, EPMBuildRule.BUILD_TARGET_ROLE, EPMBuildRule.class, true);
while (wtpart1QR.hasMoreElements()){
WTPart wtp1 = (WTPart) wtpart1QR.nextElement();
System.out.println("WTPart : " + wtp1.getDisplayIdentity());
}
QueryResult wtpart2QR = PersistenceHelper.manager.navigate(epmDoc, EPMDescribeLink.DESCRIBES_ROLE, EPMDescribeLink.class, true);
while (wtpart2QR.hasMoreElements()){
WTPart wtp2 = (WTPart) wtpart2QR.nextElement();
System.out.println("WTPart : " + wtp2.getDisplayIdentity());
}
Yogesh Bagul
Hi Yogesh,
I am trying to retreive EPM related drawing. Do you have this code.
Thanks,
Serdar
Serdar
You can use below code to get the drawings related to EPMDocument.
EPMDocument document ;
QueryResult relatedDrawings = PersistenceHelper.manager.navigate(document.getMaster(), EPMReferenceLink.REFERENCED_BY_ROLE, EPMReferenceLink.class, true);
System.out.println("getting related drawing" + document.getIdentity() + "====" + relatedDrawings.size());
while (relatedDrawings.hasMoreElements()) {
System.out.println("Drawing --- >>"+ relatedDrawings.nextElement());
}
Hope this helps !!!
Thanks,
Hi Shreyas,
Thank you very much for your help.
Serdar