create Team Area from Server API
There are many posts on how to manage Team Areas using the client API.
In particular, to create a Team Area:
IProcessItemService processItemService = (IProcessItemService) repo.getClientLibrary(IProcessServerService.class);
ITeamArea newTeam = processItemService.createTeamArea();
But what if we need to create a Team Area from an OperationParticipant (server side)?
I haven't been able to find the proper ItemService (note that IProcessItemService belongs to the com.ibm.team.process.client package)
Has anybody dealt with this before?
|
Accepted answer
Looking thru the SDK source it seems like the com.ibm.team.process\service\internal\ProcessService should do it..
in com.ibm.team.process.service_???.jar has a method saveProcessItem() which is effectively what I use in my client side project copy utility. create a TeamArea object, populate it and then 'save' it using the save ProcessItem() api. note that the Participant is running in the context of the user that made the change, and as such may NOT have permissions to do this operation.. (save teamarea) Miguel Tomico selected this answer as the correct answer
|
One other answer
Thank you, Sam. Helpful as usual ;-)
Playing with com.ibm.team.process\service\internal\ProcessService, as you suggested, I remembered a similar class I had used in the past: IAuditableServer. It belongs to com.ibm.team.workitem.service, so I have given it a try and it seems to work.
Here's the sample code:
IAuditableServer auditableService = workItemService.getAuditableServer();
ITeamArea newTeam = (ITeamArea) auditableService.createAuditable(ITeamArea.ITEM_TYPE);
IProjectArea prj = (IProjectArea) itemService.fetchItem(newWorkItem.getProjectArea(), IRepositoryItemService.COMPLETE);
prj = (IProjectArea) prj.getWorkingCopy();
newTeam.setName("myteam");
newTeam.setProjectArea(prj);
//This assumes we already have the parent ITeamArea in parentTeam variable
prj.getTeamAreaHierarchy().addChild(parentTeam, newTeam);
List<IProcessItem> itemsToSave = new ArrayList();
itemsToSave.add(prj);
itemsToSave.add(newTeam);
auditableService.saveProcessItems(itemsToSave, monitor);
Comments
sam detweiler
commented Feb 20 '15, 11:08 a.m.
great!.. I give you an answer, then you go off on your own!!.. :-)
|
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.