Skip to main content
12-Amethyst
August 11, 2024
Solved

Checkout the EPMducument/ .SLDASM from the workspace.

  • August 11, 2024
  • 1 reply
  • 1443 views

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());
}
}

Best answer by RaikarRaghu

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();

 

1 reply

12-Amethyst
August 11, 2024

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
23-Emerald I
23-Emerald I
August 11, 2024

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.

12-Amethyst
August 12, 2024

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