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

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.

0 votes



2 answers

Permanent link
if you have the item (file/versionable) UUID you can get is item handle via (for example)
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..

0 votes


Permanent link
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.

0 votes

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);

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
× 56
× 1

Question asked: Jun 10 '14, 8:52 a.m.

Question was seen: 4,757 times

Last updated: Jun 10 '14, 4:24 p.m.

Confirmation Cancel Confirm