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

how to get "Referenced By Parts" from WTdocument

SOLVED
Highlighted
Newbie

how to get "Referenced By Parts" from WTdocument

I am on Windchill 9.0 M50.

My question is

how to get "Referenced By Parts" from WTdocument ?

I have checked the API and search the web, but not find the anwser.

Can someone provide any clue?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to get "Referenced By Parts" from WTdocument

Hi Ruo,

You can use this method

PartDocServiceCommand.getAssociatedRefParts(paramWTDocument);

Below is the implementation.

public static WTArrayList getAssociatedRefParts(WTDocument paramWTDocument)

/* */ throws WTException

/* */ {

/* 203 */ QueryResult localQueryResult = StructHelper.service.navigateReferencedBy(paramWTDocument.getMaster(), WTPartReferenceLink.class, true);

/* 204 */ WTArrayList localWTArrayList = new WTArrayList();

/* */ Iterator localIterator;

/* 206 */ if (localQueryResult.size() > 0) {

/* 207 */ WTValuedMap localWTValuedMap = VersionControlHelper.service.getLatestIterations(new WTArrayList(localQueryResult), false);

/* 208 */ for (localIterator = localWTValuedMap.entrySet().iterator(); localIterator.hasNext(); ) {

/* 209 */ WTValuedMap.WTValuedEntry localWTValuedEntry = (WTValuedMap.WTValuedEntry)localIterator.next();

/* 210 */ Versioned localVersioned = (Versioned)localWTValuedEntry.getValueAsPersistable();

/* 211 */ if (localVersioned instanceof WTPart) {

/* 212 */ String str = ((Workable)localVersioned).getCheckoutInfo().getState().toString();

/* */

/* 216 */ if (!(str.equals("c/o"))) {

/* 217 */ localWTArrayList.add(localVersioned);

/* */ }

/* */ }

/* */ }

/* */

/* */ }

/* */

/* 224 */ return localWTArrayList;

/* */ }

Regards,

Kaushik

3 REPLIES 3

Re: how to get "Referenced By Parts" from WTdocument

Have a look in the WTPartHelper.service.getReference... something like that

Seems to be deprecated in 9.1

or try navigateReferencedBy() method in StandardStructService

Re: how to get "Referenced By Parts" from WTdocument

Hi Ruo,

You can use this method

PartDocServiceCommand.getAssociatedRefParts(paramWTDocument);

Below is the implementation.

public static WTArrayList getAssociatedRefParts(WTDocument paramWTDocument)

/* */ throws WTException

/* */ {

/* 203 */ QueryResult localQueryResult = StructHelper.service.navigateReferencedBy(paramWTDocument.getMaster(), WTPartReferenceLink.class, true);

/* 204 */ WTArrayList localWTArrayList = new WTArrayList();

/* */ Iterator localIterator;

/* 206 */ if (localQueryResult.size() > 0) {

/* 207 */ WTValuedMap localWTValuedMap = VersionControlHelper.service.getLatestIterations(new WTArrayList(localQueryResult), false);

/* 208 */ for (localIterator = localWTValuedMap.entrySet().iterator(); localIterator.hasNext(); ) {

/* 209 */ WTValuedMap.WTValuedEntry localWTValuedEntry = (WTValuedMap.WTValuedEntry)localIterator.next();

/* 210 */ Versioned localVersioned = (Versioned)localWTValuedEntry.getValueAsPersistable();

/* 211 */ if (localVersioned instanceof WTPart) {

/* 212 */ String str = ((Workable)localVersioned).getCheckoutInfo().getState().toString();

/* */

/* 216 */ if (!(str.equals("c/o"))) {

/* 217 */ localWTArrayList.add(localVersioned);

/* */ }

/* */ }

/* */ }

/* */

/* */ }

/* */

/* 224 */ return localWTArrayList;

/* */ }

Regards,

Kaushik

Re: how to get "Referenced By Parts" from WTdocument

Thank for suggestions.

I have solved the problem.