@SuppressWarnings("unchecked") private RepositoryContentStatistics constructRepositoryStatistics( ManagedRepositoryConfiguration arepo, RepositoryScanStatistics stats ) { // I hate jpox and modello <-- and so do I RepositoryContentStatistics dbstats = new RepositoryContentStatistics(); dbstats.setDuration( stats.getDuration() ); dbstats.setNewFileCount( stats.getNewFileCount() ); dbstats.setRepositoryId( stats.getRepositoryId() ); dbstats.setTotalFileCount( stats.getTotalFileCount() ); dbstats.setWhenGathered( stats.getWhenGathered() ); // total artifact count // note that when gathered is the end of the scan, so we look for all those before that time dbstats.setTotalArtifactCount( dao.getArtifactDAO().countArtifacts( new ArtifactsByRepositoryConstraint( arepo.getId(), stats.getWhenGathered(), "groupId", true ) ) ); // total repo size -- TODO: needs to exclude ignored files (eg .svn) long size = FileUtils.sizeOfDirectory( new File( arepo.getLocation() ) ); dbstats.setTotalSize( size ); // total unique groups List<String> repos = new ArrayList<String>(); repos.add( arepo.getId() ); dbstats.setTotalGroupCount( dao.count( new UniqueGroupIdConstraint( repos ) ) ); dbstats.setTotalProjectCount( dao.count( new UniqueArtifactIdConstraint( arepo.getId(), true ) ) ); return dbstats; }