It's all about the answers!

Ask a question

How to list all projects along with the creation dates?


Piotr Aniola (3.7k11738) | asked Sep 14 '15, 10:03 a.m.
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?

Accepted answer


permanent link
Piotr Aniola (3.7k11738) | answered Sep 14 '15, 10:23 a.m.
edited Sep 14 '15, 10:28 a.m.
// 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

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.