Daniel Ferber
Daniel Ferber

Reputation: 311

Jazz RTC Java API: How to find a Project Area by name

I am working an automation for IBM Rational Team Concert (IBM aka Jazz RTC).

The java/groovy script receives the project area name and needs to retrieve information about the project area, represented by an IProjectArea instance.

Which are the required API calls? Apparently, there is no such query available in the API.

Upvotes: 1

Views: 716

Answers (1)

Daniel Ferber
Daniel Ferber

Reputation: 311

The API was not designed to search for project areas. Fortunately, there is the IProcessClientService.findProcessArea(URI areaURI, Collection properties, IProgressMonitor monitor) method:

  1. Call ITeamRepository.getClientLibrary(IProcessClientService) to get a IProcessClientService instance.
  2. Call IProcessClientService.findProcessArea(URI areaURI, Collection properties, IProgressMonitor monitor).
    • areaURI is the project area name, 'encoded as URI' (can't explain why, it is internally converted back to string). I had to URL encode de name, but assuring that white-space is encoded as %20 instead of + which would be the encoding standard.
    • I found no documentation for the properties collection. Works with null.
    • Progress monitor, may be null.
  3. The method already returns a IProcessArea instance and not IProcessAreaInstance as I first expected by comparing with similar API methods. Therefore, no 'fetch' is needed.
IProjectArea findProjectAreaByName(String name) {
  def processClient = repositoty.getClientLibrary(IProcessClientService) as IProcessClientService
  def uri = URI.create(URLEncoder.encode(name, "UTF-8").replace('+','%20'))
  return processClient.findProcessArea(uri, null, null) as IProjectArea
}

Upvotes: 1

Related Questions