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

How to get folder of checked out part?

VasiliyRepecki
1-Newbie

How to get folder of checked out part?

Hi.

I need to put created child parts to the parent part folder (all i do through java code).

If parent part wasn't checked out, then folder is defined corrrectly ( for example: wt.folder.Cabinet:103501<Default>) by code FolderHelper.service.getFolder((FolderEntry) parentPart).

But if parent part was checked out then FolderHelper.service.getFolder method returns something like that: wt.folder.SubFolder:48744<Checked Out>.

How can i get first result of checked out part?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Note that this happens only when parent part is at root level of a product/library. For a subfolder, this does not happen.

The fix is, get original copy of wtpart and then get its folder.

//Code

Folder folder = FolderHelper.service.getFolder((FolderEntry) wtpart);

System.out.println("folder = " + folder + " \nFolder Name: " + folder.getName());

WTPart wtpartOriginalCopy = (WTPart) WorkInProgressHelper.service.originalCopyOf(wtpart);

folder = FolderHelper.service.getFolder((FolderEntry) wtpartOriginalCopy);

System.out.println("folder = " + folder + " \nFolder Name: " + folder.getName());

//Output

folder = wt.folder.SubFolder:7771<Checked Out>

Folder Name: Checked Out

folder = wt.folder.Cabinet:7818<Default>

Folder Name: Default

View solution in original post

1 REPLY 1

Note that this happens only when parent part is at root level of a product/library. For a subfolder, this does not happen.

The fix is, get original copy of wtpart and then get its folder.

//Code

Folder folder = FolderHelper.service.getFolder((FolderEntry) wtpart);

System.out.println("folder = " + folder + " \nFolder Name: " + folder.getName());

WTPart wtpartOriginalCopy = (WTPart) WorkInProgressHelper.service.originalCopyOf(wtpart);

folder = FolderHelper.service.getFolder((FolderEntry) wtpartOriginalCopy);

System.out.println("folder = " + folder + " \nFolder Name: " + folder.getName());

//Output

folder = wt.folder.SubFolder:7771<Checked Out>

Folder Name: Checked Out

folder = wt.folder.Cabinet:7818<Default>

Folder Name: Default

View solution in original post

Announcements