From: Brett Porter Date: Sat, 9 Sep 2006 15:47:24 +0000 (+0000) Subject: [MRM-166] select repository to show in reports page X-Git-Tag: archiva-0.9-alpha-1~563 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1a3026414e9a5c3a02d3bbb31fbf92fc388600f5;p=archiva.git [MRM-166] select repository to show in reports page git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@441799 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java index 79f84a085..73fb380c6 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java @@ -17,6 +17,7 @@ package org.apache.maven.archiva.web.action; */ import com.opensymphony.xwork.ActionSupport; +import com.opensymphony.xwork.Preparable; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ConfigurationStore; import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory; @@ -26,6 +27,7 @@ import org.apache.maven.archiva.discoverer.filter.SnapshotArtifactFilter; import org.apache.maven.archiva.reporting.ReportExecutor; import org.apache.maven.archiva.reporting.ReportingDatabase; import org.apache.maven.archiva.reporting.ReportingStore; +import org.apache.maven.archiva.reporting.ReportingStoreException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; @@ -40,6 +42,7 @@ import java.util.List; */ public class ReportsAction extends ActionSupport + implements Preparable { /** * @plexus.requirement @@ -65,33 +68,45 @@ public class ReportsAction */ private ReportExecutor executor; + private Configuration configuration; + public String execute() throws Exception { databases = new ArrayList(); - Configuration configuration = configurationStore.getConfigurationFromStore(); - - for ( Iterator i = configuration.getRepositories().iterator(); i.hasNext(); ) + if ( repositoryId != null && !repositoryId.equals( "-" ) ) { - RepositoryConfiguration repositoryConfiguration = (RepositoryConfiguration) i.next(); - - ArtifactRepository repository = factory.createRepository( repositoryConfiguration ); - - ReportingDatabase database = reportingStore.getReportsFromStore( repository ); + RepositoryConfiguration repositoryConfiguration = configuration.getRepositoryById( repositoryId ); + getReport( repositoryConfiguration ); + } + else + { + for ( Iterator i = configuration.getRepositories().iterator(); i.hasNext(); ) + { + RepositoryConfiguration repositoryConfiguration = (RepositoryConfiguration) i.next(); - databases.add( database ); + getReport( repositoryConfiguration ); + } } return SUCCESS; } + private void getReport( RepositoryConfiguration repositoryConfiguration ) + throws ReportingStoreException + { + ArtifactRepository repository = factory.createRepository( repositoryConfiguration ); + + ReportingDatabase database = reportingStore.getReportsFromStore( repository ); + + databases.add( database ); + } + public String runReport() throws Exception { // TODO: this should be one that runs in the background - see the showcase - Configuration configuration = configurationStore.getConfigurationFromStore(); - RepositoryConfiguration repositoryConfiguration = configuration.getRepositoryById( repositoryId ); ArtifactRepository repository = factory.createRepository( repositoryConfiguration ); @@ -149,4 +164,15 @@ public class ReportsAction { return databases; } + + public void prepare() + throws Exception + { + configuration = configurationStore.getConfigurationFromStore(); + } + + public Configuration getConfiguration() + { + return configuration; + } } diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp index 7e96731a3..563558d41 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp @@ -32,7 +32,12 @@
-<%-- TODO!: select report, repository and filter --%> +<%-- TODO!: select report, filter --%> + + + +