[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
This commit is contained in:
Brett Porter 2007-11-05 14:05:10 +00:00
parent e0187521ec
commit ed1fe1cb4c
5 changed files with 33 additions and 82 deletions

View File

@ -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 );
}

View File

@ -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;
}
}

View File

@ -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>

View File

@ -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

View File

@ -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"/>