archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r581119 - in /maven/archiva/trunk/archiva-web/archiva-webapp/src/main: java/org/apache/maven/archiva/web/action/reports/ resources/ resources/org/apache/maven/archiva/web/action/reports/ webapp/WEB-INF/jsp/decorators/ webapp/WEB-INF/jsp/rep...
Date Tue, 02 Oct 2007 00:44:22 GMT
Author: joakime
Date: Mon Oct  1 17:44:21 2007
New Revision: 581119

URL: http://svn.apache.org/viewvc?rev=581119&view=rev
Log:
[MRM-448] validation for reports form.
Creating validation.
Changing "Show Reports" to "Pick Reports" to be more clear.
Minor cleanup of jasper detection.


Added:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
  (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
  (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp
      - copied, changed from r581044, maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp
Removed:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ShowReportsAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp
Modified:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java?rev=581119&r1=581118&r2=581119&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
Mon Oct  1 17:44:21 2007
@@ -40,7 +40,7 @@
 import java.util.List;
 
 /**
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="generateReportAction"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="generateReport"
  */
 public class GenerateReportAction
     extends PlexusActionSupport
@@ -55,7 +55,7 @@
 
     protected HttpServletRequest request;
 
-    protected List reports = new ArrayList();
+    protected List<RepositoryProblemReport> reports = new ArrayList<RepositoryProblemReport>();
 
     protected String groupId;
 
@@ -79,10 +79,10 @@
 
     private static Boolean jasperPresent;
 
-    public String execute()
+    public String input()
         throws Exception
     {
-        List problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems( configureConstraint()
);
+        List<RepositoryProblem> problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems(
configureConstraint() );
 
         String contextPath =
             request.getRequestURL().substring( 0, request.getRequestURL().indexOf( request.getRequestURI()
) );
@@ -118,9 +118,9 @@
         {
             return BLANK;
         }
-        else if ( !isJasperPresent() )
+        else if ( isJasperPresent() )
         {
-            return BASIC;
+            return "jasper";
         }
         else
         {
@@ -137,6 +137,10 @@
                 Class.forName( "net.sf.jasperreports.engine.JRExporterParameter" );
                 jasperPresent = Boolean.TRUE;
             }
+            catch ( NoClassDefFoundError e )
+            {
+                jasperPresent = Boolean.FALSE;
+            }
             catch ( ClassNotFoundException e )
             {
                 jasperPresent = Boolean.FALSE;
@@ -154,7 +158,7 @@
 
         if ( groupId != null && ( !groupId.equals( "" ) ) )
         {
-            if ( repositoryId != null && ( !repositoryId.equals( "" ) &&
!repositoryId.equals( ShowReportsAction.ALL_REPOSITORIES ) ) )
+            if ( repositoryId != null && ( !repositoryId.equals( "" ) &&
!repositoryId.equals( PickReportAction.ALL_REPOSITORIES ) ) )
             {
                 constraint = new RepositoryProblemConstraint( range, groupId, repositoryId
);
             }
@@ -163,7 +167,7 @@
                 constraint = new RepositoryProblemByGroupIdConstraint( range, groupId );
             }
         }
-        else if ( repositoryId != null && ( !repositoryId.equals( "" ) &&
!repositoryId.equals( ShowReportsAction.ALL_REPOSITORIES ) ) )
+        else if ( repositoryId != null && ( !repositoryId.equals( "" ) &&
!repositoryId.equals( PickReportAction.ALL_REPOSITORIES ) ) )
         {
             constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId
);
         }
@@ -180,7 +184,7 @@
         this.request = request;
     }
 
-    public List getReports()
+    public List<RepositoryProblemReport> getReports()
     {
         return reports;
     }

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java?rev=581119&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
(added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
Mon Oct  1 17:44:21 2007
@@ -0,0 +1,70 @@
+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:joakim@erdfelt.com">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;
+    }
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml?rev=581119&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
(added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
Mon Oct  1 17:44:21 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+    "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+  <field name="rowCount">
+    <field-validator type="int">
+      <param name="min">10</param>
+      <param name="max">5000</param>
+      <message>Row count must be between ${min} and ${max}.</message>
+    </field-validator>
+  </field>
+  <!-- 
+  <field name="groupId">
+    <field-validator type="regex">
+      <param name="expression"><![CDATA[([a-zA-Z0-9]+[a-zA-Z0-9.]*)]]></param>
+      <message>You must provide a valid group id.</message>
+    </field-validator>
+  </field>
+     -->
+  <field name="repositoryId">
+    <field-validator type="requiredstring">
+      <message>You must provide a repository id.</message>
+    </field-validator>
+  </field>
+</validators>
\ No newline at end of file

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/reports/GenerateReportAction-validation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?rev=581119&r1=581118&r2=581119&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Mon Oct  1
17:44:21 2007
@@ -402,17 +402,18 @@
   </package>
 
   <package name="report" namespace="/report" extends="base">
-    <action name="showReports" class="showReportsAction">
-      <result>/WEB-INF/jsp/reports/showReports.jsp</result>
+    <action name="pickReport" class="pickReport">
+      <result>/WEB-INF/jsp/reports/pickReport.jsp</result>
     </action>
 
-    <action name="generateReportAction" class="generateReportAction">
-      <result name="success" type="jasper">
+    <action name="generateReport" class="generateReport">
+      <result name="jasper" type="jasper">
         <param name="location">/WEB-INF/jasperreports/report.jasper</param>
         <param name="dataSource">reports</param>
         <param name="format">HTML</param>
       </result>
-      <result name="basic">/WEB-INF/jsp/reports/basicReport.jsp</result>
+      <result name="input" type="redirect-action">pickReport</result>
+      <result name="success">/WEB-INF/jsp/reports/basicReport.jsp</result>
       <result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
     </action>
   </package>

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp?rev=581119&r1=581118&r2=581119&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
Mon Oct  1 17:44:21 2007
@@ -100,7 +100,7 @@
       <ul>
         <redback:ifAuthorized permission="archiva-access-reports">
           <li class="none">
-            <my:currentWWUrl action="showReports" namespace="/report">Show Reports</my:currentWWUrl>
+            <my:currentWWUrl action="pickReport" namespace="/report">Pick Report</my:currentWWUrl>
           </li>
         </redback:ifAuthorized>
           <%-- POSTPONED to 1.1 series

Copied: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp
(from r581044, maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp)
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp?p2=maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp&p1=maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp&r1=581044&r2=581119&rev=581119&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/pickReport.jsp
Mon Oct  1 17:44:21 2007
@@ -30,7 +30,7 @@
 
 <div id="contentArea">
 
-  <ww:form action="generateReportAction" namespace="/report">
+  <ww:form action="generateReport" namespace="/report" validate="true">
     <ww:textfield label="Row Count" name="rowCount" value="100"/>
     <ww:textfield label="Group ID" name="groupId"/>
     <ww:select label="Repository ID" name="repositoryId" list="repositoryIds"/>



Mime
View raw message