It's all about the answers!

Ask a question

How to generate List of all ProjectAreas with Plain Java API


Marco Berger (144) | asked Jan 12 '12, 5:22 a.m.
Hi everyone,

I am total Newbie to RTC. I would like to know how to generate a list (String array, ...) of names of all ProjectAreas registered in a repository. I am Using the RTC Eclipse Client with Plain Java API on RTC 3.0. I am working on client side.

If anybody could help me, I would be very thankful.

Cheers,
Marco

2 answers



permanent link
Sapan Desai (5625) | answered Aug 08 '12, 2:50 p.m.
edited Aug 08 '12, 2:51 p.m.

Not sure if you are still looking for it. 


IProjectAreaHandle matchingProjectArea = null;

IItemType itemType= IProjectArea.ITEM_TYPE;

IDynamicQueryModel model= itemType.getQueryModel();

IItemQuery query= IItemQuery.FACTORY.newInstance((IItemQueryModel) model);

ItemQueryIterator<IProjectAreaHandle> iterator= new ItemQueryIterator<IProjectAreaHandle>(getAuditableCommon(), query);

List <IProjectAreaHandle> projectAreas = iterator.toList(monitor);

for (IProjectAreaHandle pa : projectAreas){

    		IProjectArea projectArea = (IProjectArea) repo.itemManager().fetchCompleteItem(pa, IItemManager.DEFAULT, monitor);
    String projectAreaName = projectArea.getName();    
    // Keep adding project area name to a list. }

Comments
Lei Li commented Jul 08 '13, 11:56 p.m.
Cannot find the class "ItemQueryIterator"?

permanent link
Ralph Schoon (63.1k33645) | answered Jul 09 '13, 2:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Marco,

you probably want to look at that example: https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/

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.