← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10197: local/in/mobile updates

 

------------------------------------------------------------
revno: 10197
committer: Harsh Atal <harsh.atal@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-14 12:18:31 +0530
message:
  local/in/mobile updates
modified:
  local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java
  local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java
  local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/MobileImportService.java
  local/in/dhis-mobile/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java
  local/in/dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml
  local/in/dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.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 'local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java'
--- local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java	2011-12-26 10:07:59 +0000
+++ local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java	2013-03-14 06:48:31 +0000
@@ -48,6 +48,7 @@
 import org.hisp.dhis.mobile.api.SendSMS;
 import org.hisp.dhis.mobile.api.SendSMSService;
 import org.hisp.dhis.mobile.api.XmlCreatorService;
+import org.smslib.AGateway;
 import org.smslib.GatewayException;
 import org.smslib.ICallNotification;
 import org.smslib.IInboundMessageNotification;
@@ -63,6 +64,7 @@
 import org.smslib.InboundMessage.MessageClasses;
 import org.smslib.Message.MessageTypes;
 import org.smslib.OutboundWapSIMessage.WapSISignals;
+import org.smslib.helper.Logger;
 import org.smslib.modem.SerialModemGateway;
 
 public class SmsService implements MessageService
@@ -110,13 +112,16 @@
     private OutboundNotification outboundNotification;
 
     private CallNotification callNotification;
+    
+    private Logger logger;
 
     public SmsService()
     {
-        serv = new Service();
+        serv = Service.getInstance();
         inboundNotification = new InboundNotification();
         outboundNotification = new OutboundNotification();
         callNotification = new CallNotification();
+        logger = Logger.getInstance();
     }
 
     @Override
@@ -229,23 +234,24 @@
             {
                 serv.sendMessage( message );
                 //serv.sendMessages( messages );
-                getService().getLogger().logInfo( "Message Sent to Group: " + groupName, null, null );
+                
+                logger.logInfo( "Message Sent to Group: " + groupName, null, null );
                 return "SUCCESS";
             } catch ( TimeoutException ex )
             {
-                getService().getLogger().logError( "Timeout error in sending message", ex, null );
+                logger.logError( "Timeout error in sending message", ex, null );
                 return "ERROR";
             } catch ( GatewayException ex )
             {
-                getService().getLogger().logError( "Gateway Exception in sending message", ex, null );
+                logger.logError( "Gateway Exception in sending message", ex, null );
                 return "ERROR";
             } catch ( IOException ex )
             {
-                getService().getLogger().logError( "IO Exception in sending message", ex, null );
+                logger.logError( "IO Exception in sending message", ex, null );
                 return "ERROR";
             } catch ( InterruptedException ex )
             {
-                getService().getLogger().logError( "Interrupted Exception in sending message", ex, null );
+                logger.logError( "Interrupted Exception in sending message", ex, null );
                 return "ERROR";
             } finally
             {
@@ -253,7 +259,7 @@
             }
         } else
         {
-            getService().getLogger().logError( "Service not running", null, null );
+            logger.logError( "Service not running", null, null );
             return "SERVICE NOT RUNNING";
         }
     }
@@ -293,7 +299,7 @@
             {
                 if ( status.equalsIgnoreCase( "MODEMERROR" ) )
                 {
-                    getService().getLogger().logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
+                    logger.logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
                     return "Modem Stops Responding...Till then successfully sent : " + successCount;
                 } else
                 {
@@ -322,7 +328,7 @@
             {
                 if ( status.equalsIgnoreCase( "MODEMERROR" ) )
                 {
-                    getService().getLogger().logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
+                    logger.logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
                     //System.out.println("Successfully sent : "+ successCount +" Failed : " + failCount);
                     System.out.println( "modem is not responding....waiting for it to respond..." );
                     // return "Modem Stops Responding...Till then successfully sent : "+successCount; 
@@ -356,7 +362,7 @@
             {
                 if ( status.equalsIgnoreCase( "MODEMERROR" ) )
                 {
-                    getService().getLogger().logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
+                    logger.logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
                     //System.out.println("Successfully sent : "+ successCount +" Failed : " + failCount);
                     System.out.println( "modem is not responding....waiting for it to respond..." );
                     // return "Modem Stops Responding...Till then successfully sent : "+successCount; 
@@ -386,33 +392,33 @@
             {
                 if ( serv.sendMessage( message ) )
                 {
-                    getService().getLogger().logInfo( "Message Sent to: " + recipient, null, null );
+                    logger.logInfo( "Message Sent to: " + recipient, null, null );
                     return "SUCCESS";
                 } else
                 {
-                    getService().getLogger().logError( "Timeout error in sending message to: " + recipient, null, null );
+                    logger.logError( "Timeout error in sending message to: " + recipient, null, null );
                     return "MODEMERROR";
                 }
             } catch ( TimeoutException ex )
             {
-                getService().getLogger().logError( "Timeout error in sending message", ex, null );
+                logger.logError( "Timeout error in sending message", ex, null );
                 return "ERROR";
             } catch ( GatewayException ex )
             {
-                getService().getLogger().logError( "Gateway Exception in sending message", ex, null );
+                logger.logError( "Gateway Exception in sending message", ex, null );
                 return "ERROR";
             } catch ( IOException ex )
             {
-                getService().getLogger().logError( "IO Exception in sending message", ex, null );
+                logger.logError( "IO Exception in sending message", ex, null );
                 return "ERROR";
             } catch ( InterruptedException ex )
             {
-                getService().getLogger().logError( "Interrupted Exception in sending message", ex, null );
+                logger.logError( "Interrupted Exception in sending message", ex, null );
                 return "ERROR";
             }
         } else
         {
-            getService().getLogger().logError( "Service not running", null, null );
+            logger.logError( "Service not running", null, null );
             return "SERVICE NOT RUNNING";
         }
     }
@@ -429,33 +435,33 @@
             {
                 if ( serv.sendMessage( message ) )
                 {
-                    getService().getLogger().logInfo( "Message Sent to: " + recipient, null, null );
+                    logger.logInfo( "Message Sent to: " + recipient, null, null );
                     return "SUCCESS";
                 } else
                 {
-                    getService().getLogger().logError( "Timeout error in sending message to: " + recipient, null, null );
+                    logger.logError( "Timeout error in sending message to: " + recipient, null, null );
                     return "MODEMERROR";
                 }
             } catch ( TimeoutException ex )
             {
-                getService().getLogger().logError( "Timeout error in sending message", ex, null );
+                logger.logError( "Timeout error in sending message", ex, null );
                 return "ERROR";
             } catch ( GatewayException ex )
             {
-                getService().getLogger().logError( "Gateway Exception in sending message", ex, null );
+                logger.logError( "Gateway Exception in sending message", ex, null );
                 return "ERROR";
             } catch ( IOException ex )
             {
-                getService().getLogger().logError( "IO Exception in sending message", ex, null );
+                logger.logError( "IO Exception in sending message", ex, null );
                 return "ERROR";
             } catch ( InterruptedException ex )
             {
-                getService().getLogger().logError( "Interrupted Exception in sending message", ex, null );
+                logger.logError( "Interrupted Exception in sending message", ex, null );
                 return "ERROR";
             }
         } else
         {
-            getService().getLogger().logError( "Service not running", null, null );
+            logger.logError( "Service not running", null, null );
             return "SERVICE NOT RUNNING";
         }
     }
@@ -467,7 +473,7 @@
         int delSMSflag = 0;
         try
         {
-            getService().getLogger().logInfo( "---Starting processing message---", null, null );
+            logger.logInfo( "---Starting processing message---", null, null );
             InboundBinaryMessage binaryMsg = (InboundBinaryMessage) message;
             byte[] compressedData = binaryMsg.getDataBytes();
             String unCompressedText = new String( Compressor.decompress( compressedData ), "UTF-8" );
@@ -479,41 +485,46 @@
             {
                 mobileImportService.importInteractionMessage(unCompressedText, sender, sendTime);
             }
-            
+            else if (unCompressedText.startsWith("S1")){
+            	mobileImportService.registerData(unCompressedText, sender, sendTime);
+            }
+            else if (unCompressedText.startsWith("S2")){
+            	mobileImportService.registerDataByUID(unCompressedText, sender, sendTime);
+            }
             else
             {
 
             // Creating XML File
-            getService().getLogger().logInfo( "Creating XML file...", null, null );
+            logger.logInfo( "Creating XML file...", null, null );
             createXMLFile( sender, sendTime, unCompressedText );
 
             //Delete SMS
-            getService().getLogger().logInfo( "Deleting SMS...", null, null );
+            logger.logInfo( "Deleting SMS...", null, null );
             if ( getProperties().getProperty( "settings.delete_after_processing", "no" ).equalsIgnoreCase( "yes" ) )
             {
                 try
                 {
                     getService().deleteMessage( (InboundMessage) message );
-                    getService().getLogger().logInfo( "Deleted message", null, null );
+                    logger.logInfo( "Deleted message", null, null );
                     delSMSflag = 1;
                 } catch ( Exception e )
                 {
-                    getService().getLogger().logError( "Error deleting received message!", e, null );
+                    logger.logError( "Error deleting received message!", e, null );
                 }
             }
 
             // Import data into DHIS
-            //getService().getLogger().logInfo( "Importing data into DHIS...", null, null );
+            //logger.logInfo( "Importing data into DHIS...", null, null );
             //String statusMessage = importData( sender, sendTime, unCompressedText );
 
             //Sending ACK/Status SMS
-            //getService().getLogger().logInfo( "Sending ACK/Status messge...", null, null );
+            //logger.logInfo( "Sending ACK/Status messge...", null, null );
             //sendMessage( sender, statusMessage );
 
-            getService().getLogger().logInfo( "---Message Processing Finished---", null, null );
+            logger.logInfo( "---Message Processing Finished---", null, null );
 
             //String statusMessage = saveData( sender, sendTime, unCompressedText );
-            //getService().getLogger().logInfo( "Saved Report. Sending Acknowledgement to " + sender, null, null );
+            //logger.logInfo( "Saved Report. Sending Acknowledgement to " + sender, null, null );
             //sendAck( sender, "REPORT", unCompressedText );
             //sendMessage( sender, statusMessage );
             
@@ -521,23 +532,23 @@
 
         } catch ( UnsupportedEncodingException uneex )
         {
-            getService().getLogger().logError( "Error reading encoding: ", uneex, null );
+            logger.logError( "Error reading encoding: ", uneex, null );
             return;
         } catch ( ClassCastException ccex )
         {
-            getService().getLogger().logError( "Error performing ClassCast: ", ccex, null );
+            logger.logError( "Error performing ClassCast: ", ccex, null );
             return;
         } catch ( ArithmeticException aex )
         {
-            getService().getLogger().logError( "Error performing arithmatic operation: ", aex, null );
+            logger.logError( "Error performing arithmatic operation: ", aex, null );
             return;
         } catch ( ArrayIndexOutOfBoundsException aiobex )
         {
-            getService().getLogger().logError( "Error with message format. PLEASE CHECK APP VERSION: ", aiobex, null );
+            logger.logError( "Error with message format. PLEASE CHECK APP VERSION: ", aiobex, null );
             return;
         } catch ( NullPointerException npex )
         {
-            getService().getLogger().logError( "MISSING form number. PLEASE CHECK formIDLayout.csv: ", npex, null );
+            logger.logError( "MISSING form number. PLEASE CHECK formIDLayout.csv: ", npex, null );
             return;
         } finally
         {
@@ -546,13 +557,13 @@
                 try
                 {
                     getService().deleteMessage( (InboundMessage) message );
-                    getService().getLogger().logInfo( "Deleted message", null, null );
+                    logger.logInfo( "Deleted message", null, null );
                 } catch ( Exception e )
                 {
-                    getService().getLogger().logError( "Error deleting received message!", e, null );
+                    logger.logError( "Error deleting received message!", e, null );
                 }
             }
-            getService().getLogger().logInfo( "---Message Processing Finished---", null, null );
+            logger.logInfo( "---Message Processing Finished---", null, null );
         }
         
     }
@@ -607,7 +618,7 @@
         xmlCreatorService.setSendTime( timeStamp );
         xmlCreatorService.setInfo( data );
         xmlCreatorService.run(); //should be made thread-safe
-        getService().getLogger().logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
+        logger.logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
     }
 
     public String importData( String mobileNumber, Date sendTime, String data )
@@ -617,7 +628,7 @@
 
         String importFileName = mobileNumber + "_" + timeStamp.replace( ":", "-" ) + ".xml";
         String statusMessage = mobileImportService.importXMLFile( importFileName );
-        getService().getLogger().logInfo( "Importing Completed for current messages", null, null );
+        logger.logInfo( "Importing Completed for current messages", null, null );
         return statusMessage;
     }
 
@@ -630,18 +641,18 @@
         xmlCreatorService.setSendTime( timeStamp );
         xmlCreatorService.setInfo( data );
         xmlCreatorService.run(); //should be made thread-safe
-        getService().getLogger().logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
+        logger.logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
         //mobileImportService.importAllFiles();
         String importFileName = mobileNumber + "_" + timeStamp.replace( ":", "-" ) + ".xml";
         String statusMessage = mobileImportService.importXMLFile( importFileName );
-        getService().getLogger().logInfo( "Importing Completed for current messages", null, null );
+        logger.logInfo( "Importing Completed for current messages", null, null );
         return statusMessage;
     }
 
     private void processStatusReport( InboundMessage message )
     {
         String originator = message.getOriginator();
-        getService().getLogger().logInfo( "STATUS REPORT received from: " + originator, null, null );
+        logger.logInfo( "STATUS REPORT received from: " + originator, null, null );
     }
 
     @Override
@@ -649,7 +660,7 @@
     {
         if ( !getServiceStatus() )
         {
-            getService().getLogger().logError( "SMSService not running", null, null );
+            logger.logError( "SMSService not running", null, null );
 
             return "SMSService not running";
         }
@@ -677,7 +688,7 @@
     {
         if ( !getServiceStatus() )
         {
-            getService().getLogger().logError( "SMSService not running", null, null );
+            logger.logError( "SMSService not running", null, null );
 
             return null;
         }
@@ -687,7 +698,7 @@
         List<InboundMessage> msgList = new ArrayList<InboundMessage>();
         try
         {
-            getService().getLogger().logInfo( "Reading All Pending Messages...", null, null );
+            logger.logInfo( "Reading All Pending Messages...", null, null );
 
             serv.readMessages( msgList, MessageClasses.ALL );
 
@@ -716,15 +727,15 @@
                     try
                     {
                         pendingMessages.put( sender + "_" + timeStamp, message.getText() );
-                        getService().getLogger().logInfo( "Normal Text Message", null, null );
+                        logger.logInfo( "Normal Text Message", null, null );
                     } catch ( Exception e )
                     {
                         pendingMessages.put( sender + "_" + timeStamp, "Unsupported Format" );
-                        getService().getLogger().logError( "UnSupported Format", null, null );
+                        logger.logError( "UnSupported Format", null, null );
                     }
                 } catch ( Exception e )
                 {
-                    getService().getLogger().logError( "Error While reading messages, returning whatever sms got till now", null, null );
+                    logger.logError( "Error While reading messages, returning whatever sms got till now", null, null );
                     return pendingMessages;
                 }
             }
@@ -733,7 +744,7 @@
         } catch ( Exception e )
         {
             e.printStackTrace();
-            getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
+            logger.logError( "SMSServer: error setting custom balancer!", null, null );
 
             return null;
         }
@@ -744,7 +755,7 @@
     {
         if ( !getServiceStatus() )
         {
-            getService().getLogger().logError( "SMSService not running", null, null );
+            logger.logError( "SMSService not running", null, null );
 
             return null;
         }
@@ -753,7 +764,7 @@
         List<InboundMessage> msgList = new ArrayList<InboundMessage>();
         try
         {
-            getService().getLogger().logInfo( "Reading All Messages...", null, null );
+            logger.logInfo( "Reading All Messages...", null, null );
 
             serv.readMessages( msgList, MessageClasses.ALL );
 
@@ -761,7 +772,7 @@
         } catch ( Exception e )
         {
             e.printStackTrace();
-            getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
+            logger.logError( "SMSServer: error setting custom balancer!", null, null );
 
             return null;
         }
@@ -800,11 +811,11 @@
                     Constructor<?> constructor = c.getConstructor( argsClass );
                     org.smslib.balancing.LoadBalancer balancer = (org.smslib.balancing.LoadBalancer) constructor.newInstance( args );
                     getService().setLoadBalancer( balancer );
-                    getService().getLogger().logInfo( "SMSServer: set balancer to: " + getProperties().getProperty( "smsserver.balancer", "" ), null, null );
+                    logger.logInfo( "SMSServer: set balancer to: " + getProperties().getProperty( "smsserver.balancer", "" ), null, null );
                 } catch ( Exception e )
                 {
                     e.printStackTrace();
-                    getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
+                    logger.logError( "SMSServer: error setting custom balancer!", null, null );
                 }
             }
             //</editor-fold>
@@ -826,10 +837,10 @@
                     Constructor<?> constructor = c.getConstructor( argsClass );
                     org.smslib.routing.Router router = (org.smslib.routing.Router) constructor.newInstance( args );
                     getService().setRouter( router );
-                    getService().getLogger().logInfo( "SMSServer: set router to: " + getProperties().getProperty( "smsserver.router", "" ), null, null );
+                    logger.logInfo( "SMSServer: set router to: " + getProperties().getProperty( "smsserver.router", "" ), null, null );
                 } catch ( Exception e )
                 {
-                    getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
+                    logger.logError( "SMSServer: error setting custom balancer!", null, null );
                 }
             }
             //</editor-fold>
@@ -904,10 +915,10 @@
                     {
                         getService().addGateway( gateway );
                     }
-                    getService().getLogger().logInfo( "SMSServer: added gateway " + i + " / ", null, null );
+                    logger.logInfo( "SMSServer: added gateway " + i + " / ", null, null );
                 } catch ( Exception e )
                 {
-                    getService().getLogger().logError( "SMSServer: Unknown Gateway in configuration file!, " + e.getMessage(), null, null );
+                    logger.logError( "SMSServer: Unknown Gateway in configuration file!, " + e.getMessage(), null, null );
 
                     e.printStackTrace();
 
@@ -934,18 +945,17 @@
     class InboundNotification implements IInboundMessageNotification
     {
 
-        @Override
         public void process( String gatewayId, MessageTypes msgType, InboundMessage msg )
         {
             if ( msgType == MessageTypes.INBOUND )
             {
-                getService().getLogger().logInfo( "New INBOUND MESSAGE on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
+                logger.logInfo( "New INBOUND MESSAGE on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
                 processMessage( msg );
             } else
             {
                 if ( msgType == MessageTypes.STATUSREPORT )
                 {
-                    getService().getLogger().logInfo( "New STATUS REPORT on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
+                    logger.logInfo( "New STATUS REPORT on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
                     processStatusReport( msg );
                 }
 
@@ -954,10 +964,10 @@
                     try
                     {
                         getService().deleteMessage( msg );
-                        getService().getLogger().logInfo( "Deleted message", null, null );
+                        logger.logInfo( "Deleted message", null, null );
                     } catch ( Exception e )
                     {
-                        getService().getLogger().logError( "Error deleting received message!", e, null );
+                        logger.logError( "Error deleting received message!", e, null );
                     }
                 }
             }
@@ -968,15 +978,22 @@
             try
             {
             getService().deleteMessage( msg );
-            getService().getLogger().logInfo( "Deleted message", null, null );
+            logger.logInfo( "Deleted message", null, null );
             } 
             catch ( Exception e )
             {
-            getService().getLogger().logError( "Error deleting received message!", e, null );
+            logger.logError( "Error deleting received message!", e, null );
             }
             }
              */
         }
+
+		@Override
+		public void process(AGateway gateway, MessageTypes msgType,
+				InboundMessage msg) {
+			// TODO Auto-generated method stub
+			
+		}
     }
     //</editor-fold>
 
@@ -984,10 +1001,15 @@
     class OutboundNotification implements IOutboundMessageNotification
     {
 
-        @Override
         public void process( String gtwId, org.smslib.OutboundMessage msg )
         {
         }
+
+		@Override
+		public void process(AGateway gateway, OutboundMessage msg) {
+			// TODO Auto-generated method stub
+			
+		}
     }
     //</editor-fold>
 
@@ -995,11 +1017,16 @@
     class QueueSendingNotification implements IQueueSendingNotification
     {
 
-        @Override
         public void process( String gtwId, OutboundMessage msg )
         {
-            getService().getLogger().logInfo( "**** >>>> Now Sending: " + msg.getRecipient(), null, gtwId );
+            logger.logInfo( "**** >>>> Now Sending: " + msg.getRecipient(), null, gtwId );
         }
+
+		@Override
+		public void process(AGateway gateway, OutboundMessage msg) {
+			// TODO Auto-generated method stub
+			
+		}
     }
     //</editor-fold>
 
@@ -1009,8 +1036,14 @@
 
         public void process( String gatewayId, String callerId )
         {
-            getService().getLogger().logInfo( "**** >>>> Getting call from: " + callerId, null, null );
+            logger.logInfo( "**** >>>> Getting call from: " + callerId, null, null );
         }
+
+		@Override
+		public void process(AGateway gateway, String callerId) {
+			// TODO Auto-generated method stub
+			
+		}
     }
     //</editor-fold>
     //</editor-fold>

=== modified file 'local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java'
--- local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java	2011-09-03 11:14:13 +0000
+++ local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/DefaultMobileImportService.java	2013-03-14 06:48:31 +0000
@@ -28,10 +28,13 @@
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -40,6 +43,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -48,6 +52,7 @@
 import org.amplecode.quick.BatchHandlerFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.constant.ConstantService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -58,6 +63,18 @@
 import org.hisp.dhis.mobile.SmsService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.period.DailyPeriodType;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
@@ -65,8 +82,16 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.WeeklyPeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.user.UserStore;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
@@ -84,6 +109,8 @@
 
     private static final Log LOG = LogFactory.getLog( DefaultMobileImportService.class );
 
+	
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -172,6 +199,83 @@
         this.batchHandlerFactory = batchHandlerFactory;
     }
 
+    private UserService userService;
+
+    public void setUserService(UserService userService) 
+    {
+	this.userService = userService;
+    }
+    
+    private ConstantService constantService;
+    
+    public void setConstantService(ConstantService constantService) {
+  		this.constantService = constantService;
+  	}
+    
+    private PatientAttributeService patientAttributeService;
+
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+    
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+    
+    private ProgramService programService;
+    
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+    
+    private ProgramInstanceService programInstanceService;
+    
+    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+    {
+        this.programInstanceService = programInstanceService;
+    }
+
+    private ProgramStageInstanceService programStageInstanceService;
+    
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    private PatientDataValueService patientDataValueService;
+    
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+        
+    private PatientIdentifierService patientIdentifierService;
+
+    public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService )
+    {
+        this.patientIdentifierService = patientIdentifierService;
+    }
+
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+    
+    public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
+    {
+        this.patientIdentifierTypeService = patientIdentifierTypeService;
+    }
+    
+    private PatientAttributeValueService patientAttributeValueService;
+
+    public void setPatientAttributeValueService(
+			PatientAttributeValueService patientAttributeValueService) {
+		this.patientAttributeValueService = patientAttributeValueService;
+	}
+
+    
     // -------------------------------------------------------------------------
     // Parameters
     // -------------------------------------------------------------------------
@@ -599,8 +703,9 @@
 
             if ( curUser != null )
             {
-                UserCredentials userCredentials = userStore.getUserCredentials( curUser );
-
+              //  UserCredentials userCredentials = userStore.getUserCredentials( curUser );
+            	  UserCredentials userCredentials = userService.getUserCredentials( curUser );
+            	
                 if ( (userCredentials != null)
                     && (mobImportParameters.getMobileNumber().equals( curUser.getPhoneNumber() )) )
                 {
@@ -675,8 +780,9 @@
 
             if ( curUser != null )
             {
-                UserCredentials userCredentials = userStore.getUserCredentials( curUser );
-
+                //UserCredentials userCredentials = userStore.getUserCredentials( curUser );
+                UserCredentials userCredentials = userService.getUserCredentials( curUser );
+                
                 if ( (userCredentials != null)
                     && (mobImportParameters.getMobileNumber().equals( curUser.getPhoneNumber() )) )
                 {
@@ -777,7 +883,8 @@
             if ( sqlResultSet != null && sqlResultSet.next() )
             {
                 Integer userId = sqlResultSet.getInt( 1 );
-                User user = userStore.getUser( userId );
+              //  User user = userStore.getUser( userId );
+                User user = userService.getUser(userId);
                 if ( user != null )
                     return user;
             }
@@ -843,7 +950,9 @@
             }
             else
             {
-                UserCredentials userCredentials = userStore.getUserCredentials( curUser );
+                //UserCredentials userCredentials = userStore.getUserCredentials( curUser );
+                UserCredentials userCredentials = userService.getUserCredentials( curUser );
+            	
                 storedBy = userCredentials.getUsername();
             }
 
@@ -1019,8 +1128,9 @@
             }
             else
             {
-                UserCredentials userCredentials = userStore.getUserCredentials( curUser );
-
+//                UserCredentials userCredentials = userStore.getUserCredentials( curUser );
+            	  UserCredentials userCredentials = userService.getUserCredentials( curUser );
+              	
                 storedBy = userCredentials.getUsername();
             }
             DataElement dataElement = dataElementService.getDataElement( dataelementid );
@@ -1154,4 +1264,393 @@
         }
 
     }
-}
+
+	@Override
+	public String registerData(String unCompressedText, String sender, Date sendTime ) {
+	
+		//	S1#10/09/2012$ebc:sc:sname:fname:21032013:F:5:5665222222:0:0:1:0
+		
+		String stage="";
+		String programName = "Registration and Symptom detection";
+		String statusMessage=null;
+		String registrationDate="";
+		 String fullName = "";
+         String firstName = "";
+         String middleName = "";
+         String lastName = "";
+         String gender = null;
+         String formNo = "";
+         Date dob = null;
+         String fatherName = "";
+		
+         int fatherNamePatientAttributeId = (int) constantService.getConstantByName("PatientAttributeFatherNameId").getValue();
+         int schoolCodePatientAttributeId = (int) constantService.getConstantByName("PatientAttributeSchoolCodeId").getValue();
+    		
+         
+         List<PatientAttributeValue> patientAttributeValues = new ArrayList<PatientAttributeValue>();
+         
+		String smsData[] = unCompressedText.split("#");
+		stage = smsData[0];
+		
+		String regDate[] = smsData[1].split("//$");
+		registrationDate = regDate[0];
+		
+		String data[] = regDate[1].split(":");
+		
+		String path = System.getenv( "DHIS2_HOME" ) +  File.separator + "mi" + File.separator + "formIDLayout.csv";
+        Properties props = new Properties();
+        try {
+			props.load( new FileReader( path ) );
+		} catch (FileNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        
+        String mappingString = props.getProperty("S1");
+		String[] elementIds = mappingString.split("\\,");
+		
+		for (int i=0;i<elementIds.length;i++){
+			//print these
+		}
+		
+	//save patient attribute data + patient data + datavalue data
+		//register patient
+		//enroll patient into program
+		// enter data for the program
+		
+		Collection<User> users = userService.getUsersByPhoneNumber(sender);
+		User user = users.iterator().next();
+		
+		Patient patient = new Patient();
+		
+
+		for (int i=0;i<elementIds.length;i++){
+			
+			if (elementIds[i].equalsIgnoreCase("NAME")){
+			
+				// Set FirstName, MiddleName, LastName by FullName
+                fullName = data[i].trim();
+
+                int startIndex = fullName.indexOf( ' ' );
+                int endIndex = fullName.lastIndexOf( ' ' );
+
+                firstName = fullName.toString();
+                middleName = "";
+                lastName = "";
+
+                if ( fullName.indexOf( ' ' ) != -1 )
+                {
+                    firstName = fullName.substring( 0, startIndex );
+                    if ( startIndex == endIndex )
+                    {
+                        middleName = "";
+                        lastName = fullName.substring( startIndex + 1, fullName.length() );
+                    }
+                    else
+                    {
+                        middleName = fullName.substring( startIndex + 1, endIndex );
+                        lastName = fullName.substring( endIndex + 1, fullName.length() );
+                    }
+                }
+
+                patient.setFirstName( firstName );
+                patient.setMiddleName( middleName );
+                patient.setLastName( lastName );
+                patient.setIsDead( false );
+                //patient.setUnderAge( false );
+                patient.setOrganisationUnit( user.getOrganisationUnit() );
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                Date convertedDate=null;
+				try {
+					convertedDate = dateFormat.parse( registrationDate );
+				} catch (ParseException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} 
+                patient.setRegistrationDate( convertedDate );
+			}
+			
+			 else if( elementIds[i].equalsIgnoreCase( "GENDER" ) && data[i] != null )
+             {
+            
+                if( gender == null )
+                     gender = data[i];
+                 patient.setGender( gender );
+             }
+             else if( elementIds[i].equalsIgnoreCase( "PHONE" ) && data[i] != null )
+             {
+                 patient.setPhoneNumber( data[i] );
+             }
+             else if( elementIds[i].equalsIgnoreCase( "DOB" ) && data[i] != null )
+             {
+            	  SimpleDateFormat dateFormat = new SimpleDateFormat("ddMMyy");
+                  
+            	  try {
+					Date birthDate = dateFormat.parse(registrationDate);
+				} catch (ParseException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+             }
+             
+             else if( elementIds[i].substring( 0, 2 ).equalsIgnoreCase( "PA" ) && data[i] != null )
+             {
+                 PatientAttributeValue attributeValue = null;
+                 PatientAttribute attribute = patientAttributeService.getPatientAttribute( Integer.parseInt( elementIds[i].split( ":" )[1] ) );
+                 
+                 String value = data[i];
+                 //String value = props1.getProperty( elementIds[i]+":"+patientData[i] );
+                 
+               PatientAttributeValue patientAttributeValue = new PatientAttributeValue();
+               patientAttributeValue.setPatient(patient);
+               patientAttributeValue.setPatientAttribute(attribute);
+               patientAttributeValue.setValue(value);
+               
+               patientAttributeValues.add(patientAttributeValue);
+             }
+			
+		}
+		
+		 PatientIdentifierType patientIdentifierType = patientIdentifierTypeService.getPatientIdentifierType( PatientIdentifierType.ORGUNITAUTOFORMAT );
+         int fourDigitRunningNo = 1;
+         String fourDigitRunningNumber = "0001";
+         
+         PatientAttribute schoolCodePatientAttribute = patientAttributeService.getPatientAttribute(schoolCodePatientAttributeId);
+         PatientAttributeValue schoolCodeValue = patientAttributeValueService.getPatientAttributeValue(patient, schoolCodePatientAttribute);
+         PatientAttribute fatherNamePatientAttribute = patientAttributeService.getPatientAttribute(fatherNamePatientAttributeId);
+         PatientAttributeValue fatherNameAttributeValue = patientAttributeValueService.getPatientAttributeValue(patient, fatherNamePatientAttribute);
+         
+         String orgUnitAutoIdentifierData = schoolCodeValue.getValue()+fullName.substring(0,3)+patient.getAge()+patient.getGender()+fatherNameAttributeValue.getValue().substring(0, 2) + fourDigitRunningNumber;
+       
+         PatientIdentifier orgUnitAutoIdentifier = patientIdentifierService.get( patientIdentifierType, orgUnitAutoIdentifierData );
+         
+         while ( orgUnitAutoIdentifier != null )
+         {
+             fourDigitRunningNo++;
+             if( fourDigitRunningNo <= 9 )
+             {
+                 fourDigitRunningNumber = "000" + fourDigitRunningNo;
+             }
+             else if( fourDigitRunningNo >= 10 && fourDigitRunningNo <= 99 )
+             {
+                 fourDigitRunningNumber = "00" + fourDigitRunningNo;
+             }
+             else if( fourDigitRunningNo >= 100 && fourDigitRunningNo <= 999 )
+             {
+                 fourDigitRunningNumber = "0" + fourDigitRunningNo;
+             }
+             orgUnitAutoIdentifierData = schoolCodeValue.getValue()+fullName.substring(0,3)+patient.getAge()+patient.getGender()+fatherNameAttributeValue.getValue().substring(0, 2) + fourDigitRunningNumber;
+                orgUnitAutoIdentifier = patientIdentifierService.get( patientIdentifierType, orgUnitAutoIdentifierData );
+         }
+         orgUnitAutoIdentifier = new PatientIdentifier();
+         orgUnitAutoIdentifier.setIdentifierType( patientIdentifierType );
+         orgUnitAutoIdentifier.setIdentifier( orgUnitAutoIdentifierData );
+         orgUnitAutoIdentifier.setPatient( patient );
+
+         patient.getIdentifiers().add( orgUnitAutoIdentifier );
+      
+		
+		
+			  // Creating new Patient 
+            Integer id = patientService.createPatient( patient, null, null, patientAttributeValues );
+            
+            // Enrolling Patient to Program
+            Patient createdPatient = patientService.getPatient( id );
+            Program program = programService.getProgramByName(programName);
+            ProgramStage programStage = null;
+            
+
+            if ( program.getProgramStages() != null )
+            {
+                programStage = program.getProgramStages().iterator().next();
+            }
+            ProgramInstance programInstance = null;
+            
+            int type = program.getType();
+            if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION )
+            {
+                // Add a new program-instance
+                programInstance = new ProgramInstance();
+                programInstance.setEnrollmentDate( createdPatient.getRegistrationDate() );
+                programInstance.setDateOfIncident( createdPatient.getRegistrationDate() );
+                programInstance.setProgram( program );
+                programInstance.setCompleted( false );
+
+                programInstance.setPatient( createdPatient );
+                createdPatient.getPrograms().add( program );
+                patientService.updatePatient( createdPatient );
+
+                programInstanceService.addProgramInstance( programInstance );
+                
+                // Add a new program-stage-instance
+                ProgramStageInstance programStageInstance = new ProgramStageInstance();
+                programStageInstance.setProgramInstance( programInstance );
+                programStageInstance.setProgramStage( programStage );
+                
+               // programStageInstance.setStageInProgram( programStage.getStageInProgram() );
+                programStageInstance.setDueDate( createdPatient.getRegistrationDate() );
+                programStageInstance.setExecutionDate( createdPatient.getRegistrationDate() );
+                programStageInstance.setOrganisationUnit( createdPatient.getOrganisationUnit() );
+
+                int psInstanceId = programStageInstanceService.addProgramStageInstance( programStageInstance );
+
+                ProgramStageInstance progStageInstance = programStageInstanceService.getProgramStageInstance( psInstanceId );
+                
+                
+                // Saving Patient Datavalue
+                for ( int i = 0; i < elementIds.length; i++ )
+                {
+                    if( elementIds[i].substring( 0, 2 ).equalsIgnoreCase( "DV" ) && data[i] != null )
+                    {
+                        DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( elementIds[i].split( ":" )[1] ) );
+                        PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( progStageInstance, dataElement );
+                        
+                        
+                        String value = data[i];
+                        //String value = props1.getProperty( elementIds[i]+":"+patientData[i] );
+                      
+                        
+                        if ( value != null && value.trim().length() == 0 )
+                        {
+                            value = null;
+                        }
+                        
+                        if ( progStageInstance.getExecutionDate() == null )
+                        {
+                            progStageInstance.setExecutionDate( new Date() );
+                            programStageInstanceService.updateProgramStageInstance( progStageInstance );
+                        }
+                        
+                        if ( patientDataValue == null && value != null )
+                        {
+                            LOG.debug( "Adding PatientDataValue, value added" );
+
+                            patientDataValue = new PatientDataValue( progStageInstance, dataElement, new Date(), value );
+                            patientDataValue.setStoredBy( storedBy );
+                            patientDataValue.setProvidedElsewhere( false );
+
+                            patientDataValueService.savePatientDataValue( patientDataValue );
+                        }
+                        if( patientDataValue != null && value == null )
+                        {
+                            patientDataValueService.deletePatientDataValue( patientDataValue );
+                        }
+                        else if( patientDataValue != null && value != null )
+                        {
+                            LOG.debug( "Updating PatientDataValue, value added/changed" );
+
+                            patientDataValue.setValue( value );
+                            patientDataValue.setTimestamp( new Date() );
+                            patientDataValue.setProvidedElsewhere( false );
+                            patientDataValue.setStoredBy( storedBy );
+                            
+                            patientDataValueService.updatePatientDataValue( patientDataValue );
+                        }
+                    }
+                }
+            }
+            
+            statusMessage = fullName+" IS SUCCESSFULLY REGISTERED, UNIQUEID IS: "+orgUnitAutoIdentifierData;
+            return statusMessage;
+	}
+
+	@Override
+	public void registerDataByUID(String unCompressedText, String sender,
+			Date sendTime) {
+		
+		//S2#10/09/2012#UID#0:1:0
+		
+		String stage = "";
+		String registrationDate = "";
+		String UID="";
+		String smsData[] = unCompressedText.split("#");
+		stage = smsData[0];
+		
+		
+		registrationDate = smsData[1];
+		UID = smsData[2];
+		String data[] = smsData[3].split(":");
+		
+		String path = System.getenv( "DHIS2_HOME" ) +  File.separator + "mi" + File.separator + "formIDLayout.csv";
+        Properties props = new Properties();
+        try {
+			props.load( new FileReader( path ) );
+		} catch (FileNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        
+        String mappingString = props.getProperty("S2");
+		String[] elementIds = mappingString.split("\\,");
+		
+		
+		PatientIdentifierType patientIdentifierType = patientIdentifierTypeService.getPatientIdentifierType( PatientIdentifierType.ORGUNITAUTOFORMAT );
+	        
+		
+		Patient patient = patientIdentifierService.getPatient(patientIdentifierType, UID.trim());
+		
+		ProgramStageInstance progStageInstance = null;
+		
+		for (int i=0;i<elementIds.length;i++){
+			
+			 if( elementIds[i].substring( 0, 2 ).equalsIgnoreCase( "DV" ) && data[i] != null ){
+                 DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( elementIds[i].split( ":" )[1] ) );
+                 PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( progStageInstance, dataElement );
+                 
+                 
+                 String value = data[i];
+                 //String value = props1.getProperty( elementIds[i]+":"+patientData[i] );
+               
+                 
+                 if ( value != null && value.trim().length() == 0 )
+                 {
+                     value = null;
+                 }
+                 
+                 if ( progStageInstance.getExecutionDate() == null )
+                 {
+                     progStageInstance.setExecutionDate( new Date() );
+                     programStageInstanceService.updateProgramStageInstance( progStageInstance );
+                 }
+                 
+                 if ( patientDataValue == null && value != null )
+                 {
+                     LOG.debug( "Adding PatientDataValue, value added" );
+
+                     patientDataValue = new PatientDataValue( progStageInstance, dataElement, new Date(), value );
+                     patientDataValue.setStoredBy( storedBy );
+                     patientDataValue.setProvidedElsewhere( false );
+
+                     patientDataValueService.savePatientDataValue( patientDataValue );
+                 }
+                 if( patientDataValue != null && value == null )
+                 {
+                     patientDataValueService.deletePatientDataValue( patientDataValue );
+                 }
+                 else if( patientDataValue != null && value != null )
+                 {
+                     LOG.debug( "Updating PatientDataValue, value added/changed" );
+
+                     patientDataValue.setValue( value );
+                     patientDataValue.setTimestamp( new Date() );
+                     patientDataValue.setProvidedElsewhere( false );
+                     patientDataValue.setStoredBy( storedBy );
+                     
+                     patientDataValueService.updatePatientDataValue( patientDataValue );
+                 }
+				 
+			}
+		}
+		
+		
+	}
+		
+	}
+
+

=== modified file 'local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/MobileImportService.java'
--- local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/MobileImportService.java	2011-09-03 11:14:13 +0000
+++ local/in/dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/api/MobileImportService.java	2013-03-14 06:48:31 +0000
@@ -57,4 +57,9 @@
     public void readAllMessages();
     
     public void importInteractionMessage( String smsText, String sender, Date sendTime );
+
+	public String registerData(String unCompressedText, String sender, Date sendTime );
+
+	public void registerDataByUID(String unCompressedText, String sender,
+			Date sendTime);
 }

=== modified file 'local/in/dhis-mobile/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-mobile/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-02-02 09:56:51 +0000
+++ local/in/dhis-mobile/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-03-14 06:48:31 +0000
@@ -27,6 +27,17 @@
 		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
 		<property name="batchHandlerFactory" ref="batchHandlerFactory"/>
 		<property name="jdbcTemplate" ref="jdbcTemplate"/>
+		  <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />	
+   	  	<!-- <property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService"/>
+		<property name="patientIdentifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService"/>
+		<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService"/>
+       	<property name="programService" ref="org.hisp.dhis.program.ProgramService"/>
+        <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService"/>
+        <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService"/>
+		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService"/>
+		<property name="patientAttributeValueService" ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService"/>		
+   	    <property name="patientService" ref="org.hisp.dhis.patient.PatientService"/>
+		-->
     </bean>
 
     <bean id="org.hisp.dhis.mobile.api.XmlCreatorService"

=== modified file 'local/in/dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java'
--- local/in/dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java	2011-04-15 11:41:30 +0000
+++ local/in/dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/app/action/GetDataElementsAction.java	2013-03-14 06:48:31 +0000
@@ -77,7 +77,7 @@
     public String execute()
         throws Exception
     {
-        DataSet dataSet = dataSetService.getDataSetByName( dataSetName );
+        DataSet dataSet = (DataSet) dataSetService.getDataSetByName( dataSetName );
         dataElements = dataSet.getDataElements();
         return SUCCESS;
     }

=== modified file 'local/in/dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml	2012-02-02 09:56:51 +0000
+++ local/in/dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-03-14 06:48:31 +0000
@@ -80,4 +80,10 @@
         <property name="smsService" ref="org.hisp.dhis.mobile.SmsService" />
     </bean>
 
+	<bean id="org.hisp.dhis.mobile.action.TestSMSDataAction"
+          class="org.hisp.dhis.mobile.action.TestSMSDataAction"
+          scope="prototype">
+        <property name="mobileImportService" ref="org.hisp.dhis.mobile.api.MobileImportService"/>
+    </bean>
+	
 </beans>

=== modified file 'local/in/dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml'
--- local/in/dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml	2011-06-17 11:44:03 +0000
+++ local/in/dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml	2013-03-14 06:48:31 +0000
@@ -101,6 +101,20 @@
                 <param name="allowedTypes">image/png</param>
             </interceptor-ref>
         </action>
+        
+	<action name="testSendSMSPage"
+            class="org.hisp.dhis.mobile.action.MobileHomePageAction">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-mobile/testPage.vm</param>
+            <param name="menu">/dhis-web-mobile/menu.vm</param>
+        </action>
+        
+        <action name="testSMSData"
+            class="org.hisp.dhis.mobile.action.TestSMSDataAction">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-mobile/testPage.vm</param>
+            <param name="menu">/dhis-web-mobile/menu.vm</param>
+        </action>
 		
         <action name="jarGenerator"
 			class="org.hisp.dhis.mobile.app.action.JarGeneratorAction">

=== modified file 'local/in/dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm'
--- local/in/dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm	2011-06-17 10:06:08 +0000
+++ local/in/dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm	2013-03-14 06:48:31 +0000
@@ -9,4 +9,6 @@
     <li><a href = "mobileSettings.action">Settings</a></li>
     <li><a href = "receiveAllMessages.action">Inbox</a></li>
     <li><a href = "getAllDraftMessages.action">Draft</a></li>
+    
+    <li><a href = "testSendSMSPage.action">TestSendSMSData</a></li>
 </ul>
\ No newline at end of file