← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8002: Add polling interval attribute for modem gateway config

 

------------------------------------------------------------
revno: 8002
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-09-05 10:16:04 +0700
message:
  Add polling interval attribute for modem gateway config
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/ModemGatewayConfig.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.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/webapp/dhis-web-maintenance-mobile/javascript/gateway.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.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-api/src/main/java/org/hisp/dhis/sms/config/ModemGatewayConfig.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/ModemGatewayConfig.java	2012-03-01 08:56:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/config/ModemGatewayConfig.java	2012-09-05 03:16:04 +0000
@@ -43,6 +43,8 @@
     private String pin;
 
     private String simMemLocation;
+    
+    private Integer pollingInterval;
 
     private boolean inbound;
 
@@ -128,4 +130,14 @@
         this.simMemLocation = simMemLocation;
     }
 
+    public Integer getPollingInterval()
+    {
+        return pollingInterval;
+    }
+
+    public void setPollingInterval( Integer pollingInterval )
+    {
+        this.pollingInterval = pollingInterval;
+    }
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java	2012-03-26 04:42:44 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/SmsConfigurationManagerImpl.java	2012-09-05 03:16:04 +0000
@@ -124,7 +124,6 @@
                 return gateway;
             }
         }
-
         return null;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.java	2012-03-21 02:20:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/UpdateModemGateWayConfigAction.java	2012-09-05 03:16:04 +0000
@@ -81,6 +81,13 @@
         this.baudRate = baudRate;
     }
 
+    private Integer pollingInterval;
+
+    public void setPollingInterval( Integer pollingInterval )
+    {
+        this.pollingInterval = pollingInterval;
+    }
+
     private String manufacturer;
 
     public void setManufacturer( String manufacturer )
@@ -142,10 +149,11 @@
                 {
                     index = config.getGateways().indexOf( gatewayConfig );
                 }
-
+                
                 gatewayConfig.setName( name );
                 gatewayConfig.setPort( port );
                 gatewayConfig.setBaudRate( baudRate );
+                gatewayConfig.setPollingInterval( pollingInterval );
                 gatewayConfig.setManufacturer( manufacturer );
                 gatewayConfig.setModel( model );
                 gatewayConfig.setPin( pin );

=== 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	2012-08-22 07:08:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java	2012-09-05 03:16:04 +0000
@@ -32,6 +32,7 @@
 
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.sms.SmsConfigurationManager;
+import org.hisp.dhis.sms.config.ModemGatewayConfig;
 import org.hisp.dhis.sms.config.SmsConfiguration;
 import org.hisp.dhis.sms.incoming.IncomingSms;
 import org.hisp.dhis.sms.incoming.IncomingSmsService;
@@ -101,16 +102,17 @@
     public String execute()
         throws Exception
     {
-        SmsConfiguration smsConfig = smsConfigurationManager.getSmsConfiguration();
+        ModemGatewayConfig gatewayConfig = (ModemGatewayConfig) smsConfigurationManager
+        .checkInstanceOfGateway( ModemGatewayConfig.class );
 
-        if ( smsConfig == null )
+        if ( gatewayConfig != null )
+        {
+            pollingInterval = gatewayConfig.getPollingInterval()*1000;
+        }
+        else
         {
             pollingInterval = 0;
         }
-        else
-        {
-            pollingInterval = smsConfig.getPollingInterval()*1000;
-        }
         listIncomingSms = incomingSmsService.listAllMessageFromModem();
 
         if ( listIncomingSms.size() > 0 )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js	2012-08-30 12:47:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/gateway.js	2012-09-05 03:16:04 +0000
@@ -36,6 +36,7 @@
 			'modemFields input[id=name]' : { 'required' : true },
 			'modemFields input[id=port]' : { 'required' : true },
 			'modemFields input[id=baudrate]' : { 'required' : true },
+			'modemFields input[id=pollingInterval]' : { 'required' : true },
 			'modemFields input[id=manufacturer]' : { 'required' : true },
 			'modemFields input[id=model]' : { 'required' : true },
 			'modemFields input[id=pin]' : { 'required' : true },
@@ -103,6 +104,7 @@
 				name: getFieldValue( 'modemFields input[id=name]' ),
 				port: getFieldValue( 'modemFields input[id=port]' ),
 				baudRate: getFieldValue( 'modemFields input[id=baudRate]' ),
+				pollingInterval: getFieldValue( 'modemFields input[id=pollingInterval]' ),
 				manufacturer: getFieldValue( 'modemFields input[id=manufacturer]' ),
 				model: getFieldValue( 'modemFields input[id=model]' ),
 				pin: getFieldValue( 'modemFields input[id=pin]' ),

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.vm	2012-09-04 08:15:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/updateGateway.vm	2012-09-05 03:16:04 +0000
@@ -100,6 +100,10 @@
 				<td><input type="text" name="baudRate" id="baudRate" style="width: 28em" value="$!modemGateway.baudRate"/></td>
 			</tr>
 			<tr>
+				<td>$i18n.getString( "polling_interval_in_seconds" ): <em title="$i18n.getString( 'required' )" class="required">*</em>:</td>
+				<td><input type="text" name="pollingInterval" id="pollingInterval" style="width: 28em" value="$!modemGateway.pollingInterval"/></td>
+			</tr>
+			<tr>
 				<td>$i18n.getString( "manufacturer" ):</td>
 				<td><input type="text" name="manufacturer" id="manufacturer" style="width: 28em" value="$!modemGateway.manufacturer"/></td>
 			</tr>