dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22648
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10947: new function to re-import sms
------------------------------------------------------------
revno: 10947
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Thu 2013-05-23 15:05:27 +0700
message:
new function to re-import sms
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReimportSMSAction.java
modified:
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.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-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-05-21 07:01:29 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java 2013-05-23 08:05:27 +0000
@@ -131,6 +131,7 @@
}
catch ( SMSParserException e )
{
+ e.printStackTrace();
sms.setStatus( SmsMessageStatus.FAILED );
incomingSmsService.update( sms );
sendSMS( e.getMessage(), sms.getOriginator() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java 2013-05-21 07:01:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java 2013-05-23 08:05:27 +0000
@@ -147,7 +147,6 @@
if ( statusArray[i].toString().equalsIgnoreCase( smsStatus ) )
{
listIncomingSms = new ArrayList<IncomingSms>( incomingSmsService.getSmsByStatus( statusArray[i] ) );
- System.out.println( "Status: " + statusArray[i].toString() );
break;
}
}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReimportSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReimportSMSAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReimportSMSAction.java 2013-05-23 08:05:27 +0000
@@ -0,0 +1,94 @@
+package org.hisp.dhis.mobile.action.incoming;
+
+import org.hisp.dhis.sms.incoming.IncomingSms;
+import org.hisp.dhis.sms.incoming.IncomingSmsService;
+import org.hisp.dhis.sms.parse.ParserManager;
+import com.opensymphony.xwork2.Action;
+
+public class ReimportSMSAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ParserManager parserManager;
+
+ private IncomingSmsService incomingSmsService;
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String incomingSMSId;
+
+ private IncomingSms incomingSMS;
+
+ public ParserManager getParserManager()
+ {
+ return parserManager;
+ }
+
+ public void setParserManager( ParserManager parserManager )
+ {
+ this.parserManager = parserManager;
+ }
+
+ public IncomingSmsService getIncomingSmsService()
+ {
+ return incomingSmsService;
+ }
+
+ public void setIncomingSmsService( IncomingSmsService incomingSmsService )
+ {
+ this.incomingSmsService = incomingSmsService;
+ }
+
+ public String getIncomingSMSId()
+ {
+ return incomingSMSId;
+ }
+
+ public void setIncomingSMSId( String incomingSMSId )
+ {
+ this.incomingSMSId = incomingSMSId;
+ }
+
+ public IncomingSms getIncomingSMS()
+ {
+ return incomingSMS;
+ }
+
+ public void setIncomingSMS( IncomingSms incomingSMS )
+ {
+ this.incomingSMS = incomingSMS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ incomingSMS = incomingSmsService.findBy( Integer.parseInt( incomingSMSId ) );
+
+ if ( incomingSMS == null )
+ {
+ return "error";
+ }
+
+ try
+ {
+ parserManager.parse( incomingSMS );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2013-05-22 07:06:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2013-05-23 08:05:27 +0000
@@ -3,6 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
+ <bean id="org.hisp.dhis.mobile.action.incoming.ReimportSMSAction"
+ class="org.hisp.dhis.mobile.action.incoming.ReimportSMSAction">
+ <property name="parserManager"
+ ref="org.hisp.dhis.sms.parse.DefaultParserManager" />
+ <property name="incomingSmsService"
+ ref="org.hisp.dhis.sms.incoming.IncomingSmsService" />
+ </bean>
+
<bean id="org.hisp.dhis.mobile.caseentry.state.SelectedStateManager"
class="org.hisp.dhis.mobile.caseentry.state.DefaultSelectedStateManager">
<property name="patientService"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2013-05-21 07:01:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2013-05-23 08:05:27 +0000
@@ -102,7 +102,11 @@
mark_as_default=Mark as default
view_sent_sms=View sent SMS
receipient=Receipient
-
+action=Action
+incoming=Incoming
+processed=Processed
+failed=Failed
+unhandled=Unhandled
# ------------------------------------------------------------------------------
# SMS COMMAND LOCALIZATION
# ------------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2013-05-20 09:32:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2013-05-23 08:05:27 +0000
@@ -53,6 +53,10 @@
<result name="error" type="velocity-json">../dhis-web-commons/ajax/jsonResponseError.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <action name="reimport" class="org.hisp.dhis.mobile.action.incoming.ReimportSMSAction">
+ <result name="success" type="redirect">showReceivingPage.action</result>
+ </action>
<!-- Patient Mobile Setting Action -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm 2013-05-21 07:01:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm 2013-05-23 08:05:27 +0000
@@ -198,14 +198,14 @@
<input type="hidden" id="$incomingSms.id" value="$incomingSms.text" onblur="makeVisible( $incomingSms.id, $velocityCount )"/></td>
<td>$incomingSms.originator</td>
<td>$incomingSms.status</td>
- <td style="text-align:center">#if($incomingSms.status == 'FAILED')<a href="#"> Re-import </a> #else None #end</td>
+ <td style="text-align:center">#if($incomingSms.status == 'FAILED' || $incomingSms.status == 'INCOMING')<a href="reimport.action?incomingSMSId=$incomingSms.id"> Re-import </a> #else None #end</td>
<td style="text-align:center"><a href="javascript:removeSingleItem( '$incomingSms.id', '$incomingSms.getText()' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></td>
</tr>
#end
</tbody>
</table>
<br/>
- #parse( "/dhis-web-commons/paging/paging.vm" )
+
<br/>
<div style="text-align:right; width:800px">
<input type="button" name="btnShowConfig" value="$i18n.getString( 'config_my_gateway' )" onclick="window.location='showSMSConfigureForm.action'"/>