Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How do I get IFolder from IFolderHandle?

I want to fetch the parent folder of a file in SCM. I am able to fetch the file from changesets and from the file I can get parent folder's IFolderHandle. How do I translate it to IFolder?

0 votes



2 answers

Permanent link

From a file version in a change set, you know which folder item is its parent, but you don't know which version of that folder item to select ... you need a configuration context (baseline, stream) to identify the version.

0 votes

Comments

Thanks for quick response, but how do I fetch the baseline and stream info from changeset?


Permanent link

Anyway, using the standard method to get an object from its handle (with the server-side Java SDK):


IFolderHandle folderHandle = ....;
// "this" is the current Java class, in this case the plugin (extension) that is running
AbstractService pluginAbstractService = (AbstractService) this;
IRepositoryItemService repositoryItemService = pluginAbstractService.getService(IRepositoryItemService.class);
IFolder folder = (IFolder) repositoryItemService.fetchItem(folderHandle, IRepositoryItemService.COMPLETE);

0 votes

Comments

Exception in thread "main" java.lang.ClassCastException: com.ibm.team.filesystem.common.internal.impl.FileItemHandleImpl cannot be cast to com.ibm.team.repository.common.IManagedItemHandle



Getting this error if I use standard method.

It looks like a casting error.

Check the class of the first argument of the fetchItem method.
It seems that you are trying to get a IManagedItem object, but the first argument of the fetchItem method is a FileItemHandle object.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Apr 16 '19, 12:39 a.m.

Question was seen: 1,557 times

Last updated: Apr 16 '19, 6:56 a.m.

Confirmation Cancel Confirm