Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

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

$
0
0

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();

  }

  }


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>