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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to link WTPart to EPMDocument without checkout of WTPart

cdeshpandey
1-Visitor

How to link WTPart to EPMDocument without checkout of WTPart

Please let me which API to use to create link between WTPart and EPMDocument without checking out the WTPart..

Thanks in advance

4 REPLIES 4

About which API are you talking?

With Java code you can do something like this:

EPMDescribeLink describeLink = EPMDescribeLink.newEPMDescribeLink(wtPart, epmDocument);

PersistenceServerHelper.manager.insert(describeLink);

Hi Fabian,

Actually I was trying to link WTPart and EPMDocument, I was successful in doing so but it requires a check out of WTPart which I dont want, so asked this to get the answer.

The above code will require the WTPart Check out

chetan deshpandey wrote:

Please let me which API to use to create link between WTPart and EPMDocument without checking out the WTPart..

Thanks in advance

You can use something like the following:

EPMBuildRule buildRule = EPMBuildRule.newEPMBuildRule(epmDoc, wtPart, EPMBuildRule.BUILD_ATTRIBUTES | EPMBuildRule.BUILD_STRUCTURE | EPMBuildRule.CAD_REPRESENTATION);

WTCollection byPassIterationModifierSet = new WTHashSet();

byPassIterationModifierSet.add(buildRule);

byPassIterationModifierSet.add(wtPart);

WorkInProgressServerHelper.putInTxMapForValidateModifiable(byPassIterationModifierSet);//allows modification without checkout

buildRule = (EPMBuildRule)PersistenceHelper.manager.save(buildRule);

See also this post:

Re: Java Code to add Windchill IBA Values to WTPart Object

and this article:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS188209

Hi Chetan,

When ever we perform some operation, pre-events will be triggers which acts as check before actually performing the actual operation. Similarly, when we perform a save of EPMDescribeLink, the pre-event will check for certain conditions like whether WTPart is a working copy or not.

In order to by-pass these pre-events, use the below code which will perform the actual save operation.

EPMDescribeLink epmLink = EPMDescribeLink.newEPMDescribeLink(part, epmDoc);

Transaction localTransaction = new Transaction();

try{

  localTransaction.start();

  PersistentObjectManager.getPom().insert(epmLink, null, null);

  localTransaction.commit();

}catch(Exception e){

}

Regards

Srikanth

Announcements

Top Tags