Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Through java i collected all the cad assemblies from the BOM in windchill and i added the Cad Assembly into the workspace, I wanted to checkout those Cad assembly from the workspace and do checkin from the solid works.
I tried the below code to checkout but it is checkout from the windchill side not from the workspace
//Get check out folder for the current user in the session
wt.folder.Folder checkoutFolder = wt.vc.wip.WorkInProgressHelper.service.getCheckoutFolder();
//Check out object
wt.vc.wip.CheckoutLink chklink = wt.vc.wip.WorkInProgressHelper.service.checkout(cad, checkoutFolder, "Check out comment");
Solved! Go to Solution.
Hi @RaikarRaghu
Soo resolve the error.
The error points you where your code has an issue.
So in your case you use some function that expects WTKeyedHashSet but you provide WTValuedMap
So you need to find the row in your code and correct it.
PetrH
Hi RR_11032239
Thank you for your question.
I encourage you to bring more details and context to your initial inquiry. This will make it easier for you to receive meaningful help from other Community members.
I created one action in the windchill UI, if we click on that action it will collect all the cad Assemblies which is associated to WTPart from the structure and the collected cad assemblies will be added to the workspace, from that workspace I wanted to checkout and checkin the cad assemblies from the workspace.i am able to do checkout but checkin is not happening, its throwing error.
This is code that i written for the checkout and checkin.
private void checkoutAndCheckin(EPMDocument copy) throws WTException {
System.out.println("We are inside the Checkout and checkin method");
try {
wt.fc.ReferenceFactory referencefactory = new wt.fc.ReferenceFactory();
wt.fc.WTReference wtreference = referencefactory.getReference(copy);
wt.epm.EPMDocument epm = (wt.epm.EPMDocument) wtreference.getObject();
wtreference = referencefactory.getReference("OR:wt.epm.workspaces.EPMWorkspace:1150900");
wt.epm.workspaces.EPMWorkspace workspace = (wt.epm.workspaces.EPMWorkspace) wtreference.getObject();
// Get the EPMDocuments in the workspace
wt.fc.collections.WTSet hvm = wt.epm.workspaces.EPMWorkspaceHelper.manager.getObjectsInWorkspace(workspace, wt.epm.EPMDocument.class);
// Check out each EPMDocument
for (java.util.Iterator<?> iterator = hvm.persistableIterator(); iterator.hasNext();) {
wt.epm.EPMDocument epmDocument = (wt.epm.EPMDocument) iterator.next();
wt.fc.collections.WTArrayList partCollection = new wt.fc.collections.WTArrayList();
partCollection.add(epmDocument);
wt.fc.collections.WTValuedMap toCheckin = (wt.fc.collections.WTValuedMap) wt.epm.workspaces.EPMWorkspaceHelper.manager
.checkout(workspace, partCollection);
// Check in each EPMDocument
wt.fc.collections.WTKeyedMap checkinMap = new wt.fc.collections.WTKeyedHashMap(toCheckin.size());
for (java.util.Iterator<?> i_objects = toCheckin.persistableIterator(); i_objects.hasNext();) {
wt.vc.wip.Workable workable = (wt.vc.wip.Workable) i_objects.next();
checkinMap.put(workable, new wt.epm.workspaces.CheckinOption("Test checkin"));
}
wt.fc.collections.WTSet checkedInObjects = wt.epm.workspaces.EPMWorkspaceHelper.manager.checkin(workspace, checkinMap);
}
} catch (WTException e) {
e.printStackTrace();
}
}
Hi @RaikarRaghu
Soo resolve the error.
The error points you where your code has an issue.
So in your case you use some function that expects WTKeyedHashSet but you provide WTValuedMap
So you need to find the row in your code and correct it.
PetrH