dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24062
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11742: replace DefaultSmsSender by SmsMessageSender, minor change for clearer code
------------------------------------------------------------
revno: 11742
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-22 15:03:53 +0700
message:
replace DefaultSmsSender by SmsMessageSender, minor change for clearer code
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java
dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java
dhis-2/dhis-web/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/sendSMS.js
dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm
--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java 2013-08-12 09:47:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/SmsPublisher.java 2013-08-22 08:03:53 +0000
@@ -123,6 +123,7 @@
smsSender.sendMessage( e.getMessage(), message.getOriginator() );
}
+ // remove for error case
messageQueue.remove( message );
message = messageQueue.get();
log.info( "Queue Size: " + messageQueue.get() );
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java'
--- dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ProcessingSendSMSAction.java 2013-08-22 08:03:53 +0000
@@ -30,18 +30,20 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.sms.SmsSender;
+import org.hisp.dhis.sms.SmsMessageSender;
import org.hisp.dhis.sms.outbound.OutboundSmsTransportService;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupService;
import org.springframework.beans.factory.annotation.Autowired;
+
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -74,18 +76,12 @@
@Autowired
private OutboundSmsTransportService transportService;
- private SmsSender smsSender;
-
- public SmsSender getSmsSender()
- {
- return smsSender;
- }
-
- public void setSmsSender( SmsSender smsSender )
- {
- this.smsSender = smsSender;
- }
-
+ private SmsMessageSender smsMessageSender;
+
+ public void setSmsMessageSender( SmsMessageSender smsMessageSender )
+ {
+ this.smsMessageSender = smsMessageSender;
+ }
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -104,11 +100,11 @@
this.smsSubject = smsSubject;
}
- private String smsMessage;
+ private String text;
- public void setSmsMessage( String smsMessage )
+ public void setText( String text )
{
- this.smsMessage = smsMessage;
+ this.text = text;
}
private String sendTarget;
@@ -167,7 +163,7 @@
return ERROR;
}
- if ( smsMessage == null || smsMessage.trim().length() == 0 )
+ if ( text == null || text.trim().length() == 0 )
{
message = i18n.getString( "no_message" );
@@ -195,12 +191,12 @@
user.setPhoneNumber( each );
recipientsList.add( user );
}
-
//message = messageSender.sendMessage( smsSubject, smsMessage, currentUser, true, recipients, gatewayId );
- message = smsSender.sendMessage( smsSubject, smsMessage, currentUser, recipientsList, false );
+ message = smsMessageSender.sendMessage( smsSubject, text, currentUser, recipientsList, false );
}
else if ( sendTarget.equals( "userGroup" ) )
{
+
UserGroup group = userGroupService.getUserGroup( userGroup );
if ( group == null )
@@ -216,9 +212,8 @@
return ERROR;
}
-
//message = messageSender.sendMessage( smsSubject, smsMessage, currentUser, false, group.getMembers(), gatewayId );
- message = smsSender.sendMessage( smsSubject, smsMessage, currentUser, group.getMembers(), false );
+ message = smsMessageSender.sendMessage( smsSubject, text, currentUser, group.getMembers(), false );
}
else if ( sendTarget.equals( "user" ) )
{
@@ -239,7 +234,7 @@
}
//message = messageSender.sendMessage( smsSubject, smsMessage, currentUser, false, users, gatewayId );
- message = smsSender.sendMessage( smsSubject, smsMessage, currentUser, recipientsList, false );
+ message = smsMessageSender.sendMessage( smsSubject, text, currentUser, recipientsList, false );
}
}
else if ( sendTarget.equals( "unit" ) )
@@ -261,7 +256,7 @@
return ERROR;
}
- message = smsSender.sendMessage( smsSubject, smsMessage, currentUser, recipientsList, false );
+ message = smsMessageSender.sendMessage( smsSubject, text, currentUser, recipientsList, false );
}
else
@@ -293,7 +288,7 @@
return ERROR;
}
- message = smsSender.sendMessage( smsSubject, smsMessage, currentUser, recipientsList, false );
+ message = smsMessageSender.sendMessage( smsSubject, text, currentUser, recipientsList, false );
}
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml 2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/resources/META-INF/dhis/beans.xml 2013-08-22 08:03:53 +0000
@@ -17,7 +17,7 @@
<bean id="org.hisp.dhis.sms.outcoming.ProcessingSendSMSAction"
class="org.hisp.dhis.sms.outcoming.ProcessingSendSMSAction" scope="prototype">
- <property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
+ <property name="smsMessageSender" ref="org.hisp.dhis.sms.SmsMessageSender" />
</bean>
<bean id="org.hisp.dhis.sms.outcoming.SearchPatientAction" class="org.hisp.dhis.sms.outcoming.SearchPatientAction"
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/sendSMS.js'
--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/sendSMS.js 2013-06-25 13:58:55 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/javascript/sendSMS.js 2013-08-22 08:03:53 +0000
@@ -105,7 +105,7 @@
{
recipients: JSON.stringify( p.recipients ),
gatewayId: getFieldValue( 'gatewayId' ),
- smsMessage: getFieldValue( 'smsMessage' ),
+ text: getFieldValue( 'text' ),
sendTarget: getFieldValue( 'sendTarget' ),
userGroup: getFieldValue( 'userGroup' )
}, function ( json )
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm 2013-08-05 09:18:33 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/sendSMSPage.vm 2013-08-22 08:03:53 +0000
@@ -72,7 +72,7 @@
</tr>
<tr><th colspan="2">$i18n.getString( "message" ) ($i18n.getString( "do_not_send_patient_confidential_messages_using_sms" ))</th></tr>
- <tr><td colspan="2"><textarea id="smsMessage" name="smsMessage" rows="5" style="width:544px;" class="{validate:{required:true}}"></textarea></td></tr>
+ <tr><td colspan="2"><textarea id="text" name="text" rows="5" style="width:544px;" class="{validate:{required:true}}"></textarea></td></tr>
<tr>
<td><input type="submit" class='large-button' name="send" value="$i18n.getString( 'send' )"/>
</tr>