Obtain file given stream and itemID (API)
Given a stream and an itemID uuid, how can I obtain a file item handle efficiently using the API? I know I could always traverse every file in the stream and compare id's but that takes too long to do.
|
2 answers
if you have the item (file/versionable) UUID you can get is item handle via (for example)
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.. |
From your stream, get your IWorkspaceConnection.
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
sam detweiler
commented Jun 10 '14, 10:13 a.m.
>how can I obtain a file item handle efficiently using the API
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.
Mark Richardson
commented Jun 10 '14, 4:11 p.m.
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?
sam detweiler
commented Jun 10 '14, 4:24 p.m.
it was a sample
|
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.