It's all about the answers!

Ask a question

How to archive access groups programmatically


Sanjeev Kulkarni (331823) | asked Feb 22 '17, 2:22 a.m.

I don't see option to archive multiple access groups at one shot in web client.
We have created several access groups for test purpose which needs to be archived now. Is it possible to do it programmatically?

One answer



permanent link
Ralph Schoon (63.7k33648) | answered Feb 22 '17, 3:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Feb 22 '17, 3:13 a.m.

 Likely Yes. The code below is untested and might not work but could be some kind of stating point.



// Not sure that works
IAccessGroupService accessGroupService = (IAccessGroupService) teamRepository
.getClientLibrary(IAccessGroupService.class);

accessGroup = (IAccessGroup) accessGroup.getWorkingCopy();
//com.ibm.team.process.internal.common.service.IAccessGroupService
accessGroupService.archive(accessGroup);
//accessGroupClientService.archiveAcccessGroup(accessGroup, monitor)
accessGroupClientService.save(accessGroup, monitor);


I know this works:

IAccessGroupClientService accessGroupClientService = (IAccessGroupClientService) teamRepository
.getClientLibrary(IAccessGroupClientService.class);

And you can find accessGroups using IAuditableCommon.


Comments
Sanjeev Kulkarni commented Feb 22 '17, 5:12 a.m.

Hi Ralph,

Thanks for the response.

IAccessGroupService accessGroupService = (IAccessGroupService) teamRepository

.getClientLibrary(IAccessGroupService.class);
I am working on a client side application, above code always returns me null. It's not able to fetch proper service object.

While I face some difficulty in getting it working with alternative approach suggested.
accessGroupClientService.archiveAcccessGroup(group, rtcBean.getProgressMonitor()); {Error:  Method is undefined }

 I am using RTC 6.0.2 java libraries. Am I missing something?


Ralph Schoon commented Feb 22 '17, 5:19 a.m. | edited Feb 22 '17, 5:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I searched the code and IAccessGroupService is only used in the server API using getService(). If is however the only API I found that allows to archive and delete AccessGroups. I might have overlooked something.


If you set up the development environment with the SDK as explained in the Extensions Workshop, you can search the API. I don't have the time to search the API for you. I spent as much time as I could.


Ralph Schoon commented Feb 22 '17, 8:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I had another quick look. The IAccessGroupService is not easily accessible. You can get the IAccessGroupClientService 


IAccessGroupClientService accessGroupClientService = (IAccessGroupClientService) teamRepository
.getClientLibrary(IAccessGroupClientService.class);

Which internally uses IAccessGroupService but does not expose the API to archive and delete access groups. 

You can look up how that class gets the IAccessGroupService and try to get it in a similar way, but it is basically using internal APIs if you achieve that goal.  

Your answer


Register or 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.