{
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
Map<String, PrepareBuildProjectsTask> currentPrepareBuildTasks =
getContinuum().getBuildsManager().getCurrentProjectInPrepareBuild();
Set<String> keySet = currentPrepareBuildTasks.keySet();
for ( String key : keySet )
{
PrepareBuildProjectsTask prepareBuildTask = currentPrepareBuildTasks.get( key );
PrepareBuildSummary s = new PrepareBuildSummary();
s.setProjectGroupId( prepareBuildTask.getProjectGroupId() );
s.setProjectGroupName( prepareBuildTask.getProjectGroupName() );
s.setScmRootId( prepareBuildTask.getProjectScmRootId() );
s.setScmRootAddress( prepareBuildTask.getScmRootAddress() );
s.setQueueName( key );
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 );
}
}
catch ( BuildManagerException e )
{
addActionError( e.getMessage() );
return ERROR;
}
try
{
// queued prepare builds
Map<String, List<PrepareBuildProjectsTask>> prepareBuilds =
getContinuum().getBuildsManager().getProjectsInPrepareBuildQueue();
Set<String> keySet = prepareBuilds.keySet();
for ( String key : keySet )
{
for ( PrepareBuildProjectsTask task : prepareBuilds.get( key ) )
{
PrepareBuildSummary summary = new PrepareBuildSummary();
summary.setProjectGroupId( task.getProjectGroupId() );
summary.setProjectGroupName( task.getProjectGroupName() );
summary.setScmRootId( task.getProjectScmRootId() );
summary.setScmRootAddress( task.getScmRootAddress() );
summary.setHashCode( task.getHashCode() );
summary.setQueueName( key );
prepareBuildQueues.add( summary );
}
}
}