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

How to find WTPart associated to EPMDocument?

Highlighted
Newbie

How to find WTPart associated to EPMDocument?

Does anyone out there have code to find the WTPart associated to an
EPMDocument?

I have code to find WTParts associated to a WTDocument but cannot find API
to find WTParts associated to EPMDocument.
4 REPLIES 4
Highlighted

How to find WTPart associated to EPMDocument?

I had this one but it was written for an EPMDocumentMaster class. The
API should be close if you are dealing specifically with an EPMDocument
iteration.

//returns the related WTPart to the latest EPMDocument version of master

private WTPart getRelatedWTPart(Mastered master){
WTPart relatedPart;
QueryResult result;
try{

result=BuildHelper.service.getTargetsForSources(VersionControlHelper.ser
vice.allVersionsOf(master),EPMBuildLinksRule.class);
}
catch(WTException e){
System.out.println(e.getMessage());
return null;
}
if(result.hasMoreElements()){
Object o=result.nextElement();
relatedPart=(WTPart)((EPMBuildLinksRule)o).getBuildTarget();
return relatedPart;
}
return null;
}
Highlighted

How to find WTPart associated to EPMDocument?

The java way to do this is:

WTPartHelper.service.getDescribedByDocuments(WTPart part)


Return a QueryResult of Documents (WTDocuments AND EPMDocuments) that the given WTPart is being described by.

Check out the javadoc for more methods to utilize.


David DeMay


Highlighted

How to find WTPart associated to EPMDocument?


As an additional followup. This also may help you. I'm not sure what your exact use case is and whether or not you want to pass in the wtpart or the epmdocument:

There are also these other options:

EPMStructureHelper.service.navigateUsedBy(...)

That is probably more complicated so I also can pass along using

StructHelper.service with EPMDescribeLink, the role A object should be the WTPart and role B object will be the EPMDocument iteration described by.

or using PersistenceHelper.manager.navigate(); (see javadoc for this)

If you want to do a queryspec looking for a specific wtparts based on object identifier of an EPMDocument, which will also give you what you want, I can send you something.


David DeMay


Highlighted

RE: How to find WTPart associated to EPMDocument?

Hi Dave,


I'd like to get the WTDocuments linked to EPMDocuments but I can't find the exact relation in Windchill. How does this queryspec you mention look like? How can I use the method EPMStructureHelper.service.navigateUsedBy(...) to get this?


Thanks in advance,


Felipe



In Reply to Dave DeMay:



As an additional followup. This also may help you. I'm not sure what your exact use case is and whether or not you want to pass in the wtpart or the epmdocument:

There are also these other options:

EPMStructureHelper.service.navigateUsedBy(...)

That is probably more complicated so I also can pass along using

StructHelper.service with EPMDescribeLink, the role A object should be the WTPart and role B object will be the EPMDocument iteration described by.

or using PersistenceHelper.manager.navigate(); (see javadoc for this)

If you want to do a queryspec looking for a specific wtparts based on object identifier of an EPMDocument, which will also give you what you want, I can send you something.


David DeMay


Announcements