From ed1fe1cb4cbf5bed3de88a226a3939dff47fbb42 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Mon, 5 Nov 2007 14:05:10 +0000 Subject: [PATCH] [MRM-540] fix regressions regarding reporting actions git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@592000 13f79535-47bb-0310-9956-ffa450edef68 --- .../action/reports/GenerateReportAction.java | 33 +++++++-- .../web/action/reports/PickReportAction.java | 70 ------------------- .../src/main/resources/xwork.xml | 8 +-- .../webapp/WEB-INF/jsp/decorators/default.jsp | 2 +- .../webapp/WEB-INF/jsp/reports/pickReport.jsp | 2 +- 5 files changed, 33 insertions(+), 82 deletions(-) delete mode 100644 archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java index 04a55adba..289bbb566 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java @@ -20,12 +20,14 @@ package org.apache.maven.archiva.web.action.reports; */ import com.opensymphony.webwork.interceptor.ServletRequestAware; +import com.opensymphony.xwork.Preparable; import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.constraints.RangeConstraint; import org.apache.maven.archiva.database.constraints.RepositoryProblemByGroupIdConstraint; import org.apache.maven.archiva.database.constraints.RepositoryProblemByRepositoryIdConstraint; import org.apache.maven.archiva.database.constraints.RepositoryProblemConstraint; +import org.apache.maven.archiva.database.constraints.UniqueFieldConstraint; import org.apache.maven.archiva.model.RepositoryProblem; import org.apache.maven.archiva.model.RepositoryProblemReport; import org.apache.maven.archiva.security.ArchivaRoleConstants; @@ -37,6 +39,7 @@ import org.codehaus.plexus.xwork.action.PlexusActionSupport; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; +import java.util.Collection; import java.util.List; /** @@ -44,7 +47,7 @@ import java.util.List; */ public class GenerateReportAction extends PlexusActionSupport - implements SecureAction, ServletRequestAware + implements SecureAction, ServletRequestAware, Preparable { /** * @plexus.requirement role-hint="jdo" @@ -71,7 +74,7 @@ public class GenerateReportAction protected int rowCount = 100; - protected boolean isLastPage = false; + protected boolean isLastPage; public static final String BLANK = "blank"; @@ -79,10 +82,28 @@ public class GenerateReportAction private static Boolean jasperPresent; - public String input() + private Collection repositoryIds; + + public static final String ALL_REPOSITORIES = "All Repositories"; + + public void prepare() + { + repositoryIds = new ArrayList(); + repositoryIds.add( ALL_REPOSITORIES ); // comes first to be first in the list + repositoryIds.addAll( + dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) ); + } + + public Collection getRepositoryIds() + { + return repositoryIds; + } + + public String execute() throws Exception { - List problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems( configureConstraint() ); + List problemArtifacts = + dao.getRepositoryProblemDAO().queryRepositoryProblems( configureConstraint() ); String contextPath = request.getRequestURL().substring( 0, request.getRequestURL().indexOf( request.getRequestURI() ) ); @@ -158,7 +179,7 @@ public class GenerateReportAction if ( groupId != null && ( !groupId.equals( "" ) ) ) { - if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( PickReportAction.ALL_REPOSITORIES ) ) ) + if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( ALL_REPOSITORIES ) ) ) { constraint = new RepositoryProblemConstraint( range, groupId, repositoryId ); } @@ -167,7 +188,7 @@ public class GenerateReportAction constraint = new RepositoryProblemByGroupIdConstraint( range, groupId ); } } - else if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( PickReportAction.ALL_REPOSITORIES ) ) ) + else if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( ALL_REPOSITORIES ) ) ) { constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId ); } diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java deleted file mode 100644 index 37e13c5c6..000000000 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.maven.archiva.web.action.reports; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import com.opensymphony.xwork.Preparable; - -import org.apache.maven.archiva.database.ArchivaDAO; -import org.apache.maven.archiva.database.constraints.UniqueFieldConstraint; -import org.apache.maven.archiva.model.RepositoryProblem; -import org.codehaus.plexus.xwork.action.PlexusActionSupport; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * PickReportAction - * - * @author Joakim Erdfelt - * @version $Id$ - * - * @plexus.component role="com.opensymphony.xwork.Action" role-hint="pickReport" - */ -public class PickReportAction - extends PlexusActionSupport - implements Preparable -{ - /** - * @plexus.requirement role-hint="jdo" - */ - protected ArchivaDAO dao; - - private Collection repositoryIds = new ArrayList(); - - public static final String ALL_REPOSITORIES = "All Repositories"; - - public void prepare() - { - repositoryIds.add( ALL_REPOSITORIES ); - repositoryIds.addAll( dao - .query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) ); - } - - public String input() - throws Exception - { - return INPUT; - } - - public Collection getRepositoryIds() - { - return repositoryIds; - } -} diff --git a/archiva-web/archiva-webapp/src/main/resources/xwork.xml b/archiva-web/archiva-webapp/src/main/resources/xwork.xml index 4966cbde7..d75ae3172 100644 --- a/archiva-web/archiva-webapp/src/main/resources/xwork.xml +++ b/archiva-web/archiva-webapp/src/main/resources/xwork.xml @@ -400,8 +400,8 @@ - - /WEB-INF/jsp/reports/pickReport.jsp + + /WEB-INF/jsp/reports/pickReport.jsp @@ -410,9 +410,9 @@ reports HTML - pickReport - /WEB-INF/jsp/reports/basicReport.jsp + /WEB-INF/jsp/reports/pickReport.jsp /WEB-INF/jsp/reports/blankReport.jsp + /WEB-INF/jsp/reports/basicReport.jsp diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp index 9a51a0c45..8594d0afb 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp @@ -102,7 +102,7 @@
  • - Pick Report + Reports
  • <%-- POSTPONED to 1.1 series diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp index e1d039d97..117db55eb 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp @@ -31,7 +31,7 @@
    - +