continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmora...@apache.org
Subject svn commit: r801098 - in /continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/ continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/ continuum-webapp/src/main/java/org/a...
Date Wed, 05 Aug 2009 09:13:25 GMT
Author: jmorales
Date: Wed Aug  5 09:13:25 2009
New Revision: 801098

URL: http://svn.apache.org/viewvc?rev=801098&view=rev
Log:
[CONTINUUM-493] Allow to add all developpers address in a notifier without duplicate developpers
addresses.

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
    continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailGroupNotifierEditAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailProjectNotifierEditAction.java
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierMail.jsp

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?rev=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
Wed Aug  5 09:13:25 2009
@@ -720,10 +720,32 @@
 
                         }
 
-                        String committerField = (String) notifier.getConfiguration().get(
COMMITTER_FIELD );
-                        if ( StringUtils.isNotEmpty( committerField ) && context.getBuildResult()
!= null )
+                        if (context.getBuildResult() != null)
                         {
-                            if ( Boolean.parseBoolean( committerField ) )
+                            String committerField = (String) notifier.getConfiguration().get(COMMITTER_FIELD);
+                            String developerField = (String) notifier.getConfiguration().get(DEVELOPER_FIELD);
+                            // Developers constains committers.
+                            if (StringUtils.isNotEmpty(developerField) && Boolean.parseBoolean(developerField))
+                            {
+                                List<ProjectDeveloper> developers = project.getDevelopers();
+                                if (developers == null || developers.isEmpty())
+                                {
+                                    log.warn("No developers have been configured...notifcation
email will not be sent");
+                                    return;
+                                }
+                                Map<String, String> developerToEmailMap = mapDevelopersToRecipients(developers);
+                                for (String email : developerToEmailMap.values())
+                                {
+                                    if (!listRecipents.contains(email.trim()))
+                                    {
+                                        InternetAddress to = new InternetAddress(email.trim());
+                                        log.info("Recipient: To '" + to + "'.");
+                                        message.addRecipient(Message.RecipientType.TO, to);
+                                        listRecipents.add(email.trim());
+                                    }
+                                }
+                            } 
+                            else if (StringUtils.isNotEmpty(committerField) && Boolean.parseBoolean(committerField))
                             {
                                 ScmResult scmResult = context.getBuildResult().getScmResult();
                                 if ( scmResult != null && scmResult.getChanges()
!= null &&

Modified: continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java?rev=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java
(original)
+++ continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java
Wed Aug  5 09:13:25 2009
@@ -49,6 +49,8 @@
 
     public static final String COMMITTER_FIELD = "committers";
 
+    public static final String DEVELOPER_FIELD = "developers";
+
     private static final Logger log = LoggerFactory.getLogger( AbstractContinuumNotifier.class
);
 
     @Resource

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java?rev=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/GenerateRecipentNotifier.java
Wed Aug  5 09:13:25 2009
@@ -62,6 +62,15 @@
                     }
                 }
             }
+            if (StringUtils.isNotEmpty(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD)))
{
+                if (Boolean.parseBoolean(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD)))
{
+                    if ("unknown".equals(recipent)) {
+                        recipent = "project developers";
+                    } else {
+                        recipent += ", " + "project developers";
+                    }
+                }
+            }
         }
         if ( "irc".equals( notifier.getType() ) )
         {

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailGroupNotifierEditAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailGroupNotifierEditAction.java?rev=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailGroupNotifierEditAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailGroupNotifierEditAction.java
Wed Aug  5 09:13:25 2009
@@ -43,6 +43,8 @@
 
     private boolean committers;
 
+    private boolean developers;
+
     protected void initConfiguration( Map<String, String> configuration )
     {
         if ( StringUtils.isNotEmpty( configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD
) ) )
@@ -54,6 +56,11 @@
         {
             committers = Boolean.parseBoolean( configuration.get( AbstractContinuumNotifier.COMMITTER_FIELD
) );
         }
+
+        if (StringUtils.isNotEmpty(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD)))
+        {
+            developers = Boolean.parseBoolean(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD));
+        }
     }
 
     protected void setNotifierConfiguration( ProjectNotifier notifier )
@@ -67,6 +74,8 @@
 
         configuration.put( AbstractContinuumNotifier.COMMITTER_FIELD, String.valueOf( committers
) );
 
+        configuration.put(AbstractContinuumNotifier.DEVELOPER_FIELD, String.valueOf(developers));
+
         notifier.setConfiguration( configuration );
     }
 
@@ -89,4 +98,14 @@
     {
         this.committers = committers;
     }
+
+    public boolean isDevelopers()
+    {
+        return developers;
+    }
+
+    public void setDevelopers(boolean developers)
+    {
+        this.developers = developers;
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailProjectNotifierEditAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailProjectNotifierEditAction.java?rev=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailProjectNotifierEditAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/MailProjectNotifierEditAction.java
Wed Aug  5 09:13:25 2009
@@ -43,6 +43,8 @@
 
     private boolean committers;
 
+    private boolean developers;
+
     protected void initConfiguration( Map<String, String> configuration )
     {
         if ( StringUtils.isNotEmpty( configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD
) ) )
@@ -54,6 +56,11 @@
         {
             committers = Boolean.parseBoolean( configuration.get( AbstractContinuumNotifier.COMMITTER_FIELD
) );
         }
+
+        if (StringUtils.isNotEmpty(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD)))
+        {
+            developers = Boolean.parseBoolean(configuration.get(AbstractContinuumNotifier.DEVELOPER_FIELD));
+        }
     }
 
     protected void setNotifierConfiguration( ProjectNotifier notifier )
@@ -67,6 +74,8 @@
 
         configuration.put( AbstractContinuumNotifier.COMMITTER_FIELD, String.valueOf( committers
) );
 
+        configuration.put(AbstractContinuumNotifier.DEVELOPER_FIELD, String.valueOf(developers));
+
         notifier.setConfiguration( configuration );
     }
 
@@ -89,4 +98,14 @@
     {
         this.committers = committers;
     }
+
+    public boolean isDevelopers()
+    {
+        return developers;
+    }
+
+    public void setDevelopers(boolean developers)
+    {
+        this.developers = developers;
+    }
 }

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=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Wed Aug  5 09:13:25 2009
@@ -501,6 +501,7 @@
 notifier.type.label = Type
 notifier.mail.recipient.address.label = Mail Recipient Address
 notifier.mail.recipient.committers.label = Send a mail to latest committers
+notifier.mail.recipient.developers.label = Send a mail to project developers
 notifier.irc.host.label = IRC Host
 notifier.irc.port.label = IRC port
 notifier.irc.channel.label = IRC channel

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierMail.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierMail.jsp?rev=801098&r1=801097&r2=801098&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierMail.jsp
(original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierMail.jsp
Wed Aug  5 09:13:25 2009
@@ -57,6 +57,7 @@
               <tbody>
                 <s:textfield label="%{getText('notifier.mail.recipient.address.label')}"
name="address" />
                 <s:checkbox label="%{getText('notifier.mail.recipient.committers.label')}"
name="committers" value="committers" fieldValue="true"/>
+                <s:checkbox label="%{getText('notifier.mail.recipient.developers.label')}"
name="developers" value="developers" fieldValue="true"/>
                 <s:checkbox label="%{getText('notifier.event.sendOnSuccess')}" name="sendOnSuccess"
value="sendOnSuccess" fieldValue="true"/>
                 <s:checkbox label="%{getText('notifier.event.sendOnFailure')}" name="sendOnFailure"
value="sendOnFailure" fieldValue="true"/>
                 <s:checkbox label="%{getText('notifier.event.sendOnError')}" name="sendOnError"
value="sendOnError" fieldValue="true"/>



Mime
View raw message