------------------------------------------------------------
revno: 11439
committer: Lars Helge Ă˜verland <larshe...@gmail.com>
branch nick: dhis2
timestamp: Thu 2013-07-18 13:22:08 +0200
message:
  Added option for forcing send of notifications like email/sms in 
MessageService
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java	2013-01-16 10:29:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java	2013-07-18 11:22:08 +0000
@@ -42,9 +42,33 @@
 
     final String META_USER_AGENT = "User-agent: ";
 
+    /**
+     * Sends a message to the in-box of the given recipients.
+     * 
+     * @param subject the message subject.
+     * @param text the message text.
+     * @param metaData message meta-data.
+     * @param users the recipients of the message.
+     * 
+     * @return the identifier of the created message conversation.
+     */
     int sendMessage( String subject, String text, String metaData, Set<User> users );
 
-    int sendMessage( String subject, String text, String metaData, Set<User> users, boolean includeFeedbackRecipients );
+    /**
+     * Sends a message to the in-box of the given recipients.
+     * 
+     * @param subject the message subject.
+     * @param text the message text.
+     * @param metaData message meta-data.
+     * @param users the recipients of the message.
+     * @param includeFeedbackRecipients include the feedback recipients user group
+     *        in the message recipients.
+     * @param forceNotifications send notifications to message senders ignoring
+     *        whether users have enabled it.
+     *        
+     * @return the identifier of the created message conversation.
+     */
+    int sendMessage( String subject, String text, String metaData, Set<User> users, boolean includeFeedbackRecipients, boolean forceNotifications );
 
     int sendFeedback( String subject, String text, String metaData );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2013-05-21 10:16:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2013-07-18 11:22:08 +0000
@@ -97,11 +97,11 @@
 
     public int sendMessage( String subject, String text, String metaData, Set<User> users )
     {
-        return sendMessage( subject, text, metaData, users, false );
+        return sendMessage( subject, text, metaData, users, false, false );
     }
 
     public int sendMessage( String subject, String text, String metaData, Set<User> users_,
-        boolean includeFeedbackRecipients )
+        boolean includeFeedbackRecipients, boolean forceNotifications )
     {
         Set<User> users = new HashSet<User>( users_ );
 
@@ -150,14 +150,14 @@
 
         int id = saveMessageConversation( conversation );
 
-        invokeMessageSenders( subject, text, sender, users );
+        invokeMessageSenders( subject, text, sender, users, forceNotifications );
 
         return id;
     }
 
     public int sendFeedback( String subject, String text, String metaData )
     {
-        return sendMessage( subject, text, metaData, new HashSet<User>(), true );
+        return sendMessage( subject, text, metaData, new HashSet<User>(), true, false );
     }
 
     public void sendReply( MessageConversation conversation, String text, String metaData )
@@ -170,7 +170,7 @@
 
         updateMessageConversation( conversation );
 
-        invokeMessageSenders( conversation.getSubject(), text, sender, new HashSet<User>( conversation.getUsers() ) );
+        invokeMessageSenders( conversation.getSubject(), text, sender, new HashSet<User>( conversation.getUsers() ), false );
     }
 
     public int sendCompletenessMessage( CompleteDataSetRegistration registration )
@@ -218,7 +218,7 @@
         {
             int id = saveMessageConversation( conversation );
             
-            invokeMessageSenders( COMPLETE_SUBJECT, text, sender, new HashSet<User>( conversation.getUsers() ) );
+            invokeMessageSenders( COMPLETE_SUBJECT, text, sender, new HashSet<User>( conversation.getUsers() ), false );
 
             return id;
         }
@@ -301,13 +301,13 @@
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private void invokeMessageSenders( String subject, String text, User sender, Set<User> users )
+    private void invokeMessageSenders( String subject, String text, User sender, Set<User> users, boolean forceSend )
     {
         for ( MessageSender messageSender : messageSenders )
         {
             log.debug( "Invoking message sender: " + messageSender.getClass().getSimpleName() );
             
-            messageSender.sendMessage( subject, text, sender, new HashSet<User>( users ), false );
+            messageSender.sendMessage( subject, text, sender, new HashSet<User>( users ), forceSend );
         }
     }
 }

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to