Obtain file given stream and itemID (API)
2 answers
IItemHandle handle = IComponent.ITEM_TYPE.createHandle(uuid, null);
see accepted answer here
https://jazz.net/forum/questions/94538/get-iversionablehandle-from-uuid
as for which stream (or workspace) that versionable might be in? yeesh..
Using connection.configuration(IComponentHandle) will get you your configuration based on the component where your file resides.
Then call #fetchCompleteItem on your configuration. Give it the handle that you've obtained with the method Sam described. That will give you a versionable with state that represents the file in the stream. If you get just the handle, it has no state and refers to the item in a general sense.
Comments
>how can I obtain a file item handle efficiently using the API
I think all he has is the file uuid.
how can u find what component that would be in? (in the stream he has)
It's more computation if the component isn't known. The IWorkspaceConfiguration can be retrieved to get all the component configurations in the stream. Then see if #fetchCompleteItem returns anything.
The fetchCompleteItem method expects a IVersionableHandle. IComponent.ITEM_TYPE.createHandle is creating an IItemHandle where itemHandle.isAuditable() is true (IAuditableItemHandle). How do I create one of the type IVersionableHandle?
it was a sample
uuid to ANY type handle is
type.ITEM_TYPE.createHandle(uuid, null);
so
IVersionable.ITEM_TYPE.createHandle(uuid, null);
workitem
IWorkItem.ITEM_TYPE.createHandle(uuid, null);