projectGroup.setBuildDefinitions( processBuildDefinitions( projectGroup.getBuildDefinitions(),
schedules, profiles, buildDefinitions ) );
for ( Iterator j = projectGroup.getProjects().iterator(); j.hasNext(); )
{
Project project = (Project) j.next();
project.setBuildDefinitions( processBuildDefinitions( project.getBuildDefinitions(),
schedules, profiles, buildDefinitions ) );
}
if ( projectGroup.getLocalRepository() != null )
{
projectGroup.setLocalRepository( localRepositories.get(
Integer.valueOf( projectGroup.getLocalRepository().getId() ) ) );
}
projectGroup = (ProjectGroup) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), projectGroup );
projectGroups.put( Integer.valueOf( projectGroup.getId() ), projectGroup );
}
// create project scm root data (CONTINUUM-2040)
Map<Integer, ProjectScmRoot> projectScmRoots = new HashMap<Integer, ProjectScmRoot>();
Set<Integer> keys = projectGroups.keySet();
int id = 1;
for( Integer key : keys )
{
ProjectGroup projectGroup = projectGroups.get( key );
String url = " ";
List<Project> projects =
ProjectSorter.getSortedProjects( getProjectsByGroupIdWithDependencies( pmf, projectGroup.getId() ),
log );
for ( Iterator j = projects.iterator(); j.hasNext(); )
{
Project project = (Project) j.next();
if ( !project.getScmUrl().trim().startsWith( url ) )
{
url = project.getScmUrl();
ProjectScmRoot projectScmRoot = new ProjectScmRoot();
projectScmRoot.setId( id );
projectScmRoot.setProjectGroup( projectGroup );
projectScmRoot.setScmRootAddress( url );
projectScmRoot.setState( project.getState() );
projectScmRoot = (ProjectScmRoot) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), projectScmRoot );
projectScmRoots.put( Integer.valueOf( projectScmRoot.getId() ), projectScmRoot );
id++;
}
}
}
/*
for ( RepositoryPurgeConfiguration repoPurge : (List<RepositoryPurgeConfiguration>) database.getRepositoryPurgeConfigurations() )
{
repoPurge.setRepository( localRepositories.get(
Integer.valueOf( repoPurge.getRepository().getId() ) ) );
if ( repoPurge.getSchedule() != null )
{
repoPurge.setSchedule( schedules.get(
Integer.valueOf( repoPurge.getSchedule().getId() ) ) );
}
repoPurge = (RepositoryPurgeConfiguration) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), repoPurge );
}*/
for ( DirectoryPurgeConfiguration dirPurge : (List<DirectoryPurgeConfiguration>) database.getDirectoryPurgeConfigurations() )
{
if ( dirPurge.getSchedule() != null )
{
dirPurge.setSchedule( schedules.get(
Integer.valueOf( dirPurge.getSchedule().getId() ) ) );
}
dirPurge = (DirectoryPurgeConfiguration) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), dirPurge );
}
for ( ContinuumReleaseResult releaseResult : (List<ContinuumReleaseResult>) database.getContinuumReleaseResults() )
{
releaseResult.setProjectGroup( projectGroups.get(
Integer.valueOf( releaseResult.getProjectGroup().getId() ) ) );
ProjectGroup group = releaseResult.getProjectGroup();
for ( Project project : (List<Project>) group.getProjects() )
{
if ( project.getId() == releaseResult.getProject().getId() )
{
try
{
Project proj =
(Project) PlexusJdoUtils.getObjectById( pmf.getPersistenceManager(), Project.class, project.getId(), null );
releaseResult.setProject( proj );
}
catch ( Exception e )
{