diff options
author | Brett Porter <brett@apache.org> | 2007-11-05 14:05:10 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2007-11-05 14:05:10 +0000 |
commit | ed1fe1cb4cbf5bed3de88a226a3939dff47fbb42 (patch) | |
tree | d4dc2769dc7c96b91f837cef3b1002d65b84eacf /archiva-web | |
parent | e0187521ec9ba43d2bdf8417e4c6370980122e33 (diff) | |
download | archiva-ed1fe1cb4cbf5bed3de88a226a3939dff47fbb42.tar.gz archiva-ed1fe1cb4cbf5bed3de88a226a3939dff47fbb42.zip |
[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
Diffstat (limited to 'archiva-web')
5 files changed, 33 insertions, 82 deletions
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<String> repositoryIds; + + public static final String ALL_REPOSITORIES = "All Repositories"; + + public void prepare() + { + repositoryIds = new ArrayList<String>(); + repositoryIds.add( ALL_REPOSITORIES ); // comes first to be first in the list + repositoryIds.addAll( + dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) ); + } + + public Collection<String> getRepositoryIds() + { + return repositoryIds; + } + + public String execute() throws Exception { - List<RepositoryProblem> problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems( configureConstraint() ); + List<RepositoryProblem> 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 <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @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<String> repositoryIds = new ArrayList<String>(); - - 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<String> 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 @@ </package> <package name="report" namespace="/report" extends="base"> - <action name="pickReport" class="pickReport"> - <result>/WEB-INF/jsp/reports/pickReport.jsp</result> + <action name="pickReport" class="generateReport" method="input"> + <result name="input">/WEB-INF/jsp/reports/pickReport.jsp</result> </action> <action name="generateReport" class="generateReport"> @@ -410,9 +410,9 @@ <param name="dataSource">reports</param> <param name="format">HTML</param> </result> - <result name="input" type="redirect-action">pickReport</result> - <result name="success">/WEB-INF/jsp/reports/basicReport.jsp</result> + <result name="input">/WEB-INF/jsp/reports/pickReport.jsp</result> <result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result> + <result>/WEB-INF/jsp/reports/basicReport.jsp</result> </action> </package> </xwork> 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 @@ <ul> <redback:ifAuthorized permission="archiva-access-reports"> <li class="none"> - <my:currentWWUrl action="pickReport" namespace="/report">Pick Report</my:currentWWUrl> + <my:currentWWUrl action="pickReport" namespace="/report">Reports</my:currentWWUrl> </li> </redback:ifAuthorized> <%-- 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 @@ <div id="contentArea"> <ww:form action="generateReport" namespace="/report" validate="true"> - <ww:textfield label="Row Count" name="rowCount" value="100"/> + <ww:textfield label="Row Count" name="rowCount" /> <ww:textfield label="Group ID" name="groupId"/> <ww:select label="Repository ID" name="repositoryId" list="repositoryIds"/> <ww:submit value="Show Report"/> |