dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23731
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11552: compact sending message method in Alert command
------------------------------------------------------------
revno: 11552
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-01 14:11:37 +0700
message:
compact sending message method in Alert command
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
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.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-07-18 11:22:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java 2013-08-01 07:11:37 +0000
@@ -68,7 +68,7 @@
*
* @return the identifier of the created message conversation.
*/
- int sendMessage( String subject, String text, String metaData, Set<User> users, boolean includeFeedbackRecipients, boolean forceNotifications );
+ int sendMessage( String subject, String text, String metaData, Set<User> users, User sender, 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-07-18 11:22:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java 2013-08-01 07:11:37 +0000
@@ -97,11 +97,11 @@
public int sendMessage( String subject, String text, String metaData, Set<User> users )
{
- return sendMessage( subject, text, metaData, users, false, false );
+ return sendMessage( subject, text, metaData, users, null, false, false );
}
public int sendMessage( String subject, String text, String metaData, Set<User> users_,
- boolean includeFeedbackRecipients, boolean forceNotifications )
+ User sender, boolean includeFeedbackRecipients, boolean forceNotifications )
{
Set<User> users = new HashSet<User>( users_ );
@@ -119,20 +119,19 @@
}
}
- User sender = currentUserService.getCurrentUser();
-
- if ( sender != null )
+ if ( sender == null )
+ {
+ sender = currentUserService.getCurrentUser();
+ if ( sender != null )
+ {
+ users.add( sender );
+ }
+ }
+ else
{
users.add( sender );
}
- User recipient = currentUserService.getCurrentUser();
-
- if ( recipient != null )
- {
- users.add( recipient );
- }
-
// ---------------------------------------------------------------------
// Instantiate message, content and user messages
// ---------------------------------------------------------------------
@@ -150,6 +149,8 @@
int id = saveMessageConversation( conversation );
+ users.remove( sender );
+
invokeMessageSenders( subject, text, sender, users, forceNotifications );
return id;
@@ -157,7 +158,7 @@
public int sendFeedback( String subject, String text, String metaData )
{
- return sendMessage( subject, text, metaData, new HashSet<User>(), true, false );
+ return sendMessage( subject, text, metaData, new HashSet<User>(), null, true, false );
}
public void sendReply( MessageConversation conversation, String text, String metaData )
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java 2013-08-01 05:25:14 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java 2013-08-01 07:11:37 +0000
@@ -371,7 +371,10 @@
Set<User> receivers = new HashSet<User>( userGroup.getMembers() );
- // forward to user group by SMS
+ // forward to user group by SMS, E-mail, DHIS conversation
+ messageService.sendMessage( command.getName(), message, null, receivers, sender, false, false );
+
+ /*// forward to user group by SMS
smsMessageSender.sendMessage( command.getName(), message, sender, receivers, true );
// forward to user group by E-mail
@@ -393,7 +396,8 @@
conversation.addUserMessage( new UserMessage( receiver, read ) );
}
- messageConversationStore.save( conversation );
+ messageConversationStore.save( conversation );*/
+
// confirm SMS was received and forwarded completely
Set<User> feedbackList = new HashSet<User>();
feedbackList.add( sender );