how to use getCreator()??
Hi all,
I need ur help, how to get creator by RTC API?
The output is..
CREATOR:com.ibm.team.repository.common.model.impl.ContributorHandleImpl@5cef5cef
(stateId: , itemId: , origin: <unset>, immutable: <unset>)
any idea?
I need ur help, how to get creator by RTC API?
if (data instanceof ISaveParameter) {
ISaveParameter param = (ISaveParameter) data;
IAuditable auditable = param.getNewState();
if (auditable instanceof IWorkItem) {
IWorkItem sourceworkItem = (IWorkItem) auditable;
System.out.println("CREATOR:"+ sourceworkItem.getCreator());
}
}
The output is..
CREATOR:com.ibm.team.repository.common.model.impl.ContributorHandleImpl@5cef5cef
(stateId: , itemId: , origin: <unset>, immutable: <unset>)
any idea?
8 answers
.getCreator returns an IAuditableHandle. It could be an instance of IContributorHandle, ITeamAreaHandle or IProjectAreaHandle (it depends on what you're looking for).
Once you have it, you can use IRepositoryItemService.fetchItem in order to get the Item from an Handle. When you got the Item (i suppose you want an IContributor) than you can get the property you need (name, email etc...).
Best Regards,
Michele.
Once you have it, you can use IRepositoryItemService.fetchItem in order to get the Item from an Handle. When you got the Item (i suppose you want an IContributor) than you can get the property you need (name, email etc...).
Best Regards,
Michele.
in one of my server plugins (which extends AbstractService) I use
basically you need to 'load' the object from the repository, using its handle. note that in my case I am loading the COMPLETE object.
(thanks for making me took at this, I only need a small portion of the data and could help the system out by reducing the size of the object load, as it will be discarded almost immediately).
IContributor rtcUser = (IContributor) itemService().fetchItem(
rtcUserHandle, IRepositoryItemService.COMPLETE);
private static IRepositoryItemService itemService=null;
private IRepositoryItemService itemService()
{
if(itemService==null)
itemService=getService(IRepositoryItemService.class);
return itemService;
}
basically you need to 'load' the object from the repository, using its handle. note that in my case I am loading the COMPLETE object.
(thanks for making me took at this, I only need a small portion of the data and could help the system out by reducing the size of the object load, as it will be discarded almost immediately).
RTC stores links to other objects as 'handles' which is a persistant linkage to the object in question. as it will be loaded into memory in many different locations over its lifetime by many parts of the system.
So, People (users) are 'contrubutors', and reference to a user is a ContributorHandle.
you must use some function to convert the handle to an object.
Sam
So, People (users) are 'contrubutors', and reference to a user is a ContributorHandle.
you must use some function to convert the handle to an object.
Sam
RTC stores links to other objects as 'handles' which is a persistant linkage to the object in question. as it will be loaded into memory in many different locations over its lifetime by many parts of the system.
So, People are 'contrubutors', and reference to a user is a ContributorHandle.
you must use some function to convert the handle to an object.
Sam
Hi Sam,
How to convert the handle to an object? sample code please..
This is my code:
how to implement your code?? because my code not extends AbstractService. Thanks.
public class HelloWorldProhibitSave implements
IOperationAdvisor {
...
public void run(AdvisableOperation operation,
IProcessConfigurationElement advisorConfiguration,
IAdvisorInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
Object data = operation.getOperationData();
if (data instanceof ISaveParameter) {
ISaveParameter param = (ISaveParameter) data;
IAuditable auditable = param.getNewState();
if (auditable instanceof IWorkItem) {
IWorkItem sourceworkItem = (IWorkItem) auditable;
System.out.println("CREATOR:"
+ sourceworkItem.getCreator().toString());
System.out.println("This work item is of type: "
+ sourceworkItem.getWorkItemType());
}
}
}
...
how to implement your code?? because my code not extends AbstractService. Thanks.