Search code examples
javaptc-windchill

How to get the original folder path of PTC Windchill Document after it is checked out


Once the WTDocument is checked out its folder path get changed to following

/username/Checked Out/yes - Copy-1

how ever the before checkout folder path looks like follows

 /Site/QATest/Test-T/20160830/upload and download/subfolder/yes - Copy-1

How can I get this original folder path even after document been checked out


Solution

  • When you checkout an object you get the Working copy of the object which is located in the checked out folder. You need to use the WIPHelper (work in progress) to get the original of the working copy. Then use the FolderHelper to get the folder.

    Something like this

    WTDocument originalDoc = (WTDocument)WIPHelper.service.getOriginalCopy(workingDoc);
    Folder folder = FolderHelper.service.getFolder(originalDoc);
    

    I don't have the javadoc so I am going from memory. I don't recall if the methods are are on service or the helper. And the getFolder method probably takes a WTCollection and returns a WTCollection but that shouldn't be too hard for you to fix.