← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11726: fix bugs for SMS command, change the validation for SMS command code

 

------------------------------------------------------------
revno: 11726
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-21 16:27:39 +0700
message:
  fix bugs for SMS command, change the validation for SMS command code
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml


--
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/UnregisteredSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java	2013-08-21 05:40:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java	2013-08-21 09:27:39 +0000
@@ -33,11 +33,7 @@
 import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
-import org.hisp.dhis.message.Message;
-import org.hisp.dhis.message.MessageConversation;
-import org.hisp.dhis.message.MessageConversationStore;
 import org.hisp.dhis.message.MessageService;
-import org.hisp.dhis.message.UserMessage;
 import org.hisp.dhis.sms.incoming.IncomingSms;
 import org.hisp.dhis.sms.incoming.IncomingSmsListener;
 import org.hisp.dhis.sms.parse.ParserType;
@@ -55,8 +51,6 @@
 {
     private SMSCommandService smsCommandService;
 
-    private MessageConversationStore messageConversationStore;
-
     private UserService userService;
 
     private MessageService messageService;
@@ -132,8 +126,7 @@
                 {
                     anonymousUser = userService.getUserCredentialsByUsername( "admin" );
                 }
-
-                MessageConversation conversation = new MessageConversation( smsCommand.getName(),
+                /*MessageConversation conversation = new MessageConversation( smsCommand.getName(),
                     anonymousUser.getUser() );
 
                 conversation.addMessage( new Message( message, null, anonymousUser.getUser() ) );
@@ -143,7 +136,7 @@
                     boolean read = false;
 
                     conversation.addUserMessage( new UserMessage( receiver, read ) );
-                }
+                }*/
                 // forward to user group by SMS, E-mail, DHIS conversation
 
                 messageService.sendMessage( smsCommand.getName(), message, null, receivers, anonymousUser.getUser(),
@@ -160,43 +153,24 @@
         }
     }
 
-    public SMSCommandService getSmsCommandService()
-    {
-        return smsCommandService;
-    }
-
     public void setSmsCommandService( SMSCommandService smsCommandService )
     {
         this.smsCommandService = smsCommandService;
     }
 
-    public MessageConversationStore getMessageConversationStore()
-    {
-        return messageConversationStore;
-    }
-
-    public void setMessageConversationStore( MessageConversationStore messageConversationStore )
-    {
-        this.messageConversationStore = messageConversationStore;
-    }
-
-    public UserService getUserService()
-    {
-        return userService;
-    }
-
     public void setUserService( UserService userService )
     {
         this.userService = userService;
     }
 
-    public MessageService getMessageService()
-    {
-        return messageService;
-    }
-
     public void setMessageService( MessageService messageService )
     {
         this.messageService = messageService;
     }
+
+    public void setSmsMessageSender( SmsMessageSender smsMessageSender )
+    {
+        this.smsMessageSender = smsMessageSender;
+    }
+    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java	2013-08-12 06:51:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java	2013-08-21 09:27:39 +0000
@@ -124,7 +124,7 @@
     {
         Criteria criteria = sessionFactory.getCurrentSession().createCriteria( SMSCommand.class );
         criteria.add( Restrictions.eq( "parserType", parserType ) );
-        criteria.add( Restrictions.eq( "name", commandName ) );
+        criteria.add( Restrictions.ilike( "name", "%"+commandName+"%") );
         
         if ( criteria.list() != null && criteria.list().size() > 0 )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2013-08-13 11:54:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2013-08-21 09:27:39 +0000
@@ -763,10 +763,10 @@
   </bean>
   
   <bean id="org.hisp.dhis.sms.UnregisteredSMSListener" class="org.hisp.dhis.sms.UnregisteredSMSListener">
-    <property name="messageConversationStore" ref="org.hisp.dhis.message.MessageConversationStore" />
     <property name="smsCommandService" ref="smsCommandService" />
+    <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
+    <property name="smsMessageSender" ref="org.hisp.dhis.sms.SmsMessageSender" />
     <property name="userService" ref="org.hisp.dhis.user.UserService" />
-    <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
   </bean>
   
   <bean id="org.hisp.dhis.sms.DHISMessageAlertListener" class="org.hisp.dhis.sms.DHISMessageAlertListener">