]> source.dussan.org Git - archiva.git/commitdiff
[MRM-540] fix regressions regarding reporting actions
authorBrett Porter <brett@apache.org>
Mon, 5 Nov 2007 14:05:10 +0000 (14:05 +0000)
committerBrett Porter <brett@apache.org>
Mon, 5 Nov 2007 14:05:10 +0000 (14:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@592000 13f79535-47bb-0310-9956-ffa450edef68

archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java [deleted file]
archiva-web/archiva-webapp/src/main/resources/xwork.xml
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp

index 04a55adbac270c522c59b83c945e784cfc60841b..289bbb5660310feef9bc589850ca9fdedab47a49 100644 (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 );
         }
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 (file)
index 37e13c5..0000000
+++ /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;
-    }
-}
index 4966cbde7bab6aa58c59683b41c389cca826a489..d75ae3172256fd8f59ceda137d880fe0e95d1604 100644 (file)
   </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>
index 9a51a0c45bc568db72c2c7c78e3ca32b284d1ce6..8594d0afbca1304c83c5c2067a606db2db8e50c2 100644 (file)
       <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
index e1d039d97cf21e69e0d5e9345e98165b632e2525..117db55ebd2530163a2847550d36de7dba444c4e 100644 (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"/>