try
{
wproject = new WerkzProject();
doItAll = new Goal( "DO_IT_ALL" );
doItAll.setAction( new DummyAction() );
//Initialise all the true goals of the system
Iterator iter = projects.iterator();
while ( iter.hasNext() )
{
Project project = (Project) iter.next();
Goal projectGoal = getOrCreateGoal( project, true );
doItAll.addPrecursor( projectGoal );
}
//Now add the dependencies
iter = projects.iterator();
while ( iter.hasNext() )
{
Project project = (Project) iter.next();
Goal projectGoal = getExistingGoal( project );
Iterator depIter = project.getDependencies().iterator();
while ( depIter.hasNext() )
{
Dependency dep = (Dependency) depIter.next();
Project depProject = new Project();
depProject.setId( dep.getId() );
Goal depGoal = getOrCreateGoal( depProject, false );
projectGoal.addPrecursor( depGoal );
}
}
}
catch ( CyclicGoalChainException e )