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

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

How to retrieve all related objects from EPMDocument and to workspace

Pushpak
9-Granite

How to retrieve all related objects from EPMDocument and to workspace

Hello All,

How to retrieve all related objects from EPMDocument and to workspace?

Thanks.


@HelesicPetr 

1 REPLY 1


@Pushpak wrote:

Hello All,

How to retrieve all related objects from EPMDocument and to workspace?

Thanks.


@HelesicPetrMyMilestoneCard


Hello,

 

To retrieve all related objects from an EPMDocument to a workspace in Windchill, you can use the Windchill Java API. Here’s a general approach using the API:

 

 

public static void retrieveRelatedObjects(EPMDocument epmDocument) throws WTException {
    // Get the master of the EPMDocument
    EPMDocumentMaster master = (EPMDocumentMaster) epmDocument.getMaster();
    
    // Use EPMStructureHelper service to navigate the 'describes' link to get related objects
    QueryResult relatedObjects = EPMStructureHelper.service.navigateDescribedBy(master, null, false);
    
    // Iterate through the related objects
    while (relatedObjects.hasMoreElements()) {
        Persistable relatedObject = (Persistable) relatedObjects.nextElement();
        
        // Check if the related object is an EPMDocument and add it to the workspace
        if (relatedObject instanceof EPMDocument) {
            EPMDocument relatedEPMDocument = (EPMDocument) relatedObject;
            // Add logic to add the relatedEPMDocument to the workspace
        }
    }
}

 

This code snippet demonstrates how to navigate the relationships of an EPMDocument to find related objects. You would need to add your own logic to add these objects to a workspace, possibly using EPMWorkspaceHelper.manager.addToWorkspace() method.

 

I hope this solution worked for you. 

 

Best regards,

Yvonne Rhodes

Top Tags