It's all about the answers!

Ask a question

RTC Java API - Reading attribute value using workitemcommon


Vignesh ramamoorthy Muniyandy (1516) | asked Jul 25 '17, 4:34 a.m.
edited Jul 25 '17, 7:51 a.m.

Hi,
     I have a working code. Where I need to verify either my understanding is correct or to find the right way to do it.

public class HandleWorkflowOnStateChangeParticipant extends AbstractService

        implements IOperationParticipant {

 

public void run(AdvisableOperation operation,

IProcessConfigurationElement participantConfig,

IParticipantInfoCollector collector, IProgressMonitor monitor)

throws TeamRepositoryException {

 

WorkItemCommon workItemCommon = (IWorkItemCommon) getService(IWorkItemServer.class);


}

}


I was creating the operation participant for the first time. Where I have a requirement to the read the attribute value. And some where in the forum I found few codes. Also, from the following links,

https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/

I am not sure how to retrieve

"fTeamRepository" 
IWorkItemCommon workItemCommon = (IWorkItemCommon ) fTeamRepository.getClientLibrary(IWorkItemCommon.class);
Now, I am able to use "workItemCommon", not by using the above line, but it is done using "getService".


Can anyone suggest me whether I did in right way using "getService". Or, how or retrieve "fTeamRepository".


Thanks.

One answer



permanent link
Ralph Schoon (57.1k23642) | answered Jul 25 '17, 3:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 25 '17, 3:31 p.m.

You have to distinguish the server and the client API. There are small differences. 
https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ is client API. The server API is very similar. However getting services and client libraries is different. See https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ for the server API. It uses

AbstractService.getService()

to get the service
IWorkItemServer 

and
IWorkItemCommon 

ITeamRepository.getClientLibrary() only works in the client API, getService() only in the server API if you extend AbstractService.

Your answer


Register or to post your answer.