}
public ContinuumReleaseResult addContinuumReleaseResult( int projectId, String releaseId, String releaseType )
throws ContinuumException
{
ReleaseResult result;
String releaseBy = "";
if ( getConfiguration().isDistributedBuildEnabled() )
{
try
{
result = (ReleaseResult) distributedReleaseManager.getReleaseResult( releaseId );
PreparedRelease preparedRelease = distributedReleaseManager.getPreparedRelease( releaseId,
releaseType );
if ( preparedRelease != null )
{
releaseBy = preparedRelease.getReleaseBy();
}
}
catch ( ContinuumReleaseException e )
{
throw new ContinuumException( "Failed to release project: " + projectId, e );
}
catch ( BuildAgentConfigurationException e )
{
throw new ContinuumException( "Failed to release project: " + projectId, e );
}
}
else
{
result = (ReleaseResult) releaseManager.getReleaseResults().get( releaseId );
ContinuumReleaseDescriptor descriptor =
(ContinuumReleaseDescriptor) releaseManager.getPreparedReleases().get( releaseId );
if ( descriptor != null )
{
releaseBy = descriptor.getReleaseBy();
}
}
if ( result != null && getContinuumReleaseResult( projectId, releaseType, result.getStartTime(),
result.getEndTime() ) == null )
{
ContinuumReleaseResult releaseResult = createContinuumReleaseResult( projectId, releaseType, result,
releaseBy );
return addContinuumReleaseResult( releaseResult );
}