It's all about the answers!

Ask a question

Reading the list of project Area


0
1
m sawires (1463268) | asked Aug 19 '09, 11:55 a.m.
Hello,
I'd like to know how to read a list of project area once I have a repository connection.
It looks like I need to use the api "fetchCompleteItems" but how should I initialize the list of itemHandle to return

repo.itemManager().fetchCompleteItems(projectAreaList, IItemManager.DEFAULT, monitor);


Any help is welcome. Thanks

12 answers



permanent link
Jared Burns (4.5k29) | answered Aug 19 '09, 11:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Wed, 19 Aug 2009 16:08:01 +0000, marly wrote:

Hello,
I'd like to know how to read a list of project area once I have a
repository connection.
It looks like I need to use the api "fetchCompleteItems" but how should
I initialize the list of itemHandle to return

repo.itemManager().fetchCompleteItems(projectAreaList,
IItemManager.DEFAULT, monitor);

Any help is welcome. Thanks

You need to use the Process component's client library:
IProcessItemService. This has a method to retrieve the list of all
project areas.

Retrieve the client library using:
repo.getClientLibrary(IProcessItemService.class)


--
Jared Burns
Jazz Process Team

permanent link
Christian Hoertnagl (6174) | answered Aug 19 '09, 12:31 p.m.
marly wrote:
I'd like to know how to read a list of project area once I have a
repository connection.

Something like this might work:

IProcessItemService processItemService =
(IProcessItemService)teamRepository.getClientLibrary(IProcessItemService.class);

for (Object obj:
processItemService.findAllProjectAreas(IProcessClientService.ALL_PROPERTIES,
null)) {
IProjectArea projectArea = (IProjectArea)obj;
// ...
}

permanent link
m sawires (1463268) | answered Aug 19 '09, 12:33 p.m.
I think I got it using

IProcessItemService client = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);


List projectAreas = client.findAllProjectAreas(IProcessClientService.ALL_PROPERTIES, null);

permanent link
radhika bandari (10675) | answered Dec 22 '11, 6:55 a.m.
Hi,

I want to get the projectAreaHandle of a specific project using plan java code(Serve libraries only, need to deploy Operation advisor in server).
I tried below code

IProcessService IPS = getService(IProcessService.class);
IProcessServerService processService = getService(IProcessServerService.class);
String uri = processService.getURIForProcessArea(ipah1);
System.out.println("URI........."+uri);
IAuditableCommon iac = ((ISaveParameter) data).getSaveOperationParameter().getAuditableCommon();
IProjectArea projectArea2 = (IProjectArea)iac.findProcessAreaByURI(URI.create("https://radhikabandari.in.ibm.com:9443/ccm/process/project-areas/_cgoIABWmEeGnN4lxE3OfSw"), ItemProfile.PROJECT_AREA_FULL, monitor);

The method findProcessAreaByURI() is returning null.
Any help would be appreciated.

Thanks & Regards
Radhika

permanent link
sam detweiler (12.5k6195201) | answered Dec 22 '11, 8:26 a.m.
URI.create("https://radhikabandari.in.ibm.com:9443/ccm/process/project-areas/_cgoIABWmEeGnN4lxE3OfSw"

thats the wrong URI.. they never will include the server address..

you may have to look thru the source to get the right URI syntax.

Sam

permanent link
Henry Armburg Jennings (13076) | answered Dec 22 '11, 8:46 a.m.
Hi Radhika,

You shouldn't need to find the project area by its full URI. Connecting to the repository should get you the ITeamRepository object for "https://radhikabandari.in.ibm.com:9443/ccm" and then it looks like this is the UUID of the project area "_cgoIABWmEeGnN4lxE3OfSw" so search for the project area by UUID. Here is a method that I wrote which gets it by name, I'm sure you could pass it the UUID instead of the name:

    public static IProjectArea getProjectArea(ITeamRepository repo,IProgressMonitor monitor,String projectAreaName) throws TeamRepositoryException{


IProcessItemService service = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
List projectAreas = service.findAllProjectAreas(null, monitor);

int projectAreasSize = projectAreas.size();
for(int i = 0; i < projectAreasSize; i++){
IProjectArea projectArea = (IProjectArea)projectAreas.get(i);
if(projectArea.getName().equals(projectAreaName)){
System.out.println("Found " + projectAreaName);
IProjectArea desiredProject = projectArea;
return desiredProject;
}
else if(i + 1 == projectAreasSize){
System.out.println("Failed to find '" + projectAreaName + "'");
return null;
}
}
return null;
}


Let me know if it works,

Henry

permanent link
Martha (Ruby) Andrews (3.0k44351) | answered Dec 22 '11, 6:04 p.m.
JAZZ DEVELOPER
Hello Sam,

Try using IProcessService#findProcessArea(String, String[])
The first argument is simply the name of the project. The second argument is the array of properties you want the project area to have. This will return the project area, not its handle.
See the javadoc on the method for more details.

Martha
Jazz Developer, Process Team

URI.create("https://radhikabandari.in.ibm.com:9443/ccm/process/project-areas/_cgoIABWmEeGnN4lxE3OfSw"

thats the wrong URI.. they never will include the server address..

you may have to look thru the source to get the right URI syntax.

Sam

permanent link
radhika bandari (10675) | answered Dec 22 '11, 11:12 p.m.
Hi,

I need to work with server libraries only. I am not supposed use client libraries com.ibm.team.process.client.ProcessClient;
com.ibm.team.process.client.IProcessItemService...because I will be deploying the plugin on server.
Can you please suggest me some code using server libraries.

Thank you,
Radhika

permanent link
Kevin Gu (17131) | answered Dec 23 '11, 5:26 a.m.
JAZZ DEVELOPER
Hi,

I need to work with server libraries only. I am not supposed use client libraries com.ibm.team.process.client.ProcessClient;
com.ibm.team.process.client.IProcessItemService...because I will be deploying the plugin on server.
Can you please suggest me some code using server libraries.

Thank you,
Radhika


Hi Radhika,

I think Martha has already provided the answer, IProcessService is exactly a server side service, what you need to do are:

1. Define your own service that extends AbstractService.
2. Add com.ibm.team.process.internal.common.service.IProcessService as prerequisite.
3. Call getService(IProcessService.class) in your own service, and then follow Martha's instruction to get project area information.

Kevin
Jazz Foundation Process Team

permanent link
Henry Armburg Jennings (13076) | answered Dec 23 '11, 5:28 a.m.
Sorry Radhika, I don't know what the server libraries are, I just use anything that ships with the JPJC library which I suppose is designed for clients.

Your answer


Register or 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.