]> source.dussan.org Git - archiva.git/commitdiff
[MRM-329] The Reports link gives an HTTP 500
authorJoakim Erdfelt <joakime@apache.org>
Thu, 2 Aug 2007 20:02:27 +0000 (20:02 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Thu, 2 Aug 2007 20:02:27 +0000 (20:02 +0000)
Patch by: Teodoro Cue Jr

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@562233 13f79535-47bb-0310-9956-ffa450edef68

20 files changed:
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryProblemReport.java [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java
archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java
archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java [new file with mode: 0644]
archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
archiva-web/archiva-webapp/pom.xml
archiva-web/archiva-webapp/src/main/jasperreports/report.jrxml [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/AbstractReportAction.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/AllProblematicArtifactsAction.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByArtifactIdAction.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByGroupIdAction.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByRepositoryIdAction.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ShowReportsAction.java [new file with mode: 0644]
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/blankReport.jsp [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp [new file with mode: 0644]

diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryProblemReport.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryProblemReport.java
new file mode 100644 (file)
index 0000000..acba5c0
--- /dev/null
@@ -0,0 +1,51 @@
+package org.apache.maven.archiva.model;
+
+public class RepositoryProblemReport extends RepositoryProblem
+{
+    protected String groupURL;
+
+    protected String artifactURL;
+
+    protected String versionURL;
+
+    public RepositoryProblemReport( RepositoryProblem repositoryProblem )
+    {
+        setGroupId( repositoryProblem.getGroupId() );
+        setArtifactId( repositoryProblem.getArtifactId() );
+        setVersion( repositoryProblem.getVersion() );
+        setMessage( repositoryProblem.getMessage() );
+        setOrigin( repositoryProblem.getOrigin() );
+        setPath( repositoryProblem.getPath() );
+        setType( repositoryProblem.getType() );
+    }
+
+    public void setGroupURL( String groupURL )
+    {
+        this.groupURL = groupURL;
+    }
+
+    public String getGroupURL()
+    {
+        return groupURL; 
+    }
+
+    public void setArtifactURL( String artifactURL )
+    {
+        this.artifactURL = artifactURL;
+    }
+
+    public String getArtifactURL()
+    {
+        return artifactURL; 
+    }
+
+    public void setVersionURL( String versionURL )
+    {
+        this.versionURL = versionURL;
+    }
+
+    public String getVersionURL()
+    {
+        return versionURL; 
+    }
+}
index c2bca5f05c0b583ffbdfe103a0c7e54874cd57cc..bb2f48e56138b1d6e29ecf663bd23357284557e7 100644 (file)
@@ -92,4 +92,13 @@ public interface DeclarativeConstraint extends Constraint
      * @return the equivalent of the SELECT WHERE (condition) value for this constraint. (can be null)
      */
     public abstract String getWhereCondition();
+
+    /**
+     * Get the declared range used for this query. (optional)
+     * 
+     * NOTE: This is DAO implementation specific.
+     * 
+     * @return the range. (can be null)
+     */
+    public abstract int[] getRange();
 }
\ No newline at end of file
index 87afa9b7919fddb048c50261e05068581f992946..3aad6ab15d6abe03d0ac552ab29bcd7a399ca10f 100644 (file)
@@ -39,6 +39,8 @@ public abstract class AbstractDeclarativeConstraint
 
     protected Object[] params;
 
+    protected int[] range;
+
     public String getFilter()
     {
         return null;
@@ -73,4 +75,9 @@ public abstract class AbstractDeclarativeConstraint
     {
         return variables;
     }
+
+    public int[] getRange()
+    {
+       return range;
+    }
 }
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RangeConstraint.java
new file mode 100644 (file)
index 0000000..9fb821d
--- /dev/null
@@ -0,0 +1,45 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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 org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RangeConstraint 
+ */
+public class RangeConstraint
+    extends AbstractDeclarativeConstraint
+    implements Constraint
+{
+    public RangeConstraint( int[] range )
+    {
+       this.range = range;
+    }
+
+    public String getSortColumn()
+    {
+        return null;
+    }
+
+    public String getWhereCondition()
+    {
+        return null;
+    }
+}
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByArtifactIdConstraint.java
new file mode 100644 (file)
index 0000000..a94aed8
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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 org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RepositoryProblemByArtifactIdConstraint
+ */
+public class RepositoryProblemByArtifactIdConstraint extends RangeConstraint implements Constraint
+{
+    private String whereClause;
+
+    public RepositoryProblemByArtifactIdConstraint( int[] range, String desiredArtifactId )
+    {
+        super( range );
+        whereClause = "artifactId == desiredArtifactId";
+        declParams = new String[] { "String desiredArtifactId" };
+        params = new Object[] { desiredArtifactId };
+    }
+
+    public String getSortColumn()
+    {
+        return "groupId";
+    }
+
+    public String getWhereCondition()
+    {
+        return whereClause;
+    }
+}
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java
new file mode 100644 (file)
index 0000000..fbeff09
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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 org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RepositoryProblemByGroupIdConstraint
+ */
+public class RepositoryProblemByGroupIdConstraint extends RangeConstraint implements Constraint
+{
+    private String whereClause;
+
+    public RepositoryProblemByGroupIdConstraint( int[] range, String desiredGroupId )
+    {
+        super( range );
+        whereClause = "groupId == desiredGroupId";
+        declParams = new String[] { "String desiredGroupId" };
+        params = new Object[] { desiredGroupId };
+    }
+
+    public String getSortColumn()
+    {
+        return "artifactId";
+    }
+
+    public String getWhereCondition()
+    {
+        return whereClause;
+    }
+}
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByRepositoryIdConstraint.java
new file mode 100644 (file)
index 0000000..08b024b
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.archiva.database.constraints;
+
+/*
+ * 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 org.apache.maven.archiva.database.Constraint;
+
+/**
+ * RepositoryProblemByRepositoryIdConstraint
+ */
+public class RepositoryProblemByRepositoryIdConstraint extends RangeConstraint implements Constraint
+{
+    private String whereClause;
+
+    public RepositoryProblemByRepositoryIdConstraint( int[] range, String desiredRepositoryId )
+    {
+        super( range );
+        whereClause = "repositoryId == desiredRepositoryId";
+        declParams = new String[] { "String desiredRepositoryId" };
+        params = new Object[] { desiredRepositoryId };
+    }
+
+    public String getSortColumn()
+    {
+        return "groupId";
+    }
+
+    public String getWhereCondition()
+    {
+        return whereClause;
+    }
+}
index 2161b7bee1d16392b67a7cec2c73ef811a59d4b3..6ddb9a982eac989053031421c0cc95d5905b99eb 100644 (file)
@@ -357,6 +357,11 @@ public class JdoAccess
             query.declareImports( StringUtils.join( constraint.getDeclaredImports(), ", " ) );
         }
 
+        if ( constraint.getRange() != null )
+        {
+               query.setRange( constraint.getRange()[0], constraint.getRange()[1] );
+        }
+
         if ( constraint.getDeclaredParameters() != null )
         {
             if ( constraint.getParameters() == null )
index 8797415e4f7e65cfbdd4a6769c1c9d6538573ec8..89378a9bf1f2c9699f086f25fae0ebd2c5b12f04 100644 (file)
       <artifactId>activation</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>jasperreports</groupId>
+      <artifactId>jasperreports</artifactId>
+      <version>1.2.0</version>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
                 <!-- Directory created by jetty:run -->
                 <include>WEB-INF/temp</include>
                 <!-- Directory created by jetty:run -->
+                <include>WEB-INF/jasperreports</include>
+                <!-- Directory created by jasperreports-maven-plugin -->
               </includes>
             </fileset>
           </filesets>
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>jasperreports-maven-plugin</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <phase>compile</phase>
+            <goals>
+              <goal>compile-reports</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <targetDirectory>src/main/webapp/WEB-INF/jasperreports</targetDirectory>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <profiles>
       </build>
     </profile>
    </profiles>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>Codehaus Snapshots</id>
+      <url>http://snapshots.repository.codehaus.org/</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+    </pluginRepository>
+  </pluginRepositories>
 </project>
diff --git a/archiva-web/archiva-webapp/src/main/jasperreports/report.jrxml b/archiva-web/archiva-webapp/src/main/jasperreports/report.jrxml
new file mode 100644 (file)
index 0000000..3f61ec2
--- /dev/null
@@ -0,0 +1,238 @@
+<?xml version="1.0"?>
+<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
+<jasperReport name="ArchivaReport"
+              pageWidth="1800">
+  <field name="groupId" class="java.lang.String"/>
+  <field name="artifactId" class="java.lang.String"/>
+  <field name="version" class="java.lang.String"/>
+  <field name="message" class="java.lang.String"/>
+  <field name="origin" class="java.lang.String"/>
+  <field name="path" class="java.lang.String"/>
+  <field name="type" class="java.lang.String"/>
+  <field name="groupURL" class="java.lang.String"/>
+  <field name="artifactURL" class="java.lang.String"/>
+  <field name="versionURL" class="java.lang.String"/>
+  <field name="prev" class="java.lang.String"/>
+  <field name="next" class="java.lang.String"/>
+  <field name="page" class="java.lang.Integer"/>
+  <field name="isLastPage" class="java.lang.Boolean"/>
+  <title>
+    <band height="50">
+      <staticText>
+        <reportElement x="0" y="0" width="2240" height="50"/>
+        <textElement textAlignment="Center">
+          <font size="14" isBold="true"/>
+        </textElement>
+        <text><![CDATA[All Problematic Artifacts]]></text>
+      </staticText>
+    </band>
+  </title>
+  <pageHeader>
+    <band></band>
+  </pageHeader>
+  <columnHeader>
+    <band height="20">
+      <staticText>
+        <reportElement x="0" y="0" width="300" height="20"/>
+        <box leftBorder="Thin"
+             leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Group Id]]></text>
+      </staticText>
+      <staticText>
+        <reportElement x="300" y="0" width="300" height="20"/>
+        <box leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Artifact Id]]></text>
+      </staticText>
+      <staticText>
+        <reportElement x="600" y="0" width="300" height="20"/>
+        <box leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Version]]></text>
+      </staticText>
+      <staticText>
+        <reportElement x="900" y="0" width="300" height="20"/>
+        <box leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Message]]></text>
+      </staticText>
+      <staticText>
+        <reportElement x="1200" y="0" width="300" height="20"/>
+        <box leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Origin]]></text>
+      </staticText>
+      <staticText>
+        <reportElement x="1500" y="0" width="300" height="20"/>
+        <box leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Repository Path]]></text>
+      </staticText>
+      <staticText>
+        <reportElement x="1800" y="0" width="300" height="20"/>
+        <box leftPadding="10"
+             rightBorder="Thin"
+             rightPadding="10"
+             topBorder="Thin"
+             bottomBorder="Thin"/>
+        <textElement textAlignment="Center">
+          <font size="12"/>
+        </textElement>
+        <text><![CDATA[Type]]></text>
+      </staticText>
+    </band>
+  </columnHeader>
+  <detail>
+    <band height="20">
+        <textField isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Self">
+          <reportElement x="0" y="0" width="300" height="15"/>
+          <box leftBorder="Thin"
+               leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{groupId}]]>
+          </textFieldExpression>
+          <hyperlinkReferenceExpression><![CDATA[$F{groupURL}]]></hyperlinkReferenceExpression>
+        </textField>
+        <textField isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Self">
+          <reportElement x="300" y="0" width="300" height="15"/>
+          <box leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{artifactId}]]>
+          </textFieldExpression>
+          <hyperlinkReferenceExpression><![CDATA[$F{artifactURL}]]></hyperlinkReferenceExpression>
+        </textField>
+        <textField isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Self">
+          <reportElement x="600" y="0" width="300" height="15"/>
+          <box leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{version}]]>
+          </textFieldExpression>
+          <hyperlinkReferenceExpression><![CDATA[$F{versionURL}]]></hyperlinkReferenceExpression>
+        </textField>
+        <textField isBlankWhenNull="true" isStretchWithOverflow="true">
+          <reportElement x="900" y="0" width="300" height="15"/>
+          <box leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{message}]]>
+          </textFieldExpression>
+        </textField>
+        <textField isBlankWhenNull="true">
+          <reportElement x="1200" y="0" width="300" height="15"/>
+          <box leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{origin}]]>
+          </textFieldExpression>
+        </textField>
+        <textField isBlankWhenNull="true" isStretchWithOverflow="true">
+          <reportElement x="1500" y="0" width="300" height="15"/>
+          <box leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{path}]]>
+          </textFieldExpression>
+        </textField>
+        <textField isBlankWhenNull="true">
+          <reportElement x="1800" y="0" width="300" height="15"/>
+          <box leftPadding="10"
+               rightBorder="Thin"
+               rightPadding="10"
+               bottomBorder="Thin"/>
+          <textFieldExpression>
+            <![CDATA[$F{type}]]>
+          </textFieldExpression>
+        </textField>
+    </band>
+  </detail>
+  <columnFooter>
+    <band></band>
+  </columnFooter>
+  <pageFooter>
+    <band height="15">
+      <textField>
+        <reportElement x="0" y="0" width="50" height="15"/>
+        <textFieldExpression>
+          <![CDATA["Page: " + $F{page}]]>
+        </textFieldExpression>
+      </textField>
+      <textField hyperlinkType="Reference" hyperlinkTarget="Self">
+        <reportElement x="50" y="0" width="50" height="15">
+          <printWhenExpression>
+            <![CDATA[$F{page}.intValue() != 1]]>
+          </printWhenExpression>
+        </reportElement>
+        <textFieldExpression>
+          <![CDATA["prev"]]>
+        </textFieldExpression>
+        <hyperlinkReferenceExpression><![CDATA[$F{prev}]]></hyperlinkReferenceExpression>
+      </textField>
+      <textField hyperlinkType="Reference" hyperlinkTarget="Self">
+        <reportElement x="100" y="0" width="50" height="15">
+          <printWhenExpression>
+            <![CDATA[$F{isLastPage} != true]]>
+          </printWhenExpression>
+        </reportElement>
+        <textFieldExpression>
+          <![CDATA["next"]]>
+        </textFieldExpression>
+        <hyperlinkReferenceExpression><![CDATA[$F{next}]]></hyperlinkReferenceExpression>
+      </textField>
+    </band>
+  </pageFooter>
+  <summary>
+    <band></band>
+  </summary>
+</jasperReport>
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/AbstractReportAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/AbstractReportAction.java
new file mode 100644 (file)
index 0000000..6f9d52a
--- /dev/null
@@ -0,0 +1,177 @@
+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 java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.maven.archiva.database.ArchivaDAO;
+import org.apache.maven.archiva.database.Constraint;
+import org.apache.maven.archiva.model.RepositoryProblem;
+import org.apache.maven.archiva.model.RepositoryProblemReport;
+import org.apache.maven.archiva.security.ArchivaRoleConstants;
+import org.codehaus.plexus.redback.rbac.Resource;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+import com.opensymphony.webwork.interceptor.ServletRequestAware;
+
+/**
+ * Abstract reporting.
+ */
+public abstract class AbstractReportAction extends PlexusActionSupport implements SecureAction, ServletRequestAware
+{
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    protected ArchivaDAO dao;
+
+    protected Constraint constraint;
+
+    protected HttpServletRequest request;
+
+    protected List reports = new ArrayList();
+
+    protected String prev;
+
+    protected String next;
+
+    protected int[] range = new int[2];
+
+    protected int page = 1;
+
+    protected int rowCount = 100;
+
+    protected boolean isLastPage = false;
+
+    public static final String BLANK = "blank";
+
+    public String execute() throws Exception
+    {
+        range[0] = ( page - 1 ) * rowCount;
+        range[1] = ( page * rowCount ) + 1; // Add 1 to check if it's the last page or not.
+
+        configureConstraint();
+        List problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
+
+        String contextPath =
+            request.getRequestURL().substring( 0, request.getRequestURL().indexOf( request.getRequestURI() ) );
+        RepositoryProblem problemArtifact;
+        RepositoryProblemReport problemArtifactReport;
+        for ( int i = 0; i < problemArtifacts.size(); i++ )
+        {
+            problemArtifact = (RepositoryProblem) problemArtifacts.get( i );
+            problemArtifactReport = new RepositoryProblemReport( problemArtifact );
+
+            problemArtifactReport.setGroupURL( contextPath + "/browse/" + problemArtifact.getGroupId() );
+            problemArtifactReport.setArtifactURL( contextPath + "/browse/" + problemArtifact.getGroupId() + "/"
+                            + problemArtifact.getArtifactId() );
+            problemArtifactReport.setVersionURL( contextPath + "/browse/" + problemArtifact.getGroupId() + "/"
+                            + problemArtifact.getArtifactId() + "/" + problemArtifact.getVersion() );
+
+            reports.add( problemArtifactReport );
+        }
+
+        if ( reports.size() <= rowCount )
+        {
+            isLastPage = true;
+        }
+        else
+        {
+            reports.remove( rowCount );
+        }
+
+        prev = request.getRequestURL() + "?page=" + ( page - 1 ) + "&rowCount=" + rowCount;
+        next = request.getRequestURL() + "?page=" + ( page + 1 ) + "&rowCount=" + rowCount;
+
+        if ( reports.size() == 0 && page == 1 )
+        {
+            return BLANK;
+        }
+        else
+        {
+            return SUCCESS;
+        }
+    }
+
+    /**
+     * To be implemented by sub-reports to configure specific constraints.
+     */
+    abstract protected void configureConstraint();
+
+    public void setServletRequest( HttpServletRequest request )
+    {
+        this.request = request;
+    }
+
+    public List getReports()
+    {
+        return reports;
+    }
+
+    public String getPrev()
+    {
+        return prev;
+    }
+
+    public String getNext()
+    {
+        return next;
+    }
+
+    public int getPage()
+    {
+        return page;
+    }
+
+    public void setPage( int page )
+    {
+        this.page = page;
+    }
+
+    public int getRowCount()
+    {
+        return rowCount;
+    }
+
+    public void setRowCount( int rowCount )
+    {
+        this.rowCount = rowCount;
+    }
+
+    public boolean getIsLastPage()
+    {
+        return isLastPage;
+    }
+
+    public SecureActionBundle getSecureActionBundle() throws SecureActionException
+    {
+        SecureActionBundle bundle = new SecureActionBundle();
+
+        bundle.setRequiresAuthentication( true );
+        bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_ACCESS_REPORT, Resource.GLOBAL );
+
+        return bundle;
+    }
+}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/AllProblematicArtifactsAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/AllProblematicArtifactsAction.java
new file mode 100644 (file)
index 0000000..ba53076
--- /dev/null
@@ -0,0 +1,35 @@
+package org.apache.maven.archiva.web.action.reports;
+
+import org.apache.maven.archiva.database.constraints.RangeConstraint;
+
+/*
+ * 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.
+ */
+
+/**
+ * All problematic artifacts reporting.
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="allProblematicArtifactsAction"
+ */
+public class AllProblematicArtifactsAction extends AbstractReportAction
+{
+    protected void configureConstraint()
+    {
+        this.constraint = new RangeConstraint( range );
+    }
+}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByArtifactIdAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByArtifactIdAction.java
new file mode 100644 (file)
index 0000000..7600819
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.maven.archiva.web.action.reports;
+
+import org.apache.maven.archiva.database.constraints.RepositoryProblemByArtifactIdConstraint;
+
+/*
+ * 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.
+ */
+
+/**
+ * By artifact id reporting.
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsByArtifactIdAction"
+ */
+public class ReportsByArtifactIdAction extends AbstractReportAction
+{
+    private String artifactId;
+
+    protected void configureConstraint()
+    {
+        this.constraint = new RepositoryProblemByArtifactIdConstraint( range, artifactId );
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByGroupIdAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByGroupIdAction.java
new file mode 100644 (file)
index 0000000..ec53082
--- /dev/null
@@ -0,0 +1,43 @@
+package org.apache.maven.archiva.web.action.reports;
+
+import org.apache.maven.archiva.database.constraints.RangeConstraint;
+import org.apache.maven.archiva.database.constraints.RepositoryProblemByGroupIdConstraint;
+
+/*
+ * 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.
+ */
+
+/**
+ * By group id reporting.
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsByGroupIdAction"
+ */
+public class ReportsByGroupIdAction extends AbstractReportAction
+{
+    private String groupId;
+
+    protected void configureConstraint()
+    {
+        this.constraint = new RepositoryProblemByGroupIdConstraint( range, groupId );
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByRepositoryIdAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ReportsByRepositoryIdAction.java
new file mode 100644 (file)
index 0000000..9c8e8d3
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.maven.archiva.web.action.reports;
+
+import org.apache.maven.archiva.database.constraints.RepositoryProblemByRepositoryIdConstraint;
+
+/*
+ * 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.
+ */
+
+/**
+ * By repository id reporting.
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsByRepositoryIdAction"
+ */
+public class ReportsByRepositoryIdAction extends AbstractReportAction
+{
+    private String repositoryId;
+
+    protected void configureConstraint()
+    {
+        this.constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId );
+    }
+
+    public void setRepositoryId( String repositoryId )
+    {
+        this.repositoryId = repositoryId;
+    }
+}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ShowReportsAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ShowReportsAction.java
new file mode 100644 (file)
index 0000000..c59b968
--- /dev/null
@@ -0,0 +1,49 @@
+package org.apache.maven.archiva.web.action.reports;
+
+import java.util.Collection;
+
+import org.apache.maven.archiva.database.ArchivaDAO;
+import org.codehaus.plexus.xwork.action.PlexusActionSupport;
+
+/**
+ * Show reports.
+ * 
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="showReportsAction"
+ */
+public class ShowReportsAction extends PlexusActionSupport
+{
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    protected ArchivaDAO dao;
+
+    private Collection groupIds;
+
+    private Collection artifactIds;
+
+    private Collection repositoryIds;
+
+    public String execute() throws Exception
+    {
+        /*
+         * TODO Use combo box for groupIds, artifactIds and repositoryIds instead of a text field.
+         */
+
+        return SUCCESS;
+    }
+
+    public Collection getGroupIds()
+    {
+        return groupIds;
+    }
+
+    public Collection getArtifactIds()
+    {
+        return artifactIds;
+    }
+
+    public Collection getRepositoryIds()
+    {
+        return repositoryIds;
+    }
+}
index fd9c989a4591e6d520e56a23c1745eebb86bd32e..3e317b8951d9e5abd9b08db7bd3e6f00198b9097 100644 (file)
       <interceptor-ref name="unconfiguredArchivaStack"/>
     </action>
 
-    <action name="reports" class="reportsAction">
-      <result>/WEB-INF/jsp/reports/reports.jsp</result>
-    </action>
-
-    <action name="runReport" class="reportsAction" method="runReport">
-      <interceptor-ref name="configuredArchivaStack"/>
-      <interceptor-ref name="execAndWait"/>
-      <result name="wait" type="redirect">/admin/reports.action?reportGroup=${reportGroup}&amp;repositoryId=${repositoryId}&amp;filter=${filter}</result>
-      <result name="success" type="redirect">/admin/reports.action?reportGroup=${reportGroup}&amp;repositoryId=${repositoryId}&amp;filter=${filter}</result>
-    </action>
-    
     <!-- The following are needed by the maven-app-configuration-web artifact -->
 
     <action name="configureAppearance" class="configureAppearance" method="input">
       </result>
     </action>
   </package>
+
+  <package name="report" namespace="/report" extends="base">
+    <action name="showReports" class="showReportsAction">
+      <result>/WEB-INF/jsp/reports/showReports.jsp</result>
+    </action>
+
+    <action name="allProblematicArtifacts" class="allProblematicArtifactsAction">
+      <result name="success" type="jasper">
+        <param name="location">/WEB-INF/jasperreports/report.jasper</param>
+        <param name="dataSource">reports</param>
+        <param name="format">HTML</param>
+      </result>
+      <result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
+    </action>
+
+    <action name="byGroupId" class="reportsByGroupIdAction">
+      <result name="success" type="jasper">
+        <param name="location">/WEB-INF/jasperreports/report.jasper</param>
+        <param name="dataSource">reports</param>
+        <param name="format">HTML</param>
+      </result>
+      <result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
+    </action>
+
+    <action name="byArtifactId" class="reportsByArtifactIdAction">
+      <result name="success" type="jasper">
+        <param name="location">/WEB-INF/jasperreports/report.jasper</param>
+        <param name="dataSource">reports</param>
+        <param name="format">HTML</param>
+      </result>
+      <result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
+    </action>
+
+    <action name="byRepositoryId" class="reportsByRepositoryIdAction">
+      <result name="success" type="jasper">
+        <param name="location">/WEB-INF/jasperreports/report.jasper</param>
+        <param name="dataSource">reports</param>
+        <param name="format">HTML</param>
+      </result>
+      <result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
+    </action>
+  </package>
 </xwork>
 
index 7725e9ecd52db7e8bb871a5918e5e92677a86a97..b515a791e90b352ef3538ac675dbd324efdb252a 100644 (file)
     <redback:ifAnyAuthorized permissions="archiva-manage-users,archiva-access-reports,archiva-manage-configuration">
       <h5>Manage</h5>
       <ul>
-         <%-- POSTPONED to 1.0-alpha-2 
         <redback:ifAuthorized permission="archiva-access-reports">
           <li class="none">
-            <my:currentWWUrl action="reports" namespace="/admin">Reports</my:currentWWUrl>
+            <my:currentWWUrl action="showReports" namespace="/report">Show Reports</my:currentWWUrl>
           </li>
         </redback:ifAuthorized>
-          --%>
           <%-- POSTPONED to 1.1 series
                 <li class="none">
                   <a href="#">Synchronisation</a>
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/blankReport.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/blankReport.jsp
new file mode 100644 (file)
index 0000000..321b896
--- /dev/null
@@ -0,0 +1,36 @@
+<%--
+  ~ 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.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+
+<html>
+<head>
+  <title>Reports</title>
+  <ww:head/>
+</head>
+
+<body>
+<h1>Reports</h1>
+<div id="contentArea">
+
+  <ww:text name="The operation generated an empty report."/>
+
+</div>
+</body>
+</html>
diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/showReports.jsp
new file mode 100644 (file)
index 0000000..8264493
--- /dev/null
@@ -0,0 +1,80 @@
+<%--
+  ~ 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.
+  --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+
+<html>
+<head>
+  <title>Reports</title>
+  <ww:head/>
+</head>
+
+<body>
+<script>
+  function getRowCount()
+  {
+    document.getElementById("rowCount1_id").value = document.getElementById("rowCountSource_id").value;
+    document.getElementById("rowCount2_id").value = document.getElementById("rowCountSource_id").value;
+    document.getElementById("rowCount3_id").value = document.getElementById("rowCountSource_id").value;
+    document.getElementById("rowCount4_id").value = document.getElementById("rowCountSource_id").value;
+  }
+</script>
+
+<h1>Reports</h1>
+
+<div id="contentArea">
+
+  <h2>Global Settings</h2>
+  <ww:textfield id="rowCountSource_id" label="Row Count" value="100"/>
+  <br><br>
+
+  <h2>All Problematic Artifacts</h2>
+  <ww:form onsubmit="getRowCount();" action="allProblematicArtifacts" namespace="/report">
+    <ww:hidden id="rowCount1_id" name="rowCount"/>
+    <ww:submit value="Show All Problematic Artifacts"/>
+  </ww:form>
+  <br>
+
+  <h2>Problematic Artifacts by Group Id</h2>
+  <ww:form action="byGroupId" namespace="/report">
+    <ww:hidden id="rowCount2_id" name="rowCount"/>
+    <ww:textfield name="groupId"/>
+    <ww:submit value="Problematic Artifacts by Group Id"/>
+  </ww:form>
+  <br>
+
+  <h2>Problematic Artifacts by Artifact Id</h2>
+  <ww:form action="byArtifactId" namespace="/report">
+    <ww:hidden id="rowCount3_id" name="rowCount"/>
+    <ww:textfield name="artifactId"/>
+    <ww:submit value="Problematic Artifacts by Artifact Id"/>
+  </ww:form>
+  <br>
+
+  <h2>Problematic Artifacts by Repository Id</h2>
+  <ww:form action="byRepositoryId" namespace="/report">
+    <ww:hidden id="rowCount4_id" name="rowCount"/>
+    <ww:textfield name="repositoryId"/>
+    <ww:submit value="Problematic Artifacts by Repository Id"/>
+  </ww:form>
+
+</div>
+
+</body>
+</html>