continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r443424 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ScheduleAction.java resources/localization/Continuum.properties webapp/editSchedule.jsp
Date Thu, 14 Sep 2006 17:36:46 GMT
Author: carlos
Date: Thu Sep 14 10:36:45 2006
New Revision: 443424

URL: http://svn.apache.org/viewvc?view=rev&rev=443424
Log:
[CONTINUUM-847] Add a friendly cron editor for editSchedule
Submitted by: Maria Odea Ching

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

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?view=diff&rev=443424&r1=443423&r2=443424
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
Thu Sep 14 10:36:45 2006
@@ -32,8 +32,6 @@
 
     private boolean active = true;
 
-    private String cronExpression;
-
     private int delay;
 
     private String description;
@@ -48,6 +46,20 @@
 
     private int maxJobExecutionTime;
 
+    private String second = "0";
+
+    private String minute = "0";
+
+    private String hour = "*";
+
+    private String dayOfMonth = "*";
+
+    private String month = "*";
+
+    private String dayOfWeek = "?";
+
+    private String year;
+
     public String summary()
         throws ContinuumException
     {
@@ -64,7 +76,24 @@
             {
                 schedule = getContinuum().getSchedule( id );
                 active = schedule.isActive();
-                cronExpression = schedule.getCronExpression();
+
+                String[] cronEx = schedule.getCronExpression().split( " " );
+                int i = 0;
+                while ( i < cronEx.length )
+                {
+                    switch( i )
+                    {
+                        case 0 : second = cronEx[i]; break;
+                        case 1 : minute = cronEx[i]; break;
+                        case 2 : hour = cronEx[i]; break;
+                        case 3 : dayOfMonth = cronEx[i]; break;
+                        case 4 : month = cronEx[i]; break;
+                        case 5 : dayOfWeek = cronEx[i]; break;
+                        case 6 : year = cronEx[i]; break;
+                    }
+                    i++;
+                }
+
                 description = schedule.getDescription();
                 name = schedule.getName();
                 delay = schedule.getDelay();
@@ -113,7 +142,7 @@
     private Schedule setFields( Schedule schedule )
     {
         schedule.setActive( active );
-        schedule.setCronExpression( cronExpression );
+        schedule.setCronExpression( getCronExpression() );
         schedule.setDelay( delay );
         schedule.setDescription( description );
         schedule.setName( name );
@@ -171,16 +200,6 @@
         this.active = active;
     }
 
-    public String getCronExpression()
-    {
-        return cronExpression;
-    }
-
-    public void setCronExpression( String cronExpression )
-    {
-        this.cronExpression = cronExpression;
-    }
-
     public int getDelay()
     {
         return delay;
@@ -239,5 +258,81 @@
     public void setMaxJobExecutionTime( int maxJobExecutionTime )
     {
         this.maxJobExecutionTime = maxJobExecutionTime;
+    }
+
+    public String getSecond()
+    {
+        return second;
+    }
+
+    public void setSecond( String second )
+    {
+        this.second = second;
+    }
+
+    public String getMinute()
+    {
+        return minute;
+    }
+
+    public void setMinute( String minute )
+    {
+        this.minute = minute;
+    }
+
+    public String getHour()
+    {
+        return hour;
+    }
+
+    public void setHour( String hour )
+    {
+        this.hour = hour;
+    }
+
+    public String getDayOfMonth()
+    {
+        return dayOfMonth;
+    }
+
+    public void setDayOfMonth( String dayOfMonth )
+    {
+        this.dayOfMonth = dayOfMonth;
+    }
+
+    public String getYear()
+    {
+        return year;
+    }
+
+    public void setYear( String year )
+    {
+        this.year = year;
+    }
+
+    public String getMonth()
+    {
+        return month;
+    }
+
+    public void setMonth( String month )
+    {
+        this.month = month;
+    }
+
+    public String getDayOfWeek()
+    {
+        return dayOfWeek;
+    }
+
+    public void setDayOfWeek( String dayOfWeek )
+    {
+        this.dayOfWeek = dayOfWeek;
+    }
+
+    private String getCronExpression()
+    {
+        return ( second + " " + minute + " " + hour + " " + dayOfMonth + " " +
+                    month + " " + dayOfWeek + " " + year ).trim();
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?view=diff&rev=443424&r1=443423&r2=443424
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Thu Sep 14 10:36:45 2006
@@ -355,6 +355,13 @@
 schedule.quietPeriod.message = Enter a quiet period period for this schedule
 schedule.enabled.label = Enabled
 schedule.enabled.message = Enable/Disable the schedule
+schedule.second.label = Second
+schedule.minute.label = Minute
+schedule.hour.label = Hour
+schedule.dayOfMonth.label = Day of Month
+schedule.month.label = Month
+schedule.dayOfWeek.label = Day of Week
+schedule.year.label = Year [optional]
 
 # ----------------------------------------------------------------------
 # Page: SurefireReport

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/editSchedule.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/editSchedule.jsp?view=diff&rev=443424&r1=443423&r2=443424
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/editSchedule.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/editSchedule.jsp Thu Sep 14 10:36:45
2006
@@ -13,17 +13,31 @@
     <div class="axial">
       <ww:form action="saveSchedule" method="post">
         <ww:hidden name="id"/>
-        <table>
-          <tbody>
+          <table>
             <ww:textfield label="%{getText('schedule.name.label')}" name="name" required="true">
                 <ww:param name="desc"><p><ww:text name="schedule.name.message"/></p></ww:param>
             </ww:textfield>
             <ww:textfield label="%{getText('schedule.description.label')}" name="description"
required="true">
                 <ww:param name="desc"><p><ww:text name="schedule.description.message"/></p></ww:param>
             </ww:textfield>
-            <ww:textfield label="%{getText('schedule.cronExpression.label')}" name="cronExpression"
required="true">
-                <ww:param name="desc"><p><ww:text name="schedule.cronExpression.message"/></p></ww:param>
-            </ww:textfield>
+
+            <tr>
+              <th><ww:label theme="simple" value="%{getText('schedule.cronExpression.label')}:"
required="true"/></th>
+              <td>
+                <table>
+                  <ww:textfield label="%{getText('schedule.second.label')}" name="second"
size="2"/>
+                  <ww:textfield label="%{getText('schedule.minute.label')}" name="minute"
size="2"/>
+                  <ww:textfield label="%{getText('schedule.hour.label')}" name="hour"
 size="2"/>
+                  <ww:textfield label="%{getText('schedule.dayOfMonth.label')}" name="dayOfMonth"
 size="2"/>
+                  <ww:textfield label="%{getText('schedule.month.label')}" name="month"
 size="2"/>
+                  <ww:textfield label="%{getText('schedule.dayOfWeek.label')}" name="dayOfWeek"
 size="2"/>
+                  <ww:textfield label="%{getText('schedule.year.label')}" name="year"
 size="4">
+                    <ww:param name="desc"><p><ww:text name="schedule.cronExpression.message"/></p></ww:param>
+                  </ww:textfield>
+                </table>
+              </td>
+            </tr>
+
             <ww:textfield label="%{getText('schedule.maxJobExecutionTime.label')}" name="maxJobExecutionTime"
required="true">
                 <ww:param name="desc"><p><ww:text name="schedule.maxJobExecutionTime.message"/></p></ww:param>
             </ww:textfield>
@@ -33,8 +47,8 @@
             <ww:checkbox label="%{getText('schedule.enabled.label')}" name="active" value="active"
fieldValue="true">
                 <ww:param name="desc"><p><ww:text name="schedule.enabled.message"/></p></ww:param>
             </ww:checkbox>
-          </tbody>
-        </table>
+          </table>
+
         <div class="functnbar3">
           <c1:submitcancel value="%{getText('save')}" cancel="%{getText('cancel')}"/>
         </div>
@@ -45,4 +59,4 @@
 
 </body>
 </ww:i18n>
-</html>
\ No newline at end of file
+</html>



Mime
View raw message