Java API extending - create IFolder instance from IVersionableHandle
Hi,
Using the RTC 4.0.2 API, I build a Map of already-created component folders using IConfiguration.childEntries(). The returned map contains <key, value> of type <String, IVersionableHandle>. I would like to cast or convert one of the IVersionableHandle values to IFolder and use that IFolder to create a child folder. Is it possible to convert IVersionableHandle to IFolder?
// This returns an instance of Map:
iconfig.childEntries(ifh, monitor);
// From the Map 'value', I am able to get an IVersionableHandle:
IVersionableHandle thisVersionable = (IVersionableHandle) mapEntry.getValue();
// This line does nothing, tmp is left as null
IFolder tmp = (IFolder) thisVersionable.getFullState();
Do I need to retrieve a different type of handle, or is there a different method in IConfiguration that I might use? Thanks!
Peter
Accepted answer
As far as I can tell, you need to fetch the item that the handle represents and then you can look at what kind of item it is. The code would look like:
List{IVersionable} items = workspace.configuration(component).fetchCompleteItems(
new ArrayList{IVersionableHandle}(handles.values()), monitor);
You can then test if your Item is an IFolder and cast it. Please note, I had to replace < with { and > with } above.