continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmora...@apache.org
Subject svn commit: r792012 - in /continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ScheduleAction.java resources/localization/Continuum.properties webapp/WEB-INF/jsp/editSchedule.jsp
Date Wed, 08 Jul 2009 01:29:57 GMT
Author: jmorales
Date: Wed Jul  8 01:29:57 2009
New Revision: 792012

URL: http://svn.apache.org/viewvc?rev=792012&view=rev
Log:
merged -r 792004 from 1.3.x branch [CONTINUUM-2288][CONTINUUM-2199] Parallel build queue to
schedule mapping is unclear and Association with build queues are deleted if temporal enable
distributebuild and edit the schedule. 
Reorganization of the code to manage the associated buildQueues to a schedule. Behavior similar
to templateBuildDefinition.

Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=792012&r1=792011&r2=792012&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
Wed Jul  8 01:29:57 2009
@@ -23,6 +23,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
@@ -79,9 +80,11 @@
 
     private String year;
 
-    private List<String> availableBuildQueues;
+    private List<BuildQueue> availableBuildQueues;
 
-    private List<String> selectedBuildQueues = new ArrayList<String>();
+    private List<BuildQueue> selectedBuildQueues = new ArrayList<BuildQueue>();
+    
+    private List<String> selectedBuildQueuesIds = new ArrayList<String>();
 
     public void prepare()
         throws Exception
@@ -94,27 +97,19 @@
     private void populateBuildQueues()
         throws ContinuumException
     {
-        List<BuildQueue> buildQueues;
         if ( schedule != null )
         {
-            buildQueues = schedule.getBuildQueues();
-            for ( BuildQueue buildQueue : buildQueues )
+            selectedBuildQueues = schedule.getBuildQueues();
+            for ( BuildQueue bq : selectedBuildQueues )
             {
-                selectedBuildQueues.add( buildQueue.getName() );
+                this.selectedBuildQueuesIds.add( Integer.toString( bq.getId() ) );
             }
-
         }
 
-        availableBuildQueues = new ArrayList<String>();
-
-        buildQueues = getContinuum().getAllBuildQueues();
-        for ( BuildQueue buildQueue : buildQueues )
-        {
-            availableBuildQueues.add( buildQueue.getName() );
-        }
+        availableBuildQueues = getContinuum().getAllBuildQueues();
 
         // remove selected build queues from available build queues
-        for ( String buildQueue : selectedBuildQueues )
+        for ( BuildQueue buildQueue : selectedBuildQueues )
         {
             if ( availableBuildQueues.contains( buildQueue ) )
             {
@@ -222,24 +217,30 @@
         {
             logger.error( "Can't create schedule. No schedule name was supplied." );
             addActionError( getText( "buildDefinition.noname.save.error.message" ) );
+        }
+        if ( !getContinuum().getConfiguration().isDistributedBuildEnabled()
+            && ( selectedBuildQueuesIds == null || selectedBuildQueuesIds.isEmpty()
) )
+        {
+            addActionError( getText( "schedule.buildqueues.empty.error" ) );
+        }
+        if ( hasErrors() )
+        {
             return ERROR;
         }
-        else
+
+        try
         {
-            try
-            {
-                Schedule s = getContinuum().getScheduleByName( name );
-                if ( s != null && id != s.getId() )
-                {
-                    addActionError( getText( "schedule.name.already.exists" ) );
-                    return ERROR;
-                }
-            }
-            catch ( ContinuumException e )
+            Schedule s = getContinuum().getScheduleByName( name );
+            if ( s != null && id != s.getId() )
             {
-                logger.debug( "Unexpected error getting schedule" );
+                addActionError( getText( "schedule.name.already.exists" ) );
+                return ERROR;
             }
         }
+        catch ( ContinuumException e )
+        {
+            logger.debug( "Unexpected error getting schedule" );
+        }
         
         AuditLog event = new AuditLog( getName(), AuditLogConstants.ADD_SCHEDULE );
         event.setCategory( AuditLogConstants.SCHEDULE );
@@ -284,15 +285,14 @@
         schedule.setDelay( delay );
         schedule.setDescription( description );
         schedule.setName( name );
-        schedule.setMaxJobExecutionTime( maxJobExecutionTime );
-
-        // remove old build queues
-        schedule.setBuildQueues( null );
-
-        for ( String name : selectedBuildQueues )
-        {
-            BuildQueue buildQueue = getContinuum().getBuildQueueByName( name );
-            schedule.addBuildQueue( buildQueue );
+        schedule.setMaxJobExecutionTime(maxJobExecutionTime);
+        if (!getContinuum().getConfiguration().isDistributedBuildEnabled()) {
+            // if distributed build don't update schedules
+            schedule.setBuildQueues(null);
+            for (String id : selectedBuildQueuesIds) {
+                BuildQueue buildQueue = getContinuum().getBuildQueue(Integer.parseInt(id));
+                schedule.addBuildQueue(buildQueue);
+            }
         }
 
         return schedule;
@@ -529,23 +529,33 @@
             year ).trim();
     }
 
-    public List<String> getAvailableBuildQueues()
+    public List<BuildQueue> getAvailableBuildQueues()
     {
         return availableBuildQueues;
     }
 
-    public void setAvailableBuildQueues( List<String> availableBuildQueues )
+    public void setAvailableBuildQueues( List<BuildQueue> availableBuildQueues )
     {
         this.availableBuildQueues = availableBuildQueues;
     }
 
-    public List<String> getSelectedBuildQueues()
+    public List<BuildQueue> getSelectedBuildQueues()
     {
         return selectedBuildQueues;
     }
 
-    public void setSelectedBuildQueues( List<String> selectedBuildQueues )
+    public void setSelectedBuildQueues( List<BuildQueue> selectedBuildQueues )
     {
         this.selectedBuildQueues = selectedBuildQueues;
     }
+
+    public List<String> getSelectedBuildQueuesIds()
+    {
+        return selectedBuildQueuesIds;
+    }
+
+    public void setSelectedBuildQueuesIds( List<String> selectedBuildQueuesIds )
+    {
+        this.selectedBuildQueuesIds = selectedBuildQueuesIds;
+    }
 }

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=792012&r1=792011&r2=792012&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Wed Jul  8 01:29:57 2009
@@ -660,6 +660,7 @@
 schedule.available.buildqueues.used = --- Used Build Queues ---
 schedule.buildqueues.add.error = Error attaching the build queue(s) to schedule.
 schedule.name.already.exists = A Schedule with the same name already exists
+schedule.buildqueues.empty.error = Used Build Queues cannot be empty
 
 # ----------------------------------------------------------------------
 # Page: Delete Schedule

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp?rev=792012&r1=792011&r2=792012&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp Wed Jul
 8 01:29:57 2009
@@ -32,7 +32,7 @@
     <h3><s:text name="editSchedule.section.title"/></h3>
 
     <div class="axial">
-      <s:form action="saveSchedule" method="post" validate="true">
+      <s:form action="saveSchedule" method="post" validate="false" name="scheduleForm">
         <c:if test="${!empty actionErrors}">
           <div class="errormessage">
             <s:iterator value="actionErrors">
@@ -74,14 +74,27 @@
             </s:textfield>
     	      
             <c1:ifBuildTypeEnabled buildType="parallel">          
-              <s:optiontransferselect label="%{getText('schedule.buildqueues.label')}"
name="availableBuildQueues"
-                  list="availableBuildQueues" size="8" multiple="true" emptyOption="false"
-                  doubleName="selectedBuildQueues" doubleList="selectedBuildQueues" doubleSize="8"

-                  doubleMultiple="true" doubleEmptyOption="false"
-                  addAllToRightOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
-  				addToRightOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
-  				addAllToLeftOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
-  				addToLeftOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+              <s:optiontransferselect 
+                label="%{getText('schedule.buildqueues.label')}"
+                name="availableBuildQueuesIds"
+                list="availableBuildQueues"
+                listKey="id"
+                listValue="name"
+                headerKey="-1"
+                headerValue="%{getText('schedule.available.buildqueues')}"
+                multiple="true"
+                size="8"
+                emptyOption="false"
+                doubleName="selectedBuildQueuesIds"
+                doubleList="selectedBuildQueues"
+                doubleListKey="id"
+                doubleListValue="name"
+                doubleHeaderKey="-1"
+                doubleSize="8"
+                doubleMultiple="true"
+                doubleEmptyOption="false"
+                doubleHeaderValue="%{getText('schedule.available.buildqueues.used')}"
+                formName="scheduleForm"
                   />
              </c1:ifBuildTypeEnabled>   
                                        



Mime
View raw message