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

creating a link between part and document

$
0
0

Hie All,

               I m tring to create link between part and document throgh the following code.

 

 

WTPart part = WTPart.newWTPart("MyPart", "MyPart001");
PersistenceHelper.manager.save(part);

 

WTDocument doc1 = new WTDocument().newWTDocument();
doc1.setName("Doc1");
doc1.setNumber("D001");
PersistenceHelper.manager.save(doc1);
System.out.println("Saved Document ...");

 


Folder myFolder = WorkInProgressHelper.service.getCheckoutFolder();
System.out.println("Folder name is " + myFolder.getFolderPath());


CheckoutLink checkout_lnk = WorkInProgressHelper.service.checkout(part, myFolder, "workingCopy");
System.out.println("Creating the working copy of part..");
part = (WTPart) checkout_lnk.getWorkingCopy();


System.out.println("Created working copy ...");

WTPartDescribeLink link1 = WTPartDescribeLink.newWTPartDescribeLink(part, doc1);
PersistenceHelper.manager.save(link1);
System.out.println("Saved link ...");

 

WorkInProgressHelper.service.checkin(part, null);

 

But getting the following error:-

wt.vc.wip.WorkInProgressException: java.lang.NullPointerException

Nested exception is: java.lang.NullPointerException

        at wt.fc.collections.ReferenceUtility.isInflated(ReferenceUtility.java:3

83)

        at wt.fc.collections.ReferenceUtility.getPersistable(ReferenceUtility.ja

va:263)


Viewing all articles
Browse latest Browse all 3592

Trending Articles



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