private List<RepositoryStatistics> constructRepositoryStatistics(
List<RepositoryContentStatistics> repoContentStats,
String repository, Date endDate,
int start, int end )
{
ArtifactDAO artifactDao = dao.getArtifactDAO();
List<RepositoryStatistics> repoStatisticsList = new ArrayList<RepositoryStatistics>();
for( int i = start; i <= end; i++ )
{
RepositoryContentStatistics repoContentStat = (RepositoryContentStatistics) repoContentStats.get( i );
RepositoryStatistics repoStatistics = new RepositoryStatistics();
repoStatistics.setRepositoryId( repository );
// get only the latest
repoStatistics.setArtifactCount( repoContentStat.getTotalArtifactCount() );
repoStatistics.setGroupCount( repoContentStat.getTotalGroupCount() );
repoStatistics.setProjectCount( repoContentStat.getTotalProjectCount() );
repoStatistics.setTotalSize( repoContentStat.getTotalSize() );
repoStatistics.setFileCount( repoContentStat.getTotalFileCount() );
repoStatistics.setDateOfScan( repoContentStat.getWhenGathered() );
try
{
//TODO use the repo content stats whenGathered date instead of endDate for single repo reports
List<ArchivaArtifact> types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, JAR_TYPE, endDate, "whenGathered" ) );
repoStatistics.setJarCount( types.size() );
types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, WAR_TYPE, endDate, "whenGathered" ) );
repoStatistics.setWarCount( types.size() );
types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, MAVEN_PLUGIN, endDate, "whenGathered" ) );
repoStatistics.setPluginCount( types.size() );
types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, EAR_TYPE, endDate, "whenGathered" ) );
repoStatistics.setEarCount( types.size() );
types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, DLL_TYPE, endDate, "whenGathered" ) );
repoStatistics.setDllCount( types.size() );
types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, EXE_TYPE, endDate, "whenGathered" ) );
repoStatistics.setExeCount( types.size() );
types = artifactDao.queryArtifacts(
new ArtifactsByRepositoryConstraint( repository, ZIP_TYPE, endDate, "whenGathered" ) );
repoStatistics.setZipCount( types.size() );
// TODO: must need to be able to track archetypes. possible way of identifying an
// archetype is by checking if archetype.xml exists in src/main/resources/META-INF/