Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi All,
I can get all epmdocument which are linked with WTPart by following code:
Here "part" is variable.
QueryResult qr2 = WTPartHelper.service.getDescribedByDocuments(part);
But, Is there any way to get WTPart from its EPMDocument?. If possible, please provide sample code.
Regards
Saravanan
Dear Avinash,
Excellent!!!. Your code is working fine.
Thanks
Saravanan
I have used:
import com.ptc.windchill.cadx.common.util.AssociateUtilities;
import com.ptc.windchill.cadx.common.util.ObjectDependencyUtility;
WTPart wtpList[] = ObjectDependencyUtility.getAssociated((EPMDocument)epmdoc);
if( wtpList != null ) {
System.out.println( "\tAssociated EPMDoc length (wtpList.length): " + wtpList.length+"\n");
for (int y = 0; y < wtpList.length; y++ ) {
WTPart wtpAssoc = null;
wtpAssoc = (WTPart)wtpList[y];
System.out.println( "Found Existing WTPart Number Association to ("+y+"):");
System.out.println( "WTPart Number: "+ wtpAssoc.getNumber() + ", WTPart Name: " + wtpAssoc.getName());
System.out.println( "WTPart Version: " + wtpAssoc.getVersionIdentifier().getValue() + "."+wtpAssoc.getIterationIdentifier().getValue()+"\n");
}
}
that way yo get active & passive wtpart associations.
L Jett
All,
I know this is an old thread, however, I am trying to expand on it a little. I am specifically trying to get the associated WTPart(s) from the EPMDoc (primaryBusinessObject) and then set the LC state of the WTParts accordingly.
This is what I tried:
//get the object that is described by the epm document
java.lang.Object wtpart = com.ptc.windchill.cadx.common.util.AssociateUtilities.getAssociatedObjects((wt.epm.EPMDocument)primaryBusinessObject);while (wtpart.hasMoreElements()){
//set the state of the described object to RELEASED
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(((wt.lifecycle.LifeCycleManaged)wtpart.nextElement()),wt.lifecycle.State.toState("RELEASED"),true);}
If you have epm document then you can get the WTPart related to document below API
QueryResult qr= PersistenceHelper.manager.navigate(epmdocument, EPMBuildRule.BUILD_TARGET_ROLE, EPMBuildRule.class,true);
Iterate the QureyResult to get the WTPart
Is there a way by which we can get the related ID, just like this