It's all about the answers!

Ask a question

Get the Component name from Changeset


Fatla 777 (263712) | asked Feb 25 '13, 10:45 a.m.
Hello,

I have a Componetn associated to changeset.

Now I need to get the Component name from the changeset not the .getItemId()

I have managed to fetch the IComponentHandle object.
I have been searching for a way to get the Component name from IComponentHandle. ... Can you help me into that !

    IComponentHandle component = changeSet.getComponent();
    IConfiguration configuration = workspaceConnection.configuration(component);

Thanks in advance,

Accepted answer


permanent link
Scott Crouch (48532426) | answered Feb 25 '13, 12:53 p.m.
edited Feb 25 '13, 12:54 p.m.
You should be able to use the IRepositoryItemService to get the IComponent object. From there you can get the name. Hope this helps. 
IRepositoryItemService fRepositoryItemService = getService(IRepositoryItemService.class);
IComponent c = (IComponent)fRepositoryItemService.fetchItem(changeSet.getComponent(), IRepositoryItemService.COMPLETE);
Fatla 777 selected this answer as the correct answer

Comments
Fatla 777 commented Feb 25 '13, 2:06 p.m.

Thanks Scott :)

One other answer



permanent link
Fatla 777 (263712) | answered Feb 25 '13, 2:06 p.m.

IProgressMonitor monitor;
ITeamRepository repository;
IComponentHandle componentHandle= changeSet.getComponent();

IComponent component = (IComponent) repository.itemManager().fetchCompleteItem(componentHandle, IItemManager.DEFAULT, monitor);
To get the component:

component.getName()

Your answer


Register or 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.