*/
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;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
/**
*/
public class GenerateReportAction
extends PlexusActionSupport
- implements SecureAction, ServletRequestAware
+ implements SecureAction, ServletRequestAware, Preparable
{
/**
* @plexus.requirement role-hint="jdo"
protected int rowCount = 100;
- protected boolean isLastPage = false;
+ protected boolean isLastPage;
public static final String BLANK = "blank";
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() ) );
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 );
}
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 );
}
+++ /dev/null
-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;
- }
-}
</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">
<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>
<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
<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"/>