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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

how to checkout the workspace object through api

GS_10707985
4-Participant

how to checkout the workspace object through api

I added the epm document to workspace though api, and i want to check out the added EPM document from the workspace.

 

this is my code 

private void addToWorkspace(EPMDocument doc) {

try {

wt.fc.ReferenceFactory referencefactory = new wt.fc.ReferenceFactory();

wt.fc.WTReference wtreference = referencefactory.getReference(doc);

wt.epm.EPMDocument epm = (wt.epm.EPMDocument) wtreference.getObject();

 

System.out.println("epm-->"+epm);

 

wtreference = referencefactory.getReference("OR:wt.epm.workspaces.EPMWorkspace:1150900");

 

wt.epm.workspaces.EPMWorkspace workspace= (wt.epm.workspaces.EPMWorkspace) wtreference.getObject();

 

System.out.println("workspace-->"+workspace);

 

//Get the EPMDocument configuration

 

wt.epm.workspaces.EPMAsStoredConfigSpec asStored = wt.epm.workspaces.EPMAsStoredConfigSpec.newEPMAsStoredConfigSpec(epm);

 

wt.fc.QueryResult queryResult = wt.epm.structure.EPMStructureHelper.service.navigateReferencesToIteration(epm, null, true, asStored);

 

//To add to workspace, set some collection

 

wt.fc.collections.WTHashSet collection = new wt.fc.collections.WTHashSet();

 

collection.add(epm);

// Add to workspace

wt.epm.workspaces.EPMWorkspaceHelper.manager.addToWorkspace(workspace, collection);

 

//Get check out folder for the current user in the session

wt.folder.Folder checkoutFolder1 = wt.vc.wip.WorkInProgressHelper.service.getCheckoutFolder();

 

//Check out object

wt.vc.wip.CheckoutLink chklink1 = wt.vc.wip.WorkInProgressHelper.service.checkout(epm, checkoutFolder1, "Check out comment");

wt.epm.EPMDocument wrk1 = (wt.epm.EPMDocument) chklink1.getWorkingCopy();

 

} catch (WTException | WTPropertyVetoException e) {

e.printStackTrace();

}

}

 

 

 this is coming like this, i wanted to checkout from workspace

GS_10707985_0-1712029394578.png

 

2 REPLIES 2

Hello @GS_10707985,

 

Thank you for using PTC Community!

Did you get a chance to search our knowledge base?

There are several knowledge base articles around this topic. Please click on the above hyperlink and review if any of those articles help to answer your question.

Use your PTC.com username and password to login.

 

If a certain article helps, please post that article link here & mark it as a solution. It will surely help other users who may have a similar question.

 

Hope this helps.

 

Thanks & Regards,

Community Moderation Team.

 

 

 

 

 

 


 

Hi @GS_10707985 

Try to use follwoing workspace chekout method

public WTValuedMap checkout(EPMWorkspace var1, WTCollection var2) throws WTException

PetrH

Announcements

Top Tags