rtc

how to get creator and Owner info of Work item in RTC 4.0.4


how to get creator and Owner info of Work item in Rational Team Concert 4.0.4 using plain java lib .The getOwner() method of IWorkItem returns IContributorHandle type object which don't have any method to get name from this. Please help.


Solution

  • IContributor should be better suited.
    See this thread:

    Every handle class has a corresponding Item class where the 'full info' is available (handle is just some sort of pointer).

    You can use the IItemManager (ITeamRepository#itemManager()) to resolve a handle to an item (e.g. from IContributorHandle to IContributor).

    Something like this:

    IContributorHandle wkspOwnerhandle = (IContributorHandle)data.getSourceWorkspace().getOwner();   
    IItem contributerHandle = itemService.fetchItem(wkspOwnerhandle, null);
    IContributor userid = (IContributor) contributerHandle.getFullState();
    String userName = userid.getName();