continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r661906 - /continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
Date Fri, 30 May 2008 22:56:38 GMT
Author: olamy
Date: Fri May 30 15:56:37 2008
New Revision: 661906

URL: http://svn.apache.org/viewvc?rev=661906&view=rev
Log:
[CONTINUUM-1712] improve the performance of the group summary page
Submitted by Maria Catherine Tan 


Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java?rev=661906&r1=661905&r2=661906&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
Fri May 30 15:56:37 2008
@@ -19,19 +19,16 @@
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.apache.maven.continuum.web.model.GroupSummary;
-import org.apache.maven.continuum.web.model.ProjectSummary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -43,18 +40,17 @@
 {
     private String infoMessage;
 
-    private List groups;
+    private List<GroupSummary> groups;
 
     public String execute()
         throws ContinuumException
     {
-        groups = new ArrayList();
+        groups = new ArrayList<GroupSummary>();
 
-        Collection projectGroups = getContinuum().getAllProjectGroupsWithProjects();
+        Collection<ProjectGroup> projectGroups = getContinuum().getAllProjectGroupsWithProjects();
 
-        for ( Iterator j = projectGroups.iterator(); j.hasNext(); )
+        for ( ProjectGroup projectGroup : projectGroups )
         {
-            ProjectGroup projectGroup = (ProjectGroup) j.next();
 
             if ( isAuthorized( projectGroup.getName() ) )
             {
@@ -67,58 +63,17 @@
                 groupModel.setDescription( projectGroup.getDescription() );
 
                 //TODO: Create a summary jpox request so code will be more simple and performance
will be better
-                Collection projects = projectGroup.getProjects();
+                Collection<Project> projects = projectGroup.getProjects();
 
                 groupModel.setNumProjects( projects.size() );
 
-                Map buildResults = getContinuum().getLatestBuildResults();
-
-                Map buildResultsInSuccess = getContinuum().getBuildResultsInSuccess();
-
-                List projectModels = new ArrayList();
                 int numSuccesses = 0;
                 int numFailures = 0;
                 int numErrors = 0;
 
-                for ( Iterator i = projects.iterator(); i.hasNext(); )
+                for ( Project project : projects )
                 {
-                    Project project = (Project) i.next();
-
-                    if ( groupModel.getProjectType() == null )
-                    {
-                        groupModel.setProjectType( project.getExecutorId() );
-                    }
-
-                    ProjectSummary model = new ProjectSummary();
-
-                    getLogger().debug( "GroupSummaryAction: building project model " + project.getName()
);
-
-                    model.setId( project.getId() );
-
-                    model.setName( project.getName() );
-
-                    model.setVersion( project.getVersion() );
-
-                    model.setProjectGroupId( project.getProjectGroup().getId() );
-
-                    model.setProjectGroupName( project.getProjectGroup().getName() );
-
-                    if ( getContinuum().isInBuildingQueue( project.getId() ) )
-                    {
-                        model.setInBuildingQueue( true );
-                    }
-                    else if ( getContinuum().isInCheckoutQueue( project.getId() ) )
-                    {
-                        model.setInCheckoutQueue( true );
-                    }
-                    else
-                    {
-                        model.setInBuildingQueue( false );
-                        model.setInCheckoutQueue( false );
-                    }
-
-                    model.setState( project.getState() );
-
+                    
                     if ( project.getState() == 2 )
                     {
                         numSuccesses++;
@@ -131,31 +86,6 @@
                     {
                         numErrors++;
                     }
-
-                    model.setBuildNumber( project.getBuildNumber() );
-
-                    if ( buildResultsInSuccess != null )
-                    {
-                        BuildResult buildInSuccess =
-                            (BuildResult) buildResultsInSuccess.get( new Integer( project.getId()
) );
-
-                        if ( buildInSuccess != null )
-                        {
-                            model.setBuildInSuccessId( buildInSuccess.getId() );
-                        }
-                    }
-
-                    if ( buildResults != null )
-                    {
-                        BuildResult latestBuild = (BuildResult) buildResults.get( new Integer(
project.getId() ) );
-
-                        if ( latestBuild != null )
-                        {
-                            model.setLatestBuildId( latestBuild.getId() );
-                        }
-                    }
-                    getLogger().debug( "GroupSummaryAction: adding model to group " + model.getName()
);
-                    projectModels.add( model );
                 }
 
                 //todo wire in the next scheduled build for the project group and a meaningful
status message
@@ -165,7 +95,6 @@
                 groupModel.setNumSuccesses( numSuccesses );
                 groupModel.setNumFailures( numFailures );
                 groupModel.setNumErrors( numErrors );
-                groupModel.setProjects( projectModels );
                 getLogger().debug( "GroupSummaryAction: adding group to groups list " + groupModel.getName()
);
                 groups.add( groupModel );
             }
@@ -174,7 +103,7 @@
         return SUCCESS;
     }
 
-    public List getGroups()
+    public List<GroupSummary> getGroups()
     {
         return groups;
     }



Mime
View raw message