continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r265058 - in /maven/continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/ continuum-core/src/main/java/org/apache/maven/continuum/notification/ ...
Date Wed, 31 Aug 2005 15:01:55 GMT
Author: evenisse
Date: Wed Aug 31 08:01:39 2005
New Revision: 265058

URL: http://svn.apache.org/viewcvs?rev=265058&view=rev
Log:
o [CONTINUUM-241] Don't remove notifiers created from web interface
o Fix notifier edition
o notifier define in pom can't be edited or deleted

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
    maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationIrc.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationJabber.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMsn.xml
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditIrcNotifier.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditJabberNotifier.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMailNotifier.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMsnNotifier.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Aug 31 08:01:39 2005
@@ -546,13 +546,18 @@
     public void updateNotifier( int projectId, int notifierId, Map configuration )
         throws ContinuumException
     {
+        Project project = getProjectWithAllDetails( projectId );
+
         ProjectNotifier notifier = getNotifier( projectId, notifierId );
 
-        Properties notifierProperties = createNotifierProperties( configuration );
+        String notifierType = notifier.getType();
 
-        notifier.setConfiguration( notifierProperties );
+        // I remove notifier then add it instead of update it due to a ClassCastException
in jpox
+        project.removeNotifier( notifier );
 
-        storeNotifier( notifier );
+        updateProject( project );
+
+        addNotifier( projectId, notifierType, configuration );
     }
 
     private Properties createNotifierProperties( Map configuration )
@@ -589,7 +594,9 @@
 
         notifier.setConfiguration( notifierProperties );
 
-        Project project = getProject( projectId );
+        notifier.setFrom( ProjectNotifier.FROM_USER );
+
+        Project project = getProjectWithAllDetails( projectId );
 
         project.addNotifier( notifier );
 
@@ -605,9 +612,18 @@
 
         if ( n != null )
         {
-            project.removeNotifier( n );
+            if ( n.isFromProject() )
+            {
+                n.setEnabled( false );
+
+                storeNotifier( n );
+            }
+            else
+            {
+                project.removeNotifier( n );
 
-            updateProject( project );
+                updateProject( project );
+            }
         }
     }
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
Wed Aug 31 08:01:39 2005
@@ -174,13 +174,41 @@
             }
 
             continuumProject.setDependencies( dependencies );
+            
         }
 
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
+        List userNotifiers = new ArrayList();
+
+        for ( int i = 0; i < continuumProject.getNotifiers().size(); i++ )
+        {
+            ProjectNotifier notifier = (ProjectNotifier) continuumProject.getNotifiers().get(
i );
+
+            if ( notifier.isFromUser() )
+            {
+                ProjectNotifier userNotifier = new ProjectNotifier();
+
+                userNotifier.setType( notifier.getType() );
+
+                userNotifier.setConfiguration( notifier.getConfiguration() );
+
+                userNotifier.setFrom( notifier.getFrom() );
+
+                userNotifiers.add( userNotifier );
+            }
+        }
+
         continuumProject.setNotifiers( getNotifiers( mavenProject ) );
+        
+        for ( Iterator i = userNotifiers.iterator(); i.hasNext(); )
+        {
+            ProjectNotifier notifier = (ProjectNotifier) i.next();
+
+            continuumProject.addNotifier( notifier );
+        }
     }
 
     public MavenProject getMavenProject( File file )
@@ -285,6 +313,8 @@
             }
 
             notifier.setConfiguration( projectNotifier.getConfiguration() );
+
+            notifier.setFrom( ProjectNotifier.FROM_PROJECT );
 
             notifiers.add( notifier );
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
Wed Aug 31 08:01:39 2005
@@ -138,6 +138,13 @@
 
             String notifierType = projectNotifier.getType();
 
+            if ( !projectNotifier.isEnabled() )
+            {
+                getLogger().info( notifierType + " notifier (id=" + projectNotifier.getId()
+ ") is disabled." );
+
+                continue;
+            }
+
             Map configuration = projectNotifier.getConfiguration();
 
             try

Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo Wed Aug 31 08:01:39 2005
@@ -221,6 +221,18 @@
           <description>The mechanism used to deliver notifications.</description>
         </field>
         <field>
+          <name>from</name>
+          <version>1.0.0+</version>
+          <type>int</type>
+          <description>The origin of the notifier (pom or user).</description>
+        </field>
+        <field>
+          <name>enabled</name>
+          <version>1.0.0+</version>
+          <defaultValue>true</defaultValue>
+          <type>boolean</type>
+        </field>
+        <field>
           <name>recipientType</name>
           <version>1.0.0+</version>
           <type>int</type>
@@ -251,6 +263,27 @@
           </association>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0+</version>
+          <code><![CDATA[
+
+              public static final int FROM_PROJECT = 1;
+
+              public static final int FROM_USER = 2;
+
+              public boolean isFromProject()
+              {
+                  return from == FROM_PROJECT;
+              }
+
+              public boolean isFromUser()
+              {
+                  return from == FROM_USER;
+              }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
     </class>
 
     <class>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationIrc.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationIrc.xml?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationIrc.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationIrc.xml Wed Aug
31 08:01:39 2005
@@ -1,7 +1,7 @@
 <form>
   <id>notificationIrc</id>
   <source-role>org.apache.maven.continuum.Continuum</source-role>
-  <lookup-expression>getNotifier(#id,#notifierType)</lookup-expression>
+  <lookup-expression>getNotifier(#id,#notifierId)</lookup-expression>
   <elements>
     <element>
       <id>notifierType</id>
@@ -64,7 +64,7 @@
     <view>Summary.vm</view>
     <view-on-failure>Edit.vm</view-on-failure>
     <fid-on-failure>notificationIrc</fid-on-failure>
-    <expression>updateNotifier(#id,#notifierType,#parameters)</expression>
+    <expression>updateNotifier(#id,#notifierId,#parameters)</expression>
   </update>
 
 </form>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationJabber.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationJabber.xml?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationJabber.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationJabber.xml Wed
Aug 31 08:01:39 2005
@@ -1,7 +1,7 @@
 <form>
   <id>notificationJabber</id>
   <source-role>org.apache.maven.continuum.Continuum</source-role>
-  <lookup-expression>getNotifier(#id,#notifierType)</lookup-expression>  
+  <lookup-expression>getNotifier(#id,#notifierId)</lookup-expression>  
   <elements>
     <element>
       <id>notifierType</id>
@@ -86,7 +86,7 @@
     <action>updateEntity</action>
     <view>Summary.vm</view>
     <view-on-failure>Edit.vm</view-on-failure>
-    <expression>updateAntProject(#entity)</expression>
+    <expression>updateNotifier(#id,#notifierId,#parameters)</expression>
   </update>
 
 </form>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml Wed
Aug 31 08:01:39 2005
@@ -1,7 +1,7 @@
 <form>
   <id>notificationMail</id>
   <source-role>org.apache.maven.continuum.Continuum</source-role>
-  <lookup-expression>getNotifier(#id,#notifierType)</lookup-expression>  
+  <lookup-expression>getNotifier(#id,#notifierId)</lookup-expression>  
   <elements>
     <element>
       <id>notifierType</id>
@@ -38,7 +38,7 @@
     <action>updateEntity</action>
     <view>Summary.vm</view>
     <view-on-failure>Edit.vm</view-on-failure>
-    <expression>updateAntProject(#entity)</expression>
+    <expression>updateNotifier(#id,#notifierId,#parameters)</expression>
   </update>
 
 </form>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMsn.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMsn.xml?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMsn.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMsn.xml Wed Aug
31 08:01:39 2005
@@ -1,7 +1,7 @@
 <form>
   <id>notificationMsn</id>
   <source-role>org.apache.maven.continuum.Continuum</source-role>
-  <lookup-expression>getNotifier(#id,#notifierType)</lookup-expression>  
+  <lookup-expression>getNotifier(#id,#notifierId)</lookup-expression>  
   <elements>
     <element>
       <id>notifierType</id>
@@ -62,7 +62,7 @@
     <action>updateEntity</action>
     <view>Summary.vm</view>
     <view-on-failure>Edit.vm</view-on-failure>
-    <expression>updateAntProject(#entity)</expression>
+    <expression>updateNotifier(#id,#notifierId,#parameters)</expression>
   </update>
 
 </form>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditIrcNotifier.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditIrcNotifier.vm?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditIrcNotifier.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditIrcNotifier.vm
Wed Aug 31 08:01:39 2005
@@ -6,9 +6,9 @@
     <form method="post" action="$link">
       #hidden ( "action" "cam" )
       #hidden ( "cid" "updateNotifier" )
-      #hidden ( "view" "ProjectNotifiers.vm" )
+      #hidden ( "view" "Summary.vm" )
       #hidden ( "id" $project.id )
-      #hidden ( "notifierType" "irc" )
+      #hidden ( "notifierId" $notifier.id )
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
           <tr>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditJabberNotifier.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditJabberNotifier.vm?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditJabberNotifier.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditJabberNotifier.vm
Wed Aug 31 08:01:39 2005
@@ -6,9 +6,9 @@
     <form method="post" action="$link">
       #hidden ( "action" "cam" )
       #hidden ( "cid" "updateNotifier" )
-      #hidden ( "view" "ProjectNotifiers.vm" )
+      #hidden ( "view" "Summary.vm" )
       #hidden ( "id" $project.id )
-      #hidden ( "notifierType" "jabber" )
+      #hidden ( "notifierId" $notifier.id )
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
           <tr>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMailNotifier.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMailNotifier.vm?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMailNotifier.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMailNotifier.vm
Wed Aug 31 08:01:39 2005
@@ -6,9 +6,9 @@
     <form method="post" action="$link">
       #hidden ( "action" "cam" )
       #hidden ( "cid" "updateNotifier" )
-      #hidden ( "view" "ProjectNotifiers.vm" )
+      #hidden ( "view" "Summary.vm" )
       #hidden ( "id" $project.id )
-      #hidden ( "notifierType" "mail" )
+      #hidden ( "notifierId" $notifier.id )
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
           <tr>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMsnNotifier.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMsnNotifier.vm?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMsnNotifier.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/EditMsnNotifier.vm
Wed Aug 31 08:01:39 2005
@@ -6,9 +6,9 @@
     <form method="post" action="$link">
       #hidden ( "action" "cam" )
       #hidden ( "cid" "updateNotifier" )
-      #hidden ( "view" "ProjectNotifiers.vm" )
+      #hidden ( "view" "Summary.vm" )
       #hidden ( "id" $project.id )
-      #hidden ( "notifierType" "jabber" )
+      #hidden ( "notifierId" $notifier.id )
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
           <tr>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm?rev=265058&r1=265057&r2=265058&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm Wed Aug
31 08:01:39 2005
@@ -112,7 +112,7 @@
         <th width="10%">&nbsp;</th>
       </tr>
       #foreach ( $notifier in $project.notifiers )
-        <tr class="b">
+        <tr class="b" #if ( !$notifier.isEnabled() ) style="color: silver;" #end>
           #if ( $notifier.type == "irc" )
             <td>IRC</td>
           #elseif ( $notifier.type == "mail" )
@@ -128,30 +128,40 @@
             #else
               $notifier.configuration.address
             #end
+            #if ( !$notifier.isEnabled() )
+              (DISABLED)
+            #end
           </td>
           <td>Success, Failures</td>
-          <td>Project</td>
           <td>
-            #if ( $notifier.type == "irc" )
-              #set ( $editNotifierLink = $link.setPage('EditIrcNotifier.vm').addPathInfo('view','EditIrcNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
-              <a href="$editNotifierLink">Edit</a>
-            #elseif ( $notifier.type == "mail" )
-              #set ( $editNotifierLink = $link.setPage('EditMailNotifier.vm').addPathInfo('view','EditMailNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
-              <a href="$editNotifierLink">Edit</a>
-            #elseif ( $notifier.type == "msn" )
-              #set ( $editNotifierLink = $link.setPage('EditMsnNotifier.vm').addPathInfo('view','EditMsnNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
-              <a href="$editNotifierLink">Edit</a>
-            #elseif ( $notifier.type == "jabber" )
-              #set ( $editNotifierLink = $link.setPage('EditJabberNotifier.vm').addPathInfo('view','EditJabberNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
-              <a href="$editNotifierLink">Edit</a>
+            #if ( $notifier.isFromProject() )
+              Project
+            #else
+              User
+            #end
+          </td>
+          <td>
+            #if ( $notifier.isFromUser() )
+              #if ( $notifier.type == "irc" )
+                #set ( $editNotifierLink = $link.setPage('EditIrcNotifier.vm').addPathInfo('view','EditIrcNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
+                <a href="$editNotifierLink">Edit</a>
+              #elseif ( $notifier.type == "mail" )
+                #set ( $editNotifierLink = $link.setPage('EditMailNotifier.vm').addPathInfo('view','EditMailNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
+                <a href="$editNotifierLink">Edit</a>
+              #elseif ( $notifier.type == "msn" )
+                #set ( $editNotifierLink = $link.setPage('EditMsnNotifier.vm').addPathInfo('view','EditMsnNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
+                <a href="$editNotifierLink">Edit</a>
+              #elseif ( $notifier.type == "jabber" )
+                #set ( $editNotifierLink = $link.setPage('EditJabberNotifier.vm').addPathInfo('view','EditJabberNotifier').addPathInfo('notifierId',
$notifier.id).addPathInfo('id', $item.id) )
+                <a href="$editNotifierLink">Edit</a>
+              #end
+              #set ( $deleteNotifierLink = $link.setPage('Summary.vm').addPathInfo('notifierId',
$notifier.id).addPathInfo('action','cam').addPathInfo('cid','deleteNotifier').addPathInfo('id',
$project.id) )
+              | <a href="$deleteNotifierLink">Delete</a>
             #end
-            #set ( $deleteNotifierLink = $link.setPage('Summary.vm').addPathInfo('notifierId',
$notifier.id).addPathInfo('action','cam').addPathInfo('cid','deleteNotifier').addPathInfo('id',
$project.id) )
-            | <a href="$deleteNotifierLink">Delete</a>
           </td>
         </tr>
       #end
     </table>
-    <!--
     <div class="functnbar3">
       <table>
         <tr>
@@ -164,7 +174,6 @@
         </tr>
       </table>
     </div>
-    -->
     #end
 
     #if ( $project.dependencies )
@@ -199,13 +208,13 @@
       <tr>
         <th>Name</th>
         <th>Email</th>
-        <th width="10%">&nbsp;</th>
+        <!-- th width="10%">&nbsp;</th -->
       </tr>
       #foreach ( $developer in $project.developers )
       <tr class="b">
         <td>$developer.name</td>
         <td>$developer.email</td>
-        <td>&nbsp;</td>
+        <!-- td>&nbsp;</td -->
       </tr>
       #end
     </table>



Mime
View raw message