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

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?

1

0 votes


Accepted answer

Permanent link
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

0 votes


One other answer

Permanent link
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);

0 votes

Comments

great!.. I give you an answer, then you go off on your own!!.. :-)

thanks for posting back, will help others..
I forget about that AuditableServer service!..

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

Question asked: Feb 20 '15, 8:35 a.m.

Question was seen: 2,999 times

Last updated: Feb 20 '15, 11:08 a.m.

Confirmation Cancel Confirm