How can I use the Windchill API's to upload EPMDocument content files?
Hi,
I was able to create the EPMDocument, but I can not register the content file(**.mi or **.drw) with Windchill API's.
Below is the source code.
How can I use the Windchill API's to upload EPMDocument content files?
Thanks,
-----
private static void createEPMDocument(String s, String name, String cadName) {
try {
// Set owner application
EPMContextHelper.setApplication(EPMApplicationType.toEPMApplicationType("EPM"));
// Set Authoring Application (required in EPMAuthoringAppType.rbInfo)
EPMAuthoringAppType at = EPMAuthoringAppType.toEPMAuthoringAppType("COCRDRAFT");
// Set EPMDocumentType (required in EPMDocumentType.rbInfo)
EPMDocumentType dt = EPMDocumentType.toEPMDocumentType("CADCOMPONENT");
EPMDocument epmDoc = EPMDocument.newEPMDocument(null, name, at, dt, cadName);
epmDoc.setDescription("Created by TPWCreateEPMDocument.java");
// epmDoc.setInstance(true); //need family table
QueryResult qr = new QueryResult();
QuerySpec qs = new QuerySpec(wt.pdmlink.PDMLinkProduct.class);
SearchCondition sc = new SearchCondition(wt.pdmlink.PDMLinkProduct.class, wt.pdmlink.PDMLinkProduct.NAME,
SearchCondition.EQUAL, s, false);
qs.appendSearchCondition(sc);
qr = wt.fc.PersistenceHelper.manager.find(qs);
FolderHelper.assignLocation(epmDoc, "/Default",
WTContainerRef.newWTContainerRef((PDMLinkProduct) qr.nextElement()));
PersistenceHelper.manager.save(epmDoc);
} catch (WTException | WTPropertyVetoException e) {
e.printStackTrace();
}
}
-----

