// current builds
Map<String, BuildProjectTask> currentBuildMap = getContinuum().getDistributedBuildManager().getProjectsCurrentlyBuilding();
for ( String url : currentBuildMap.keySet() )
{
BuildProjectTask task = currentBuildMap.get( url );
Project project = getContinuum().getProject( task.getProjectId() );
DistributedBuildSummary summary = new DistributedBuildSummary();
summary.setProjectId( project.getId() );
summary.setProjectName( project.getName() );
summary.setProjectGroupName( project.getProjectGroup().getName() );
summary.setBuildDefinitionId( task.getBuildDefinitionId() );
summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
summary.setHashCode( task.getHashCode() );
summary.setBuildAgentUrl( url );
currentDistributedBuilds.add( summary );
}
// prepare build queues
Map<String, List<PrepareBuildProjectsTask>> prepareBuildMap = getContinuum().getDistributedBuildManager().getProjectsInPrepareBuildQueue();
for ( String url : prepareBuildMap.keySet() )
{
for ( PrepareBuildProjectsTask task : prepareBuildMap.get( url ) )
{
ProjectGroup projectGroup = getContinuum().getProjectGroup( task.getProjectGroupId() );
PrepareBuildSummary summary = new PrepareBuildSummary();
summary.setBuildAgentUrl( url );
summary.setProjectGroupId( task.getProjectGroupId() );
summary.setProjectGroupName( projectGroup.getName() );
summary.setScmRootAddress( task.getScmRootAddress() );
summary.setScmRootId( task.getProjectScmRootId() );
summary.setHashCode( task.getHashCode() );
distributedPrepareBuildQueues.add( summary );
}
}
// build queues
Map<String, List<BuildProjectTask>> buildMap = getContinuum().getDistributedBuildManager().getProjectsInBuildQueue();
for ( String url : buildMap.keySet() )
{
for ( BuildProjectTask task : buildMap.get( url ) )
{
DistributedBuildSummary summary = new DistributedBuildSummary();
Project project = getContinuum().getProject( task.getProjectId() );
summary.setProjectId( project.getId() );
summary.setProjectName( project.getName() );
summary.setProjectGroupName( project.getProjectGroup().getName() );
summary.setBuildDefinitionId( task.getBuildDefinitionId() );
summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
summary.setHashCode( task.getHashCode() );
summary.setBuildAgentUrl( url );
distributedBuildQueues.add( summary );
}
}
return DISTRIBUTED_BUILD_SUCCESS;
}
else
{
try
{
// current prepare builds
PrepareBuildProjectsTask currentPrepareBuildTask = getContinuum().getBuildsManager().getCurrentProjectInPrepareBuild();
if ( currentPrepareBuildTask != null )
{
PrepareBuildSummary s = new PrepareBuildSummary();
s.setProjectGroupId( currentPrepareBuildTask.getProjectGroupId() );
s.setProjectGroupName( currentPrepareBuildTask.getProjectGroupName() );
s.setScmRootId( currentPrepareBuildTask.getProjectScmRootId() );
s.setScmRootAddress( currentPrepareBuildTask.getScmRootAddress() );
currentPrepareBuilds.add( s );
}
}
catch ( BuildManagerException e )
{
addActionError( e.getMessage() );
return ERROR;
}
try
{
// current builds
Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
Set<String> keySet = currentBuilds.keySet();
for ( String key : keySet )
{
BuildProjectTask buildTask = currentBuilds.get( key );
BuildProjectQueue queue = new BuildProjectQueue();
queue.setName( key );
queue.setTask( buildTask );
currentBuildProjectTasks.add( queue );
}