← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22195: Code style

 

------------------------------------------------------------
revno: 22195
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-08 16:49:12 +0100
message:
  Code style
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultSmsConsumerService.java


--
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/incoming/DefaultSmsConsumerService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultSmsConsumerService.java	2016-03-08 14:53:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultSmsConsumerService.java	2016-03-08 15:49:12 +0000
@@ -1,14 +1,5 @@
 package org.hisp.dhis.sms.incoming;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.setting.SettingKey;
-import org.hisp.dhis.setting.SystemSettingManager;
-import org.hisp.dhis.sms.SmsPublisher;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ContextRefreshedEvent;
-
 /*
  * Copyright (c) 2004-2016, University of Oslo
  * All rights reserved.
@@ -37,6 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.setting.SettingKey;
+import org.hisp.dhis.setting.SystemSettingManager;
+import org.hisp.dhis.sms.SmsPublisher;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
+
 public class DefaultSmsConsumerService
     implements ApplicationListener<ContextRefreshedEvent>, SmsConsumerService
 {
@@ -57,11 +57,20 @@
     // -------------------------------------------------------------------------
 
     @Override
+    public void onApplicationEvent( ContextRefreshedEvent event )
+    {
+        if ( isSmsConsumerRunning() )
+        {
+            startSmsConsumer();
+        }  
+    }
+
+    @Override
     public void startSmsConsumer()
     {
         smsPublisher.start();
 
-        log.info( "SMS Consumer Stared" );
+        log.info( "SMS consumer started" );
 
         saveSmsConsumerState( true );
     }
@@ -71,21 +80,12 @@
     {
         smsPublisher.stop();
 
-        log.info( "SMS Consumer Stopped !!! " );
+        log.info( "SMS consumer stopped" );
 
         saveSmsConsumerState( false );
     }
 
-    @Override
-    public void onApplicationEvent( ContextRefreshedEvent event )
-    {
-        if ( getSmsConsumerState() )
-        {
-            startSmsConsumer();
-        }  
-    }
-
-    private boolean getSmsConsumerState()
+    private boolean isSmsConsumerRunning()
     {
         return (boolean) systemSettingManager.getSystemSetting( SettingKey.SMS_CONSUMER_STATE );
     }
@@ -94,5 +94,4 @@
     {
         systemSettingManager.saveSystemSetting( SettingKey.SMS_CONSUMER_STATE, state );
     }
-
 }