cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Checkout the EPMducument/ .SLDASM from the workspace.

RaikarRaghu
10-Marble

Checkout the EPMducument/ .SLDASM from the workspace.

Use case: I have a Part Structure. I want to add all the Parts and associated EPMDocuments available in the structure, Add the structure into the workspace and then do check out all the EPMDocuments from the workspace.

 

What i did :

private void checkoutDocument(EPMDocument document) throws WTException, WTPropertyVetoException {
try {
System.out.println("Checking out document: " + document.getNumber());
if (!WorkInProgressHelper.isCheckedOut(document)) {
// Get the current user's checkout folder
Folder checkoutFolder = WorkInProgressHelper.service.getCheckoutFolder();

// CheckoutLink chilink = WorkInProgressHelper.service.checkout(document, checkoutFolder, "Check out comment");
CheckoutLink chilink = WorkInProgressHelper.service.checkout(document, checkoutFolder, WorkspaceName)
wt.epm.EPMDocument wrk = (wt.epm.EPMDocument)chilink.getWorkingCopy();
System.out.println("Document checked out successfully: " + wrk.getIdentity());
} else {
System.out.println("Document is already checked out.");
}
} catch (WTException e) {
e.printStackTrace();
throw new WTException("Error checking out document: " + e.getMessage());
}
}

ACCEPTED SOLUTION

Accepted Solutions

I got the answer,  insted of using 

CheckoutLink chilink = WorkInProgressHelper.service.checkout(document, checkoutFolder, WorkspaceName);

 

I  used :  CheckoutLink chlink = WorkInProgressHelper.service.checkout(document, workpace.getfolder(), "comment");

                EPMDocument wrk = (wt.epm.EPMDocument) chlink.getWorkingCopy();

 

View solution in original post

5 REPLIES 5

RaikarRaghu_0-1723347422878.png

 

I added all things into workspace, i did checkout also, but in the workspace it was showing. checkout by you added into some other workspace.

avillanueva
22-Sapphire II
(To:RaikarRaghu)

Can you share your log messages? I can assume you used the same workspace name for adding and checkout? Can you also hover over that workspace status icon you highlighted? Also, check the history on one of those objects. It should show you where the working copy is checked out to.

I attached the MSlogs file,

i am doing the checkout after the EPPM Document get added into the workspace, i highlighted the workspace number, in the MSLog also it sysout was showing the same workspace id:

RaikarRaghu_3-1723437933558.png

 

 

I think it was doing the checkout from the windchill side, we need to do it from the workspace side, do  you have any sample code for doing checkout the object from the  workspace.

I got the answer,  insted of using 

CheckoutLink chilink = WorkInProgressHelper.service.checkout(document, checkoutFolder, WorkspaceName);

 

I  used :  CheckoutLink chlink = WorkInProgressHelper.service.checkout(document, workpace.getfolder(), "comment");

                EPMDocument wrk = (wt.epm.EPMDocument) chlink.getWorkingCopy();

 

Announcements

Top Tags