formatting only

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@886673 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-12-03 04:20:59 +00:00
parent 94ece43b50
commit fc37f62c5c
1 changed files with 235 additions and 224 deletions

View File

@ -140,9 +140,9 @@ public class GenerateReportAction
private DataLimits limits = new DataLimits(); private DataLimits limits = new DataLimits();
private String[] datePatterns = new String[] { "MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", private String[] datePatterns =
"dd MMMMM yyyy", "dd/MM/yy", "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", new String[]{"MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", "dd MMMMM yyyy", "dd/MM/yy",
"MM-dd-yy" }; "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", "MM-dd-yy"};
public static final String SEND_FILE = "send-file"; public static final String SEND_FILE = "send-file";
@ -153,8 +153,8 @@ public class GenerateReportAction
{ {
repositoryIds = new ArrayList<String>(); repositoryIds = new ArrayList<String>();
repositoryIds.add( ALL_REPOSITORIES ); // comes first to be first in the list repositoryIds.add( ALL_REPOSITORIES ); // comes first to be first in the list
repositoryIds.addAll( (List<String>) dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), repositoryIds.addAll( (List<String>) dao.query(
"repositoryId" ) ) ); new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) );
availableRepositories = new ArrayList<String>(); availableRepositories = new ArrayList<String>();
@ -250,12 +250,15 @@ public class GenerateReportAction
return INPUT; return INPUT;
} }
List<RepositoryContentStatistics> contentStats = repoContentStatsDao.queryRepositoryContentStatistics( List<RepositoryContentStatistics> contentStats =
new RepositoryContentStatisticsByRepositoryConstraint( selectedRepo, startDateInDF, endDateInDF ) ); repoContentStatsDao.queryRepositoryContentStatistics(
new RepositoryContentStatisticsByRepositoryConstraint( selectedRepo, startDateInDF,
endDateInDF ) );
if ( contentStats == null || contentStats.isEmpty() ) if ( contentStats == null || contentStats.isEmpty() )
{ {
addActionError( "No statistics available for repository. Repository might not have been scanned." ); addActionError(
"No statistics available for repository. Repository might not have been scanned." );
return ERROR; return ERROR;
} }
@ -264,7 +267,8 @@ public class GenerateReportAction
int totalPages = ( limits.getTotalCount() / limits.getPerPageCount() ) + extraPage; int totalPages = ( limits.getTotalCount() / limits.getPerPageCount() ) + extraPage;
limits.setCountOfPages( totalPages ); limits.setCountOfPages( totalPages );
repositoryStatistics = generator.generateReport( contentStats, selectedRepo, startDateInDF, endDateInDF, limits ); repositoryStatistics =
generator.generateReport( contentStats, selectedRepo, startDateInDF, endDateInDF, limits );
} }
catch ( ObjectNotFoundException oe ) catch ( ObjectNotFoundException oe )
{ {
@ -354,16 +358,20 @@ public class GenerateReportAction
return INPUT; return INPUT;
} }
List<RepositoryContentStatistics> contentStats = repoContentStatsDao.queryRepositoryContentStatistics( List<RepositoryContentStatistics> contentStats =
new RepositoryContentStatisticsByRepositoryConstraint( selectedRepo, startDateInDF, endDateInDF ) ); repoContentStatsDao.queryRepositoryContentStatistics(
new RepositoryContentStatisticsByRepositoryConstraint( selectedRepo, startDateInDF,
endDateInDF ) );
if ( contentStats == null || contentStats.isEmpty() ) if ( contentStats == null || contentStats.isEmpty() )
{ {
addActionError( "No statistics available for repository. Repository might not have been scanned." ); addActionError(
"No statistics available for repository. Repository might not have been scanned." );
return ERROR; return ERROR;
} }
repositoryStatistics = generator.generateReport( contentStats, selectedRepo, startDateInDF, endDateInDF, false ); repositoryStatistics =
generator.generateReport( contentStats, selectedRepo, startDateInDF, endDateInDF, false );
} }
catch ( ObjectNotFoundException oe ) catch ( ObjectNotFoundException oe )
{ {
@ -438,8 +446,8 @@ public class GenerateReportAction
return pasedSelectedRepos; return pasedSelectedRepos;
} }
private void generateReportForMultipleRepos( RepositoryContentStatisticsDAO repoContentStatsDao, private void generateReportForMultipleRepos( RepositoryContentStatisticsDAO repoContentStatsDao, Date startDateInDF,
Date startDateInDF, Date endDateInDF, boolean useLimits ) Date endDateInDF, boolean useLimits )
throws ArchivaReportException throws ArchivaReportException
{ {
for ( String repo : selectedRepositories ) for ( String repo : selectedRepositories )
@ -458,12 +466,13 @@ public class GenerateReportAction
if ( useLimits ) if ( useLimits )
{ {
repositoryStatistics.addAll( generator.generateReport( contentStats, repo, startDateInDF, endDateInDF, repositoryStatistics.addAll(
limits ) ); generator.generateReport( contentStats, repo, startDateInDF, endDateInDF, limits ) );
} }
else else
{ {
repositoryStatistics.addAll( generator.generateReport( contentStats, repo, startDateInDF, endDateInDF, true ) ); repositoryStatistics.addAll(
generator.generateReport( contentStats, repo, startDateInDF, endDateInDF, true ) );
} }
} }
catch ( ObjectNotFoundException oe ) catch ( ObjectNotFoundException oe )
@ -516,7 +525,8 @@ public class GenerateReportAction
if ( selectedRepositories.size() == 1 ) if ( selectedRepositories.size() == 1 )
{ {
input = new StringBuffer( "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count," + input = new StringBuffer(
"Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count," +
"Plugins,Archetypes,Jars,Wars,Deployments,Downloads\n" ); "Plugins,Archetypes,Jars,Wars,Deployments,Downloads\n" );
for ( RepositoryStatistics stats : repositoryStatistics ) for ( RepositoryStatistics stats : repositoryStatistics )
@ -537,7 +547,8 @@ public class GenerateReportAction
} }
else if ( selectedRepositories.size() > 1 ) else if ( selectedRepositories.size() > 1 )
{ {
input = new StringBuffer( "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count," + input = new StringBuffer(
"Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count," +
"Plugins,Archetypes,Jars,Wars,Deployments,Downloads\n" ); "Plugins,Archetypes,Jars,Wars,Deployments,Downloads\n" );
for ( RepositoryStatistics stats : repositoryStatistics ) for ( RepositoryStatistics stats : repositoryStatistics )