continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r947907 [1/3] - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-data-management/data-manag...
Date Tue, 25 May 2010 03:51:20 GMT
Author: ctan
Date: Tue May 25 03:51:19 2010
New Revision: 947907

URL: http://svn.apache.org/viewvc?rev=947907&view=rev
Log:
[CONTINUUM-2521] added a builds report page
- search by date range, triggered by, build status
- paginated
- TODO: export to file, selectable fields to display


Added:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReportTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp
    continuum/trunk/continuum-webapp/src/main/webapp/css/no-theme/
    continuum/trunk/continuum-webapp/src/main/webapp/css/no-theme/jquery-ui-1.7.2.custom.css
    continuum/trunk/continuum-webapp/src/main/webapp/js/jquery-1.3.2.min.js
    continuum/trunk/continuum-webapp/src/main/webapp/js/jquery-ui-1.7.2.custom.min.js
    continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/stub/ViewBuildsReportActionStub.java
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
    continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
    continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml
    continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java
    continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
    continuum/trunk/continuum-webapp/pom.xml
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
    continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/resources/struts.xml
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java (original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/BuildResultDao.java Tue May 25 03:51:19 2010
@@ -100,4 +100,6 @@ public interface BuildResultDao
                                                         long endIndex );
 
     List<BuildResult> getAllBuildsForAProjectByDate( int projectId );
+
+    List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state, String triggeredBy );
 }

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java Tue May 25 03:51:19 2010
@@ -210,6 +210,8 @@ public interface Continuum
     void removeBuildResult( int buildId )
         throws ContinuumException;
 
+    List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state, String triggeredBy );
+
     // ----------------------------------------------------------------------
     // Projects
     // ----------------------------------------------------------------------

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Tue May 25 03:51:19 2010
@@ -101,6 +101,7 @@ import org.springframework.beans.BeanUti
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -586,6 +587,11 @@ public class DefaultContinuum
         return ( builds.isEmpty() ? null : builds.get( 0 ) );
     }
 
+    public List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state, String triggeredBy )
+    {
+        return buildResultDao.getBuildResultsInRange( fromDate, toDate, state, triggeredBy );
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml (original)
+++ continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml Tue May 25 03:51:19 2010
@@ -23,7 +23,8 @@
               <project id="1"></project>
               <id>1</id>
               <buildNumber>1</buildNumber>
-              <state>1</state>
+              <username>user</username>
+              <state>2</state>
               <trigger>1</trigger>
               <startTime>1239794961904</startTime>
               <endTime>1239794962904</endTime>
@@ -80,7 +81,8 @@
               <project id="1"></project>
               <id>2</id>
               <buildNumber>2</buildNumber>
-              <state>2</state>
+              <username>schedule</username>
+              <state>3</state>
               <trigger>2</trigger>
               <startTime>1239794963904</startTime>
               <endTime>1239794964904</endTime>
@@ -200,8 +202,9 @@
               <project id="2"></project>
               <id>3</id>
               <buildNumber>3</buildNumber>
-              <state>3</state>
-              <trigger>3</trigger>
+              <username>schedule</username>
+              <state>2</state>
+              <trigger>2</trigger>
               <startTime>1239794965904</startTime>
               <endTime>1239794966904</endTime>
               <error>error3</error>

Modified: continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java (original)
+++ continuum/trunk/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java Tue May 25 03:51:19 2010
@@ -127,4 +127,6 @@ public class ContinuumRoleConstants
     public static final String CONTINUUM_VIEW_RELEASE = "continuum-view-release";
 
     public static final String CONTINUUM_MANAGE_PARALLEL_BUILDS = "continuum-manage-parallel-builds";
+
+    public static final String CONTINUUM_VIEW_REPORT = "continuum-view-report";
 }

Modified: continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml (original)
+++ continuum/trunk/continuum-security/src/main/resources/META-INF/redback/redback.xml Tue May 25 03:51:19 2010
@@ -200,6 +200,11 @@
           <name>continuum-manage-parallel-builds</name>
           <description>Continuum Manage Parallel Builds</description>
         </operation>
+        <operation>
+          <id>continuum-view-report</id>
+          <name>continuum-view-report</name>
+          <description>Continuum View Report</description>
+        </operation>
       </operations>
       <roles>
         <role>
@@ -616,6 +621,12 @@
               <operation>continuum-view-queues</operation>
               <resource>global</resource>
             </permission>
+            <permission>
+              <id>continuum-view-report</id>
+              <name>Continuum View Report</name>
+              <operation>continuum-view-report</operation>
+              <resource>global</resource>
+            </permission>
           </permissions>  	  
           <parentRoles>
             <parentRole>continuum-group-project-user</parentRole>

Modified: continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java (original)
+++ continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildResultDaoImpl.java Tue May 25 03:51:19 2010
@@ -748,4 +748,83 @@ public class BuildResultDaoImpl
 
         return null;
     }
+
+    @SuppressWarnings( "unchecked" )
+    public List<BuildResult> getBuildResultsInRange( long fromDate, long toDate, int state, String triggeredBy )
+    {
+        PersistenceManager pm = getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            pm.getFetchPlan().addGroup( BUILD_RESULT_WITH_DETAILS_FETCH_GROUP );
+
+            Extent extent = pm.getExtent( BuildResult.class, true );
+
+            Query query = pm.newQuery( extent );
+
+            String parameters = "";
+            String filter = "";
+
+            Map params = new HashMap();
+
+            int ctr = 0;
+            if ( state > 0 )
+            {
+                params.put( "state", state );
+                ctr++;
+                parameters += "int state, ";
+                filter += "this.state == state && ";
+            }
+
+            if ( triggeredBy != null && !triggeredBy.equals( "" ) )
+            {
+                params.put( "triggeredBy", triggeredBy );
+                ctr++;
+                query.declareImports( "import java.lang.String" );
+                parameters += "String triggeredBy, ";
+                filter += "this.username == triggeredBy && ";
+            }
+
+            if ( fromDate > 0 )
+            {
+                params.put( "fromDate", fromDate );
+                ctr++;
+                parameters += "long fromDate, ";
+                filter += "this.startTime >= fromDate && ";
+            }
+
+            if ( toDate > 0 )
+            {
+                params.put( "toDate", toDate );
+                ctr++;
+                parameters += "long toDate";
+                filter += "this.startTime <= toDate";
+            }
+
+            if ( filter.endsWith( "&& " ) )
+            {
+                filter = filter.substring( 0, filter.length() - 3 );
+                parameters = parameters.substring( 0, parameters.length() - 2 );
+            }
+
+            query.declareParameters( parameters );
+            query.setFilter( filter );
+
+            List<BuildResult> result = (List<BuildResult>) query.executeWithMap( params );
+
+            result = (List<BuildResult>) pm.detachCopyAll( result );
+            
+            tx.commit();
+
+            return result;
+        }
+        finally
+        {
+            rollback( tx );
+        }
+    }
 }

Modified: continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java (original)
+++ continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java Tue May 25 03:51:19 2010
@@ -161,6 +161,8 @@ public abstract class AbstractContinuumS
 
     protected BuildQueue testBuildQueue3;
 
+    protected long baseTime;
+
     private SystemConfiguration systemConfiguration;
 
     @Override
@@ -343,8 +345,10 @@ public abstract class AbstractContinuumS
         ProjectDependency testDependency3 = createTestDependency( "groupId3", "artifactId3", "version3" );
 
         // TODO: simplify by deep copying the relationships in createTest... ?
-        long baseTime = System.currentTimeMillis();
-        testBuildResult1 = createTestBuildResult( 1, true, 1, 1, "error1", 1, baseTime, baseTime + 1000 );
+        baseTime = System.currentTimeMillis();
+        
+        // successful forced build
+        testBuildResult1 = createTestBuildResult( 1, true, 2, 1, "error1", 1, baseTime, baseTime + 1000, "user" );
         BuildResult buildResult1 = createTestBuildResult( testBuildResult1 );
         ScmResult scmResult = createTestScmResult( "commandOutput1", "providerMessage1", true, "1" );
         buildResult1.setScmResult( scmResult );
@@ -355,11 +359,13 @@ public abstract class AbstractContinuumS
         testProject1.setCheckoutResult( checkoutResult1 );
         testProject1.addBuildResult( buildResult1 );
 
-        testBuildResult2 = createTestBuildResult( 2, false, 2, 2, "error2", 2, baseTime + 2000, baseTime + 3000 );
+        // failed scheduled build
+        testBuildResult2 = createTestBuildResult( 2, false, 3, 2, "error2", 2, baseTime + 2000, baseTime + 3000, "schedule" );
         BuildResult buildResult2 = createTestBuildResult( testBuildResult2 );
         testProject1.addBuildResult( buildResult2 );
 
-        testBuildResult3 = createTestBuildResult( 3, true, 3, 3, "error3", 3, baseTime + 4000, baseTime + 5000 );
+        // successful scheduled build
+        testBuildResult3 = createTestBuildResult( 2, true, 2, 3, "error3", 3, baseTime + 4000, baseTime + 5000, "schedule" );
         BuildResult buildResult3 = createTestBuildResult( testBuildResult3 );
         scmResult = createTestScmResult( "commandOutput3", "providerMessage3", true, "3" );
         buildResult3.setScmResult( scmResult );
@@ -1090,11 +1096,11 @@ public abstract class AbstractContinuumS
     {
         return createTestBuildResult( buildResult.getTrigger(), buildResult.isSuccess(), buildResult.getState(),
                                       buildResult.getExitCode(), buildResult.getError(), buildResult.getBuildNumber(),
-                                      buildResult.getStartTime(), buildResult.getEndTime() );
+                                      buildResult.getStartTime(), buildResult.getEndTime(), buildResult.getUsername() );
     }
 
     private static BuildResult createTestBuildResult( int trigger, boolean success, int state, int exitCode,
-                                                      String error, int buildNumber, long startTime, long endTime )
+                                                      String error, int buildNumber, long startTime, long endTime, String triggeredBy )
     {
         BuildResult result = new BuildResult();
         result.setBuildNumber( buildNumber );
@@ -1105,6 +1111,7 @@ public abstract class AbstractContinuumS
         result.setState( state );
         result.setSuccess( success );
         result.setTrigger( trigger );
+        result.setUsername( triggeredBy );
         return result;
     }
 

Modified: continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java (original)
+++ continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java Tue May 25 03:51:19 2010
@@ -1399,6 +1399,33 @@ public class ContinuumStoreTest
 
 	}
 
+    public void testGetBuildResultsInRange()
+        throws Exception
+    {
+        List<BuildResult> results = buildResultDao.getBuildResultsInRange( 0, 0, 0, null );	    
+        assertEquals( "check number of build results returned", 3, results.size() );
+
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 2, null );
+        assertEquals( "check number of build results returned with state == OK", 2, results.size() );
+
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, "user" );
+        assertEquals( "check number of build results returned with triggeredBy == user", 1, results.size() );
+	    
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 0, "schedule" );
+        assertEquals( "check number of build results returned with triggeredBy == schedule", 2, results.size() );
+        
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 2, "schedule" );
+        assertEquals( "check number of build results returned with state == Ok and triggeredBy == schedule", 1, results.size() );
+
+        results = buildResultDao.getBuildResultsInRange( 0, 0, 3, "user" );
+        assertEquals( "check number of build results returned with state == Failed and triggeredBy == user", 0, results.size() );
+
+        results = buildResultDao.getBuildResultsInRange( baseTime, baseTime + 2000, 0, null );
+        assertEquals( "check number of build results returned with startDate and endDate", 2, results.size() );
+
+        results = buildResultDao.getBuildResultsInRange( baseTime, baseTime, 0, null );
+        assertEquals( "check number of build results returned with the same startDate and endDate", 1, results.size() );
+    }
     // ----------------------------------------------------------------------
     //  HELPER METHODS
     // ----------------------------------------------------------------------

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml Tue May 25 03:51:19 2010
@@ -49,6 +49,7 @@ under the License.
         <include name="mavenOneProject" />
         <include name="antProject"/>
         <include name="shellProject"/>
+        <include name="report"/>
         <include name="agent"/>
         <include name="release"/>
         <include name="buildDefinition" />

Added: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReportTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReportTest.java?rev=947907&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReportTest.java (added)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReportTest.java Tue May 25 03:51:19 2010
@@ -0,0 +1,38 @@
+package org.apache.continuum.web.test;
+
+/*
+ * 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.continuum.web.test.parent.AbstractContinuumTest;
+import org.testng.annotations.Test;
+
+@Test( groups = { "report" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class ReportTest
+    extends AbstractContinuumTest
+{
+    @Test( dependsOnMethods = { "testProjectGroupAllBuildSuccess" } )
+    public void testViewBuildsReport()
+        throws Exception
+    {
+        goToProjectBuildsReport();
+        clickButtonWithValue( "View Report" );
+
+        assertProjectBuildReport();
+    }
+}

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java Tue May 25 03:51:19 2010
@@ -1067,4 +1067,42 @@ public abstract class AbstractContinuumT
         assertTextPresent("Build Agent Groups");
         assertButtonWithValuePresent( "Add" );
     }
+
+    // ////////////////////////////////////
+    // Reports
+    // ////////////////////////////////////
+
+    public void goToProjectBuildsReport()
+    {
+        clickLinkWithText( "Project Builds" );
+        assertViewBuildsReportPage();
+    }
+
+    public void assertViewBuildsReportPage()
+    {
+        assertPage( "Continuum - Project Builds Report" );
+        assertTextPresent( "Start Date" );
+        assertElementPresent( "startDate" );
+        assertTextPresent( "End Date" );
+        assertElementPresent( "endDate" );
+        assertTextPresent( "Triggered By" );
+        assertElementPresent( "triggeredBy" );
+        assertTextPresent( "Build Status" );
+        assertElementPresent( "buildStatus" );
+        assertTextPresent( "Row Count" );
+        assertElementPresent( "rowCount" );
+        assertButtonWithValuePresent( "View Report" );
+        assertTextPresent( "Results" );
+    }
+    
+    public void assertProjectBuildReport()
+    {
+        assertTextPresent( "Project Group" );
+        assertTextPresent( "Project" );
+        assertTextPresent( "Build Date" );
+        assertTextPresent( "Triggered By" );
+        assertTextPresent( "Build Status" );
+        assertTextPresent( "Prev" );
+        assertTextPresent( "Next" );
+    }
 }

Modified: continuum/trunk/continuum-webapp/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/pom.xml?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/pom.xml (original)
+++ continuum/trunk/continuum-webapp/pom.xml Tue May 25 03:51:19 2010
@@ -105,7 +105,7 @@ under the License.
               <models>
                 <model>src/main/mdo/view-models.mdo</model>
               </models>
-              <version>1.0.0</version>
+              <version>1.4.1</version>
             </configuration>
             <goals>
               <goal>java</goal>

Added: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java?rev=947907&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java (added)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/ViewBuildsReportAction.java Tue May 25 03:51:19 2010
@@ -0,0 +1,284 @@
+package org.apache.continuum.web.action;
+
+/*
+ * 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.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.web.action.ContinuumActionSupport;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.model.ProjectBuildsSummary;
+
+/**
+ * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="projectBuildsReport"
+ */
+public class ViewBuildsReportAction
+    extends ContinuumActionSupport
+{
+    private int buildStatus;
+
+    private String triggeredBy = "";
+
+    private String startDate = "";
+
+    private String endDate = "";
+
+    private int rowCount = 30;
+
+    private int page = 1;
+
+    private int numPages;
+
+    private Map<Integer, String> buildStatuses;
+
+    private List<ProjectBuildsSummary> projectBuilds;
+
+    private static final String[] datePatterns =
+        new String[]{"MM/dd/yy", "MM/dd/yyyy", "MMMMM/dd/yyyy", "MMMMM/dd/yy", "dd MMMMM yyyy", "dd/MM/yy",
+            "dd/MM/yyyy", "yyyy/MM/dd", "yyyy-MM-dd", "yyyy-dd-MM", "MM-dd-yyyy", "MM-dd-yy"};
+
+    public void prepare()
+        throws Exception
+    {
+        super.prepare();
+
+        buildStatuses = new LinkedHashMap<Integer, String>();
+        buildStatuses.put( 0, "ALL" );
+        buildStatuses.put( ContinuumProjectState.OK, "Ok" );
+        buildStatuses.put( ContinuumProjectState.FAILED, "Failed" );
+        buildStatuses.put( ContinuumProjectState.ERROR, "Error" );    
+    }
+
+    public String init()
+    {
+        try
+        {
+            checkViewReportsAuthorization();
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+
+        // action class was called from the Menu; do not generate report first
+        return SUCCESS;
+    }
+
+    public String execute()
+    {
+        try
+        {
+            checkViewReportsAuthorization();
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            addActionError( authzE.getMessage() );
+            return REQUIRES_AUTHORIZATION;
+        }
+
+        long fromDate = 0;
+        long toDate = 0;
+
+        try
+        {
+            if ( !StringUtils.isEmpty( startDate ) )
+            {
+                fromDate = DateUtils.parseDate( startDate, datePatterns ).getTime();
+            }
+    
+            if ( !StringUtils.isEmpty( endDate ) )
+            {
+                toDate = DateUtils.parseDate( endDate, datePatterns ).getTime();
+            }
+        }
+        catch ( ParseException e )
+        {
+            addActionError( "Error parsing date(s): " + e.getMessage() );
+            return ERROR;
+        }
+
+        if ( fromDate != 0 && toDate != 0 && new Date( fromDate ).after( new Date( toDate ) ) )
+        {
+            addFieldError( "startDate", "Start Date must be earlier than the End Date" );
+            return INPUT;
+        }
+
+        if ( rowCount < 10 )
+        {
+            // TODO: move to validation framework
+            addFieldError( "rowCount", "Row count must be larger than 10." );
+            return INPUT;
+        }
+
+        List<BuildResult> buildResults = getContinuum().getBuildResultsInRange( fromDate, toDate, buildStatus, triggeredBy );
+
+        if ( buildResults != null && !buildResults.isEmpty() )
+        {
+            projectBuilds = mapBuildResultsToProjectBuildsSummaries( buildResults );
+    
+            int extraPage = ( projectBuilds.size() % rowCount ) != 0 ? 1 : 0;
+            numPages = ( projectBuilds.size() / rowCount ) + extraPage;
+    
+            if ( page > numPages )
+            {
+                addActionError(
+                "Error encountered while generating project builds report :: The requested page exceeds the total number of pages." );
+                return ERROR;
+            }
+    
+            int start = rowCount * ( page - 1 );
+            int end = ( start + rowCount ) - 1;
+    
+            if ( end > projectBuilds.size() )
+            {
+                end = projectBuilds.size() - 1;
+            }
+
+            projectBuilds = projectBuilds.subList( start, end + 1 );
+        }
+
+        return SUCCESS;
+    }
+
+    private List<ProjectBuildsSummary> mapBuildResultsToProjectBuildsSummaries( List<BuildResult> buildResults )
+    {
+        List<ProjectBuildsSummary> buildsSummary = new ArrayList<ProjectBuildsSummary>();
+
+        for( BuildResult buildResult : buildResults )
+        {
+            Project project = buildResult.getProject();
+
+            // check if user is authorised to view build result
+            if ( !isAuthorized( project.getProjectGroup().getName() ) )
+            {
+                continue;
+            }
+
+            ProjectBuildsSummary summary = new ProjectBuildsSummary();
+            summary.setProjectGroupName( project.getProjectGroup().getName() );
+            summary.setProjectName( project.getName() );
+            summary.setBuildDate( buildResult.getStartTime() );
+            summary.setBuildState( buildResult.getState() );
+            summary.setBuildTriggeredBy( buildResult.getUsername() );
+
+            buildsSummary.add( summary );
+        }
+
+        return buildsSummary;
+    }
+
+    public int getBuildStatus()
+    {
+        return this.buildStatus;
+    }
+
+    public void setBuildStatus( int buildStatus )
+    {
+        this.buildStatus = buildStatus;
+    }
+
+    public String getTriggeredBy()
+    {
+        return this.triggeredBy;
+    }
+
+    public void setTriggeredBy( String triggeredBy )
+    {
+        this.triggeredBy = triggeredBy;
+    }
+
+    public String getStartDate()
+    {
+        return this.startDate;
+    }
+
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate()
+    {
+        return this.endDate;
+    }
+
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+
+    public int getRowCount()
+    {
+        return rowCount;
+    }
+
+    public void setRowCount( int rowCount )
+    {
+        this.rowCount = rowCount;
+    }
+
+    public Map<Integer, String> getBuildStatuses()
+    {
+        return buildStatuses;
+    }
+
+    public List<ProjectBuildsSummary> getProjectBuilds()
+    {
+        return projectBuilds;
+    }
+
+    public int getPage()
+    {
+        return page;
+    }
+
+    public void setPage( int page )
+    {
+        this.page = page;
+    }
+
+    public int getNumPages()
+    {
+        return numPages;
+    }
+
+    private boolean isAuthorized( String projectGroupName )
+    {
+        try
+        {
+            checkViewProjectGroupAuthorization( projectGroupName );
+            return true;
+        }
+        catch ( AuthorizationRequiredException authzE )
+        {
+            return false;
+        }
+    }
+}

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java Tue May 25 03:51:19 2010
@@ -485,6 +485,12 @@ public class ContinuumActionSupport
         checkAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_REPOSITORIES );
     }
 
+    protected void checkViewReportsAuthorization()
+        throws AuthorizationRequiredException
+    {
+        checkAuthorization( ContinuumRoleConstants.CONTINUUM_VIEW_REPORT );
+    }
+    
     /**
      * Get the security session
      *
@@ -561,5 +567,5 @@ public class ContinuumActionSupport
             principal = "unknown-user";
         }
         return principal;
-    }    
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo (original)
+++ continuum/trunk/continuum-webapp/src/main/mdo/view-models.mdo Tue May 25 03:51:19 2010
@@ -29,11 +29,11 @@
   <classes>
     <class rootElement="true">
       <name>ContinuumViewModels</name>
-      <version>1.0.0</version>
+      <version>1.0.0+</version>
       <fields>
         <field>
           <name>projectSummarys</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description></description>
           <required>true</required>
           <association>
@@ -43,7 +43,7 @@
         </field>
          <field>
           <name>groupSummarys</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description></description>
           <required>true</required>
           <association>
@@ -53,7 +53,7 @@
         </field>
          <field>
           <name>buildDefinitionSummarys</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description></description>
           <required>true</required>
           <association>
@@ -63,7 +63,7 @@
         </field>
         <field>
           <name>notifierSummarys</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description></description>
           <required>false</required>
           <association>
@@ -75,11 +75,11 @@
     </class>
     <class>
       <name>ProjectSummary</name>
-      <version>1.0.0</version>
+      <version>1.0.0+</version>
       <fields>
         <field>
           <name>id</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>project id of the project</description>
           <type>int</type>
@@ -87,21 +87,21 @@
         </field>
         <field>
           <name>name</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>name of the project</description>
           <type>String</type>
         </field>
         <field>
           <name>version</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>version of the project</description>
           <type>String</type>
         </field>
         <field>
           <name>projectGroupId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>id of the project group this project is a member of</description>
           <type>int</type>
@@ -109,14 +109,14 @@
         </field>
         <field>
           <name>projectGroupName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>name of the project group this project is a member of</description>
           <type>String</type>
         </field>
         <field>
           <name>latestBuildId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>latest build id of the project</description>
           <type>int</type>
@@ -124,7 +124,7 @@
         </field>
         <field>
           <name>buildInSuccessId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description></description>
           <type>int</type>
@@ -132,7 +132,7 @@
         </field>
         <field>
           <name>buildNumber</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description></description>
           <type>int</type>
@@ -140,7 +140,7 @@
         </field>
         <field>
           <name>state</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>lifecycle state of the project</description>
           <type>int</type>
@@ -148,7 +148,7 @@
         </field>
         <field>
           <name>inBuildingQueue</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>true/false depending on if the project is in the build queue or not</description>
           <type>boolean</type>
@@ -156,7 +156,7 @@
         </field>
         <field>
           <name>inCheckoutQueue</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>true/false depending on if the project is in the checkout queue or not</description>
           <type>boolean</type>
@@ -164,21 +164,21 @@
         </field>
         <field>
           <name>lastBuildDateTime</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>last build dateTime of the project</description>
           <type>long</type>
         </field>
         <field>
           <name>lastBuildDuration</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>last build duration of the project</description>
           <type>String</type>
         </field>
         <field>
           <name>projectType</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>type of the project</description>
           <type>String</type>
@@ -187,11 +187,11 @@
     </class>
     <class>
       <name>GroupSummary</name>
-      <version>1.0.0</version>
+      <version>1.0.0+</version>
       <fields>
         <field>
           <name>id</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>internal continuum group id</description>
           <type>int</type>
@@ -199,56 +199,56 @@
         </field>
         <field>
           <name>name</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>name of the project group</description>
           <type>String</type>
         </field>
          <field>
           <name>groupId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>maven groupId of the project group</description>
           <type>String</type>
         </field>
         <field>
           <name>description</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>description of the project group</description>
           <type>String</type>
         </field>
         <field>
           <name>numProjects</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>the number of projects in the project group</description>
           <type>int</type>
         </field>
         <field>
           <name>projectType</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>the type of project, maven2/maven1/ant/shell</description>
           <type>String</type>
         </field>
         <field>
           <name>statusMessage</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>a status message like, (building project X)</description>
           <type>String</type>
         </field>
         <field>
          <name>nextScheduledBuild</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>timestamp for the next scheduled build</description>
           <type>String</type>
         </field>
         <field>
           <name>projects</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description></description>
           <required>true</required>
           <association>
@@ -258,7 +258,7 @@
         </field>
         <field>
           <name>numSuccesses</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>number of successful builds in the project group</description>
           <type>int</type>
@@ -266,7 +266,7 @@
         </field>
         <field>
           <name>numFailures</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>number of failed builds in the project group</description>
           <type>int</type>
@@ -274,7 +274,7 @@
         </field>
         <field>
           <name>numErrors</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>number of errored builds in the project group</description>
           <type>int</type>
@@ -282,7 +282,7 @@
         </field>
         <field>
           <name>repositoryId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>local repository id of the project group</description>
           <type>int</type>
@@ -290,7 +290,7 @@
         </field>
         <field>
           <name>repositoryName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>local repository name of the project group</description>
           <type>String</type>
@@ -303,115 +303,115 @@
       <fields>
         <field>
           <name>id</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>id of the build definition</description>
           <type>int</type>
         </field>
         <field>
           <name>projectId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>project id of the project containing the build definition</description>
           <type>int</type>
         </field>
         <field>
           <name>projectGroupId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>project group id of the project group with the build definition</description>
           <type>int</type>
         </field>
         <field>
           <name>goals</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>goals for build definition</description>
           <type>String</type>
         </field>
         <field>
           <name>arguments</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>arguments for build definition</description>
           <type>String</type>
         </field>
         <field>
           <name>buildFile</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>goals for build definition</description>
           <type>String</type>
         </field>
         <field>
           <name>isBuildFresh</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description>if the build is to be smoked and checked back out from the scm each build</description>
           <type>boolean</type>
         </field>
         <field>
           <name>isDefault</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description>if the build definition is used in default cases</description>
           <type>boolean</type>
         </field>
         <field>
           <name>scheduleId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>id of the schedule for build definition</description>
           <type>int</type>
         </field>
         <field>
           <name>scheduleName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>name of the schedule for build definition</description>
           <type>String</type>
         </field>
         <field>
           <name>from</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>source of build definition, project or project group lvl</description>
           <type>String</type>
         </field>
         <field>
           <name>profileName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>name of the profile for the build definition</description>
           <type>String</type>
         </field>
         <field>
           <name>projectName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>if project lvl, then the name of the project using the definition</description>
           <type>String</type>
         </field>
         <field>
           <name>profileId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>id of the profile for build definition</description>
           <type>int</type>
         </field> 
         <field>
           <name>description</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <type>String</type>
           <description>description of the buid defintion</description>
         </field>
         <field>
           <name>type</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <type>String</type>
           <description>type of the buid defintion</description>
         </field>   
         <field>
           <name>alwaysBuild</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <type>boolean</type>
           <defaultValue>false</defaultValue>
           <description>true if the build had to be forced even if there is no scm change</description>
@@ -424,70 +424,70 @@
        <fields>
         <field>
           <name>id</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>id of the notifier</description>
           <type>int</type>
         </field>
         <field>
           <name>projectId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>project id of the project containing the notifier</description>
           <type>int</type>
         </field>
         <field>
           <name>projectName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>project name of the project containing the notifier</description>
           <type>String</type>
         </field>
         <field>
           <name>projectGroupId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>project group id of the project group with the notifier</description>
           <type>int</type>
         </field>
         <field>
           <name>type</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>Type of notifier - mail, IRC, jabber etc.</description>
           <type>String</type>
         </field>
         <field>
           <name>fromProject</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>The origin of the notifier (pom or user).</description>
           <type>boolean</type>
         </field>
         <field>
           <name>events</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>Events that trigger this notifier</description>
           <type>String</type>
         </field>
         <field>
           <name>recipient</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>Recipient for notifications generated by the notifier</description>
           <type>String</type>
         </field>
         <field>
           <name>sender</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>Sender of the notifications</description>
           <type>String</type>
         </field>
         <field>
           <name>enabled</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>Determines if the notifier is enabled</description>
           <type>boolean</type>
@@ -500,42 +500,42 @@
       <fields>
         <field>
           <name>buildAgentUrl</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <description>URL of the build agent</description>
           <type>String</type>
         </field>
         <field>
           <name>projectGroupId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>ID of the project group</description>
           <type>int</type>
         </field>
         <field>
           <name>projectGroupName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>Name of the project group</description>
           <type>String</type>
         </field>
         <field>
           <name>scmRootAddress</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>Scm root address of projects</description>
           <type>String</type>
         </field>
         <field>
           <name>scmRootId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>ID of the scm root</description>
           <type>int</type>
         </field>
         <field>
           <name>hashCode</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>false</required>
           <type>int</type>
         </field>
@@ -547,7 +547,7 @@
       <fields>
         <field>
           <name>phases</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <description>Release Phases</description>
           <association>
@@ -557,7 +557,7 @@
         </field>
         <field>
           <name>completedPhases</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description>Completed release phases</description>
           <association>
             <type>String</type>
@@ -566,13 +566,13 @@
         </field>
         <field>
           <name>inProgress</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <description>Release phase in progress</description> 
           <type>String</type>
         </field>
         <field>
           <name>error</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <type>String</type>
         </field>
       </fields>
@@ -583,25 +583,25 @@
       <fields>
         <field>
           <name>releaseId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>releaseGoal</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>buildAgentUrl</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>projectId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>int</type>
         </field>
@@ -613,47 +613,78 @@
       <fields>
         <field>
           <name>projectId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>int</type>
         </field>
         <field>
           <name>projectName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>projectGroupName</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>buildDefinitionId</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>int</type>
         </field>
         <field>
           <name>buildDefinitionLabel</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>buildAgentUrl</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>hashCode</name>
-          <version>1.0.0</version>
+          <version>1.0.0+</version>
           <required>true</required>
           <type>int</type>
         </field>
       </fields>
     </class>
+    <class>
+      <name>ProjectBuildsSummary</name>
+      <version>1.4.1+</version>
+      <fields>
+        <field>
+          <name>projectGroupName</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>projectName</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>buildDate</name>
+          <version>1.4.1+</version>
+          <type>long</type>
+        </field>
+        <field>
+          <name>buildState</name>
+          <version>1.4.1+</version>
+          <type>int</type>
+        </field>
+        <field>
+          <name>buildTriggeredBy</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+      </fields>
+    </class>
   </classes>
 </model>

Modified: continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties Tue May 25 03:51:19 2010
@@ -69,7 +69,7 @@ bottom.version.number = ${pom.parent.par
 menu.continuum = Continuum
 menu.continuum.about = About
 menu.continuum.showProjects = Show Projects
-menu.continuum.showProjectGroups = Show Project Groups
+menu.continuum.showProjectGroups = Show Project Groups 
 menu.addProject = Add Project
 menu.add.m2Project = Maven 2.0.x Project
 menu.add.m1Project = Maven 1.x Project
@@ -95,6 +95,8 @@ menu.distributedBuilds.buildAgents = Bui
 menu.distributedBuilds.releases = Releases
 menu.parallelBuilds = Parallel Builds
 menu.parallelBuilds.build.queue= Build Queue
+menu.reports = Reports
+menu.reports.projectBuilds = Project Builds
 
 # ----------------------------------------------------------------------
 # Page: error
@@ -1259,3 +1261,20 @@ errorOccured.section.title=Error Occured
 releaseError.page.title=Continuum - Release Error
 releaseError.section.title=Release Error
 releasePrepare.input.error = Unable to get release plugin parameters and process project - {0}
+
+# ----------------------------------------------------------------------
+# Page: Project Builds Report
+# ----------------------------------------------------------------------
+projectBuilds.report.title=Continuum - Project Builds Report
+projectBuilds.report.section.title=Project Builds Report
+projectBuilds.report.startDate=Start Date
+projectBuilds.report.endDate=End Date
+projectBuilds.report.triggeredBy=Triggered By
+projectBuilds.report.buildStatus=Build Status
+projectBuilds.report.rowCount=Row Count
+projectBuilds.report.view=View Report
+projectBuilds.report.prev=Prev
+projectBuilds.report.next=Next
+projectBuilds.report.projectGroup = Project Group
+projectBuilds.report.project=Project
+projectBuilds.report.buildDate=Build Date
\ No newline at end of file

Modified: continuum/trunk/continuum-webapp/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/struts.xml?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/struts.xml (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/struts.xml Tue May 25 03:51:19 2010
@@ -624,6 +624,15 @@
     <action name="viewReleases" class="distributedRelease" method="list">
       <result name="success">/WEB-INF/jsp/releases.jsp</result>
     </action>
+    
+    <action name="viewProjectBuildsReport" class="projectBuildsReport" method="init">
+      <result name="success">/WEB-INF/jsp/viewProjectBuildsReport.jsp</result>
+    </action>
+
+    <action name="generateProjectBuildsReport" class="projectBuildsReport">
+      <result name="input">/WEB-INF/jsp/viewProjectBuildsReport.jsp</result>
+      <result name="success">/WEB-INF/jsp/viewProjectBuildsReport.jsp</result>
+    </action>
   </package>
 
   <!--

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp?rev=947907&r1=947906&r2=947907&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp Tue May 25 03:51:19 2010
@@ -39,7 +39,6 @@
           <s:text name="menu.continuum.showProjectGroups"/>
         </s:a>
       </div>
- 
     </div>
   </div>
 
@@ -178,6 +177,22 @@
     </div>
   </redback:ifAnyAuthorized>
 
+  <redback:ifAuthorized permission="continuum-view-report">
+    <div id="projectmenu" class="toolgroup">
+      <div class="label">
+        <s:text name="menu.reports"/>
+      </div>
+      <div>
+        <div class="body">
+          <s:url id="viewProjectBuildsReportUrl" action="viewProjectBuildsReport" method="init" namespace="/" includeParams="none"/>
+          <s:a href="%{viewProjectBuildsReportUrl}">
+            <s:text name="menu.reports.projectBuilds"/>
+          </s:a> 
+        </div>
+      </div>
+    </div>
+  </redback:ifAuthorized>
+
   <c1:ifBuildTypeEnabled buildType="distributed">
     <redback:ifAnyAuthorized permissions="continuum-manage-distributed-builds,continuum-view-release">
       <div id="projectmenu" class="toolgroup">

Added: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp?rev=947907&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/viewProjectBuildsReport.jsp Tue May 25 03:51:19 2010
@@ -0,0 +1,182 @@
+<%--
+  ~ 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 uri="/struts-tags" prefix="s" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
+<%@ taglib uri="continuum" prefix="c1" %>
+
+<html>
+  <s:i18n name="localization.Continuum">
+  <head>
+    <title><s:text name="projectBuilds.report.title"/></title>
+    <s:head/>
+    <link rel="stylesheet" href="<c:url value='/css/no-theme/jquery-ui-1.7.2.custom.css'/>" type="text/css" />
+    <script type="text/javascript" src="<c:url value='/js/jquery-1.3.2.min.js'/>"></script>
+    <script type="text/javascript" src="<c:url value='/js/jquery-ui-1.7.2.custom.min.js'/>"></script>
+    <script type="text/javascript">
+      $(document).ready(function()
+      {
+		  $('#startDate').datepicker()
+		  $('#endDate').datepicker()
+      });
+    </script>
+  </head>
+  
+  <body>
+    <h3><s:text name="projectBuilds.report.section.title"/></h3>
+ 
+    <s:form name="generateReportForm" action="generateProjectBuildsReport.action">
+      <c:if test="${!empty actionErrors || !empty errorMessages}">
+        <div class="errormessage">
+          <s:iterator value="actionErrors">
+            <p><s:property/></p>
+          </s:iterator>
+          <c:forEach items="${errorMessages}" var="errorMessage">
+            <p>${errorMessage}</p>
+          </c:forEach>
+        </div>
+      </c:if>
+      
+      <div class="axial">
+        <table>
+            <s:textfield label="%{getText('projectBuilds.report.startDate')}" name="startDate" id="startDate" size="20"/>
+            <s:textfield label="%{getText('projectBuilds.report.endDate')}" name="endDate" id="endDate" size="20"/>
+            <s:select label="%{getText('projectBuilds.report.buildStatus')}" name="buildStatus" list="buildStatuses"/>
+            <s:textfield label="%{getText('projectBuilds.report.triggeredBy')}" name="triggeredBy" size="40"/>
+            <s:textfield label="%{getText('projectBuilds.report.rowCount')}" name="rowCount" size="10"/>
+        </table>
+        <div class="functnbar3">
+          <c1:submitcancel value="%{getText('projectBuilds.report.view')}" cancel="%{getText('cancel')}"/>
+        </div>
+      </div>
+    </s:form>
+    
+    </p>
+
+   	<div id="h3">
+   	  <h3>Results</h3>
+      <c:if test="${not empty projectBuilds}">
+        <c:set var="prevPageUrl">
+          <s:url action="generateProjectBuildsReport">    
+            <s:param name="triggeredBy" value="%{#attr.triggeredBy}"/>
+            <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
+            <s:param name="rowCount" value="%{#attr.rowCount}"/>
+            <s:param name="startDate" value="%{#attr.startDate}"/>                      
+            <s:param name="endDate" value="%{#attr.endDate}"/>
+            <s:param name="page" value="%{#attr.page - 1}"/>
+          </s:url>
+        </c:set>
+        <c:set var="nextPageUrl">
+          <s:url action="generateProjectBuildsReport">    
+            <s:param name="triggeredBy" value="%{#attr.triggeredBy}"/>
+            <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
+            <s:param name="rowCount" value="%{#attr.rowCount}"/>
+            <s:param name="startDate" value="%{#attr.startDate}"/>                      
+            <s:param name="endDate" value="%{#attr.endDate}"/>          
+            <s:param name="page" value="%{#attr.page + 1}"/>
+          </s:url>
+        </c:set>
+        <c:choose>
+          <c:when test="${page == 1}">                               
+            <s:text name="projectBuilds.report.prev"/>
+          </c:when>
+          <c:otherwise>
+            <a href="${prevPageUrl}">
+              <s:text name="projectBuilds.report.prev"/>
+            </a>
+          </c:otherwise>
+        </c:choose>
+
+        <c:choose>
+          <c:when test="${numPages > 11}">
+            <c:choose>
+              <c:when test="${(page - 5) < 0}">
+                <c:set var="beginVal">0</c:set>
+                <c:set var="endVal">10</c:set> 
+              </c:when>			        
+              <c:when test="${(page + 5) > (numPages - 1)}">
+                <c:set var="beginVal">${(numPages - 1) - 10}</c:set>
+                <c:set var="endVal">${numPages - 1}</c:set>
+              </c:when>
+              <c:otherwise>
+                <c:set var="beginVal">${page - 5}</c:set>
+                <c:set var="endVal">${page + 5}</c:set>
+              </c:otherwise>
+            </c:choose>  
+          </c:when>
+          <c:otherwise>
+            <c:set var="beginVal">0</c:set>
+            <c:set var="endVal">${numPages - 1}</c:set>
+          </c:otherwise>
+        </c:choose>
+
+        <c:forEach var="i" begin="${beginVal}" end="${endVal}">      
+          <c:choose>                   			    
+            <c:when test="${i != (page - 1)}">
+              <c:set var="specificPageUrl">
+                <s:url action="generateProjectBuildsReport">    
+                  <s:param name="triggeredBy" value="%{#attr.triggeredBy}"/>
+            	  <s:param name="buildStatus" value="%{#attr.buildStatus}"/>
+                  <s:param name="rowCount" value="%{#attr.rowCount}"/>
+                  <s:param name="startDate" value="%{#attr.startDate}"/>                      
+                  <s:param name="endDate" value="%{#attr.endDate}"/>          
+                  <s:param name="page" value="%{#attr.i + 1}"/>
+                </s:url>
+              </c:set>
+              <a href="${specificPageUrl}">${i + 1}</a>
+            </c:when>
+            <c:otherwise>		
+              <b>${i + 1}</b>   
+            </c:otherwise>				  			    
+          </c:choose>      
+        </c:forEach>
+
+        <c:choose>
+          <c:when test="${page == numPages}">
+            <s:text name="projectBuilds.report.next"/>
+          </c:when>
+  	      <c:otherwise>
+            <a href="${nextPageUrl}">
+              <s:text name="projectBuilds.report.next"/>
+            </a>
+          </c:otherwise>   
+        </c:choose>
+
+        <s:set name="projectBuilds" value="projectBuilds" scope="request"/>
+        <ec:table items="projectBuilds"
+                    var="projectBuild"
+                    showExports="false"
+                    showPagination="false"
+                    showStatusBar="false"
+                    sortable="false"
+                    filterable="false">
+          <ec:row highlightRow="true">
+            <ec:column property="projectGroupName" title="projectBuilds.report.projectGroup"/>
+            <ec:column property="projectName" title="projectBuilds.report.project"/>
+            <ec:column property="buildDate" title="projectBuilds.report.buildDate" cell="date"/>
+            <ec:column property="buildTriggeredBy" title="projectBuilds.report.triggeredBy"/>
+            <ec:column property="buildState" title="projectBuilds.report.buildStatus" cell="org.apache.maven.continuum.web.view.buildresults.StateCell"/>
+          </ec:row>
+        </ec:table>
+      </c:if>
+    </div>
+  </body>
+  </s:i18n>
+</html>
\ No newline at end of file



Mime
View raw message