dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23118
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11237: Sms. Added constructor. Codestyle.
------------------------------------------------------------
revno: 11237
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-06-19 20:57:37 +0200
message:
Sms. Added constructor. Codestyle.
modified:
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DhisMessageAlertParser.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/IParser.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/queue/DatabaseSupportedInternalMemoryMessageQueue.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/GateWayFactory.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.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-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java 2013-06-19 18:57:37 +0000
@@ -61,6 +61,10 @@
this.jdbcTemplate = jdbcTemplate;
}
+ // -------------------------------------------------------------------------
+ // Implementation
+ // -------------------------------------------------------------------------
+
@Override
public int save( OutboundSms sms )
{
@@ -112,6 +116,7 @@
String sql = "select osm.id as outboundsmsid, message, ore.elt as phonenumber, date "
+ "from outbound_sms osm inner join outbound_sms_recipients ore "
+ "on osm.id=ore.outbound_sms_id where status = " + realStatus;
+
try
{
List<OutboundSms> OutboundSmsList = jdbcTemplate.query( sql, new RowMapper<OutboundSms>()
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java 2013-06-19 18:57:37 +0000
@@ -138,6 +138,7 @@
OutboundSms sms = outboundSmsStore.get( outboundSmsId );
outboundSmsStore.delete( sms );
}
+
// -------------------------------------------------------------------------
// Support methods
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java 2013-06-19 18:57:37 +0000
@@ -135,10 +135,10 @@
text = createMessage( subject, text, sender );
- //Bulk is limited in sending long SMS, need to cut into small pieces
+ // Bulk is limited in sending long SMS, need to cut into small pieces
if ( SmsLibService.gatewayMap.get( "bulk_gw" ).equals( gatewayId ) )
{
- //Check if text contain any specific unicode character
+ // Check if text contain any specific unicode character
for( char each: text.toCharArray())
{
if( !Character.UnicodeBlock.of(each).equals( UnicodeBlock.BASIC_LATIN ) )
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java 2013-06-19 18:57:37 +0000
@@ -55,7 +55,11 @@
private boolean enabled = true;
- private String message = "success";
+ private static final String MESSAGE = "success";
+
+ // -------------------------------------------------------------------------
+ // Implementation
+ // -------------------------------------------------------------------------
@Override
public String sendMessage( OutboundSms sms, String gatewayId )
@@ -68,7 +72,7 @@
log.debug( "Send message: " + sms );
- return message;
+ return MESSAGE;
}
@Override
@@ -77,7 +81,7 @@
{
this.enabled = config.isEnabled();
log.debug( "initialize()" );
- return message;
+ return MESSAGE;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DhisMessageAlertParser.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DhisMessageAlertParser.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DhisMessageAlertParser.java 2013-06-19 18:57:37 +0000
@@ -32,10 +32,9 @@
/**
* @author Nguyen Kim Lai
- *
- * @version DhisMessageAlertParser.java 2:09:49 PM May 17, 2013 $
*/
-public class DhisMessageAlertParser implements IParser
+public class DhisMessageAlertParser
+ implements IParser
{
@Override
public Map<String, String> parse( String sms )
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/IParser.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/IParser.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/IParser.java 2013-06-19 18:57:37 +0000
@@ -1,8 +1,31 @@
+package org.hisp.dhis.sms.parse;
+
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package org.hisp.dhis.sms.parse;
import java.util.Map;
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java 2013-03-13 14:14:24 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java 2013-06-19 18:57:37 +0000
@@ -38,10 +38,20 @@
{
private SMSCommand smsCommand;
+ public J2MEDataEntryParser()
+ {
+ }
+
+ public J2MEDataEntryParser( SMSCommand smsCommand )
+ {
+ this.smsCommand = smsCommand;
+ }
+
@Override
public Map<String, String> parse( String sms )
{
String[] keyValuePairs = null;
+
if ( sms.indexOf( "#" ) > -1 )
{
keyValuePairs = sms.split( "#" );
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java 2013-06-19 18:57:37 +0000
@@ -115,7 +115,6 @@
{
this.stop = true;
}
-
}
public void setMessageQueue( MessageQueue messageQueue )
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/queue/DatabaseSupportedInternalMemoryMessageQueue.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/queue/DatabaseSupportedInternalMemoryMessageQueue.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/queue/DatabaseSupportedInternalMemoryMessageQueue.java 2013-06-19 18:57:37 +0000
@@ -39,8 +39,16 @@
{
private List<IncomingSms> queue = new ArrayList<IncomingSms>();
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
private IncomingSmsStore smsStore;
+ // -------------------------------------------------------------------------
+ // Implementation
+ // -------------------------------------------------------------------------
+
@Override
public void put( IncomingSms message )
{
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/GateWayFactory.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/GateWayFactory.java 2013-06-19 18:28:57 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/GateWayFactory.java 2013-06-19 18:57:37 +0000
@@ -74,7 +74,6 @@
public AGateway createSMPPGatewayConfig( SMPPGatewayConfig config )
{
-
AGateway gateway = new JSMPPGateway( config.getName(), config.getAddress(), config.getPort(),
new BindAttributes( config.getUsername(), config.getPassword(), "cp", BindType.TRANSCEIVER ) );
gateway.setInbound( true );
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java 2013-06-19 18:43:51 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java 2013-06-19 18:57:37 +0000
@@ -71,7 +71,6 @@
* </ul>
*
*/
-
public class SimplisticHttpGetGateWay
extends AGateway
{
@@ -178,5 +177,4 @@
// FIXME: ?
return 500;
}
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2013-06-19 17:22:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2013-06-19 18:57:37 +0000
@@ -296,7 +296,6 @@
message = "success";
- // Add gateways
if ( config.getGateways() == null || config.getGateways().isEmpty() )
{
message = "unable_load_configuration_cause_of_there_is_no_gateway";
@@ -500,7 +499,6 @@
@Override
public List<OutboundSms> getAllOutboundSms()
{
- // TODO Auto-generated method stub
return null;
}