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

Getting hold of an AbstractService instance from op. part.

Hi,
It's probably a really dumb question, but I am writing a WorkItem save Operation Participant, and I want to get hold of an ITeamBuildRequestService instance. Now I know AbstractService.getService() will give me that but I don't know how to get hold of an AbstractService implementing object from inside the participant.

Currently I'm doing something similar to the following, but it's deprecated so I'd like to do it the intended way but unable to work out how to get an AbstractService instance.

public void run(final AdvisableOperation operation, final IProcessConfigurationElement participantConfig, final IParticipantInfoCollector collector, final IProgressMonitor monitor)

throws TeamRepositoryException
{
final ISaveParameter saveParameter = (ISaveParameter) operation.getData();
final IAuditableCommon auditableCommon = saveParameter.getSaveOperationParameter().getAuditableCommon();
final IWorkItemServer = auditableCommon.getPeer(IWorkItemServer.class); // deprecated call
final IAuditableServer auditableServer = workItemServer.getAuditableServer();
final ITeamBuildRequestService buildService = auditableServer.getService(ITeamBuildRequestService.class) // deprecated call

// ...
}


Any help would be appreciated as I'm sure the answer is obvious - I had thought about having my OperationPartipant extend AbstractService, but that doesn't seem right as the participant isn't a service.

Thanks,
Dan

0 votes



2 answers

Permanent link
Maybe I answered my own question as there are server side operation participants in the Jazz source which extend AbstractService (com.ibm.team.reports.service.internal.process.ReportsProjectParticipant, and all of the ones in package com.ibm.team.process.internal.definitions.server) so seems that's how it should be done.

Just seems odd from as I hadn't thought of Operation Participants as Jazz Services, and I thought the Operation Participant would be passed an instance as a parameter rather than just extending AbstractService - I guess it's because I'm just used to the old way of getting passed an IAuditableCommon. Time to adjust to the new way...

0 votes


Permanent link
Did you get this to work? I tried extending AbstractService for an Operation Advisor and every time I try using the getService(IWorkItemServer.class) call, I get an exception. I am trying to use getPeer, but don't want to rely on that since it is deprecated. Thanks for any help you can provide.


Maybe I answered my own question as there are server side operation participants in the Jazz source which extend AbstractService (com.ibm.team.reports.service.internal.process.ReportsProjectParticipant, and all of the ones in package com.ibm.team.process.internal.definitions.server) so seems that's how it should be done.

...

0 votes

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,952

Question asked: Jun 04 '09, 9:21 a.m.

Question was seen: 6,419 times

Last updated: Jun 04 '09, 9:21 a.m.

Confirmation Cancel Confirm