Server api to get the Project area
I want to create work item in server programmatic in RTC 4.0.1. So we need the Project Area to create the work item.
Below code is to get the Project Area.
IProcessServerService processServerService = getService(IProcessServerService.class);
IProjectArea projectArea = (IProjectArea)processServerService.findProcessArea(areaUri, null);
But, How do I get the current working areaUri?
6 answers
https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation has information on how to create work items programmatically and may help get you started.
I try to provide several API examples for client and server API here. I have examples on creating work items on the server e.g. in a synchronizer on my hard drive. All examples have assumptions on the context you are using. You have to provide useful context to get help.
Lauren's link is a very valid source on how to create work items and use the given data, potentially even in your context.
You are asking complex questions without providing the required context. That makes it impossible to really help. If you can provide useful information about your context, the community might be able to help with additional examples.
If you want to find out on your own: In general if you want to create a work item in the server API, as far as I recall, you have to get a workingcopy manager, create/connect a work item, manipulate the work item working copy and save the working copy with the manager. You can search for this in the SDK.
as you've noticed the Server classes and methods are not well documented. the Javadoc only covers the client api.
but it is 'assumed' that you know that a client api also has a server side 'service' api, with similar methods.
and the process is generally the same.
get an instance of the service, and call thru it to do the work you need.
there will be a few 'services' that you will need to use to accomplish your task.
if you can write it up in client code, then its a minor change to use the services on the server side.
but you will have to dig for the info..there are no 'samples' in the SDK, but you can explode the product source bundles and scrounge around in there looking for something similar..
Ralph has done a good job of making useful samples on his blog to help with that
Thanks Ralph and Sam.
The context is described below.:
I am trying to develop a process template in CCM. And I want to add some Event Handlers and follow-up actions. In the follow-up action, we have requirement to create work items, for example, on code check-in, perform code review and create work items automatically.
Based on the process template, when we create a project area, the follow-up action should dynamically load the project area, and create the work items in that project.
The link provided has more information. Will try with the details provided. Thanks all.
Comments
Pancha, if you work in the context of a followup action, you have a work item and other related information already. Look at the posts here: https://rsjazz.wordpress.com/ for examples. The post tell client or server api, but as Sam states, if you have the client API, the server API is very similar,except you need to find the service that provides it. Looking for something in the SDK named similar to the client API typically does the trick.
Also, be aware, the documentation for the server API is in the SDK. It is not complete and all that, because, it is not "officially" supported. Only what is listed in the plain java client libraries javadoc is officially supported.
If you develop server extensions, you typically extend a server abstract service class. That also provides you with ways to access data.
IProcessItemService service = ...
List projectAreas = service.findAllProjectAreas(IProcessClientService.ALL_PROPERTIES, monitor);