It's all about the answers!

Ask a question

How to obatain TeamArea in service plugin?


Rakesh Kukkamalla (565) | asked Jul 02 '08, 8:12 p.m.
How can we get the team area in the service plugin? In my service plugin I have a small method which takes in string parameters and saves it to the repository. I want to add a server-side operation and advisor, and I would need a team area object. Do I need to pass additional parameters from the client down to the service for that purpose? Can anyone give me sample code to get the team area?

12 answers



permanent link
Kai-Uwe Maetzel (85611) | answered Jul 03 '08, 11:52 a.m.
JAZZ DEVELOPER
The question you have to answer is what defines the relationship between
the string you try to save and the team area. When the end user defines
this relationship for example in an input dialog or by making a
selection then you have to pass it to the server. If, for example, the
value of the string (I don't think so but let's continue that thought
experiment...) contains enough information to compute the team area, you
don't have to pass that information to the sever explicitly.

What defines the relationship in your case?

Kai
Jazz Process Team

rkukkama wrote:
How can we get the team area in the service plugin? In my service
plugin I have a small method which takes in string parameters and
saves it to the repository. I want to add a server-side operation and
advisor, and I would need a team area object. Do I need to pass
additional parameters from the client down to the service for that
purpose? Can anyone give me sample code to get the team area?

permanent link
Jared Burns (4.4k29) | answered Jul 03 '08, 11:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi, Rakesh.

When you define a process-enabled operation, you are responsible for
determining which team area is associated with that operation. How this
decision is made is totally up to you. Typically, this is done by
modeling some relationship between a team area and the artifacts being
modified by the operation.

For example, the operation which delivers change sets to a stream gets
its team area by looking at the target stream and asking it for its
owner. This "owner" relationship is a modeled field on the stream
artifact which points to a team area.

In case you haven't already found it, here's a pointer to our Developer
Guide:
https://jazz.net/wiki/bin/view/Main/TeamProcessDeveloperGuide

Jared Burns
Jazz Process Team


rkukkama wrote:
How can we get the team area in the service plugin? In my service
plugin I have a small method which takes in string parameters and
saves it to the repository. I want to add a server-side operation and
advisor, and I would need a team area object. Do I need to pass
additional parameters from the client down to the service for that
purpose? Can anyone give me sample code to get the team area?

permanent link
Rakesh Kukkamalla (565) | answered Jul 03 '08, 4:15 p.m.
Thank you very much for your replies. The string that is being passed is a review component (that i am writing), which is in turn tied to a work item.

So I guess from your replies I would need to get the team area from the work item? Can you please provide code how I can do that? Is it through the Contributor who created the work item?

permanent link
Darin Swanson (3161) | answered Jul 03 '08, 4:36 p.m.
....
ICategoryHandle categoryHandle = workItem.getCategory();
ICategory category =
teamRepository.itemManager().fetchCompleteItem(categoryHandle,
IItemManager.REFRESH, progressMonitor);
List teamAreas = category.getAssociatedTeamAreas();
....

This will give you all the associated team area handles across development
lines based on the work item category of the work item.

HTH
Darins
Jazz Process Team

"rkukkama" <rakesh> wrote in message
news:g4jc5k$i2m$1@localhost.localdomain...
Thank you very much for your replies. The string that is being passed
is a review component (that i am writing), which is in turn tied to a
work item.

So I guess from your replies I would need to get the team area from
the work item? Can you please provide code how I can do that? Is it
through the Contributor who created the work item?

permanent link
John Vasta (2.6k15) | answered Jul 03 '08, 6:19 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Just wanted to point out an alternative approach that is a bit simpler and would match the behavior of the work item component itself (when it determines which team area is implied by a work item). More than just the category could be taken into account in determining the team area. The method IWorkItemCommon#findProcessArea has this documentation:

* Returns a handle of the process area the given work item is associated
* with. This is either a team area of the work item's project area or
* the work item's project area itself if no team area could be found.
*
* The team area is computed based on the work item's Filed Against category
* and Planned For iteration. It is the team area in {@link ICategory#getAssociatedTeamAreas()}
* of the same development as the Planned For iteration iff that exists, or
* {@link ICategory#getDefaultTeamArea()} otherwise.

So you would just call IWorkItemCommon#findProcessArea with the handle of a work item and a progress monitory.

John
Jazz CQ Connector Team

permanent link
Rakesh Kukkamalla (565) | answered Jul 03 '08, 8:01 p.m.
Thank you very much. That helps :D

permanent link
Rakesh Kukkamalla (565) | answered Jul 07 '08, 6:45 p.m.
I am getting errors accessing the CategoryHandle of a work item. It says that the category handle has not been set.

I also tried to use the IWorkItemCommon method which gives the team area but I dont know how to get an instance of that class.

Is there any other way to get the team area of a work item? In the work item editor I could see the team area a work item belongs to. How can I get that particular team area. Can you please provide code.

Thank you.

permanent link
Darin Swanson (3161) | answered Jul 07 '08, 6:51 p.m.
IWorkItemCommon workItemCommon = (IWorkItemCommon)
repository.getClientLibrary(IWorkItemClient.class);

where repository is an instanceof ITeamRepository

HTH
Darins
Jazz Process Team

"rkukkama" <rakesh> wrote in message
news:g4u6eq$ih5$1@localhost.localdomain...
I am getting errors accessing the CategoryHandle of a work item. It
says that the category handle has not been set.

I also tried to use the IWorkItemCommon method which gives the team
area but I dont know how to get an instance of that class.

Is there any other way to get the team area of a work item? In the
work item editor I could see the team area a work item belongs to.
How can I get that particular team area. Can you please provide
code.

Thank you.

permanent link
Christof Marti (681) | answered Jul 08 '08, 3:32 a.m.
Not sure what the error is you see when accessing the category, but it could be that you fetched the work item without the category property. Fetching that too should fix this, please post the exact error including the stacktrace if that's not the case.

Regards,

Christof
Jazz Work Item team


Darin Swanson wrote:
IWorkItemCommon workItemCommon = (IWorkItemCommon)
repository.getClientLibrary(IWorkItemClient.class);

where repository is an instanceof ITeamRepository

HTH
Darins
Jazz Process Team

"rkukkama" <rakesh> wrote in message
news:g4u6eq$ih5$1@localhost.localdomain...
I am getting errors accessing the CategoryHandle of a work item. It
says that the category handle has not been set.

I also tried to use the IWorkItemCommon method which gives the team
area but I dont know how to get an instance of that class.

Is there any other way to get the team area of a work item? In the
work item editor I could see the team area a work item belongs to.
How can I get that particular team area. Can you please provide
code.

Thank you.



permanent link
Rakesh Kukkamalla (565) | answered Jul 08 '08, 2:39 p.m.
I fetched the whole work item and I could get the category with it. Thanks :)

Your answer


Register or to post your answer.