// TODO set repo's stats to 0
continue;
}
// only the first one
RepositoryStatistics repositoryStats = stats.get( 0 );
repositoryStatistics.add( repositoryStats );
input.append( repo ).append( "," );
input.append( repositoryStats.getTotalFileCount() ).append( "," );
input.append( repositoryStats.getTotalArtifactFileSize() ).append( "," );
input.append( repositoryStats.getTotalArtifactCount() ).append( "," );
input.append( repositoryStats.getTotalGroupCount() ).append( "," );
input.append( repositoryStats.getTotalProjectCount() ).append( "," );
input.append( repositoryStats.getTotalCountForType( "maven-plugin" ) ).append( "," );
input.append( repositoryStats.getTotalCountForType( "maven-archetype" ) ).append( "," );
input.append( repositoryStats.getTotalCountForType( "jar" ) ).append( "," );
input.append( repositoryStats.getTotalCountForType( "war" ) );
input.append( "\n" );
}
}
else if ( selectedRepositories.size() == 1 )
{
repositoryId = selectedRepositories.get( 0 );
try
{
startDateInDF = getStartDateInDateFormat();
endDateInDF = getEndDateInDateFormat();
if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
{
addFieldError( "startDate", "Start Date must be earlier than the End Date" );
return INPUT;
}
List<RepositoryStatistics> stats = null;
try
{
stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repositoryId,
startDateInDF, endDateInDF );
}
catch ( MetadataRepositoryException e )
{
log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
}
if ( stats == null || stats.isEmpty() )
{
addActionError(
"No statistics available for repository. Repository might not have been scanned." );
return ERROR;
}
input = new StringBuilder(
"Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,"
+ "Archetypes,Jars,Wars\n" );
for ( RepositoryStatistics repositoryStats : stats )
{
input.append( repositoryStats.getScanStartTime() ).append( "," );
input.append( repositoryStats.getTotalFileCount() ).append( "," );
input.append( repositoryStats.getTotalArtifactFileSize() ).append( "," );
input.append( repositoryStats.getTotalArtifactCount() ).append( "," );
input.append( repositoryStats.getTotalGroupCount() ).append( "," );
input.append( repositoryStats.getTotalProjectCount() ).append( "," );
input.append( repositoryStats.getTotalCountForType( "maven-plugin" ) ).append( "," );
input.append( repositoryStats.getTotalCountForType( "maven-archetype" ) ).append( "," );
input.append( repositoryStats.getTotalCountForType( "jar" ) ).append( "," );
input.append( repositoryStats.getTotalCountForType( "war" ) );
input.append( "\n" );
}
repositoryStatistics = stats;
}