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

We are happy to announce the new Windchill Customization board! Learn more.

How to set the EPMDocument - WTPart Association type as "Contributing content" type thru Java code?

SelvamP1
1-Newbie

How to set the EPMDocument - WTPart Association type as "Contributing content" type thru Java code?

Here is my code...

I want to change the link Association type to "contributing content" type ..any ideas?

Folder checkedout = WorkInProgressHelper.service.getCheckoutFolder();

  WTPart part = (WTPart) qr.nextElement();

  if (!(WorkInProgressHelper.isCheckedOut(part))) {

  part = (WTPart) WorkInProgressHelper.service.checkout(part, checkedout, "").getWorkingCopy();

  }else{

  if(!WorkInProgressHelper.isWorkingCopy(part)){

  part = (WTPart) WorkInProgressHelper.service.workingCopyOf(part);

  }

  }

  EPMDocument[] epmDocs = getEPMDocs(part);

  if (epmDocs != null) {

  for (int i = 0; i < epmDocs.length; i++) {

  EPMDocument epmDocument = epmDocs[i];

  BinaryLink link = GenericUtilities.findLink(part, epmDocument);

  if (!(WorkInProgressHelper.isCheckedOut(epmDocument))) {

  epmDocument = (EPMDocument) WorkInProgressHelper.service.checkout(epmDocument, checkedout, "").getWorkingCopy();

  }else{

  if(!WorkInProgressHelper.isWorkingCopy(part)){

  epmDocument = (EPMDocument) WorkInProgressHelper.service.workingCopyOf(epmDocument);

  }

  }

  AssociationType localAssociationType = AssociationType.getAssociationType(link, true);

  if (link instanceof EPMBuildRule) {

  EPMBuildRule rule = EPMBuildRule.newEPMBuildRule(epmDocument, part);

  try {

  PersistenceHelper.manager.delete(link);

  rule.setBuildType(EPMBuildRule.ALL_BUILD_ROLES);

  PersistenceHelper.manager.store(rule);

  } catch (WTPropertyVetoException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  }

  }

0 REPLIES 0
Top Tags