What is the replacement for IAuditableCommon.getPeer()
IAuditableCommon.getPeer() is marked as deprecated. GetPeer() is used in many of the advisors in the SDK. For example from the AllChildrenClosedPrecondition code:
private boolean isResolved(IAuditableCommon auditableCommon, IWorkItem workItem) { The javadoc for getPeer() says Deprecated. see ICommonServiceContext.getService(Class), AbstractService.getService(Class), ITeamRepository.getClientLibrary(Class)but there are no examples on the usage to get the IWorkItemCommon object. |
3 answers
Ralph Schoon (63.4k●3●36●46)
| answered May 09 '12, 1:24 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Kirk,
Right, thanks for the example. You can do IAudibleCommon common = (IAuditableCommon) getService(IAuditableCommon.class); because you extend AbstreactService. In Clinets/PlainJava you use ITeamrepository.getClientLibrary(). You can use getOrigin() form many objects to get to the ITeamrepository. Hope that helps. It cost me weeks to find that out.... |
Thanks Ralph! As usual the documentation is typically for those who already know the information and just need a reminder. I like examples so I put together a "template" advisor that includes the retrieval of IWorkItemCommon using AbstractService. I hope others find this useful.
package advisor.example; |
Ralph Schoon (63.4k●3●36●46)
| answered May 09 '12, 3:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Kirk,
in an precondition or follow up action or other server extension you should extend AbstractService an you can use this.getService(Serviceclass.class) to retireve the service. Honestly i have seen and created a bunch of extensions and I never stumbled upon getPeer(). In the Plain Java Client Library you use ITeamRepository.getClientLibrary(Class) to get client libraries. This is what the @see indicates, I think. |
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.