Community Tip - You can change your system assigned username to something more personal in your community settings. X
I want to get the attribute of (Modified by and Created by) in CAD part, but in EPMDocumentMaster, this attribute is not exist, how can I get them by API?
One more question: Can I get all attributes of one CAD part at one time?
Who can help me?
Solved! Go to Solution.
You can get latest EPMdocument from EPMDocumentMaster and then get the necessary information.
Sample code to get the last version of EPMDocument is as follows-
QuerySpec qs = new QuerySpec(EPMDocumentMaster.class);
EPMDocumentMaster master = null;
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);
System.out.println("Number of EPM Document Masters: " + qr.size() + "\n\n");
while (qr.hasMoreElements()) {
master = (EPMDocumentMaster) qr.nextElement();
System.out.println("***** Name ->"+ master.getName());
EPMDocument latest = (EPMDocument)wt.vc.VersionControlHelper.service.allVersionsOf(master).nextElement();
String versionLatest = wt.vc.VersionControlHelper.getVersionIdentifier(latest).getValue();
System.out.println("******** Identity -> "+ latest.getIdentity());
}
You can get EPMDocument and from EPMDocument you can get creator and modifier as follows-
sample code is as follows-
EPMDocument epmdoc = ext.Search.searchCADDocByName("fixtureblock.prt");
System.out.println(epmdoc.getCreatorName());
System.out.println(epmdoc.getModifierName());
Thanks for your reply.
But your mentioned method getCreatorName() and getModifierName() are belonged to EMPDocment, my search result is EMPDocumentMaster, it don't include these methods you mentioned.
How can I get the "Created by" and "Modified by" in EMPDocumentMaster? Thanks for your help.
You can get latest EPMdocument from EPMDocumentMaster and then get the necessary information.
Sample code to get the last version of EPMDocument is as follows-
QuerySpec qs = new QuerySpec(EPMDocumentMaster.class);
EPMDocumentMaster master = null;
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);
System.out.println("Number of EPM Document Masters: " + qr.size() + "\n\n");
while (qr.hasMoreElements()) {
master = (EPMDocumentMaster) qr.nextElement();
System.out.println("***** Name ->"+ master.getName());
EPMDocument latest = (EPMDocument)wt.vc.VersionControlHelper.service.allVersionsOf(master).nextElement();
String versionLatest = wt.vc.VersionControlHelper.getVersionIdentifier(latest).getValue();
System.out.println("******** Identity -> "+ latest.getIdentity());
}
Thanks a lot for your kindly help.