Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to list all projects along with the creation dates?

How to list all project areas in IBM Rational Team Concert (RTC) or (Rational Quality Manager) along with the creation dates using the Plain Java Client?

1 vote


Accepted answer

Permanent link
// get all project areas
IProcessItemService processItemService = (IProcessItemService)teamRepository.getClientLibrary(IProcessItemService.class);
		 List<?> list = processItemService.findAllProjectAreas(IProcessClientService.ALL_PROPERTIES, null);

//for each project area from the list above, get the list of handles for all recorded states
List<IProjectArea> states = teamRepository
.itemManager().fetchAllStateHandles(project, null);

//get complete states for all the handles
states = teamRepository.itemManager().fetchCompleteStates(states, null);
long firstModified = Long.MAX_VALUE;
//go through all the states...
for (int i = 0; i < states.size(); ++i) {
//...and find the one with the earliest modification date
//note that they appear on the list in random order, so you need to go through them all
IProjectAreaHandle projectState = states.get(i);
ProjectAreaImpl fullState = (ProjectAreaImpl) projectState.getFullState();
if (fullState != null) {
//check if the modification date of the current state is earlier than the earliest recorded so far
Date modified = fullState.getModified();
if (modified.getTime() < firstModified) {
//if so, this is the new earliest known modification
firstModified = modified.getTime();
}
}
}
//print results:
System.out.print(project.getName() + " ");
System.out.print(new Date(firstModified));
Ralph Schoon selected this answer as the correct answer

1 vote

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 14 '15, 10:03 a.m.

Question was seen: 3,516 times

Last updated: Sep 14 '15, 10:28 a.m.

Confirmation Cancel Confirm